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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 } | 702 } |
703 // Never falls through to here. | 703 // Never falls through to here. |
704 | 704 |
705 __ bind(&slow); | 705 __ bind(&slow); |
706 | 706 |
707 __ Push(lhs, rhs); | 707 __ Push(lhs, rhs); |
708 // Figure out which native to call and setup the arguments. | 708 // Figure out which native to call and setup the arguments. |
709 if (cc == eq && strict()) { | 709 if (cc == eq && strict()) { |
710 __ TailCallRuntime(Runtime::kStrictEquals, 2, 1); | 710 __ TailCallRuntime(Runtime::kStrictEquals, 2, 1); |
711 } else { | 711 } else { |
712 Builtins::JavaScript native; | 712 int context_index; |
713 if (cc == eq) { | 713 if (cc == eq) { |
714 native = Builtins::EQUALS; | 714 context_index = Context::EQUALS_BUILTIN_INDEX; |
715 } else { | 715 } else { |
716 native = | 716 context_index = is_strong(strength()) |
717 is_strong(strength()) ? Builtins::COMPARE_STRONG : Builtins::COMPARE; | 717 ? Context::COMPARE_STRONG_BUILTIN_INDEX |
| 718 : Context::COMPARE_BUILTIN_INDEX; |
718 int ncr; // NaN compare result | 719 int ncr; // NaN compare result |
719 if (cc == lt || cc == le) { | 720 if (cc == lt || cc == le) { |
720 ncr = GREATER; | 721 ncr = GREATER; |
721 } else { | 722 } else { |
722 DCHECK(cc == gt || cc == ge); // remaining cases | 723 DCHECK(cc == gt || cc == ge); // remaining cases |
723 ncr = LESS; | 724 ncr = LESS; |
724 } | 725 } |
725 __ LoadSmiLiteral(r3, Smi::FromInt(ncr)); | 726 __ LoadSmiLiteral(r3, Smi::FromInt(ncr)); |
726 __ push(r3); | 727 __ push(r3); |
727 } | 728 } |
728 | 729 |
729 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater) | 730 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater) |
730 // tagged as a small integer. | 731 // tagged as a small integer. |
731 __ InvokeBuiltin(native, JUMP_FUNCTION); | 732 __ InvokeBuiltin(context_index, JUMP_FUNCTION); |
732 } | 733 } |
733 | 734 |
734 __ bind(&miss); | 735 __ bind(&miss); |
735 GenerateMiss(masm); | 736 GenerateMiss(masm); |
736 } | 737 } |
737 | 738 |
738 | 739 |
739 void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { | 740 void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { |
740 // We don't allow a GC during a store buffer overflow so there is no need to | 741 // We don't allow a GC during a store buffer overflow so there is no need to |
741 // store the registers in any particular way, but we do have to store and | 742 // store the registers in any particular way, but we do have to store and |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 __ LoadSmiLiteral(r3, Smi::FromInt(1)); | 1543 __ LoadSmiLiteral(r3, Smi::FromInt(1)); |
1543 } | 1544 } |
1544 __ Ret(HasArgsInRegisters() ? 0 : 2); | 1545 __ Ret(HasArgsInRegisters() ? 0 : 2); |
1545 | 1546 |
1546 // Slow-case. Tail call builtin. | 1547 // Slow-case. Tail call builtin. |
1547 __ bind(&slow); | 1548 __ bind(&slow); |
1548 if (!ReturnTrueFalseObject()) { | 1549 if (!ReturnTrueFalseObject()) { |
1549 if (HasArgsInRegisters()) { | 1550 if (HasArgsInRegisters()) { |
1550 __ Push(r3, r4); | 1551 __ Push(r3, r4); |
1551 } | 1552 } |
1552 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 1553 __ InvokeBuiltin(Context::INSTANCE_OF_BUILTIN_INDEX, JUMP_FUNCTION); |
1553 } else { | 1554 } else { |
1554 { | 1555 { |
1555 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 1556 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
1556 __ Push(r3, r4); | 1557 __ Push(r3, r4); |
1557 __ InvokeBuiltin(Builtins::INSTANCE_OF, CALL_FUNCTION); | 1558 __ InvokeBuiltin(Context::INSTANCE_OF_BUILTIN_INDEX, CALL_FUNCTION); |
1558 } | 1559 } |
1559 if (CpuFeatures::IsSupported(ISELECT)) { | 1560 if (CpuFeatures::IsSupported(ISELECT)) { |
1560 __ cmpi(r3, Operand::Zero()); | 1561 __ cmpi(r3, Operand::Zero()); |
1561 __ LoadRoot(r3, Heap::kTrueValueRootIndex); | 1562 __ LoadRoot(r3, Heap::kTrueValueRootIndex); |
1562 __ LoadRoot(r4, Heap::kFalseValueRootIndex); | 1563 __ LoadRoot(r4, Heap::kFalseValueRootIndex); |
1563 __ isel(eq, r3, r3, r4); | 1564 __ isel(eq, r3, r3, r4); |
1564 } else { | 1565 } else { |
1565 Label true_value, done; | 1566 Label true_value, done; |
1566 __ cmpi(r3, Operand::Zero()); | 1567 __ cmpi(r3, Operand::Zero()); |
1567 __ beq(&true_value); | 1568 __ beq(&true_value); |
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2693 | 2694 |
2694 | 2695 |
2695 static void EmitSlowCase(MacroAssembler* masm, int argc, Label* non_function) { | 2696 static void EmitSlowCase(MacroAssembler* masm, int argc, Label* non_function) { |
2696 // Check for function proxy. | 2697 // Check for function proxy. |
2697 STATIC_ASSERT(JS_FUNCTION_PROXY_TYPE < 0xffffu); | 2698 STATIC_ASSERT(JS_FUNCTION_PROXY_TYPE < 0xffffu); |
2698 __ cmpi(r7, Operand(JS_FUNCTION_PROXY_TYPE)); | 2699 __ cmpi(r7, Operand(JS_FUNCTION_PROXY_TYPE)); |
2699 __ bne(non_function); | 2700 __ bne(non_function); |
2700 __ push(r4); // put proxy as additional argument | 2701 __ push(r4); // put proxy as additional argument |
2701 __ li(r3, Operand(argc + 1)); | 2702 __ li(r3, Operand(argc + 1)); |
2702 __ li(r5, Operand::Zero()); | 2703 __ li(r5, Operand::Zero()); |
2703 __ GetBuiltinFunction(r4, Builtins::CALL_FUNCTION_PROXY); | 2704 __ GetBuiltinFunction(r4, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX); |
2704 { | 2705 { |
2705 Handle<Code> adaptor = | 2706 Handle<Code> adaptor = |
2706 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 2707 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
2707 __ Jump(adaptor, RelocInfo::CODE_TARGET); | 2708 __ Jump(adaptor, RelocInfo::CODE_TARGET); |
2708 } | 2709 } |
2709 | 2710 |
2710 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead | 2711 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead |
2711 // of the original receiver from the call site). | 2712 // of the original receiver from the call site). |
2712 __ bind(non_function); | 2713 __ bind(non_function); |
2713 __ StoreP(r4, MemOperand(sp, argc * kPointerSize), r0); | 2714 __ StoreP(r4, MemOperand(sp, argc * kPointerSize), r0); |
2714 __ li(r3, Operand(argc)); // Set up the number of arguments. | 2715 __ li(r3, Operand(argc)); // Set up the number of arguments. |
2715 __ li(r5, Operand::Zero()); | 2716 __ li(r5, Operand::Zero()); |
2716 __ GetBuiltinFunction(r4, Builtins::CALL_NON_FUNCTION); | 2717 __ GetBuiltinFunction(r4, Context::CALL_NON_FUNCTION_BUILTIN_INDEX); |
2717 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 2718 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
2718 RelocInfo::CODE_TARGET); | 2719 RelocInfo::CODE_TARGET); |
2719 } | 2720 } |
2720 | 2721 |
2721 | 2722 |
2722 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { | 2723 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { |
2723 // Wrap the receiver and patch it back onto the stack. | 2724 // Wrap the receiver and patch it back onto the stack. |
2724 { | 2725 { |
2725 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); | 2726 FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); |
2726 __ push(r4); | 2727 __ push(r4); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2851 __ JumpToJSEntry(ip); | 2852 __ JumpToJSEntry(ip); |
2852 | 2853 |
2853 // r3: number of arguments | 2854 // r3: number of arguments |
2854 // r4: called object | 2855 // r4: called object |
2855 // r8: object type | 2856 // r8: object type |
2856 Label do_call; | 2857 Label do_call; |
2857 __ bind(&slow); | 2858 __ bind(&slow); |
2858 STATIC_ASSERT(JS_FUNCTION_PROXY_TYPE < 0xffffu); | 2859 STATIC_ASSERT(JS_FUNCTION_PROXY_TYPE < 0xffffu); |
2859 __ cmpi(r8, Operand(JS_FUNCTION_PROXY_TYPE)); | 2860 __ cmpi(r8, Operand(JS_FUNCTION_PROXY_TYPE)); |
2860 __ bne(&non_function_call); | 2861 __ bne(&non_function_call); |
2861 __ GetBuiltinFunction(r4, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); | 2862 __ GetBuiltinFunction( |
| 2863 r4, Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX); |
2862 __ b(&do_call); | 2864 __ b(&do_call); |
2863 | 2865 |
2864 __ bind(&non_function_call); | 2866 __ bind(&non_function_call); |
2865 __ GetBuiltinFunction(r4, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); | 2867 __ GetBuiltinFunction( |
| 2868 r4, Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX); |
2866 __ bind(&do_call); | 2869 __ bind(&do_call); |
2867 // Set expected number of arguments to zero (not changing r3). | 2870 // Set expected number of arguments to zero (not changing r3). |
2868 __ li(r5, Operand::Zero()); | 2871 __ li(r5, Operand::Zero()); |
2869 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 2872 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
2870 RelocInfo::CODE_TARGET); | 2873 RelocInfo::CODE_TARGET); |
2871 } | 2874 } |
2872 | 2875 |
2873 | 2876 |
2874 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { | 2877 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { |
2875 __ LoadP(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2878 __ LoadP(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3524 __ bind(¬_string); | 3527 __ bind(¬_string); |
3525 | 3528 |
3526 Label not_oddball; | 3529 Label not_oddball; |
3527 __ cmpi(r4, Operand(ODDBALL_TYPE)); | 3530 __ cmpi(r4, Operand(ODDBALL_TYPE)); |
3528 __ bne(¬_oddball); | 3531 __ bne(¬_oddball); |
3529 __ LoadP(r3, FieldMemOperand(r3, Oddball::kToNumberOffset)); | 3532 __ LoadP(r3, FieldMemOperand(r3, Oddball::kToNumberOffset)); |
3530 __ blr(); | 3533 __ blr(); |
3531 __ bind(¬_oddball); | 3534 __ bind(¬_oddball); |
3532 | 3535 |
3533 __ push(r3); // Push argument. | 3536 __ push(r3); // Push argument. |
3534 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); | 3537 __ InvokeBuiltin(Context::TO_NUMBER_BUILTIN_INDEX, JUMP_FUNCTION); |
3535 } | 3538 } |
3536 | 3539 |
3537 | 3540 |
3538 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, | 3541 void StringHelper::GenerateFlatOneByteStringEquals(MacroAssembler* masm, |
3539 Register left, | 3542 Register left, |
3540 Register right, | 3543 Register right, |
3541 Register scratch1, | 3544 Register scratch1, |
3542 Register scratch2) { | 3545 Register scratch2) { |
3543 Register length = scratch1; | 3546 Register length = scratch1; |
3544 | 3547 |
(...skipping 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5825 kStackUnwindSpace, NULL, | 5828 kStackUnwindSpace, NULL, |
5826 MemOperand(fp, 6 * kPointerSize), NULL); | 5829 MemOperand(fp, 6 * kPointerSize), NULL); |
5827 } | 5830 } |
5828 | 5831 |
5829 | 5832 |
5830 #undef __ | 5833 #undef __ |
5831 } // namespace internal | 5834 } // namespace internal |
5832 } // namespace v8 | 5835 } // namespace v8 |
5833 | 5836 |
5834 #endif // V8_TARGET_ARCH_PPC | 5837 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |