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 // Note on Mips implementation: | 7 // Note on Mips implementation: |
8 // | 8 // |
9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
(...skipping 3714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3725 // Call the target. | 3725 // Call the target. |
3726 __ li(a0, Operand(argc)); | 3726 __ li(a0, Operand(argc)); |
3727 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 3727 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
3728 // Restore context register. | 3728 // Restore context register. |
3729 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3729 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3730 // Discard the function left on TOS. | 3730 // Discard the function left on TOS. |
3731 context()->DropAndPlug(1, v0); | 3731 context()->DropAndPlug(1, v0); |
3732 } | 3732 } |
3733 | 3733 |
3734 | 3734 |
3735 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | |
3736 ZoneList<Expression*>* args = expr->arguments(); | |
3737 DCHECK(args->length() == 2); | |
3738 | |
3739 // Evaluate new.target and super constructor. | |
3740 VisitForStackValue(args->at(0)); | |
3741 VisitForStackValue(args->at(1)); | |
3742 | |
3743 // Call the construct call builtin that handles allocation and | |
3744 // constructor invocation. | |
3745 SetConstructCallPosition(expr); | |
3746 | |
3747 // Load new target into a3. | |
3748 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); | |
3749 | |
3750 // Check if the calling frame is an arguments adaptor frame. | |
3751 Label adaptor_frame, args_set_up, runtime; | |
3752 __ lw(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | |
3753 __ lw(t0, MemOperand(a2, StandardFrameConstants::kContextOffset)); | |
3754 __ Branch(&adaptor_frame, eq, t0, | |
3755 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | |
3756 // default constructor has no arguments, so no adaptor frame means no args. | |
3757 __ mov(a0, zero_reg); | |
3758 __ Branch(&args_set_up); | |
3759 | |
3760 // Copy arguments from adaptor frame. | |
3761 { | |
3762 __ bind(&adaptor_frame); | |
3763 __ lw(a1, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset)); | |
3764 __ SmiUntag(a1, a1); | |
3765 | |
3766 __ mov(a0, a1); | |
3767 | |
3768 // Get arguments pointer in a2. | |
3769 __ sll(at, a1, kPointerSizeLog2); | |
3770 __ addu(a2, a2, at); | |
3771 __ Addu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset)); | |
3772 Label loop; | |
3773 __ bind(&loop); | |
3774 // Pre-decrement a2 with kPointerSize on each iteration. | |
3775 // Pre-decrement in order to skip receiver. | |
3776 __ Addu(a2, a2, Operand(-kPointerSize)); | |
3777 __ lw(t0, MemOperand(a2)); | |
3778 __ Push(t0); | |
3779 __ Addu(a1, a1, Operand(-1)); | |
3780 __ Branch(&loop, ne, a1, Operand(zero_reg)); | |
3781 } | |
3782 | |
3783 __ bind(&args_set_up); | |
3784 __ sll(at, a0, kPointerSizeLog2); | |
3785 __ Addu(at, at, Operand(sp)); | |
3786 __ lw(a1, MemOperand(at, 0)); | |
3787 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | |
3788 | |
3789 // Restore context register. | |
3790 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
3791 | |
3792 context()->DropAndPlug(1, result_register()); | |
3793 } | |
3794 | |
3795 | |
3796 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 3735 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
3797 ZoneList<Expression*>* args = expr->arguments(); | 3736 ZoneList<Expression*>* args = expr->arguments(); |
3798 VisitForAccumulatorValue(args->at(0)); | 3737 VisitForAccumulatorValue(args->at(0)); |
3799 | 3738 |
3800 Label materialize_true, materialize_false; | 3739 Label materialize_true, materialize_false; |
3801 Label* if_true = NULL; | 3740 Label* if_true = NULL; |
3802 Label* if_false = NULL; | 3741 Label* if_false = NULL; |
3803 Label* fall_through = NULL; | 3742 Label* fall_through = NULL; |
3804 context()->PrepareTest(&materialize_true, &materialize_false, | 3743 context()->PrepareTest(&materialize_true, &materialize_false, |
3805 &if_true, &if_false, &fall_through); | 3744 &if_true, &if_false, &fall_through); |
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4913 reinterpret_cast<uint32_t>( | 4852 reinterpret_cast<uint32_t>( |
4914 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4853 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4915 return OSR_AFTER_STACK_CHECK; | 4854 return OSR_AFTER_STACK_CHECK; |
4916 } | 4855 } |
4917 | 4856 |
4918 | 4857 |
4919 } // namespace internal | 4858 } // namespace internal |
4920 } // namespace v8 | 4859 } // namespace v8 |
4921 | 4860 |
4922 #endif // V8_TARGET_ARCH_MIPS | 4861 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |