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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 2725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2736 | 2736 |
2737 void CallFunctionStub::Generate(MacroAssembler* masm) { | 2737 void CallFunctionStub::Generate(MacroAssembler* masm) { |
2738 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod()); | 2738 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod()); |
2739 } | 2739 } |
2740 | 2740 |
2741 | 2741 |
2742 void CallConstructStub::Generate(MacroAssembler* masm) { | 2742 void CallConstructStub::Generate(MacroAssembler* masm) { |
2743 // a0 : number of arguments | 2743 // a0 : number of arguments |
2744 // a1 : the function to call | 2744 // a1 : the function to call |
2745 // a2 : feedback vector | 2745 // a2 : feedback vector |
2746 // a3 : (only if a2 is not undefined) slot in feedback vector (Smi) | 2746 // a3 : slot in feedback vector (Smi, for RecordCallTarget) |
| 2747 // t0 : original constructor (for IsSuperConstructorCall) |
2747 Label slow, non_function_call; | 2748 Label slow, non_function_call; |
2748 | 2749 |
2749 // Check that the function is not a smi. | 2750 // Check that the function is not a smi. |
2750 __ JumpIfSmi(a1, &non_function_call); | 2751 __ JumpIfSmi(a1, &non_function_call); |
2751 // Check that the function is a JSFunction. | 2752 // Check that the function is a JSFunction. |
2752 __ GetObjectType(a1, t0, t0); | 2753 __ GetObjectType(a1, t1, t1); |
2753 __ Branch(&slow, ne, t0, Operand(JS_FUNCTION_TYPE)); | 2754 __ Branch(&slow, ne, t1, Operand(JS_FUNCTION_TYPE)); |
2754 | 2755 |
2755 if (RecordCallTarget()) { | 2756 if (RecordCallTarget()) { |
| 2757 if (IsSuperConstructorCall()) { |
| 2758 __ push(t0); |
| 2759 } |
2756 GenerateRecordCallTarget(masm); | 2760 GenerateRecordCallTarget(masm); |
| 2761 if (IsSuperConstructorCall()) { |
| 2762 __ pop(t0); |
| 2763 } |
2757 | 2764 |
2758 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize); | 2765 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize); |
2759 __ Addu(t1, a2, at); | 2766 __ Addu(t1, a2, at); |
2760 if (FLAG_pretenuring_call_new) { | 2767 if (FLAG_pretenuring_call_new) { |
2761 // Put the AllocationSite from the feedback vector into a2. | 2768 // Put the AllocationSite from the feedback vector into a2. |
2762 // By adding kPointerSize we encode that we know the AllocationSite | 2769 // By adding kPointerSize we encode that we know the AllocationSite |
2763 // entry is at the feedback vector slot given by a3 + 1. | 2770 // entry is at the feedback vector slot given by a3 + 1. |
2764 __ lw(a2, FieldMemOperand(t1, FixedArray::kHeaderSize + kPointerSize)); | 2771 __ lw(a2, FieldMemOperand(t1, FixedArray::kHeaderSize + kPointerSize)); |
2765 } else { | 2772 } else { |
2766 Label feedback_register_initialized; | 2773 Label feedback_register_initialized; |
2767 // Put the AllocationSite from the feedback vector into a2, or undefined. | 2774 // Put the AllocationSite from the feedback vector into a2, or undefined. |
2768 __ lw(a2, FieldMemOperand(t1, FixedArray::kHeaderSize)); | 2775 __ lw(a2, FieldMemOperand(t1, FixedArray::kHeaderSize)); |
2769 __ lw(t1, FieldMemOperand(a2, AllocationSite::kMapOffset)); | 2776 __ lw(t1, FieldMemOperand(a2, AllocationSite::kMapOffset)); |
2770 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | 2777 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); |
2771 __ Branch(&feedback_register_initialized, eq, t1, Operand(at)); | 2778 __ Branch(&feedback_register_initialized, eq, t1, Operand(at)); |
2772 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 2779 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
2773 __ bind(&feedback_register_initialized); | 2780 __ bind(&feedback_register_initialized); |
2774 } | 2781 } |
2775 | 2782 |
2776 __ AssertUndefinedOrAllocationSite(a2, t1); | 2783 __ AssertUndefinedOrAllocationSite(a2, t1); |
2777 } | 2784 } |
2778 | 2785 |
2779 // Pass function as original constructor. | 2786 // Pass function as original constructor. |
2780 if (IsSuperConstructorCall()) { | 2787 if (IsSuperConstructorCall()) { |
2781 __ li(t0, Operand(1 * kPointerSize)); | 2788 __ mov(a3, t0); |
2782 __ sll(at, a0, kPointerSizeLog2); | |
2783 __ Addu(t0, t0, Operand(at)); | |
2784 __ Addu(at, sp, Operand(t0)); | |
2785 __ lw(a3, MemOperand(at, 0)); | |
2786 } else { | 2789 } else { |
2787 __ mov(a3, a1); | 2790 __ mov(a3, a1); |
2788 } | 2791 } |
2789 | 2792 |
2790 // Jump to the function-specific construct stub. | 2793 // Jump to the function-specific construct stub. |
2791 Register jmp_reg = t0; | 2794 Register jmp_reg = t0; |
2792 __ lw(jmp_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 2795 __ lw(jmp_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
2793 __ lw(jmp_reg, FieldMemOperand(jmp_reg, | 2796 __ lw(jmp_reg, FieldMemOperand(jmp_reg, |
2794 SharedFunctionInfo::kConstructStubOffset)); | 2797 SharedFunctionInfo::kConstructStubOffset)); |
2795 __ Addu(at, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); | 2798 __ Addu(at, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); |
2796 __ Jump(at); | 2799 __ Jump(at); |
2797 | 2800 |
2798 // a0: number of arguments | 2801 // a0: number of arguments |
2799 // a1: called object | 2802 // a1: called object |
2800 // t0: object type | 2803 // t1: object type |
2801 Label do_call; | 2804 Label do_call; |
2802 __ bind(&slow); | 2805 __ bind(&slow); |
2803 __ Branch(&non_function_call, ne, t0, Operand(JS_FUNCTION_PROXY_TYPE)); | 2806 __ Branch(&non_function_call, ne, t1, Operand(JS_FUNCTION_PROXY_TYPE)); |
2804 __ GetBuiltinFunction(a1, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); | 2807 __ GetBuiltinFunction(a1, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); |
2805 __ jmp(&do_call); | 2808 __ jmp(&do_call); |
2806 | 2809 |
2807 __ bind(&non_function_call); | 2810 __ bind(&non_function_call); |
2808 __ GetBuiltinFunction(a1, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); | 2811 __ GetBuiltinFunction(a1, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); |
2809 __ bind(&do_call); | 2812 __ bind(&do_call); |
2810 // Set expected number of arguments to zero (not changing r0). | 2813 // Set expected number of arguments to zero (not changing r0). |
2811 __ li(a2, Operand(0, RelocInfo::NONE32)); | 2814 __ li(a2, Operand(0, RelocInfo::NONE32)); |
2812 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 2815 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
2813 RelocInfo::CODE_TARGET); | 2816 RelocInfo::CODE_TARGET); |
(...skipping 2760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5574 MemOperand(fp, 6 * kPointerSize), NULL); | 5577 MemOperand(fp, 6 * kPointerSize), NULL); |
5575 } | 5578 } |
5576 | 5579 |
5577 | 5580 |
5578 #undef __ | 5581 #undef __ |
5579 | 5582 |
5580 } // namespace internal | 5583 } // namespace internal |
5581 } // namespace v8 | 5584 } // namespace v8 |
5582 | 5585 |
5583 #endif // V8_TARGET_ARCH_MIPS | 5586 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |