OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 #include "src/s390/code-stubs-s390.h" | 19 #include "src/s390/code-stubs-s390.h" |
20 | 20 |
21 namespace v8 { | 21 namespace v8 { |
22 namespace internal { | 22 namespace internal { |
23 | 23 |
24 static void InitializeArrayConstructorDescriptor( | 24 #define __ ACCESS_MASM(masm) |
25 Isolate* isolate, CodeStubDescriptor* descriptor, | |
26 int constant_stack_parameter_count) { | |
27 Address deopt_handler = | |
28 Runtime::FunctionForId(Runtime::kArrayConstructor)->entry; | |
29 | 25 |
30 if (constant_stack_parameter_count == 0) { | 26 void ArrayNArgumentsConstructorStub::Generate(MacroAssembler* masm) { |
31 descriptor->Initialize(deopt_handler, constant_stack_parameter_count, | 27 __ ShiftLeftP(r1, r2, Operand(kPointerSizeLog2)); |
32 JS_FUNCTION_STUB_MODE); | 28 __ StoreP(r3, MemOperand(sp, r1)); |
33 } else { | 29 __ push(r3); |
34 descriptor->Initialize(r2, deopt_handler, constant_stack_parameter_count, | 30 __ push(r4); |
35 JS_FUNCTION_STUB_MODE); | 31 __ AddP(r2, r2, Operand(3)); |
36 } | 32 __ TailCallRuntime(Runtime::kNewArray); |
37 } | |
38 | |
39 static void InitializeInternalArrayConstructorDescriptor( | |
40 Isolate* isolate, CodeStubDescriptor* descriptor, | |
41 int constant_stack_parameter_count) { | |
42 Address deopt_handler = | |
43 Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry; | |
44 | |
45 if (constant_stack_parameter_count == 0) { | |
46 descriptor->Initialize(deopt_handler, constant_stack_parameter_count, | |
47 JS_FUNCTION_STUB_MODE); | |
48 } else { | |
49 descriptor->Initialize(r2, deopt_handler, constant_stack_parameter_count, | |
50 JS_FUNCTION_STUB_MODE); | |
51 } | |
52 } | |
53 | |
54 void ArrayNArgumentsConstructorStub::InitializeDescriptor( | |
55 CodeStubDescriptor* descriptor) { | |
56 InitializeArrayConstructorDescriptor(isolate(), descriptor, -1); | |
57 } | 33 } |
58 | 34 |
59 void FastArrayPushStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { | 35 void FastArrayPushStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { |
60 Address deopt_handler = Runtime::FunctionForId(Runtime::kArrayPush)->entry; | 36 Address deopt_handler = Runtime::FunctionForId(Runtime::kArrayPush)->entry; |
61 descriptor->Initialize(r2, deopt_handler, -1, JS_FUNCTION_STUB_MODE); | 37 descriptor->Initialize(r2, deopt_handler, -1, JS_FUNCTION_STUB_MODE); |
62 } | 38 } |
63 | 39 |
64 void FastFunctionBindStub::InitializeDescriptor( | 40 void FastFunctionBindStub::InitializeDescriptor( |
65 CodeStubDescriptor* descriptor) { | 41 CodeStubDescriptor* descriptor) { |
66 Address deopt_handler = Runtime::FunctionForId(Runtime::kFunctionBind)->entry; | 42 Address deopt_handler = Runtime::FunctionForId(Runtime::kFunctionBind)->entry; |
67 descriptor->Initialize(r2, deopt_handler, -1, JS_FUNCTION_STUB_MODE); | 43 descriptor->Initialize(r2, deopt_handler, -1, JS_FUNCTION_STUB_MODE); |
68 } | 44 } |
69 | 45 |
70 void InternalArrayNArgumentsConstructorStub::InitializeDescriptor( | |
71 CodeStubDescriptor* descriptor) { | |
72 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, -1); | |
73 } | |
74 | |
75 #define __ ACCESS_MASM(masm) | |
76 | |
77 static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, | 46 static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, |
78 Condition cond); | 47 Condition cond); |
79 static void EmitSmiNonsmiComparison(MacroAssembler* masm, Register lhs, | 48 static void EmitSmiNonsmiComparison(MacroAssembler* masm, Register lhs, |
80 Register rhs, Label* lhs_not_nan, | 49 Register rhs, Label* lhs_not_nan, |
81 Label* slow, bool strict); | 50 Label* slow, bool strict); |
82 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, Register lhs, | 51 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, Register lhs, |
83 Register rhs); | 52 Register rhs); |
84 | 53 |
85 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm, | 54 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm, |
86 ExternalReference miss) { | 55 ExternalReference miss) { |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 __ Ret(); | 914 __ Ret(); |
946 } | 915 } |
947 } | 916 } |
948 | 917 |
949 bool CEntryStub::NeedsImmovableCode() { return true; } | 918 bool CEntryStub::NeedsImmovableCode() { return true; } |
950 | 919 |
951 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { | 920 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
952 CEntryStub::GenerateAheadOfTime(isolate); | 921 CEntryStub::GenerateAheadOfTime(isolate); |
953 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); | 922 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); |
954 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); | 923 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); |
955 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 924 CommonArrayConstructorStub::GenerateStubsAheadOfTime(isolate); |
956 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); | 925 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); |
957 CreateWeakCellStub::GenerateAheadOfTime(isolate); | 926 CreateWeakCellStub::GenerateAheadOfTime(isolate); |
958 BinaryOpICStub::GenerateAheadOfTime(isolate); | 927 BinaryOpICStub::GenerateAheadOfTime(isolate); |
959 StoreRegistersStateStub::GenerateAheadOfTime(isolate); | 928 StoreRegistersStateStub::GenerateAheadOfTime(isolate); |
960 RestoreRegistersStateStub::GenerateAheadOfTime(isolate); | 929 RestoreRegistersStateStub::GenerateAheadOfTime(isolate); |
961 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); | 930 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); |
962 StoreFastElementStub::GenerateAheadOfTime(isolate); | 931 StoreFastElementStub::GenerateAheadOfTime(isolate); |
963 TypeofStub::GenerateAheadOfTime(isolate); | 932 TypeofStub::GenerateAheadOfTime(isolate); |
964 } | 933 } |
965 | 934 |
(...skipping 3255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4221 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 4190 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
4222 T stub(isolate, kind); | 4191 T stub(isolate, kind); |
4223 stub.GetCode(); | 4192 stub.GetCode(); |
4224 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { | 4193 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { |
4225 T stub1(isolate, kind, DISABLE_ALLOCATION_SITES); | 4194 T stub1(isolate, kind, DISABLE_ALLOCATION_SITES); |
4226 stub1.GetCode(); | 4195 stub1.GetCode(); |
4227 } | 4196 } |
4228 } | 4197 } |
4229 } | 4198 } |
4230 | 4199 |
4231 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { | 4200 void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
4232 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( | 4201 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( |
4233 isolate); | 4202 isolate); |
4234 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( | 4203 ArrayNArgumentsConstructorStub stub(isolate); |
4235 isolate); | 4204 stub.GetCode(); |
4236 ArrayConstructorStubAheadOfTimeHelper<ArrayNArgumentsConstructorStub>( | |
4237 isolate); | |
4238 } | |
4239 | |
4240 void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime( | |
4241 Isolate* isolate) { | |
4242 ElementsKind kinds[2] = {FAST_ELEMENTS, FAST_HOLEY_ELEMENTS}; | 4205 ElementsKind kinds[2] = {FAST_ELEMENTS, FAST_HOLEY_ELEMENTS}; |
4243 for (int i = 0; i < 2; i++) { | 4206 for (int i = 0; i < 2; i++) { |
4244 // For internal arrays we only need a few things | 4207 // For internal arrays we only need a few things |
4245 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]); | 4208 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]); |
4246 stubh1.GetCode(); | 4209 stubh1.GetCode(); |
4247 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); | 4210 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); |
4248 stubh2.GetCode(); | 4211 stubh2.GetCode(); |
4249 InternalArrayNArgumentsConstructorStub stubh3(isolate, kinds[i]); | |
4250 stubh3.GetCode(); | |
4251 } | 4212 } |
4252 } | 4213 } |
4253 | 4214 |
4254 void ArrayConstructorStub::GenerateDispatchToArrayStub( | 4215 void ArrayConstructorStub::GenerateDispatchToArrayStub( |
4255 MacroAssembler* masm, AllocationSiteOverrideMode mode) { | 4216 MacroAssembler* masm, AllocationSiteOverrideMode mode) { |
4256 if (argument_count() == ANY) { | 4217 if (argument_count() == ANY) { |
4257 Label not_zero_case, not_one_case; | 4218 Label not_zero_case, not_one_case; |
4258 __ CmpP(r2, Operand::Zero()); | 4219 __ CmpP(r2, Operand::Zero()); |
4259 __ bne(¬_zero_case); | 4220 __ bne(¬_zero_case); |
4260 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | 4221 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); |
4261 | 4222 |
4262 __ bind(¬_zero_case); | 4223 __ bind(¬_zero_case); |
4263 __ CmpP(r2, Operand(1)); | 4224 __ CmpP(r2, Operand(1)); |
4264 __ bgt(¬_one_case); | 4225 __ bgt(¬_one_case); |
4265 CreateArrayDispatchOneArgument(masm, mode); | 4226 CreateArrayDispatchOneArgument(masm, mode); |
4266 | 4227 |
4267 __ bind(¬_one_case); | 4228 __ bind(¬_one_case); |
4268 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); | 4229 ArrayNArgumentsConstructorStub stub(masm->isolate()); |
| 4230 __ TailCallStub(&stub); |
4269 } else if (argument_count() == NONE) { | 4231 } else if (argument_count() == NONE) { |
4270 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | 4232 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); |
4271 } else if (argument_count() == ONE) { | 4233 } else if (argument_count() == ONE) { |
4272 CreateArrayDispatchOneArgument(masm, mode); | 4234 CreateArrayDispatchOneArgument(masm, mode); |
4273 } else if (argument_count() == MORE_THAN_ONE) { | 4235 } else if (argument_count() == MORE_THAN_ONE) { |
4274 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); | 4236 ArrayNArgumentsConstructorStub stub(masm->isolate()); |
| 4237 __ TailCallStub(&stub); |
4275 } else { | 4238 } else { |
4276 UNREACHABLE(); | 4239 UNREACHABLE(); |
4277 } | 4240 } |
4278 } | 4241 } |
4279 | 4242 |
4280 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 4243 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
4281 // ----------- S t a t e ------------- | 4244 // ----------- S t a t e ------------- |
4282 // -- r2 : argc (only if argument_count() == ANY) | 4245 // -- r2 : argc (only if argument_count() == ANY) |
4283 // -- r3 : constructor | 4246 // -- r3 : constructor |
4284 // -- r4 : AllocationSite or undefined | 4247 // -- r4 : AllocationSite or undefined |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4346 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); | 4309 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); |
4347 } | 4310 } |
4348 | 4311 |
4349 void InternalArrayConstructorStub::GenerateCase(MacroAssembler* masm, | 4312 void InternalArrayConstructorStub::GenerateCase(MacroAssembler* masm, |
4350 ElementsKind kind) { | 4313 ElementsKind kind) { |
4351 __ CmpLogicalP(r2, Operand(1)); | 4314 __ CmpLogicalP(r2, Operand(1)); |
4352 | 4315 |
4353 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); | 4316 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); |
4354 __ TailCallStub(&stub0, lt); | 4317 __ TailCallStub(&stub0, lt); |
4355 | 4318 |
4356 InternalArrayNArgumentsConstructorStub stubN(isolate(), kind); | 4319 ArrayNArgumentsConstructorStub stubN(isolate()); |
4357 __ TailCallStub(&stubN, gt); | 4320 __ TailCallStub(&stubN, gt); |
4358 | 4321 |
4359 if (IsFastPackedElementsKind(kind)) { | 4322 if (IsFastPackedElementsKind(kind)) { |
4360 // We might need to create a holey array | 4323 // We might need to create a holey array |
4361 // look at the first argument | 4324 // look at the first argument |
4362 __ LoadP(r5, MemOperand(sp, 0)); | 4325 __ LoadP(r5, MemOperand(sp, 0)); |
4363 __ CmpP(r5, Operand::Zero()); | 4326 __ CmpP(r5, Operand::Zero()); |
4364 | 4327 |
4365 InternalArraySingleArgumentConstructorStub stub1_holey( | 4328 InternalArraySingleArgumentConstructorStub stub1_holey( |
4366 isolate(), GetHoleyElementsKind(kind)); | 4329 isolate(), GetHoleyElementsKind(kind)); |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5550 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5513 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5551 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5514 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5552 } | 5515 } |
5553 | 5516 |
5554 #undef __ | 5517 #undef __ |
5555 | 5518 |
5556 } // namespace internal | 5519 } // namespace internal |
5557 } // namespace v8 | 5520 } // namespace v8 |
5558 | 5521 |
5559 #endif // V8_TARGET_ARCH_S390 | 5522 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |