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

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

Issue 2024253002: [stubs] Remove N-argument Hydrogen-based Array constructor stub (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm64 Created 4 years, 6 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 | « no previous file | src/arm/interface-descriptors-arm.cc » ('j') | src/mips/code-stubs-mips.cc » ('J')
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 #if V8_TARGET_ARCH_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
11 #include "src/codegen.h" 11 #include "src/codegen.h"
12 #include "src/ic/handler-compiler.h" 12 #include "src/ic/handler-compiler.h"
13 #include "src/ic/ic.h" 13 #include "src/ic/ic.h"
14 #include "src/ic/stub-cache.h" 14 #include "src/ic/stub-cache.h"
15 #include "src/isolate.h" 15 #include "src/isolate.h"
16 #include "src/regexp/jsregexp.h" 16 #include "src/regexp/jsregexp.h"
17 #include "src/regexp/regexp-macro-assembler.h" 17 #include "src/regexp/regexp-macro-assembler.h"
18 #include "src/runtime/runtime.h" 18 #include "src/runtime/runtime.h"
19 19
20 #include "src/arm/code-stubs-arm.h" 20 #include "src/arm/code-stubs-arm.h"
21 21
22 namespace v8 { 22 namespace v8 {
23 namespace internal { 23 namespace internal {
24 24
25 #define __ ACCESS_MASM(masm)
25 26
26 static void InitializeArrayConstructorDescriptor( 27 void ArrayNArgumentsConstructorStub::Generate(MacroAssembler* masm) {
27 Isolate* isolate, CodeStubDescriptor* descriptor, 28 __ lsl(r5, r0, Operand(kPointerSizeLog2));
28 int constant_stack_parameter_count) { 29 __ str(r1, MemOperand(sp, r5));
29 Address deopt_handler = Runtime::FunctionForId( 30 __ Push(r1);
30 Runtime::kArrayConstructor)->entry; 31 __ Push(r2);
31 32 __ add(r0, r0, Operand(3));
32 if (constant_stack_parameter_count == 0) { 33 __ TailCallRuntime(Runtime::kNewArray);
33 descriptor->Initialize(deopt_handler, constant_stack_parameter_count,
34 JS_FUNCTION_STUB_MODE);
35 } else {
36 descriptor->Initialize(r0, deopt_handler, constant_stack_parameter_count,
37 JS_FUNCTION_STUB_MODE);
38 }
39 } 34 }
40 35
41
42 static void InitializeInternalArrayConstructorDescriptor(
43 Isolate* isolate, CodeStubDescriptor* descriptor,
44 int constant_stack_parameter_count) {
45 Address deopt_handler = Runtime::FunctionForId(
46 Runtime::kInternalArrayConstructor)->entry;
47
48 if (constant_stack_parameter_count == 0) {
49 descriptor->Initialize(deopt_handler, constant_stack_parameter_count,
50 JS_FUNCTION_STUB_MODE);
51 } else {
52 descriptor->Initialize(r0, deopt_handler, constant_stack_parameter_count,
53 JS_FUNCTION_STUB_MODE);
54 }
55 }
56
57
58 void ArrayNArgumentsConstructorStub::InitializeDescriptor(
59 CodeStubDescriptor* descriptor) {
60 InitializeArrayConstructorDescriptor(isolate(), descriptor, -1);
61 }
62
63
64 void FastArrayPushStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { 36 void FastArrayPushStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
65 Address deopt_handler = Runtime::FunctionForId(Runtime::kArrayPush)->entry; 37 Address deopt_handler = Runtime::FunctionForId(Runtime::kArrayPush)->entry;
66 descriptor->Initialize(r0, deopt_handler, -1, JS_FUNCTION_STUB_MODE); 38 descriptor->Initialize(r0, deopt_handler, -1, JS_FUNCTION_STUB_MODE);
67 } 39 }
68 40
69 void FastFunctionBindStub::InitializeDescriptor( 41 void FastFunctionBindStub::InitializeDescriptor(
70 CodeStubDescriptor* descriptor) { 42 CodeStubDescriptor* descriptor) {
71 Address deopt_handler = Runtime::FunctionForId(Runtime::kFunctionBind)->entry; 43 Address deopt_handler = Runtime::FunctionForId(Runtime::kFunctionBind)->entry;
72 descriptor->Initialize(r0, deopt_handler, -1, JS_FUNCTION_STUB_MODE); 44 descriptor->Initialize(r0, deopt_handler, -1, JS_FUNCTION_STUB_MODE);
73 } 45 }
74 46
75 void InternalArrayNArgumentsConstructorStub::InitializeDescriptor(
76 CodeStubDescriptor* descriptor) {
77 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, -1);
78 }
79
80
81 #define __ ACCESS_MASM(masm)
82
83 static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, 47 static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow,
84 Condition cond); 48 Condition cond);
85 static void EmitSmiNonsmiComparison(MacroAssembler* masm, 49 static void EmitSmiNonsmiComparison(MacroAssembler* masm,
86 Register lhs, 50 Register lhs,
87 Register rhs, 51 Register rhs,
88 Label* lhs_not_nan, 52 Label* lhs_not_nan,
89 Label* slow, 53 Label* slow,
90 bool strict); 54 bool strict);
91 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, 55 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm,
92 Register lhs, 56 Register lhs,
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 893
930 bool CEntryStub::NeedsImmovableCode() { 894 bool CEntryStub::NeedsImmovableCode() {
931 return true; 895 return true;
932 } 896 }
933 897
934 898
935 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { 899 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
936 CEntryStub::GenerateAheadOfTime(isolate); 900 CEntryStub::GenerateAheadOfTime(isolate);
937 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); 901 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate);
938 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); 902 StubFailureTrampolineStub::GenerateAheadOfTime(isolate);
939 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 903 CommonArrayConstructorStub::GenerateStubsAheadOfTime(isolate);
940 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); 904 CreateAllocationSiteStub::GenerateAheadOfTime(isolate);
941 CreateWeakCellStub::GenerateAheadOfTime(isolate); 905 CreateWeakCellStub::GenerateAheadOfTime(isolate);
942 BinaryOpICStub::GenerateAheadOfTime(isolate); 906 BinaryOpICStub::GenerateAheadOfTime(isolate);
943 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); 907 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate);
944 StoreFastElementStub::GenerateAheadOfTime(isolate); 908 StoreFastElementStub::GenerateAheadOfTime(isolate);
945 TypeofStub::GenerateAheadOfTime(isolate); 909 TypeofStub::GenerateAheadOfTime(isolate);
946 } 910 }
947 911
948 912
949 void CodeStub::GenerateFPStubs(Isolate* isolate) { 913 void CodeStub::GenerateFPStubs(Isolate* isolate) {
(...skipping 3226 matching lines...) Expand 10 before | Expand all | Expand 10 after
4176 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 4140 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
4177 T stub(isolate, kind); 4141 T stub(isolate, kind);
4178 stub.GetCode(); 4142 stub.GetCode();
4179 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { 4143 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) {
4180 T stub1(isolate, kind, DISABLE_ALLOCATION_SITES); 4144 T stub1(isolate, kind, DISABLE_ALLOCATION_SITES);
4181 stub1.GetCode(); 4145 stub1.GetCode();
4182 } 4146 }
4183 } 4147 }
4184 } 4148 }
4185 4149
4186 4150 void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
4187 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) {
4188 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( 4151 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>(
4189 isolate); 4152 isolate);
4190 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( 4153 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>(
4191 isolate); 4154 isolate);
4192 ArrayConstructorStubAheadOfTimeHelper<ArrayNArgumentsConstructorStub>( 4155 ArrayNArgumentsConstructorStub stub(isolate);
4193 isolate); 4156 stub.GetCode();
4194 }
4195
4196
4197 void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(
4198 Isolate* isolate) {
4199 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS }; 4157 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS };
4200 for (int i = 0; i < 2; i++) { 4158 for (int i = 0; i < 2; i++) {
4201 // For internal arrays we only need a few things 4159 // For internal arrays we only need a few things
4202 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]); 4160 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]);
4203 stubh1.GetCode(); 4161 stubh1.GetCode();
4204 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); 4162 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]);
4205 stubh2.GetCode(); 4163 stubh2.GetCode();
4206 InternalArrayNArgumentsConstructorStub stubh3(isolate, kinds[i]);
4207 stubh3.GetCode();
4208 } 4164 }
4209 } 4165 }
4210 4166
4211 4167
4212 void ArrayConstructorStub::GenerateDispatchToArrayStub( 4168 void ArrayConstructorStub::GenerateDispatchToArrayStub(
4213 MacroAssembler* masm, 4169 MacroAssembler* masm,
4214 AllocationSiteOverrideMode mode) { 4170 AllocationSiteOverrideMode mode) {
4215 if (argument_count() == ANY) { 4171 if (argument_count() == ANY) {
4216 Label not_zero_case, not_one_case; 4172 Label not_zero_case, not_one_case;
4217 __ tst(r0, r0); 4173 __ tst(r0, r0);
4218 __ b(ne, &not_zero_case); 4174 __ b(ne, &not_zero_case);
4219 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); 4175 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
4220 4176
4221 __ bind(&not_zero_case); 4177 __ bind(&not_zero_case);
4222 __ cmp(r0, Operand(1)); 4178 __ cmp(r0, Operand(1));
4223 __ b(gt, &not_one_case); 4179 __ b(gt, &not_one_case);
4224 CreateArrayDispatchOneArgument(masm, mode); 4180 CreateArrayDispatchOneArgument(masm, mode);
4225 4181
4226 __ bind(&not_one_case); 4182 __ bind(&not_one_case);
4227 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); 4183 ArrayNArgumentsConstructorStub stub(masm->isolate());
4184 __ TailCallStub(&stub);
4228 } else if (argument_count() == NONE) { 4185 } else if (argument_count() == NONE) {
4229 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); 4186 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
4230 } else if (argument_count() == ONE) { 4187 } else if (argument_count() == ONE) {
4231 CreateArrayDispatchOneArgument(masm, mode); 4188 CreateArrayDispatchOneArgument(masm, mode);
4232 } else if (argument_count() == MORE_THAN_ONE) { 4189 } else if (argument_count() == MORE_THAN_ONE) {
4233 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); 4190 ArrayNArgumentsConstructorStub stub(masm->isolate());
4191 __ TailCallStub(&stub);
4234 } else { 4192 } else {
4235 UNREACHABLE(); 4193 UNREACHABLE();
4236 } 4194 }
4237 } 4195 }
4238 4196
4239 4197
4240 void ArrayConstructorStub::Generate(MacroAssembler* masm) { 4198 void ArrayConstructorStub::Generate(MacroAssembler* masm) {
4241 // ----------- S t a t e ------------- 4199 // ----------- S t a t e -------------
4242 // -- r0 : argc (only if argument_count() == ANY) 4200 // -- r0 : argc (only if argument_count() == ANY)
4243 // -- r1 : constructor 4201 // -- r1 : constructor
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
4305 } 4263 }
4306 4264
4307 4265
4308 void InternalArrayConstructorStub::GenerateCase( 4266 void InternalArrayConstructorStub::GenerateCase(
4309 MacroAssembler* masm, ElementsKind kind) { 4267 MacroAssembler* masm, ElementsKind kind) {
4310 __ cmp(r0, Operand(1)); 4268 __ cmp(r0, Operand(1));
4311 4269
4312 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); 4270 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind);
4313 __ TailCallStub(&stub0, lo); 4271 __ TailCallStub(&stub0, lo);
4314 4272
4315 InternalArrayNArgumentsConstructorStub stubN(isolate(), kind); 4273 ArrayNArgumentsConstructorStub stubN(isolate());
4316 __ TailCallStub(&stubN, hi); 4274 __ TailCallStub(&stubN, hi);
4317 4275
4318 if (IsFastPackedElementsKind(kind)) { 4276 if (IsFastPackedElementsKind(kind)) {
4319 // We might need to create a holey array 4277 // We might need to create a holey array
4320 // look at the first argument 4278 // look at the first argument
4321 __ ldr(r3, MemOperand(sp, 0)); 4279 __ ldr(r3, MemOperand(sp, 0));
4322 __ cmp(r3, Operand::Zero()); 4280 __ cmp(r3, Operand::Zero());
4323 4281
4324 InternalArraySingleArgumentConstructorStub 4282 InternalArraySingleArgumentConstructorStub
4325 stub1_holey(isolate(), GetHoleyElementsKind(kind)); 4283 stub1_holey(isolate(), GetHoleyElementsKind(kind));
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
5426 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5384 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5427 kStackUnwindSpace, NULL, return_value_operand, NULL); 5385 kStackUnwindSpace, NULL, return_value_operand, NULL);
5428 } 5386 }
5429 5387
5430 #undef __ 5388 #undef __
5431 5389
5432 } // namespace internal 5390 } // namespace internal
5433 } // namespace v8 5391 } // namespace v8
5434 5392
5435 #endif // V8_TARGET_ARCH_ARM 5393 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/interface-descriptors-arm.cc » ('j') | src/mips/code-stubs-mips.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698