Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: src/code-stubs.cc

Issue 2341743003: [interpreter] Inline FastCloneShallowArrayStub into bytecode handler (Closed)
Patch Set: rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/code-stubs.h ('k') | src/interpreter/bytecode-flags.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5770 matching lines...) Expand 10 before | Expand all | Expand 10 after
5781 assembler->isolate()->counters()->inlined_copied_elements(), 1); 5781 assembler->isolate()->counters()->inlined_copied_elements(), 1);
5782 5782
5783 return array; 5783 return array;
5784 } 5784 }
5785 5785
5786 } // namespace 5786 } // namespace
5787 5787
5788 // static 5788 // static
5789 compiler::Node* FastCloneShallowArrayStub::Generate( 5789 compiler::Node* FastCloneShallowArrayStub::Generate(
5790 CodeStubAssembler* assembler, compiler::Node* closure, 5790 CodeStubAssembler* assembler, compiler::Node* closure,
5791 compiler::Node* literal_index, compiler::Node* constant_elements, 5791 compiler::Node* literal_index, compiler::Node* context,
5792 compiler::Node* context, AllocationSiteMode allocation_site_mode) { 5792 CodeStubAssembler::Label* call_runtime,
5793 AllocationSiteMode allocation_site_mode) {
5793 typedef CodeStubAssembler::Label Label; 5794 typedef CodeStubAssembler::Label Label;
5794 typedef CodeStubAssembler::Variable Variable; 5795 typedef CodeStubAssembler::Variable Variable;
5795 typedef compiler::Node Node; 5796 typedef compiler::Node Node;
5796 5797
5797 Label call_runtime(assembler, Label::kDeferred), zero_capacity(assembler), 5798 Label zero_capacity(assembler), cow_elements(assembler),
5798 cow_elements(assembler), fast_elements(assembler), 5799 fast_elements(assembler), return_result(assembler);
5799 return_result(assembler);
5800 Variable result(assembler, MachineRepresentation::kTagged); 5800 Variable result(assembler, MachineRepresentation::kTagged);
5801 5801
5802 Node* literals_array = 5802 Node* literals_array =
5803 assembler->LoadObjectField(closure, JSFunction::kLiteralsOffset); 5803 assembler->LoadObjectField(closure, JSFunction::kLiteralsOffset);
5804 Node* allocation_site = assembler->LoadFixedArrayElement( 5804 Node* allocation_site = assembler->LoadFixedArrayElement(
5805 literals_array, literal_index, 5805 literals_array, literal_index,
5806 LiteralsArray::kFirstLiteralIndex * kPointerSize, 5806 LiteralsArray::kFirstLiteralIndex * kPointerSize,
5807 CodeStubAssembler::SMI_PARAMETERS); 5807 CodeStubAssembler::SMI_PARAMETERS);
5808 5808
5809 Node* undefined = assembler->UndefinedConstant(); 5809 Node* undefined = assembler->UndefinedConstant();
5810 assembler->GotoIf(assembler->WordEqual(allocation_site, undefined), 5810 assembler->GotoIf(assembler->WordEqual(allocation_site, undefined),
5811 &call_runtime); 5811 call_runtime);
5812 allocation_site = assembler->LoadFixedArrayElement( 5812 allocation_site = assembler->LoadFixedArrayElement(
5813 literals_array, literal_index, 5813 literals_array, literal_index,
5814 LiteralsArray::kFirstLiteralIndex * kPointerSize, 5814 LiteralsArray::kFirstLiteralIndex * kPointerSize,
5815 CodeStubAssembler::SMI_PARAMETERS); 5815 CodeStubAssembler::SMI_PARAMETERS);
5816 5816
5817 Node* boilerplate = assembler->LoadObjectField( 5817 Node* boilerplate = assembler->LoadObjectField(
5818 allocation_site, AllocationSite::kTransitionInfoOffset); 5818 allocation_site, AllocationSite::kTransitionInfoOffset);
5819 Node* boilerplate_map = assembler->LoadMap(boilerplate); 5819 Node* boilerplate_map = assembler->LoadMap(boilerplate);
5820 Node* boilerplate_elements = assembler->LoadElements(boilerplate); 5820 Node* boilerplate_elements = assembler->LoadElements(boilerplate);
5821 Node* capacity = assembler->LoadFixedArrayBaseLength(boilerplate_elements); 5821 Node* capacity = assembler->LoadFixedArrayBaseLength(boilerplate_elements);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
5893 assembler->Bind(&allocate_without_elements); 5893 assembler->Bind(&allocate_without_elements);
5894 { 5894 {
5895 Node* array = assembler->AllocateUninitializedJSArrayWithoutElements( 5895 Node* array = assembler->AllocateUninitializedJSArrayWithoutElements(
5896 FAST_ELEMENTS, boilerplate_map, length.value(), allocation_site); 5896 FAST_ELEMENTS, boilerplate_map, length.value(), allocation_site);
5897 assembler->StoreObjectField(array, JSObject::kElementsOffset, 5897 assembler->StoreObjectField(array, JSObject::kElementsOffset,
5898 elements.value()); 5898 elements.value());
5899 result.Bind(array); 5899 result.Bind(array);
5900 assembler->Goto(&return_result); 5900 assembler->Goto(&return_result);
5901 } 5901 }
5902 5902
5903 assembler->Bind(&call_runtime);
5904 {
5905 assembler->Comment("call runtime");
5906 Node* flags = assembler->SmiConstant(
5907 Smi::FromInt(ArrayLiteral::kShallowElements |
5908 (allocation_site_mode == TRACK_ALLOCATION_SITE
5909 ? 0
5910 : ArrayLiteral::kDisableMementos)));
5911 Node* array =
5912 assembler->CallRuntime(Runtime::kCreateArrayLiteral, context, closure,
5913 literal_index, constant_elements, flags);
5914 result.Bind(array);
5915 assembler->Goto(&return_result);
5916 }
5917
5918 assembler->Bind(&return_result); 5903 assembler->Bind(&return_result);
5919 return result.value(); 5904 return result.value();
5920 } 5905 }
5921 5906
5922 void FastCloneShallowArrayStub::GenerateAssembly( 5907 void FastCloneShallowArrayStub::GenerateAssembly(
5923 CodeStubAssembler* assembler) const { 5908 CodeStubAssembler* assembler) const {
5924 typedef compiler::Node Node; 5909 typedef compiler::Node Node;
5910 typedef CodeStubAssembler::Label Label;
5925 Node* closure = assembler->Parameter(Descriptor::kClosure); 5911 Node* closure = assembler->Parameter(Descriptor::kClosure);
5926 Node* literal_index = assembler->Parameter(Descriptor::kLiteralIndex); 5912 Node* literal_index = assembler->Parameter(Descriptor::kLiteralIndex);
5927 Node* constant_elements = assembler->Parameter(Descriptor::kConstantElements); 5913 Node* constant_elements = assembler->Parameter(Descriptor::kConstantElements);
5928 Node* context = assembler->Parameter(Descriptor::kContext); 5914 Node* context = assembler->Parameter(Descriptor::kContext);
5915 Label call_runtime(assembler, Label::kDeferred);
5916 assembler->Return(Generate(assembler, closure, literal_index, context,
5917 &call_runtime, allocation_site_mode()));
5929 5918
5930 assembler->Return(Generate(assembler, closure, literal_index, 5919 assembler->Bind(&call_runtime);
5931 constant_elements, context, 5920 {
5932 allocation_site_mode())); 5921 assembler->Comment("call runtime");
5922 Node* flags = assembler->SmiConstant(
5923 Smi::FromInt(ArrayLiteral::kShallowElements |
5924 (allocation_site_mode() == TRACK_ALLOCATION_SITE
5925 ? 0
5926 : ArrayLiteral::kDisableMementos)));
5927 assembler->Return(assembler->CallRuntime(Runtime::kCreateArrayLiteral,
5928 context, closure, literal_index,
5929 constant_elements, flags));
5930 }
5933 } 5931 }
5934 5932
5935 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { 5933 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) {
5936 CreateAllocationSiteStub stub(isolate); 5934 CreateAllocationSiteStub stub(isolate);
5937 stub.GetCode(); 5935 stub.GetCode();
5938 } 5936 }
5939 5937
5940 5938
5941 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) { 5939 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) {
5942 CreateWeakCellStub stub(isolate); 5940 CreateWeakCellStub stub(isolate);
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
6310 6308
6311 if (type == MachineType::Pointer()) { 6309 if (type == MachineType::Pointer()) {
6312 return Representation::External(); 6310 return Representation::External();
6313 } 6311 }
6314 6312
6315 return Representation::Tagged(); 6313 return Representation::Tagged();
6316 } 6314 }
6317 6315
6318 } // namespace internal 6316 } // namespace internal
6319 } // namespace v8 6317 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/interpreter/bytecode-flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698