OLD | NEW |
---|---|
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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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/mips/code-stubs-mips.h" | 16 #include "src/mips/code-stubs-mips.h" |
17 #include "src/regexp/jsregexp.h" | 17 #include "src/regexp/jsregexp.h" |
18 #include "src/regexp/regexp-macro-assembler.h" | 18 #include "src/regexp/regexp-macro-assembler.h" |
19 #include "src/runtime/runtime.h" | 19 #include "src/runtime/runtime.h" |
20 | 20 |
21 namespace v8 { | 21 namespace v8 { |
22 namespace internal { | 22 namespace internal { |
23 | 23 |
24 #define __ ACCESS_MASM(masm) | |
24 | 25 |
25 static void InitializeArrayConstructorDescriptor( | 26 void ArrayNArgumentsConstructorStub::Generate(MacroAssembler* masm) { |
26 Isolate* isolate, CodeStubDescriptor* descriptor, | 27 __ sll(t9, a0, kPointerSizeLog2); |
27 int constant_stack_parameter_count) { | 28 __ Addu(t9, sp, t9); |
28 Address deopt_handler = Runtime::FunctionForId( | 29 __ sw(a1, MemOperand(t9, 0)); |
29 Runtime::kArrayConstructor)->entry; | 30 __ Push(a1); |
30 | 31 __ Push(a2); |
balazs.kilvady
2016/06/10 10:59:04
Push(a1, a2) could be used instead of the above tw
| |
31 if (constant_stack_parameter_count == 0) { | 32 __ Addu(a0, a0, Operand(3)); |
32 descriptor->Initialize(deopt_handler, constant_stack_parameter_count, | 33 __ TailCallRuntime(Runtime::kNewArray); |
33 JS_FUNCTION_STUB_MODE); | |
34 } else { | |
35 descriptor->Initialize(a0, deopt_handler, constant_stack_parameter_count, | |
36 JS_FUNCTION_STUB_MODE); | |
37 } | |
38 } | 34 } |
39 | 35 |
40 | |
41 static void InitializeInternalArrayConstructorDescriptor( | |
42 Isolate* isolate, CodeStubDescriptor* descriptor, | |
43 int constant_stack_parameter_count) { | |
44 Address deopt_handler = Runtime::FunctionForId( | |
45 Runtime::kInternalArrayConstructor)->entry; | |
46 | |
47 if (constant_stack_parameter_count == 0) { | |
48 descriptor->Initialize(deopt_handler, constant_stack_parameter_count, | |
49 JS_FUNCTION_STUB_MODE); | |
50 } else { | |
51 descriptor->Initialize(a0, deopt_handler, constant_stack_parameter_count, | |
52 JS_FUNCTION_STUB_MODE); | |
53 } | |
54 } | |
55 | |
56 | |
57 void ArrayNArgumentsConstructorStub::InitializeDescriptor( | |
58 CodeStubDescriptor* descriptor) { | |
59 InitializeArrayConstructorDescriptor(isolate(), descriptor, -1); | |
60 } | |
61 | |
62 | |
63 void FastArrayPushStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { | 36 void FastArrayPushStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { |
64 Address deopt_handler = Runtime::FunctionForId(Runtime::kArrayPush)->entry; | 37 Address deopt_handler = Runtime::FunctionForId(Runtime::kArrayPush)->entry; |
65 descriptor->Initialize(a0, deopt_handler, -1, JS_FUNCTION_STUB_MODE); | 38 descriptor->Initialize(a0, deopt_handler, -1, JS_FUNCTION_STUB_MODE); |
66 } | 39 } |
67 | 40 |
68 void FastFunctionBindStub::InitializeDescriptor( | 41 void FastFunctionBindStub::InitializeDescriptor( |
69 CodeStubDescriptor* descriptor) { | 42 CodeStubDescriptor* descriptor) { |
70 Address deopt_handler = Runtime::FunctionForId(Runtime::kFunctionBind)->entry; | 43 Address deopt_handler = Runtime::FunctionForId(Runtime::kFunctionBind)->entry; |
71 descriptor->Initialize(a0, deopt_handler, -1, JS_FUNCTION_STUB_MODE); | 44 descriptor->Initialize(a0, deopt_handler, -1, JS_FUNCTION_STUB_MODE); |
72 } | 45 } |
73 | 46 |
74 void InternalArrayNArgumentsConstructorStub::InitializeDescriptor( | |
75 CodeStubDescriptor* descriptor) { | |
76 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, -1); | |
77 } | |
78 | |
79 | |
80 #define __ ACCESS_MASM(masm) | |
81 | |
82 static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, | 47 static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, |
83 Condition cc); | 48 Condition cc); |
84 static void EmitSmiNonsmiComparison(MacroAssembler* masm, | 49 static void EmitSmiNonsmiComparison(MacroAssembler* masm, |
85 Register lhs, | 50 Register lhs, |
86 Register rhs, | 51 Register rhs, |
87 Label* rhs_not_nan, | 52 Label* rhs_not_nan, |
88 Label* slow, | 53 Label* slow, |
89 bool strict); | 54 bool strict); |
90 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, | 55 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, |
91 Register lhs, | 56 Register lhs, |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1008 | 973 |
1009 bool CEntryStub::NeedsImmovableCode() { | 974 bool CEntryStub::NeedsImmovableCode() { |
1010 return true; | 975 return true; |
1011 } | 976 } |
1012 | 977 |
1013 | 978 |
1014 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { | 979 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
1015 CEntryStub::GenerateAheadOfTime(isolate); | 980 CEntryStub::GenerateAheadOfTime(isolate); |
1016 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); | 981 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); |
1017 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); | 982 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); |
1018 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 983 CommonArrayConstructorStub::GenerateStubsAheadOfTime(isolate); |
1019 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); | 984 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); |
1020 CreateWeakCellStub::GenerateAheadOfTime(isolate); | 985 CreateWeakCellStub::GenerateAheadOfTime(isolate); |
1021 BinaryOpICStub::GenerateAheadOfTime(isolate); | 986 BinaryOpICStub::GenerateAheadOfTime(isolate); |
1022 StoreRegistersStateStub::GenerateAheadOfTime(isolate); | 987 StoreRegistersStateStub::GenerateAheadOfTime(isolate); |
1023 RestoreRegistersStateStub::GenerateAheadOfTime(isolate); | 988 RestoreRegistersStateStub::GenerateAheadOfTime(isolate); |
1024 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); | 989 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); |
1025 StoreFastElementStub::GenerateAheadOfTime(isolate); | 990 StoreFastElementStub::GenerateAheadOfTime(isolate); |
1026 TypeofStub::GenerateAheadOfTime(isolate); | 991 TypeofStub::GenerateAheadOfTime(isolate); |
1027 } | 992 } |
1028 | 993 |
(...skipping 3334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4363 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 4328 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
4364 T stub(isolate, kind); | 4329 T stub(isolate, kind); |
4365 stub.GetCode(); | 4330 stub.GetCode(); |
4366 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { | 4331 if (AllocationSite::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { |
4367 T stub1(isolate, kind, DISABLE_ALLOCATION_SITES); | 4332 T stub1(isolate, kind, DISABLE_ALLOCATION_SITES); |
4368 stub1.GetCode(); | 4333 stub1.GetCode(); |
4369 } | 4334 } |
4370 } | 4335 } |
4371 } | 4336 } |
4372 | 4337 |
4373 | 4338 void CommonArrayConstructorStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
4374 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { | |
4375 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( | 4339 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( |
4376 isolate); | 4340 isolate); |
4377 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( | 4341 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( |
4378 isolate); | 4342 isolate); |
4379 ArrayConstructorStubAheadOfTimeHelper<ArrayNArgumentsConstructorStub>( | 4343 ArrayNArgumentsConstructorStub stub(isolate); |
4380 isolate); | 4344 stub.GetCode(); |
4381 } | |
4382 | |
4383 | |
4384 void InternalArrayConstructorStubBase::GenerateStubsAheadOfTime( | |
4385 Isolate* isolate) { | |
4386 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS }; | 4345 ElementsKind kinds[2] = { FAST_ELEMENTS, FAST_HOLEY_ELEMENTS }; |
4387 for (int i = 0; i < 2; i++) { | 4346 for (int i = 0; i < 2; i++) { |
4388 // For internal arrays we only need a few things. | 4347 // For internal arrays we only need a few things. |
4389 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]); | 4348 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]); |
4390 stubh1.GetCode(); | 4349 stubh1.GetCode(); |
4391 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); | 4350 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); |
4392 stubh2.GetCode(); | 4351 stubh2.GetCode(); |
4393 InternalArrayNArgumentsConstructorStub stubh3(isolate, kinds[i]); | |
4394 stubh3.GetCode(); | |
4395 } | 4352 } |
4396 } | 4353 } |
4397 | 4354 |
4398 | 4355 |
4399 void ArrayConstructorStub::GenerateDispatchToArrayStub( | 4356 void ArrayConstructorStub::GenerateDispatchToArrayStub( |
4400 MacroAssembler* masm, | 4357 MacroAssembler* masm, |
4401 AllocationSiteOverrideMode mode) { | 4358 AllocationSiteOverrideMode mode) { |
4402 if (argument_count() == ANY) { | 4359 if (argument_count() == ANY) { |
4403 Label not_zero_case, not_one_case; | 4360 Label not_zero_case, not_one_case; |
4404 __ And(at, a0, a0); | 4361 __ And(at, a0, a0); |
4405 __ Branch(¬_zero_case, ne, at, Operand(zero_reg)); | 4362 __ Branch(¬_zero_case, ne, at, Operand(zero_reg)); |
4406 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | 4363 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); |
4407 | 4364 |
4408 __ bind(¬_zero_case); | 4365 __ bind(¬_zero_case); |
4409 __ Branch(¬_one_case, gt, a0, Operand(1)); | 4366 __ Branch(¬_one_case, gt, a0, Operand(1)); |
4410 CreateArrayDispatchOneArgument(masm, mode); | 4367 CreateArrayDispatchOneArgument(masm, mode); |
4411 | 4368 |
4412 __ bind(¬_one_case); | 4369 __ bind(¬_one_case); |
4413 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); | 4370 ArrayNArgumentsConstructorStub stub(masm->isolate()); |
4371 __ TailCallStub(&stub); | |
4414 } else if (argument_count() == NONE) { | 4372 } else if (argument_count() == NONE) { |
4415 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | 4373 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); |
4416 } else if (argument_count() == ONE) { | 4374 } else if (argument_count() == ONE) { |
4417 CreateArrayDispatchOneArgument(masm, mode); | 4375 CreateArrayDispatchOneArgument(masm, mode); |
4418 } else if (argument_count() == MORE_THAN_ONE) { | 4376 } else if (argument_count() == MORE_THAN_ONE) { |
4419 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); | 4377 ArrayNArgumentsConstructorStub stub(masm->isolate()); |
4378 __ TailCallStub(&stub); | |
4420 } else { | 4379 } else { |
4421 UNREACHABLE(); | 4380 UNREACHABLE(); |
4422 } | 4381 } |
4423 } | 4382 } |
4424 | 4383 |
4425 | 4384 |
4426 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 4385 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
4427 // ----------- S t a t e ------------- | 4386 // ----------- S t a t e ------------- |
4428 // -- a0 : argc (only if argument_count() is ANY or MORE_THAN_ONE) | 4387 // -- a0 : argc (only if argument_count() is ANY or MORE_THAN_ONE) |
4429 // -- a1 : constructor | 4388 // -- a1 : constructor |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4493 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); | 4452 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); |
4494 } | 4453 } |
4495 | 4454 |
4496 | 4455 |
4497 void InternalArrayConstructorStub::GenerateCase( | 4456 void InternalArrayConstructorStub::GenerateCase( |
4498 MacroAssembler* masm, ElementsKind kind) { | 4457 MacroAssembler* masm, ElementsKind kind) { |
4499 | 4458 |
4500 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); | 4459 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); |
4501 __ TailCallStub(&stub0, lo, a0, Operand(1)); | 4460 __ TailCallStub(&stub0, lo, a0, Operand(1)); |
4502 | 4461 |
4503 InternalArrayNArgumentsConstructorStub stubN(isolate(), kind); | 4462 ArrayNArgumentsConstructorStub stubN(isolate()); |
4504 __ TailCallStub(&stubN, hi, a0, Operand(1)); | 4463 __ TailCallStub(&stubN, hi, a0, Operand(1)); |
4505 | 4464 |
4506 if (IsFastPackedElementsKind(kind)) { | 4465 if (IsFastPackedElementsKind(kind)) { |
4507 // We might need to create a holey array | 4466 // We might need to create a holey array |
4508 // look at the first argument. | 4467 // look at the first argument. |
4509 __ lw(at, MemOperand(sp, 0)); | 4468 __ lw(at, MemOperand(sp, 0)); |
4510 | 4469 |
4511 InternalArraySingleArgumentConstructorStub | 4470 InternalArraySingleArgumentConstructorStub |
4512 stub1_holey(isolate(), GetHoleyElementsKind(kind)); | 4471 stub1_holey(isolate(), GetHoleyElementsKind(kind)); |
4513 __ TailCallStub(&stub1_holey, ne, at, Operand(zero_reg)); | 4472 __ TailCallStub(&stub1_holey, ne, at, Operand(zero_reg)); |
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5612 kStackUnwindSpace, kInvalidStackOffset, | 5571 kStackUnwindSpace, kInvalidStackOffset, |
5613 return_value_operand, NULL); | 5572 return_value_operand, NULL); |
5614 } | 5573 } |
5615 | 5574 |
5616 #undef __ | 5575 #undef __ |
5617 | 5576 |
5618 } // namespace internal | 5577 } // namespace internal |
5619 } // namespace v8 | 5578 } // namespace v8 |
5620 | 5579 |
5621 #endif // V8_TARGET_ARCH_MIPS | 5580 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |