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/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 3696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3707 // Call the target. | 3707 // Call the target. |
3708 __ mov(r3, Operand(argc)); | 3708 __ mov(r3, Operand(argc)); |
3709 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 3709 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
3710 // Restore context register. | 3710 // Restore context register. |
3711 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3711 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3712 // Discard the function left on TOS. | 3712 // Discard the function left on TOS. |
3713 context()->DropAndPlug(1, r3); | 3713 context()->DropAndPlug(1, r3); |
3714 } | 3714 } |
3715 | 3715 |
3716 | 3716 |
3717 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | |
3718 ZoneList<Expression*>* args = expr->arguments(); | |
3719 DCHECK(args->length() == 2); | |
3720 | |
3721 // Evaluate new.target and super constructor. | |
3722 VisitForStackValue(args->at(0)); | |
3723 VisitForStackValue(args->at(1)); | |
3724 | |
3725 // Call the construct call builtin that handles allocation and | |
3726 // constructor invocation. | |
3727 SetConstructCallPosition(expr); | |
3728 | |
3729 // Check if the calling frame is an arguments adaptor frame. | |
3730 Label adaptor_frame, args_set_up, runtime; | |
3731 __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | |
3732 __ LoadP(r7, MemOperand(r5, StandardFrameConstants::kContextOffset)); | |
3733 | |
3734 // Load super constructor, new target into r4, r6. | |
3735 __ LoadP(r4, MemOperand(sp)); | |
3736 __ LoadP(r6, MemOperand(sp, 1 * kPointerSize)); | |
3737 | |
3738 __ CmpSmiLiteral(r7, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); | |
3739 __ beq(&adaptor_frame); | |
3740 | |
3741 // default constructor has no arguments, so no adaptor frame means no args. | |
3742 __ li(r3, Operand::Zero()); | |
3743 __ b(&args_set_up); | |
3744 | |
3745 // Copy arguments from adaptor frame. | |
3746 { | |
3747 __ bind(&adaptor_frame); | |
3748 __ LoadP(r3, MemOperand(r5, ArgumentsAdaptorFrameConstants::kLengthOffset)); | |
3749 __ SmiUntag(r3); | |
3750 | |
3751 // Get arguments pointer in r5. | |
3752 __ ShiftLeftImm(r0, r3, Operand(kPointerSizeLog2)); | |
3753 __ add(r5, r5, r0); | |
3754 __ addi(r5, r5, Operand(StandardFrameConstants::kCallerSPOffset)); | |
3755 | |
3756 Label loop; | |
3757 __ mtctr(r3); | |
3758 __ bind(&loop); | |
3759 // Pre-decrement in order to skip receiver. | |
3760 __ LoadPU(r7, MemOperand(r5, -kPointerSize)); | |
3761 __ Push(r7); | |
3762 __ bdnz(&loop); | |
3763 } | |
3764 | |
3765 __ bind(&args_set_up); | |
3766 __ Call(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | |
3767 | |
3768 // Restore context register. | |
3769 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | |
3770 | |
3771 context()->DropAndPlug(1, r3); | |
3772 } | |
3773 | |
3774 | |
3775 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | 3717 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { |
3776 ZoneList<Expression*>* args = expr->arguments(); | 3718 ZoneList<Expression*>* args = expr->arguments(); |
3777 VisitForAccumulatorValue(args->at(0)); | 3719 VisitForAccumulatorValue(args->at(0)); |
3778 | 3720 |
3779 Label materialize_true, materialize_false; | 3721 Label materialize_true, materialize_false; |
3780 Label* if_true = NULL; | 3722 Label* if_true = NULL; |
3781 Label* if_false = NULL; | 3723 Label* if_false = NULL; |
3782 Label* fall_through = NULL; | 3724 Label* fall_through = NULL; |
3783 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, | 3725 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, |
3784 &if_false, &fall_through); | 3726 &if_false, &fall_through); |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4899 return ON_STACK_REPLACEMENT; | 4841 return ON_STACK_REPLACEMENT; |
4900 } | 4842 } |
4901 | 4843 |
4902 DCHECK(interrupt_address == | 4844 DCHECK(interrupt_address == |
4903 isolate->builtins()->OsrAfterStackCheck()->entry()); | 4845 isolate->builtins()->OsrAfterStackCheck()->entry()); |
4904 return OSR_AFTER_STACK_CHECK; | 4846 return OSR_AFTER_STACK_CHECK; |
4905 } | 4847 } |
4906 } // namespace internal | 4848 } // namespace internal |
4907 } // namespace v8 | 4849 } // namespace v8 |
4908 #endif // V8_TARGET_ARCH_PPC | 4850 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |