Chromium Code Reviews| 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/ast/ast.h" | 9 #include "src/ast/ast.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 5686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5697 assembler->isolate()->counters()->inlined_copied_elements(), 1); | 5697 assembler->isolate()->counters()->inlined_copied_elements(), 1); |
| 5698 | 5698 |
| 5699 return array; | 5699 return array; |
| 5700 } | 5700 } |
| 5701 | 5701 |
| 5702 } // namespace | 5702 } // namespace |
| 5703 | 5703 |
| 5704 // static | 5704 // static |
| 5705 compiler::Node* FastCloneShallowArrayStub::Generate( | 5705 compiler::Node* FastCloneShallowArrayStub::Generate( |
| 5706 CodeStubAssembler* assembler, compiler::Node* closure, | 5706 CodeStubAssembler* assembler, compiler::Node* closure, |
| 5707 compiler::Node* literal_index, compiler::Node* constant_elements, | 5707 compiler::Node* literal_index, compiler::Node* context, |
| 5708 compiler::Node* context, AllocationSiteMode allocation_site_mode) { | 5708 AllocationSiteMode allocation_site_mode, |
|
rmcilroy
2016/09/16 08:52:26
nit - allocation_site_mode at the end of parameter
klaasb
2016/09/19 13:53:57
Done.
| |
| 5709 CodeStubAssembler::Label* call_runtime) { | |
| 5709 typedef CodeStubAssembler::Label Label; | 5710 typedef CodeStubAssembler::Label Label; |
| 5710 typedef CodeStubAssembler::Variable Variable; | 5711 typedef CodeStubAssembler::Variable Variable; |
| 5711 typedef compiler::Node Node; | 5712 typedef compiler::Node Node; |
| 5712 | 5713 |
| 5713 Label call_runtime(assembler, Label::kDeferred), zero_capacity(assembler), | 5714 Label zero_capacity(assembler), cow_elements(assembler), |
| 5714 cow_elements(assembler), fast_elements(assembler), | 5715 fast_elements(assembler), return_result(assembler); |
| 5715 return_result(assembler); | |
| 5716 Variable result(assembler, MachineRepresentation::kTagged); | 5716 Variable result(assembler, MachineRepresentation::kTagged); |
| 5717 | 5717 |
| 5718 Node* undefined = assembler->UndefinedConstant(); | 5718 Node* undefined = assembler->UndefinedConstant(); |
| 5719 | 5719 |
| 5720 Node* literals_array = | 5720 Node* literals_array = |
| 5721 assembler->LoadObjectField(closure, JSFunction::kLiteralsOffset); | 5721 assembler->LoadObjectField(closure, JSFunction::kLiteralsOffset); |
| 5722 Node* allocation_site = assembler->LoadFixedArrayElement( | 5722 Node* allocation_site = assembler->LoadFixedArrayElement( |
| 5723 literals_array, literal_index, | 5723 literals_array, literal_index, |
| 5724 LiteralsArray::kFirstLiteralIndex * kPointerSize, | 5724 LiteralsArray::kFirstLiteralIndex * kPointerSize, |
| 5725 CodeStubAssembler::SMI_PARAMETERS); | 5725 CodeStubAssembler::SMI_PARAMETERS); |
| 5726 | 5726 |
| 5727 assembler->GotoIf(assembler->WordEqual(allocation_site, undefined), | 5727 assembler->GotoIf(assembler->WordEqual(allocation_site, undefined), |
| 5728 &call_runtime); | 5728 call_runtime); |
| 5729 | 5729 |
| 5730 Node* boilerplate = assembler->LoadObjectField( | 5730 Node* boilerplate = assembler->LoadObjectField( |
| 5731 allocation_site, AllocationSite::kTransitionInfoOffset); | 5731 allocation_site, AllocationSite::kTransitionInfoOffset); |
| 5732 Node* boilerplate_map = assembler->LoadMap(boilerplate); | 5732 Node* boilerplate_map = assembler->LoadMap(boilerplate); |
| 5733 Node* boilerplate_elements = assembler->LoadElements(boilerplate); | 5733 Node* boilerplate_elements = assembler->LoadElements(boilerplate); |
| 5734 Node* capacity = assembler->LoadFixedArrayBaseLength(boilerplate_elements); | 5734 Node* capacity = assembler->LoadFixedArrayBaseLength(boilerplate_elements); |
| 5735 allocation_site = | 5735 allocation_site = |
| 5736 allocation_site_mode == TRACK_ALLOCATION_SITE ? allocation_site : nullptr; | 5736 allocation_site_mode == TRACK_ALLOCATION_SITE ? allocation_site : nullptr; |
| 5737 | 5737 |
| 5738 Node* zero = assembler->SmiConstant(Smi::FromInt(0)); | 5738 Node* zero = assembler->SmiConstant(Smi::FromInt(0)); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5805 assembler->Bind(&allocate_without_elements); | 5805 assembler->Bind(&allocate_without_elements); |
| 5806 { | 5806 { |
| 5807 Node* array = assembler->AllocateUninitializedJSArrayWithoutElements( | 5807 Node* array = assembler->AllocateUninitializedJSArrayWithoutElements( |
| 5808 FAST_ELEMENTS, boilerplate_map, length.value(), allocation_site); | 5808 FAST_ELEMENTS, boilerplate_map, length.value(), allocation_site); |
| 5809 assembler->StoreObjectField(array, JSObject::kElementsOffset, | 5809 assembler->StoreObjectField(array, JSObject::kElementsOffset, |
| 5810 elements.value()); | 5810 elements.value()); |
| 5811 result.Bind(array); | 5811 result.Bind(array); |
| 5812 assembler->Goto(&return_result); | 5812 assembler->Goto(&return_result); |
| 5813 } | 5813 } |
| 5814 | 5814 |
| 5815 assembler->Bind(&call_runtime); | |
| 5816 { | |
| 5817 assembler->Comment("call runtime"); | |
| 5818 Node* flags = assembler->SmiConstant( | |
| 5819 Smi::FromInt(ArrayLiteral::kShallowElements | | |
| 5820 (allocation_site_mode == TRACK_ALLOCATION_SITE | |
| 5821 ? 0 | |
| 5822 : ArrayLiteral::kDisableMementos))); | |
| 5823 Node* array = | |
| 5824 assembler->CallRuntime(Runtime::kCreateArrayLiteral, context, closure, | |
| 5825 literal_index, constant_elements, flags); | |
| 5826 result.Bind(array); | |
| 5827 assembler->Goto(&return_result); | |
| 5828 } | |
| 5829 | |
| 5830 assembler->Bind(&return_result); | 5815 assembler->Bind(&return_result); |
| 5831 return result.value(); | 5816 return result.value(); |
| 5832 } | 5817 } |
| 5833 | 5818 |
| 5834 void FastCloneShallowArrayStub::GenerateAssembly( | 5819 void FastCloneShallowArrayStub::GenerateAssembly( |
| 5835 CodeStubAssembler* assembler) const { | 5820 CodeStubAssembler* assembler) const { |
| 5836 typedef compiler::Node Node; | 5821 typedef compiler::Node Node; |
| 5822 typedef CodeStubAssembler::Label Label; | |
| 5837 Node* closure = assembler->Parameter(Descriptor::kClosure); | 5823 Node* closure = assembler->Parameter(Descriptor::kClosure); |
| 5838 Node* literal_index = assembler->Parameter(Descriptor::kLiteralIndex); | 5824 Node* literal_index = assembler->Parameter(Descriptor::kLiteralIndex); |
| 5839 Node* constant_elements = assembler->Parameter(Descriptor::kConstantElements); | 5825 Node* constant_elements = assembler->Parameter(Descriptor::kConstantElements); |
| 5840 Node* context = assembler->Parameter(Descriptor::kContext); | 5826 Node* context = assembler->Parameter(Descriptor::kContext); |
| 5827 Label call_runtime(assembler, Label::kDeferred); | |
| 5828 assembler->Return(Generate(assembler, closure, literal_index, context, | |
| 5829 allocation_site_mode(), &call_runtime)); | |
| 5841 | 5830 |
| 5842 assembler->Return(Generate(assembler, closure, literal_index, | 5831 assembler->Bind(&call_runtime); |
| 5843 constant_elements, context, | 5832 { |
| 5844 allocation_site_mode())); | 5833 assembler->Comment("call runtime"); |
| 5834 Node* flags = assembler->SmiConstant( | |
| 5835 Smi::FromInt(ArrayLiteral::kShallowElements | | |
| 5836 (allocation_site_mode() == TRACK_ALLOCATION_SITE | |
| 5837 ? 0 | |
| 5838 : ArrayLiteral::kDisableMementos))); | |
| 5839 assembler->Return(assembler->CallRuntime(Runtime::kCreateArrayLiteral, | |
| 5840 context, closure, literal_index, | |
| 5841 constant_elements, flags)); | |
| 5842 } | |
| 5845 } | 5843 } |
| 5846 | 5844 |
| 5847 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { | 5845 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { |
| 5848 CreateAllocationSiteStub stub(isolate); | 5846 CreateAllocationSiteStub stub(isolate); |
| 5849 stub.GetCode(); | 5847 stub.GetCode(); |
| 5850 } | 5848 } |
| 5851 | 5849 |
| 5852 | 5850 |
| 5853 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) { | 5851 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) { |
| 5854 CreateWeakCellStub stub(isolate); | 5852 CreateWeakCellStub stub(isolate); |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6242 | 6240 |
| 6243 if (type == MachineType::Pointer()) { | 6241 if (type == MachineType::Pointer()) { |
| 6244 return Representation::External(); | 6242 return Representation::External(); |
| 6245 } | 6243 } |
| 6246 | 6244 |
| 6247 return Representation::Tagged(); | 6245 return Representation::Tagged(); |
| 6248 } | 6246 } |
| 6249 | 6247 |
| 6250 } // namespace internal | 6248 } // namespace internal |
| 6251 } // namespace v8 | 6249 } // namespace v8 |
| OLD | NEW |