OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 4247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4258 ArrayNoArgumentConstructorDescriptor::kFunctionIndex), | 4258 ArrayNoArgumentConstructorDescriptor::kFunctionIndex), |
4259 JSFunction::kContextOffset); | 4259 JSFunction::kContextOffset); |
4260 bool track_allocation_site = | 4260 bool track_allocation_site = |
4261 AllocationSite::GetMode(elements_kind()) == TRACK_ALLOCATION_SITE && | 4261 AllocationSite::GetMode(elements_kind()) == TRACK_ALLOCATION_SITE && |
4262 override_mode() != DISABLE_ALLOCATION_SITES; | 4262 override_mode() != DISABLE_ALLOCATION_SITES; |
4263 Node* allocation_site = | 4263 Node* allocation_site = |
4264 track_allocation_site | 4264 track_allocation_site |
4265 ? assembler->Parameter( | 4265 ? assembler->Parameter( |
4266 ArrayNoArgumentConstructorDescriptor::kAllocationSiteIndex) | 4266 ArrayNoArgumentConstructorDescriptor::kAllocationSiteIndex) |
4267 : nullptr; | 4267 : nullptr; |
4268 Node* array = assembler->AllocateJSArray(elements_kind(), native_context, | 4268 Node* array_map = |
| 4269 assembler->LoadJSArrayElementsMap(elements_kind(), native_context); |
| 4270 Node* array = assembler->AllocateJSArray(elements_kind(), array_map, |
4269 JSArray::kPreallocatedArrayElements, | 4271 JSArray::kPreallocatedArrayElements, |
4270 0, allocation_site); | 4272 0, allocation_site); |
4271 assembler->Return(array); | 4273 assembler->Return(array); |
4272 } | 4274 } |
4273 | 4275 |
| 4276 void InternalArrayNoArgumentConstructorStub::GenerateAssembly( |
| 4277 CodeStubAssembler* assembler) const { |
| 4278 typedef compiler::Node Node; |
| 4279 Node* array_map = assembler->LoadObjectField( |
| 4280 assembler->Parameter( |
| 4281 ArrayNoArgumentConstructorDescriptor::kFunctionIndex), |
| 4282 JSFunction::kPrototypeOrInitialMapOffset); |
| 4283 Node* array = assembler->AllocateJSArray(elements_kind(), array_map, |
| 4284 JSArray::kPreallocatedArrayElements, |
| 4285 0, nullptr); |
| 4286 assembler->Return(array); |
| 4287 } |
| 4288 |
4274 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) | 4289 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) |
4275 : PlatformCodeStub(isolate) { | 4290 : PlatformCodeStub(isolate) { |
4276 minor_key_ = ArgumentCountBits::encode(ANY); | 4291 minor_key_ = ArgumentCountBits::encode(ANY); |
4277 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 4292 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
4278 } | 4293 } |
4279 | 4294 |
4280 | 4295 |
4281 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate, | 4296 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate, |
4282 int argument_count) | 4297 int argument_count) |
4283 : PlatformCodeStub(isolate) { | 4298 : PlatformCodeStub(isolate) { |
(...skipping 28 matching lines...) Expand all Loading... |
4312 if (type->Is(Type::UntaggedPointer())) { | 4327 if (type->Is(Type::UntaggedPointer())) { |
4313 return Representation::External(); | 4328 return Representation::External(); |
4314 } | 4329 } |
4315 | 4330 |
4316 DCHECK(!type->Is(Type::Untagged())); | 4331 DCHECK(!type->Is(Type::Untagged())); |
4317 return Representation::Tagged(); | 4332 return Representation::Tagged(); |
4318 } | 4333 } |
4319 | 4334 |
4320 } // namespace internal | 4335 } // namespace internal |
4321 } // namespace v8 | 4336 } // namespace v8 |
OLD | NEW |