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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
6 | 6 |
7 // Note on Mips implementation: | 7 // Note on Mips implementation: |
8 // | 8 // |
9 // The result_register() for mips is the 'v0' register, which is defined | 9 // The result_register() for mips is the 'v0' register, which is defined |
10 // by the ABI to contain function return values. However, the first | 10 // by the ABI to contain function return values. However, the first |
(...skipping 4018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4029 | 4029 |
4030 | 4030 |
4031 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 4031 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
4032 ZoneList<Expression*>* args = expr->arguments(); | 4032 ZoneList<Expression*>* args = expr->arguments(); |
4033 DCHECK(args->length() == 2); | 4033 DCHECK(args->length() == 2); |
4034 | 4034 |
4035 // Evaluate new.target and super constructor. | 4035 // Evaluate new.target and super constructor. |
4036 VisitForStackValue(args->at(0)); | 4036 VisitForStackValue(args->at(0)); |
4037 VisitForStackValue(args->at(1)); | 4037 VisitForStackValue(args->at(1)); |
4038 | 4038 |
4039 // Load original constructor into t0. | 4039 // Load original constructor into a3. |
4040 __ lw(t0, MemOperand(sp, 1 * kPointerSize)); | 4040 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); |
4041 | 4041 |
4042 // Check if the calling frame is an arguments adaptor frame. | 4042 // Check if the calling frame is an arguments adaptor frame. |
4043 Label adaptor_frame, args_set_up, runtime; | 4043 Label adaptor_frame, args_set_up, runtime; |
4044 __ lw(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 4044 __ lw(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
4045 __ lw(a3, MemOperand(a2, StandardFrameConstants::kContextOffset)); | 4045 __ lw(t0, MemOperand(a2, StandardFrameConstants::kContextOffset)); |
4046 __ Branch(&adaptor_frame, eq, a3, | 4046 __ Branch(&adaptor_frame, eq, t0, |
4047 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4047 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
4048 // default constructor has no arguments, so no adaptor frame means no args. | 4048 // default constructor has no arguments, so no adaptor frame means no args. |
4049 __ mov(a0, zero_reg); | 4049 __ mov(a0, zero_reg); |
4050 __ Branch(&args_set_up); | 4050 __ Branch(&args_set_up); |
4051 | 4051 |
4052 // Copy arguments from adaptor frame. | 4052 // Copy arguments from adaptor frame. |
4053 { | 4053 { |
4054 __ bind(&adaptor_frame); | 4054 __ bind(&adaptor_frame); |
4055 __ lw(a1, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 4055 __ lw(a1, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
4056 __ SmiUntag(a1, a1); | 4056 __ SmiUntag(a1, a1); |
4057 | 4057 |
4058 __ mov(a0, a1); | 4058 __ mov(a0, a1); |
4059 | 4059 |
4060 // Get arguments pointer in a2. | 4060 // Get arguments pointer in a2. |
4061 __ sll(at, a1, kPointerSizeLog2); | 4061 __ sll(at, a1, kPointerSizeLog2); |
4062 __ addu(a2, a2, at); | 4062 __ addu(a2, a2, at); |
4063 __ Addu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset)); | 4063 __ Addu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset)); |
4064 Label loop; | 4064 Label loop; |
4065 __ bind(&loop); | 4065 __ bind(&loop); |
4066 // Pre-decrement a2 with kPointerSize on each iteration. | 4066 // Pre-decrement a2 with kPointerSize on each iteration. |
4067 // Pre-decrement in order to skip receiver. | 4067 // Pre-decrement in order to skip receiver. |
4068 __ Addu(a2, a2, Operand(-kPointerSize)); | 4068 __ Addu(a2, a2, Operand(-kPointerSize)); |
4069 __ lw(a3, MemOperand(a2)); | 4069 __ lw(t0, MemOperand(a2)); |
4070 __ Push(a3); | 4070 __ Push(t0); |
4071 __ Addu(a1, a1, Operand(-1)); | 4071 __ Addu(a1, a1, Operand(-1)); |
4072 __ Branch(&loop, ne, a1, Operand(zero_reg)); | 4072 __ Branch(&loop, ne, a1, Operand(zero_reg)); |
4073 } | 4073 } |
4074 | 4074 |
4075 __ bind(&args_set_up); | 4075 __ bind(&args_set_up); |
4076 __ sll(at, a0, kPointerSizeLog2); | 4076 __ sll(at, a0, kPointerSizeLog2); |
4077 __ Addu(at, at, Operand(sp)); | 4077 __ Addu(at, at, Operand(sp)); |
4078 __ lw(a1, MemOperand(at, 0)); | 4078 __ lw(a1, MemOperand(at, 0)); |
4079 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 4079 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); |
4080 | |
4081 CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL); | |
4082 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | |
4083 | 4080 |
4084 // Restore context register. | 4081 // Restore context register. |
4085 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4082 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
4086 | 4083 |
4087 context()->DropAndPlug(1, result_register()); | 4084 context()->DropAndPlug(1, result_register()); |
4088 } | 4085 } |
4089 | 4086 |
4090 | 4087 |
4091 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { | 4088 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { |
4092 RegExpConstructResultStub stub(isolate()); | 4089 RegExpConstructResultStub stub(isolate()); |
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5233 reinterpret_cast<uint32_t>( | 5230 reinterpret_cast<uint32_t>( |
5234 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5231 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5235 return OSR_AFTER_STACK_CHECK; | 5232 return OSR_AFTER_STACK_CHECK; |
5236 } | 5233 } |
5237 | 5234 |
5238 | 5235 |
5239 } // namespace internal | 5236 } // namespace internal |
5240 } // namespace v8 | 5237 } // namespace v8 |
5241 | 5238 |
5242 #endif // V8_TARGET_ARCH_MIPS | 5239 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |