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_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 3706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3717 // Call the target. | 3717 // Call the target. |
3718 __ mov(r0, Operand(argc)); | 3718 __ mov(r0, Operand(argc)); |
3719 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 3719 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
3720 // Restore context register. | 3720 // Restore context register. |
3721 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3721 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3722 // Discard the function left on TOS. | 3722 // Discard the function left on TOS. |
3723 context()->DropAndPlug(1, r0); | 3723 context()->DropAndPlug(1, r0); |
3724 } | 3724 } |
3725 | 3725 |
3726 | 3726 |
3727 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | |
3728 ZoneList<Expression*>* args = expr->arguments(); | |
3729 DCHECK(args->length() == 2); | |
3730 | |
3731 // Evaluate new.target and super constructor. | |
3732 VisitForStackValue(args->at(0)); | |
3733 VisitForStackValue(args->at(1)); | |
3734 | |
3735 // Call the construct call builtin that handles allocation and | |
3736 // constructor invocation. | |
3737 SetConstructCallPosition(expr); | |
3738 | |
3739 // Load new target into r3. | |
3740 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); | |
3741 | |
3742 // Check if the calling frame is an arguments adaptor frame. | |
3743 Label adaptor_frame, args_set_up, runtime; | |
3744 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | |
3745 __ ldr(r4, MemOperand(r2, StandardFrameConstants::kContextOffset)); | |
3746 __ cmp(r4, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | |
3747 __ b(eq, &adaptor_frame); | |
3748 // default constructor has no arguments, so no adaptor frame means no args. | |
3749 __ mov(r0, Operand::Zero()); | |
3750 __ b(&args_set_up); | |
3751 | |
3752 // Copy arguments from adaptor frame. | |
3753 { | |
3754 __ bind(&adaptor_frame); | |
3755 __ ldr(r1, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset)); | |
3756 __ SmiUntag(r1, r1); | |
3757 __ mov(r0, r1); | |
3758 | |
3759 // Get arguments pointer in r2. | |
3760 __ add(r2, r2, Operand(r1, LSL, kPointerSizeLog2)); | |
3761 __ add(r2, r2, Operand(StandardFrameConstants::kCallerSPOffset)); | |
3762 Label loop; | |
3763 __ bind(&loop); | |
3764 // Pre-decrement r2 with kPointerSize on each iteration. | |
3765 // Pre-decrement in order to skip receiver. | |
3766 __ ldr(r4, MemOperand(r2, kPointerSize, NegPreIndex)); | |
3767 __ Push(r4); | |
3768 __ sub(r1, r1, Operand(1)); | |
3769 __ cmp(r1, Operand::Zero()); | |
3770 __ b(ne, &loop); | |
3771 } | |
3772 | |
3773 __ bind(&args_set_up); | |
3774 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | |
3775 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | |
3776 | |
3777 // Restore context register. | |
3778 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
3779 | |
3780 context()->DropAndPlug(1, r0); | |
3781 } | |
3782 | |
3783 | |
3784 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 3727 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
3785 ZoneList<Expression*>* args = expr->arguments(); | 3728 ZoneList<Expression*>* args = expr->arguments(); |
3786 VisitForAccumulatorValue(args->at(0)); | 3729 VisitForAccumulatorValue(args->at(0)); |
3787 | 3730 |
3788 Label materialize_true, materialize_false; | 3731 Label materialize_true, materialize_false; |
3789 Label* if_true = NULL; | 3732 Label* if_true = NULL; |
3790 Label* if_false = NULL; | 3733 Label* if_false = NULL; |
3791 Label* fall_through = NULL; | 3734 Label* fall_through = NULL; |
3792 context()->PrepareTest(&materialize_true, &materialize_false, | 3735 context()->PrepareTest(&materialize_true, &materialize_false, |
3793 &if_true, &if_false, &fall_through); | 3736 &if_true, &if_false, &fall_through); |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4961 DCHECK(interrupt_address == | 4904 DCHECK(interrupt_address == |
4962 isolate->builtins()->OsrAfterStackCheck()->entry()); | 4905 isolate->builtins()->OsrAfterStackCheck()->entry()); |
4963 return OSR_AFTER_STACK_CHECK; | 4906 return OSR_AFTER_STACK_CHECK; |
4964 } | 4907 } |
4965 | 4908 |
4966 | 4909 |
4967 } // namespace internal | 4910 } // namespace internal |
4968 } // namespace v8 | 4911 } // namespace v8 |
4969 | 4912 |
4970 #endif // V8_TARGET_ARCH_ARM | 4913 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |