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/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 // Never falls through to here. | 722 // Never falls through to here. |
723 | 723 |
724 __ bind(&slow); | 724 __ bind(&slow); |
725 // Prepare for call to builtin. Push object pointers, a0 (lhs) first, | 725 // Prepare for call to builtin. Push object pointers, a0 (lhs) first, |
726 // a1 (rhs) second. | 726 // a1 (rhs) second. |
727 __ Push(lhs, rhs); | 727 __ Push(lhs, rhs); |
728 // Figure out which native to call and setup the arguments. | 728 // Figure out which native to call and setup the arguments. |
729 if (cc == eq && strict()) { | 729 if (cc == eq && strict()) { |
730 __ TailCallRuntime(Runtime::kStrictEquals, 2, 1); | 730 __ TailCallRuntime(Runtime::kStrictEquals, 2, 1); |
731 } else { | 731 } else { |
732 Builtins::JavaScript native; | 732 int context_index; |
733 if (cc == eq) { | 733 if (cc == eq) { |
734 native = Builtins::EQUALS; | 734 context_index = Context::EQUALS_BUILTIN_INDEX; |
735 } else { | 735 } else { |
736 native = | 736 context_index = is_strong(strength()) |
737 is_strong(strength()) ? Builtins::COMPARE_STRONG : Builtins::COMPARE; | 737 ? Context::COMPARE_STRONG_BUILTIN_INDEX |
| 738 : Context::COMPARE_BUILTIN_INDEX; |
738 int ncr; // NaN compare result. | 739 int ncr; // NaN compare result. |
739 if (cc == lt || cc == le) { | 740 if (cc == lt || cc == le) { |
740 ncr = GREATER; | 741 ncr = GREATER; |
741 } else { | 742 } else { |
742 DCHECK(cc == gt || cc == ge); // Remaining cases. | 743 DCHECK(cc == gt || cc == ge); // Remaining cases. |
743 ncr = LESS; | 744 ncr = LESS; |
744 } | 745 } |
745 __ li(a0, Operand(Smi::FromInt(ncr))); | 746 __ li(a0, Operand(Smi::FromInt(ncr))); |
746 __ push(a0); | 747 __ push(a0); |
747 } | 748 } |
748 | 749 |
749 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater) | 750 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater) |
750 // tagged as a small integer. | 751 // tagged as a small integer. |
751 __ InvokeBuiltin(native, JUMP_FUNCTION); | 752 __ InvokeBuiltin(context_index, JUMP_FUNCTION); |
752 } | 753 } |
753 | 754 |
754 __ bind(&miss); | 755 __ bind(&miss); |
755 GenerateMiss(masm); | 756 GenerateMiss(masm); |
756 } | 757 } |
757 | 758 |
758 | 759 |
759 void StoreRegistersStateStub::Generate(MacroAssembler* masm) { | 760 void StoreRegistersStateStub::Generate(MacroAssembler* masm) { |
760 __ mov(t9, ra); | 761 __ mov(t9, ra); |
761 __ pop(ra); | 762 __ pop(ra); |
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2551 | 2552 |
2552 | 2553 |
2553 static void EmitSlowCase(MacroAssembler* masm, | 2554 static void EmitSlowCase(MacroAssembler* masm, |
2554 int argc, | 2555 int argc, |
2555 Label* non_function) { | 2556 Label* non_function) { |
2556 // Check for function proxy. | 2557 // Check for function proxy. |
2557 __ Branch(non_function, ne, t0, Operand(JS_FUNCTION_PROXY_TYPE)); | 2558 __ Branch(non_function, ne, t0, Operand(JS_FUNCTION_PROXY_TYPE)); |
2558 __ push(a1); // put proxy as additional argument | 2559 __ push(a1); // put proxy as additional argument |
2559 __ li(a0, Operand(argc + 1, RelocInfo::NONE32)); | 2560 __ li(a0, Operand(argc + 1, RelocInfo::NONE32)); |
2560 __ mov(a2, zero_reg); | 2561 __ mov(a2, zero_reg); |
2561 __ GetBuiltinFunction(a1, Builtins::CALL_FUNCTION_PROXY); | 2562 __ GetBuiltinFunction(a1, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX); |
2562 { | 2563 { |
2563 Handle<Code> adaptor = | 2564 Handle<Code> adaptor = |
2564 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 2565 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
2565 __ Jump(adaptor, RelocInfo::CODE_TARGET); | 2566 __ Jump(adaptor, RelocInfo::CODE_TARGET); |
2566 } | 2567 } |
2567 | 2568 |
2568 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead | 2569 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead |
2569 // of the original receiver from the call site). | 2570 // of the original receiver from the call site). |
2570 __ bind(non_function); | 2571 __ bind(non_function); |
2571 __ sw(a1, MemOperand(sp, argc * kPointerSize)); | 2572 __ sw(a1, MemOperand(sp, argc * kPointerSize)); |
2572 __ li(a0, Operand(argc)); // Set up the number of arguments. | 2573 __ li(a0, Operand(argc)); // Set up the number of arguments. |
2573 __ mov(a2, zero_reg); | 2574 __ mov(a2, zero_reg); |
2574 __ GetBuiltinFunction(a1, Builtins::CALL_NON_FUNCTION); | 2575 __ GetBuiltinFunction(a1, Context::CALL_NON_FUNCTION_BUILTIN_INDEX); |
2575 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 2576 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
2576 RelocInfo::CODE_TARGET); | 2577 RelocInfo::CODE_TARGET); |
2577 } | 2578 } |
2578 | 2579 |
2579 | 2580 |
2580 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { | 2581 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { |
2581 // Wrap the receiver and patch it back onto the stack. | 2582 // Wrap the receiver and patch it back onto the stack. |
2582 { FrameScope frame_scope(masm, StackFrame::INTERNAL); | 2583 { FrameScope frame_scope(masm, StackFrame::INTERNAL); |
2583 __ Push(a1); | 2584 __ Push(a1); |
2584 __ mov(a0, a3); | 2585 __ mov(a0, a3); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2703 SharedFunctionInfo::kConstructStubOffset)); | 2704 SharedFunctionInfo::kConstructStubOffset)); |
2704 __ Addu(at, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); | 2705 __ Addu(at, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); |
2705 __ Jump(at); | 2706 __ Jump(at); |
2706 | 2707 |
2707 // a0: number of arguments | 2708 // a0: number of arguments |
2708 // a1: called object | 2709 // a1: called object |
2709 // t1: object type | 2710 // t1: object type |
2710 Label do_call; | 2711 Label do_call; |
2711 __ bind(&slow); | 2712 __ bind(&slow); |
2712 __ Branch(&non_function_call, ne, t1, Operand(JS_FUNCTION_PROXY_TYPE)); | 2713 __ Branch(&non_function_call, ne, t1, Operand(JS_FUNCTION_PROXY_TYPE)); |
2713 __ GetBuiltinFunction(a1, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); | 2714 __ GetBuiltinFunction( |
| 2715 a1, Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX); |
2714 __ jmp(&do_call); | 2716 __ jmp(&do_call); |
2715 | 2717 |
2716 __ bind(&non_function_call); | 2718 __ bind(&non_function_call); |
2717 __ GetBuiltinFunction(a1, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); | 2719 __ GetBuiltinFunction( |
| 2720 a1, Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX); |
2718 __ bind(&do_call); | 2721 __ bind(&do_call); |
2719 // Set expected number of arguments to zero (not changing r0). | 2722 // Set expected number of arguments to zero (not changing r0). |
2720 __ li(a2, Operand(0, RelocInfo::NONE32)); | 2723 __ li(a2, Operand(0, RelocInfo::NONE32)); |
2721 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 2724 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
2722 RelocInfo::CODE_TARGET); | 2725 RelocInfo::CODE_TARGET); |
2723 } | 2726 } |
2724 | 2727 |
2725 | 2728 |
2726 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { | 2729 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { |
2727 __ lw(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2730 __ lw(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3403 __ TailCallRuntime(Runtime::kStringToNumber, 1, 1); | 3406 __ TailCallRuntime(Runtime::kStringToNumber, 1, 1); |
3404 __ bind(¬_string); | 3407 __ bind(¬_string); |
3405 | 3408 |
3406 Label not_oddball; | 3409 Label not_oddball; |
3407 __ Branch(¬_oddball, ne, a1, Operand(ODDBALL_TYPE)); | 3410 __ Branch(¬_oddball, ne, a1, Operand(ODDBALL_TYPE)); |
3408 __ Ret(USE_DELAY_SLOT); | 3411 __ Ret(USE_DELAY_SLOT); |
3409 __ lw(v0, FieldMemOperand(a0, Oddball::kToNumberOffset)); | 3412 __ lw(v0, FieldMemOperand(a0, Oddball::kToNumberOffset)); |
3410 __ bind(¬_oddball); | 3413 __ bind(¬_oddball); |
3411 | 3414 |
3412 __ push(a0); // Push argument. | 3415 __ push(a0); // Push argument. |
3413 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); | 3416 __ InvokeBuiltin(Context::TO_NUMBER_BUILTIN_INDEX, JUMP_FUNCTION); |
3414 } | 3417 } |
3415 | 3418 |
3416 | 3419 |
3417 void StringHelper::GenerateFlatOneByteStringEquals( | 3420 void StringHelper::GenerateFlatOneByteStringEquals( |
3418 MacroAssembler* masm, Register left, Register right, Register scratch1, | 3421 MacroAssembler* masm, Register left, Register right, Register scratch1, |
3419 Register scratch2, Register scratch3) { | 3422 Register scratch2, Register scratch3) { |
3420 Register length = scratch1; | 3423 Register length = scratch1; |
3421 | 3424 |
3422 // Compare lengths. | 3425 // Compare lengths. |
3423 Label strings_not_equal, check_zero_length; | 3426 Label strings_not_equal, check_zero_length; |
(...skipping 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5625 MemOperand(fp, 6 * kPointerSize), NULL); | 5628 MemOperand(fp, 6 * kPointerSize), NULL); |
5626 } | 5629 } |
5627 | 5630 |
5628 | 5631 |
5629 #undef __ | 5632 #undef __ |
5630 | 5633 |
5631 } // namespace internal | 5634 } // namespace internal |
5632 } // namespace v8 | 5635 } // namespace v8 |
5633 | 5636 |
5634 #endif // V8_TARGET_ARCH_MIPS | 5637 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |