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

Side by Side Diff: src/x64/code-stubs-x64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_X64 5 #if V8_TARGET_ARCH_X64
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/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
11 #include "src/ic/handler-compiler.h" 11 #include "src/ic/handler-compiler.h"
12 #include "src/ic/ic.h" 12 #include "src/ic/ic.h"
13 #include "src/ic/stub-cache.h" 13 #include "src/ic/stub-cache.h"
14 #include "src/isolate.h" 14 #include "src/isolate.h"
15 #include "src/regexp/jsregexp.h" 15 #include "src/regexp/jsregexp.h"
16 #include "src/regexp/regexp-macro-assembler.h" 16 #include "src/regexp/regexp-macro-assembler.h"
17 #include "src/runtime/runtime.h" 17 #include "src/runtime/runtime.h"
18 #include "src/x64/code-stubs-x64.h" 18 #include "src/x64/code-stubs-x64.h"
19 19
20 namespace v8 { 20 namespace v8 {
21 namespace internal { 21 namespace internal {
22 22
23 #define __ ACCESS_MASM(masm)
23 24
24 static void InitializeArrayConstructorDescriptor( 25 void ArrayNArgumentsConstructorStub::Generate(MacroAssembler* masm) {
25 Isolate* isolate, CodeStubDescriptor* descriptor, 26 __ popq(rcx);
26 int constant_stack_parameter_count) { 27 __ movq(MemOperand(rsp, rax, times_8, 0), rdi);
27 Address deopt_handler = Runtime::FunctionForId( 28 __ pushq(rdi);
28 Runtime::kArrayConstructor)->entry; 29 __ pushq(rbx);
29 30 __ pushq(rcx);
30 if (constant_stack_parameter_count == 0) { 31 __ addq(rax, Immediate(3));
31 descriptor->Initialize(deopt_handler, constant_stack_parameter_count, 32 __ TailCallRuntime(Runtime::kNewArray);
32 JS_FUNCTION_STUB_MODE);
33 } else {
34 descriptor->Initialize(rax, deopt_handler, constant_stack_parameter_count,
35 JS_FUNCTION_STUB_MODE);
36 }
37 } 33 }
38 34
39
40 static void InitializeInternalArrayConstructorDescriptor(
41 Isolate* isolate, CodeStubDescriptor* descriptor,
42 int constant_stack_parameter_count) {
43 Address deopt_handler = Runtime::FunctionForId(
44 Runtime::kInternalArrayConstructor)->entry;
45
46 if (constant_stack_parameter_count == 0) {
47 descriptor->Initialize(deopt_handler, constant_stack_parameter_count,
48 JS_FUNCTION_STUB_MODE);
49 } else {
50 descriptor->Initialize(rax, deopt_handler, constant_stack_parameter_count,
51 JS_FUNCTION_STUB_MODE);
52 }
53 }
54
55
56 void ArrayNArgumentsConstructorStub::InitializeDescriptor(
57 CodeStubDescriptor* descriptor) {
58 InitializeArrayConstructorDescriptor(isolate(), descriptor, -1);
59 }
60
61
62 void FastArrayPushStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { 35 void FastArrayPushStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
63 Address deopt_handler = Runtime::FunctionForId(Runtime::kArrayPush)->entry; 36 Address deopt_handler = Runtime::FunctionForId(Runtime::kArrayPush)->entry;
64 descriptor->Initialize(rax, deopt_handler, -1, JS_FUNCTION_STUB_MODE); 37 descriptor->Initialize(rax, deopt_handler, -1, JS_FUNCTION_STUB_MODE);
65 } 38 }
66 39
67 void FastFunctionBindStub::InitializeDescriptor( 40 void FastFunctionBindStub::InitializeDescriptor(
68 CodeStubDescriptor* descriptor) { 41 CodeStubDescriptor* descriptor) {
69 Address deopt_handler = Runtime::FunctionForId(Runtime::kFunctionBind)->entry; 42 Address deopt_handler = Runtime::FunctionForId(Runtime::kFunctionBind)->entry;
70 descriptor->Initialize(rax, deopt_handler, -1, JS_FUNCTION_STUB_MODE); 43 descriptor->Initialize(rax, deopt_handler, -1, JS_FUNCTION_STUB_MODE);
71 } 44 }
72 45
73 void InternalArrayNArgumentsConstructorStub::InitializeDescriptor(
74 CodeStubDescriptor* descriptor) {
75 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, -1);
76 }
77
78
79 #define __ ACCESS_MASM(masm)
80
81
82 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm, 46 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm,
83 ExternalReference miss) { 47 ExternalReference miss) {
84 // Update the static counter each time a new code stub is generated. 48 // Update the static counter each time a new code stub is generated.
85 isolate()->counters()->code_stubs()->Increment(); 49 isolate()->counters()->code_stubs()->Increment();
86 50
87 CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor(); 51 CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor();
88 int param_count = descriptor.GetRegisterParameterCount(); 52 int param_count = descriptor.GetRegisterParameterCount();
89 { 53 {
90 // Call the runtime system in a fresh internal frame. 54 // Call the runtime system in a fresh internal frame.
91 FrameScope scope(masm, StackFrame::INTERNAL); 55 FrameScope scope(masm, StackFrame::INTERNAL);
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 bool CEntryStub::NeedsImmovableCode() { 1618 bool CEntryStub::NeedsImmovableCode() {
1655 return false; 1619 return false;
1656 } 1620 }
1657 1621
1658 1622
1659 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { 1623 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
1660 CEntryStub::GenerateAheadOfTime(isolate); 1624 CEntryStub::GenerateAheadOfTime(isolate);
1661 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); 1625 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate);
1662 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); 1626 StubFailureTrampolineStub::GenerateAheadOfTime(isolate);
1663 // It is important that the store buffer overflow stubs are generated first. 1627 // It is important that the store buffer overflow stubs are generated first.
1664 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 1628 CommonArrayConstructorStub::GenerateStubsAheadOfTime(isolate);
1665 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); 1629 CreateAllocationSiteStub::GenerateAheadOfTime(isolate);
1666 CreateWeakCellStub::GenerateAheadOfTime(isolate); 1630 CreateWeakCellStub::GenerateAheadOfTime(isolate);
1667 BinaryOpICStub::GenerateAheadOfTime(isolate); 1631 BinaryOpICStub::GenerateAheadOfTime(isolate);
1668 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); 1632 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate);
1669 StoreFastElementStub::GenerateAheadOfTime(isolate); 1633 StoreFastElementStub::GenerateAheadOfTime(isolate);
1670 TypeofStub::GenerateAheadOfTime(isolate); 1634 TypeofStub::GenerateAheadOfTime(isolate);
1671 } 1635 }
1672 1636
1673 1637
1674 void CodeStub::GenerateFPStubs(Isolate* isolate) { 1638 void CodeStub::GenerateFPStubs(Isolate* isolate) {
(...skipping 2355 matching lines...) Expand 10 before | Expand all | Expand 10 after
4030 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 3994 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
4031 T stub(isolate, kind); 3995 T stub(isolate, kind);
4032 stub.GetCode(); 3996 stub.GetCode();
4033 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { 3997 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) {
4034 T stub1(isolate, kind, DISABLE_ALLOCATION_SITES); 3998 T stub1(isolate, kind, DISABLE_ALLOCATION_SITES);
4035 stub1.GetCode(); 3999 stub1.GetCode();
4036 } 4000 }
4037 } 4001 }
4038 } 4002 }
4039 4003
4040 4004 void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) {
4041 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) {
4042 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( 4005 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>(
4043 isolate); 4006 isolate);
4044 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( 4007 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>(
4045 isolate); 4008 isolate);
4046 ArrayConstructorStubAheadOfTimeHelper<ArrayNArgumentsConstructorStub>( 4009 ArrayNArgumentsConstructorStub stub(isolate);
4047 isolate); 4010 stub.GetCode();
4048 }
4049 4011
4050
4051 void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime(
4052 Isolate* isolate) {
4053 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS }; 4012 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS };
4054 for (int i = 0; i < 2; i++) { 4013 for (int i = 0; i < 2; i++) {
4055 // For internal arrays we only need a few things 4014 // For internal arrays we only need a few things
4056 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]); 4015 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]);
4057 stubh1.GetCode(); 4016 stubh1.GetCode();
4058 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); 4017 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]);
4059 stubh2.GetCode(); 4018 stubh2.GetCode();
4060 InternalArrayNArgumentsConstructorStub stubh3(isolate, kinds[i]);
4061 stubh3.GetCode();
4062 } 4019 }
4063 } 4020 }
4064 4021
4065 4022
4066 void ArrayConstructorStub::GenerateDispatchToArrayStub( 4023 void ArrayConstructorStub::GenerateDispatchToArrayStub(
4067 MacroAssembler* masm, 4024 MacroAssembler* masm,
4068 AllocationSiteOverrideMode mode) { 4025 AllocationSiteOverrideMode mode) {
4069 if (argument_count() == ANY) { 4026 if (argument_count() == ANY) {
4070 Label not_zero_case, not_one_case; 4027 Label not_zero_case, not_one_case;
4071 __ testp(rax, rax); 4028 __ testp(rax, rax);
4072 __ j(not_zero, &not_zero_case); 4029 __ j(not_zero, &not_zero_case);
4073 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); 4030 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
4074 4031
4075 __ bind(&not_zero_case); 4032 __ bind(&not_zero_case);
4076 __ cmpl(rax, Immediate(1)); 4033 __ cmpl(rax, Immediate(1));
4077 __ j(greater, &not_one_case); 4034 __ j(greater, &not_one_case);
4078 CreateArrayDispatchOneArgument(masm, mode); 4035 CreateArrayDispatchOneArgument(masm, mode);
4079 4036
4080 __ bind(&not_one_case); 4037 __ bind(&not_one_case);
4081 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); 4038 ArrayNArgumentsConstructorStub stub(masm->isolate());
4039 __ TailCallStub(&stub);
4082 } else if (argument_count() == NONE) { 4040 } else if (argument_count() == NONE) {
4083 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); 4041 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
4084 } else if (argument_count() == ONE) { 4042 } else if (argument_count() == ONE) {
4085 CreateArrayDispatchOneArgument(masm, mode); 4043 CreateArrayDispatchOneArgument(masm, mode);
4086 } else if (argument_count() == MORE_THAN_ONE) { 4044 } else if (argument_count() == MORE_THAN_ONE) {
4087 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); 4045 ArrayNArgumentsConstructorStub stub(masm->isolate());
4046 __ TailCallStub(&stub);
4088 } else { 4047 } else {
4089 UNREACHABLE(); 4048 UNREACHABLE();
4090 } 4049 }
4091 } 4050 }
4092 4051
4093 4052
4094 void ArrayConstructorStub::Generate(MacroAssembler* masm) { 4053 void ArrayConstructorStub::Generate(MacroAssembler* masm) {
4095 // ----------- S t a t e ------------- 4054 // ----------- S t a t e -------------
4096 // -- rax : argc 4055 // -- rax : argc
4097 // -- rbx : AllocationSite or undefined 4056 // -- rbx : AllocationSite or undefined
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
4196 InternalArraySingleArgumentConstructorStub 4155 InternalArraySingleArgumentConstructorStub
4197 stub1_holey(isolate(), GetHoleyElementsKind(kind)); 4156 stub1_holey(isolate(), GetHoleyElementsKind(kind));
4198 __ TailCallStub(&stub1_holey); 4157 __ TailCallStub(&stub1_holey);
4199 } 4158 }
4200 4159
4201 __ bind(&normal_sequence); 4160 __ bind(&normal_sequence);
4202 InternalArraySingleArgumentConstructorStub stub1(isolate(), kind); 4161 InternalArraySingleArgumentConstructorStub stub1(isolate(), kind);
4203 __ TailCallStub(&stub1); 4162 __ TailCallStub(&stub1);
4204 4163
4205 __ bind(&not_one_case); 4164 __ bind(&not_one_case);
4206 InternalArrayNArgumentsConstructorStub stubN(isolate(), kind); 4165 ArrayNArgumentsConstructorStub stubN(isolate());
4207 __ TailCallStub(&stubN); 4166 __ TailCallStub(&stubN);
4208 } 4167 }
4209 4168
4210 4169
4211 void InternalArrayConstructorStub::Generate(MacroAssembler* masm) { 4170 void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
4212 // ----------- S t a t e ------------- 4171 // ----------- S t a t e -------------
4213 // -- rax : argc 4172 // -- rax : argc
4214 // -- rdi : constructor 4173 // -- rdi : constructor
4215 // -- rsp[0] : return address 4174 // -- rsp[0] : return address
4216 // -- rsp[8] : last argument 4175 // -- rsp[8] : last argument
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
5425 kStackUnwindSpace, nullptr, return_value_operand, 5384 kStackUnwindSpace, nullptr, return_value_operand,
5426 NULL); 5385 NULL);
5427 } 5386 }
5428 5387
5429 #undef __ 5388 #undef __
5430 5389
5431 } // namespace internal 5390 } // namespace internal
5432 } // namespace v8 5391 } // namespace v8
5433 5392
5434 #endif // V8_TARGET_ARCH_X64 5393 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698