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/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 3997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4008 DCHECK(args->length() == 2); | 4008 DCHECK(args->length() == 2); |
4009 | 4009 |
4010 // Evaluate new.target. | 4010 // Evaluate new.target. |
4011 VisitForStackValue(args->at(0)); | 4011 VisitForStackValue(args->at(0)); |
4012 | 4012 |
4013 // Evaluate super constructor (to stack and r4). | 4013 // Evaluate super constructor (to stack and r4). |
4014 VisitForAccumulatorValue(args->at(1)); | 4014 VisitForAccumulatorValue(args->at(1)); |
4015 __ push(result_register()); | 4015 __ push(result_register()); |
4016 __ mr(r4, result_register()); | 4016 __ mr(r4, result_register()); |
4017 | 4017 |
4018 // Load original constructor into r7. | 4018 // Load original constructor into r6. |
4019 __ LoadP(r7, MemOperand(sp, 1 * kPointerSize)); | 4019 __ LoadP(r6, MemOperand(sp, 1 * kPointerSize)); |
4020 | 4020 |
4021 // Check if the calling frame is an arguments adaptor frame. | 4021 // Check if the calling frame is an arguments adaptor frame. |
4022 Label adaptor_frame, args_set_up, runtime; | 4022 Label adaptor_frame, args_set_up, runtime; |
4023 __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 4023 __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
4024 __ LoadP(r6, MemOperand(r5, StandardFrameConstants::kContextOffset)); | 4024 __ LoadP(r7, MemOperand(r5, StandardFrameConstants::kContextOffset)); |
4025 __ CmpSmiLiteral(r6, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); | 4025 __ CmpSmiLiteral(r7, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); |
4026 __ beq(&adaptor_frame); | 4026 __ beq(&adaptor_frame); |
4027 | 4027 |
4028 // default constructor has no arguments, so no adaptor frame means no args. | 4028 // default constructor has no arguments, so no adaptor frame means no args. |
4029 __ li(r3, Operand::Zero()); | 4029 __ li(r3, Operand::Zero()); |
4030 __ b(&args_set_up); | 4030 __ b(&args_set_up); |
4031 | 4031 |
4032 // Copy arguments from adaptor frame. | 4032 // Copy arguments from adaptor frame. |
4033 { | 4033 { |
4034 __ bind(&adaptor_frame); | 4034 __ bind(&adaptor_frame); |
4035 __ LoadP(r3, MemOperand(r5, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 4035 __ LoadP(r3, MemOperand(r5, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
4036 __ SmiUntag(r3); | 4036 __ SmiUntag(r3); |
4037 | 4037 |
4038 // Get arguments pointer in r5. | 4038 // Get arguments pointer in r5. |
4039 __ ShiftLeftImm(r0, r3, Operand(kPointerSizeLog2)); | 4039 __ ShiftLeftImm(r0, r3, Operand(kPointerSizeLog2)); |
4040 __ add(r5, r5, r0); | 4040 __ add(r5, r5, r0); |
4041 __ addi(r5, r5, Operand(StandardFrameConstants::kCallerSPOffset)); | 4041 __ addi(r5, r5, Operand(StandardFrameConstants::kCallerSPOffset)); |
4042 | 4042 |
4043 Label loop; | 4043 Label loop; |
4044 __ mtctr(r3); | 4044 __ mtctr(r3); |
4045 __ bind(&loop); | 4045 __ bind(&loop); |
4046 // Pre-decrement in order to skip receiver. | 4046 // Pre-decrement in order to skip receiver. |
4047 __ LoadPU(r6, MemOperand(r5, -kPointerSize)); | 4047 __ LoadPU(r7, MemOperand(r5, -kPointerSize)); |
4048 __ Push(r6); | 4048 __ Push(r7); |
4049 __ bdnz(&loop); | 4049 __ bdnz(&loop); |
4050 } | 4050 } |
4051 | 4051 |
4052 __ bind(&args_set_up); | 4052 __ bind(&args_set_up); |
4053 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); | 4053 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); |
4054 | |
4055 CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL); | |
4056 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | |
4057 | 4054 |
4058 // Restore context register. | 4055 // Restore context register. |
4059 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4056 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
4060 | 4057 |
4061 context()->DropAndPlug(1, r3); | 4058 context()->DropAndPlug(1, r3); |
4062 } | 4059 } |
4063 | 4060 |
4064 | 4061 |
4065 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { | 4062 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { |
4066 RegExpConstructResultStub stub(isolate()); | 4063 RegExpConstructResultStub stub(isolate()); |
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5209 return ON_STACK_REPLACEMENT; | 5206 return ON_STACK_REPLACEMENT; |
5210 } | 5207 } |
5211 | 5208 |
5212 DCHECK(interrupt_address == | 5209 DCHECK(interrupt_address == |
5213 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5210 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5214 return OSR_AFTER_STACK_CHECK; | 5211 return OSR_AFTER_STACK_CHECK; |
5215 } | 5212 } |
5216 } // namespace internal | 5213 } // namespace internal |
5217 } // namespace v8 | 5214 } // namespace v8 |
5218 #endif // V8_TARGET_ARCH_PPC | 5215 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |