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

Side by Side Diff: src/ia32/code-stubs-ia32.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
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_IA32 5 #if V8_TARGET_ARCH_IA32
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/ia32/code-stubs-ia32.h" 12 #include "src/ia32/code-stubs-ia32.h"
13 #include "src/ia32/frames-ia32.h" 13 #include "src/ia32/frames-ia32.h"
14 #include "src/ic/handler-compiler.h" 14 #include "src/ic/handler-compiler.h"
15 #include "src/ic/ic.h" 15 #include "src/ic/ic.h"
16 #include "src/ic/stub-cache.h" 16 #include "src/ic/stub-cache.h"
17 #include "src/isolate.h" 17 #include "src/isolate.h"
18 #include "src/regexp/jsregexp.h" 18 #include "src/regexp/jsregexp.h"
19 #include "src/regexp/regexp-macro-assembler.h" 19 #include "src/regexp/regexp-macro-assembler.h"
20 #include "src/runtime/runtime.h" 20 #include "src/runtime/runtime.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 __ pop(ecx);
28 int constant_stack_parameter_count) { 29 __ mov(MemOperand(esp, eax, times_4, 0), edi);
29 // register state 30 __ push(edi);
30 // eax -- number of arguments 31 __ push(ebx);
31 // edi -- function 32 __ push(ecx);
32 // ebx -- allocation site with elements kind 33 __ add(eax, Immediate(3));
33 Address deopt_handler = Runtime::FunctionForId( 34 __ TailCallRuntime(Runtime::kNewArray);
34 Runtime::kArrayConstructor)->entry;
35
36 if (constant_stack_parameter_count == 0) {
37 descriptor->Initialize(deopt_handler, constant_stack_parameter_count,
38 JS_FUNCTION_STUB_MODE);
39 } else {
40 descriptor->Initialize(eax, deopt_handler, constant_stack_parameter_count,
41 JS_FUNCTION_STUB_MODE);
42 }
43 } 35 }
44 36
45
46 static void InitializeInternalArrayConstructorDescriptor(
47 Isolate* isolate, CodeStubDescriptor* descriptor,
48 int constant_stack_parameter_count) {
49 // register state
50 // eax -- number of arguments
51 // edi -- constructor function
52 Address deopt_handler = Runtime::FunctionForId(
53 Runtime::kInternalArrayConstructor)->entry;
54
55 if (constant_stack_parameter_count == 0) {
56 descriptor->Initialize(deopt_handler, constant_stack_parameter_count,
57 JS_FUNCTION_STUB_MODE);
58 } else {
59 descriptor->Initialize(eax, deopt_handler, constant_stack_parameter_count,
60 JS_FUNCTION_STUB_MODE);
61 }
62 }
63
64
65 void ArrayNArgumentsConstructorStub::InitializeDescriptor(
66 CodeStubDescriptor* descriptor) {
67 InitializeArrayConstructorDescriptor(isolate(), descriptor, -1);
68 }
69
70
71 void FastArrayPushStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { 37 void FastArrayPushStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
72 Address deopt_handler = Runtime::FunctionForId(Runtime::kArrayPush)->entry; 38 Address deopt_handler = Runtime::FunctionForId(Runtime::kArrayPush)->entry;
73 descriptor->Initialize(eax, deopt_handler, -1, JS_FUNCTION_STUB_MODE); 39 descriptor->Initialize(eax, deopt_handler, -1, JS_FUNCTION_STUB_MODE);
74 } 40 }
75 41
76 void FastFunctionBindStub::InitializeDescriptor( 42 void FastFunctionBindStub::InitializeDescriptor(
77 CodeStubDescriptor* descriptor) { 43 CodeStubDescriptor* descriptor) {
78 Address deopt_handler = Runtime::FunctionForId(Runtime::kFunctionBind)->entry; 44 Address deopt_handler = Runtime::FunctionForId(Runtime::kFunctionBind)->entry;
79 descriptor->Initialize(eax, deopt_handler, -1, JS_FUNCTION_STUB_MODE); 45 descriptor->Initialize(eax, deopt_handler, -1, JS_FUNCTION_STUB_MODE);
80 } 46 }
81 47
82 void InternalArrayNArgumentsConstructorStub::InitializeDescriptor(
83 CodeStubDescriptor* descriptor) {
84 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, -1);
85 }
86
87
88 #define __ ACCESS_MASM(masm)
89
90
91 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm, 48 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm,
92 ExternalReference miss) { 49 ExternalReference miss) {
93 // Update the static counter each time a new code stub is generated. 50 // Update the static counter each time a new code stub is generated.
94 isolate()->counters()->code_stubs()->Increment(); 51 isolate()->counters()->code_stubs()->Increment();
95 52
96 CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor(); 53 CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor();
97 int param_count = descriptor.GetRegisterParameterCount(); 54 int param_count = descriptor.GetRegisterParameterCount();
98 { 55 {
99 // Call the runtime system in a fresh internal frame. 56 // Call the runtime system in a fresh internal frame.
100 FrameScope scope(masm, StackFrame::INTERNAL); 57 FrameScope scope(masm, StackFrame::INTERNAL);
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 bool CEntryStub::NeedsImmovableCode() { 1732 bool CEntryStub::NeedsImmovableCode() {
1776 return false; 1733 return false;
1777 } 1734 }
1778 1735
1779 1736
1780 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { 1737 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
1781 CEntryStub::GenerateAheadOfTime(isolate); 1738 CEntryStub::GenerateAheadOfTime(isolate);
1782 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); 1739 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate);
1783 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); 1740 StubFailureTrampolineStub::GenerateAheadOfTime(isolate);
1784 // It is important that the store buffer overflow stubs are generated first. 1741 // It is important that the store buffer overflow stubs are generated first.
1785 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 1742 CommonArrayConstructorStub::GenerateStubsAheadOfTime(isolate);
1786 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); 1743 CreateAllocationSiteStub::GenerateAheadOfTime(isolate);
1787 CreateWeakCellStub::GenerateAheadOfTime(isolate); 1744 CreateWeakCellStub::GenerateAheadOfTime(isolate);
1788 BinaryOpICStub::GenerateAheadOfTime(isolate); 1745 BinaryOpICStub::GenerateAheadOfTime(isolate);
1789 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); 1746 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate);
1790 StoreFastElementStub::GenerateAheadOfTime(isolate); 1747 StoreFastElementStub::GenerateAheadOfTime(isolate);
1791 TypeofStub::GenerateAheadOfTime(isolate); 1748 TypeofStub::GenerateAheadOfTime(isolate);
1792 } 1749 }
1793 1750
1794 1751
1795 void CodeStub::GenerateFPStubs(Isolate* isolate) { 1752 void CodeStub::GenerateFPStubs(Isolate* isolate) {
(...skipping 2509 matching lines...) Expand 10 before | Expand all | Expand 10 after
4305 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 4262 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
4306 T stub(isolate, kind); 4263 T stub(isolate, kind);
4307 stub.GetCode(); 4264 stub.GetCode();
4308 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { 4265 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) {
4309 T stub1(isolate, kind, DISABLE_ALLOCATION_SITES); 4266 T stub1(isolate, kind, DISABLE_ALLOCATION_SITES);
4310 stub1.GetCode(); 4267 stub1.GetCode();
4311 } 4268 }
4312 } 4269 }
4313 } 4270 }
4314 4271
4315 4272 void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
4316 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) {
4317 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( 4273 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>(
4318 isolate); 4274 isolate);
4319 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( 4275 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>(
4320 isolate); 4276 isolate);
4321 ArrayConstructorStubAheadOfTimeHelper<ArrayNArgumentsConstructorStub>( 4277 ArrayNArgumentsConstructorStub stub(isolate);
4322 isolate); 4278 stub.GetCode();
4323 }
4324 4279
4325
4326 void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(
4327 Isolate* isolate) {
4328 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS }; 4280 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS };
4329 for (int i = 0; i < 2; i++) { 4281 for (int i = 0; i < 2; i++) {
4330 // For internal arrays we only need a few things 4282 // For internal arrays we only need a few things
4331 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]); 4283 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]);
4332 stubh1.GetCode(); 4284 stubh1.GetCode();
4333 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); 4285 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]);
4334 stubh2.GetCode(); 4286 stubh2.GetCode();
4335 InternalArrayNArgumentsConstructorStub stubh3(isolate, kinds[i]);
4336 stubh3.GetCode();
4337 } 4287 }
4338 } 4288 }
4339 4289
4340 4290
4341 void ArrayConstructorStub::GenerateDispatchToArrayStub( 4291 void ArrayConstructorStub::GenerateDispatchToArrayStub(
4342 MacroAssembler* masm, 4292 MacroAssembler* masm,
4343 AllocationSiteOverrideMode mode) { 4293 AllocationSiteOverrideMode mode) {
4344 if (argument_count() == ANY) { 4294 if (argument_count() == ANY) {
4345 Label not_zero_case, not_one_case; 4295 Label not_zero_case, not_one_case;
4346 __ test(eax, eax); 4296 __ test(eax, eax);
4347 __ j(not_zero, &not_zero_case); 4297 __ j(not_zero, &not_zero_case);
4348 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); 4298 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
4349 4299
4350 __ bind(&not_zero_case); 4300 __ bind(&not_zero_case);
4351 __ cmp(eax, 1); 4301 __ cmp(eax, 1);
4352 __ j(greater, &not_one_case); 4302 __ j(greater, &not_one_case);
4353 CreateArrayDispatchOneArgument(masm, mode); 4303 CreateArrayDispatchOneArgument(masm, mode);
4354 4304
4355 __ bind(&not_one_case); 4305 __ bind(&not_one_case);
4356 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); 4306 ArrayNArgumentsConstructorStub stub(masm->isolate());
4307 __ TailCallStub(&stub);
4357 } else if (argument_count() == NONE) { 4308 } else if (argument_count() == NONE) {
4358 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); 4309 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
4359 } else if (argument_count() == ONE) { 4310 } else if (argument_count() == ONE) {
4360 CreateArrayDispatchOneArgument(masm, mode); 4311 CreateArrayDispatchOneArgument(masm, mode);
4361 } else if (argument_count() == MORE_THAN_ONE) { 4312 } else if (argument_count() == MORE_THAN_ONE) {
4362 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); 4313 ArrayNArgumentsConstructorStub stub(masm->isolate());
4314 __ TailCallStub(&stub);
4363 } else { 4315 } else {
4364 UNREACHABLE(); 4316 UNREACHABLE();
4365 } 4317 }
4366 } 4318 }
4367 4319
4368 4320
4369 void ArrayConstructorStub::Generate(MacroAssembler* masm) { 4321 void ArrayConstructorStub::Generate(MacroAssembler* masm) {
4370 // ----------- S t a t e ------------- 4322 // ----------- S t a t e -------------
4371 // -- eax : argc (only if argument_count() is ANY or MORE_THAN_ONE) 4323 // -- eax : argc (only if argument_count() is ANY or MORE_THAN_ONE)
4372 // -- ebx : AllocationSite or undefined 4324 // -- ebx : AllocationSite or undefined
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
4464 InternalArraySingleArgumentConstructorStub 4416 InternalArraySingleArgumentConstructorStub
4465 stub1_holey(isolate(), GetHoleyElementsKind(kind)); 4417 stub1_holey(isolate(), GetHoleyElementsKind(kind));
4466 __ TailCallStub(&stub1_holey); 4418 __ TailCallStub(&stub1_holey);
4467 } 4419 }
4468 4420
4469 __ bind(&normal_sequence); 4421 __ bind(&normal_sequence);
4470 InternalArraySingleArgumentConstructorStub stub1(isolate(), kind); 4422 InternalArraySingleArgumentConstructorStub stub1(isolate(), kind);
4471 __ TailCallStub(&stub1); 4423 __ TailCallStub(&stub1);
4472 4424
4473 __ bind(&not_one_case); 4425 __ bind(&not_one_case);
4474 InternalArrayNArgumentsConstructorStub stubN(isolate(), kind); 4426 ArrayNArgumentsConstructorStub stubN(isolate());
4475 __ TailCallStub(&stubN); 4427 __ TailCallStub(&stubN);
4476 } 4428 }
4477 4429
4478 4430
4479 void InternalArrayConstructorStub::Generate(MacroAssembler* masm) { 4431 void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
4480 // ----------- S t a t e ------------- 4432 // ----------- S t a t e -------------
4481 // -- eax : argc 4433 // -- eax : argc
4482 // -- edi : constructor 4434 // -- edi : constructor
4483 // -- esp[0] : return address 4435 // -- esp[0] : return address
4484 // -- esp[4] : last argument 4436 // -- esp[4] : last argument
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
5702 kStackUnwindSpace, nullptr, return_value_operand, 5654 kStackUnwindSpace, nullptr, return_value_operand,
5703 NULL); 5655 NULL);
5704 } 5656 }
5705 5657
5706 #undef __ 5658 #undef __
5707 5659
5708 } // namespace internal 5660 } // namespace internal
5709 } // namespace v8 5661 } // namespace v8
5710 5662
5711 #endif // V8_TARGET_ARCH_IA32 5663 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698