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/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 3064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3075 | 3075 |
3076 // Push the arguments ("left-to-right") on the stack. | 3076 // Push the arguments ("left-to-right") on the stack. |
3077 ZoneList<Expression*>* args = expr->arguments(); | 3077 ZoneList<Expression*>* args = expr->arguments(); |
3078 int arg_count = args->length(); | 3078 int arg_count = args->length(); |
3079 for (int i = 0; i < arg_count; i++) { | 3079 for (int i = 0; i < arg_count; i++) { |
3080 VisitForStackValue(args->at(i)); | 3080 VisitForStackValue(args->at(i)); |
3081 } | 3081 } |
3082 | 3082 |
3083 // Call the construct call builtin that handles allocation and | 3083 // Call the construct call builtin that handles allocation and |
3084 // constructor invocation. | 3084 // constructor invocation. |
3085 SetConstructCallPosition(expr); | 3085 SetConstructCallPosition(expr, arg_count); |
3086 | 3086 |
3087 // Load function and argument count into r4 and r3. | 3087 // Load function and argument count into r4 and r3. |
3088 __ mov(r3, Operand(arg_count)); | 3088 __ mov(r3, Operand(arg_count)); |
3089 __ LoadP(r4, MemOperand(sp, arg_count * kPointerSize), r0); | 3089 __ LoadP(r4, MemOperand(sp, arg_count * kPointerSize), r0); |
3090 | 3090 |
3091 // Record call targets in unoptimized code. | 3091 // Record call targets in unoptimized code. |
3092 __ EmitLoadTypeFeedbackVector(r5); | 3092 __ EmitLoadTypeFeedbackVector(r5); |
3093 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallNewFeedbackSlot())); | 3093 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallNewFeedbackSlot())); |
3094 | 3094 |
3095 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 3095 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
(...skipping 15 matching lines...) Expand all Loading... |
3111 | 3111 |
3112 // Push the arguments ("left-to-right") on the stack. | 3112 // Push the arguments ("left-to-right") on the stack. |
3113 ZoneList<Expression*>* args = expr->arguments(); | 3113 ZoneList<Expression*>* args = expr->arguments(); |
3114 int arg_count = args->length(); | 3114 int arg_count = args->length(); |
3115 for (int i = 0; i < arg_count; i++) { | 3115 for (int i = 0; i < arg_count; i++) { |
3116 VisitForStackValue(args->at(i)); | 3116 VisitForStackValue(args->at(i)); |
3117 } | 3117 } |
3118 | 3118 |
3119 // Call the construct call builtin that handles allocation and | 3119 // Call the construct call builtin that handles allocation and |
3120 // constructor invocation. | 3120 // constructor invocation. |
3121 SetConstructCallPosition(expr); | 3121 SetConstructCallPosition(expr, arg_count); |
3122 | 3122 |
3123 // Load new target into r7. | 3123 // Load new target into r7. |
3124 VisitForAccumulatorValue(super_call_ref->new_target_var()); | 3124 VisitForAccumulatorValue(super_call_ref->new_target_var()); |
3125 __ mr(r7, result_register()); | 3125 __ mr(r7, result_register()); |
3126 | 3126 |
3127 // Load function and argument count into r1 and r0. | 3127 // Load function and argument count into r1 and r0. |
3128 __ mov(r3, Operand(arg_count)); | 3128 __ mov(r3, Operand(arg_count)); |
3129 __ LoadP(r4, MemOperand(sp, arg_count * kPointerSize)); | 3129 __ LoadP(r4, MemOperand(sp, arg_count * kPointerSize)); |
3130 | 3130 |
3131 // Record call targets in unoptimized code. | 3131 // Record call targets in unoptimized code. |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3843 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3843 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
3844 // Discard the function left on TOS. | 3844 // Discard the function left on TOS. |
3845 context()->DropAndPlug(1, r3); | 3845 context()->DropAndPlug(1, r3); |
3846 } | 3846 } |
3847 | 3847 |
3848 | 3848 |
3849 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 3849 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
3850 ZoneList<Expression*>* args = expr->arguments(); | 3850 ZoneList<Expression*>* args = expr->arguments(); |
3851 DCHECK(args->length() == 2); | 3851 DCHECK(args->length() == 2); |
3852 | 3852 |
3853 // Evaluate new.target. | 3853 // Evaluate new.target and super constructor. |
3854 VisitForStackValue(args->at(0)); | 3854 VisitForStackValue(args->at(0)); |
| 3855 VisitForStackValue(args->at(1)); |
3855 | 3856 |
3856 // Evaluate super constructor (to stack and r4). | 3857 // Call the construct call builtin that handles allocation and |
3857 VisitForAccumulatorValue(args->at(1)); | 3858 // constructor invocation. |
3858 __ push(result_register()); | 3859 SetConstructCallPosition(expr, 0); |
3859 __ mr(r4, result_register()); | |
3860 | |
3861 // Load new target into r6. | |
3862 __ LoadP(r6, MemOperand(sp, 1 * kPointerSize)); | |
3863 | 3860 |
3864 // Check if the calling frame is an arguments adaptor frame. | 3861 // Check if the calling frame is an arguments adaptor frame. |
3865 Label adaptor_frame, args_set_up, runtime; | 3862 Label adaptor_frame, args_set_up, runtime; |
3866 __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 3863 __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
3867 __ LoadP(r7, MemOperand(r5, StandardFrameConstants::kContextOffset)); | 3864 __ LoadP(r7, MemOperand(r5, StandardFrameConstants::kContextOffset)); |
| 3865 |
| 3866 // Load super constructor, new target into r4, r6. |
| 3867 __ LoadP(r4, MemOperand(sp)); |
| 3868 __ LoadP(r6, MemOperand(sp, 1 * kPointerSize)); |
| 3869 |
3868 __ CmpSmiLiteral(r7, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); | 3870 __ CmpSmiLiteral(r7, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); |
3869 __ beq(&adaptor_frame); | 3871 __ beq(&adaptor_frame); |
3870 | 3872 |
3871 // default constructor has no arguments, so no adaptor frame means no args. | 3873 // default constructor has no arguments, so no adaptor frame means no args. |
3872 __ li(r3, Operand::Zero()); | 3874 __ li(r3, Operand::Zero()); |
3873 __ b(&args_set_up); | 3875 __ b(&args_set_up); |
3874 | 3876 |
3875 // Copy arguments from adaptor frame. | 3877 // Copy arguments from adaptor frame. |
3876 { | 3878 { |
3877 __ bind(&adaptor_frame); | 3879 __ bind(&adaptor_frame); |
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5041 return ON_STACK_REPLACEMENT; | 5043 return ON_STACK_REPLACEMENT; |
5042 } | 5044 } |
5043 | 5045 |
5044 DCHECK(interrupt_address == | 5046 DCHECK(interrupt_address == |
5045 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5047 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5046 return OSR_AFTER_STACK_CHECK; | 5048 return OSR_AFTER_STACK_CHECK; |
5047 } | 5049 } |
5048 } // namespace internal | 5050 } // namespace internal |
5049 } // namespace v8 | 5051 } // namespace v8 |
5050 #endif // V8_TARGET_ARCH_PPC | 5052 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |