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/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 3995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4006 | 4006 |
4007 | 4007 |
4008 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 4008 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
4009 ZoneList<Expression*>* args = expr->arguments(); | 4009 ZoneList<Expression*>* args = expr->arguments(); |
4010 DCHECK(args->length() == 2); | 4010 DCHECK(args->length() == 2); |
4011 | 4011 |
4012 // Evaluate new.target and super constructor. | 4012 // Evaluate new.target and super constructor. |
4013 VisitForStackValue(args->at(0)); | 4013 VisitForStackValue(args->at(0)); |
4014 VisitForStackValue(args->at(1)); | 4014 VisitForStackValue(args->at(1)); |
4015 | 4015 |
4016 // Load original constructor into r4. | 4016 // Load original constructor into r3. |
4017 __ ldr(r4, MemOperand(sp, 1 * kPointerSize)); | 4017 __ ldr(r3, MemOperand(sp, 1 * kPointerSize)); |
4018 | 4018 |
4019 // Check if the calling frame is an arguments adaptor frame. | 4019 // Check if the calling frame is an arguments adaptor frame. |
4020 Label adaptor_frame, args_set_up, runtime; | 4020 Label adaptor_frame, args_set_up, runtime; |
4021 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 4021 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
4022 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset)); | 4022 __ ldr(r4, MemOperand(r2, StandardFrameConstants::kContextOffset)); |
4023 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4023 __ cmp(r4, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
4024 __ b(eq, &adaptor_frame); | 4024 __ b(eq, &adaptor_frame); |
4025 // default constructor has no arguments, so no adaptor frame means no args. | 4025 // default constructor has no arguments, so no adaptor frame means no args. |
4026 __ mov(r0, Operand::Zero()); | 4026 __ mov(r0, Operand::Zero()); |
4027 __ b(&args_set_up); | 4027 __ b(&args_set_up); |
4028 | 4028 |
4029 // Copy arguments from adaptor frame. | 4029 // Copy arguments from adaptor frame. |
4030 { | 4030 { |
4031 __ bind(&adaptor_frame); | 4031 __ bind(&adaptor_frame); |
4032 __ ldr(r1, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 4032 __ ldr(r1, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
4033 __ SmiUntag(r1, r1); | 4033 __ SmiUntag(r1, r1); |
4034 __ mov(r0, r1); | 4034 __ mov(r0, r1); |
4035 | 4035 |
4036 // Get arguments pointer in r2. | 4036 // Get arguments pointer in r2. |
4037 __ add(r2, r2, Operand(r1, LSL, kPointerSizeLog2)); | 4037 __ add(r2, r2, Operand(r1, LSL, kPointerSizeLog2)); |
4038 __ add(r2, r2, Operand(StandardFrameConstants::kCallerSPOffset)); | 4038 __ add(r2, r2, Operand(StandardFrameConstants::kCallerSPOffset)); |
4039 Label loop; | 4039 Label loop; |
4040 __ bind(&loop); | 4040 __ bind(&loop); |
4041 // Pre-decrement r2 with kPointerSize on each iteration. | 4041 // Pre-decrement r2 with kPointerSize on each iteration. |
4042 // Pre-decrement in order to skip receiver. | 4042 // Pre-decrement in order to skip receiver. |
4043 __ ldr(r3, MemOperand(r2, kPointerSize, NegPreIndex)); | 4043 __ ldr(r4, MemOperand(r2, kPointerSize, NegPreIndex)); |
4044 __ Push(r3); | 4044 __ Push(r4); |
4045 __ sub(r1, r1, Operand(1)); | 4045 __ sub(r1, r1, Operand(1)); |
4046 __ cmp(r1, Operand::Zero()); | 4046 __ cmp(r1, Operand::Zero()); |
4047 __ b(ne, &loop); | 4047 __ b(ne, &loop); |
4048 } | 4048 } |
4049 | 4049 |
4050 __ bind(&args_set_up); | 4050 __ bind(&args_set_up); |
4051 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 4051 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
4052 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 4052 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); |
4053 | |
4054 CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL); | |
4055 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | |
4056 | 4053 |
4057 // Restore context register. | 4054 // Restore context register. |
4058 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4055 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
4059 | 4056 |
4060 context()->DropAndPlug(1, r0); | 4057 context()->DropAndPlug(1, r0); |
4061 } | 4058 } |
4062 | 4059 |
4063 | 4060 |
4064 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { | 4061 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { |
4065 RegExpConstructResultStub stub(isolate()); | 4062 RegExpConstructResultStub stub(isolate()); |
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5262 DCHECK(interrupt_address == | 5259 DCHECK(interrupt_address == |
5263 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5260 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5264 return OSR_AFTER_STACK_CHECK; | 5261 return OSR_AFTER_STACK_CHECK; |
5265 } | 5262 } |
5266 | 5263 |
5267 | 5264 |
5268 } // namespace internal | 5265 } // namespace internal |
5269 } // namespace v8 | 5266 } // namespace v8 |
5270 | 5267 |
5271 #endif // V8_TARGET_ARCH_ARM | 5268 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |