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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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 4021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4032 | 4032 |
4033 | 4033 |
4034 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 4034 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
4035 ZoneList<Expression*>* args = expr->arguments(); | 4035 ZoneList<Expression*>* args = expr->arguments(); |
4036 DCHECK(args->length() == 2); | 4036 DCHECK(args->length() == 2); |
4037 | 4037 |
4038 // Evaluate new.target and super constructor. | 4038 // Evaluate new.target and super constructor. |
4039 VisitForStackValue(args->at(0)); | 4039 VisitForStackValue(args->at(0)); |
4040 VisitForStackValue(args->at(1)); | 4040 VisitForStackValue(args->at(1)); |
4041 | 4041 |
4042 // Load original constructor into a4. | 4042 // Load original constructor into a3. |
4043 __ ld(a4, MemOperand(sp, 1 * kPointerSize)); | 4043 __ ld(a3, MemOperand(sp, 1 * kPointerSize)); |
4044 | 4044 |
4045 // Check if the calling frame is an arguments adaptor frame. | 4045 // Check if the calling frame is an arguments adaptor frame. |
4046 Label adaptor_frame, args_set_up, runtime; | 4046 Label adaptor_frame, args_set_up, runtime; |
4047 __ ld(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 4047 __ ld(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
4048 __ ld(a3, MemOperand(a2, StandardFrameConstants::kContextOffset)); | 4048 __ ld(a4, MemOperand(a2, StandardFrameConstants::kContextOffset)); |
4049 __ Branch(&adaptor_frame, eq, a3, | 4049 __ Branch(&adaptor_frame, eq, a4, |
4050 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4050 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
4051 // default constructor has no arguments, so no adaptor frame means no args. | 4051 // default constructor has no arguments, so no adaptor frame means no args. |
4052 __ mov(a0, zero_reg); | 4052 __ mov(a0, zero_reg); |
4053 __ Branch(&args_set_up); | 4053 __ Branch(&args_set_up); |
4054 | 4054 |
4055 // Copy arguments from adaptor frame. | 4055 // Copy arguments from adaptor frame. |
4056 { | 4056 { |
4057 __ bind(&adaptor_frame); | 4057 __ bind(&adaptor_frame); |
4058 __ ld(a1, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 4058 __ ld(a1, MemOperand(a2, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
4059 __ SmiUntag(a1, a1); | 4059 __ SmiUntag(a1, a1); |
4060 | 4060 |
4061 __ mov(a0, a1); | 4061 __ mov(a0, a1); |
4062 | 4062 |
4063 // Get arguments pointer in a2. | 4063 // Get arguments pointer in a2. |
4064 __ dsll(at, a1, kPointerSizeLog2); | 4064 __ dsll(at, a1, kPointerSizeLog2); |
4065 __ Daddu(a2, a2, Operand(at)); | 4065 __ Daddu(a2, a2, Operand(at)); |
4066 __ Daddu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset)); | 4066 __ Daddu(a2, a2, Operand(StandardFrameConstants::kCallerSPOffset)); |
4067 Label loop; | 4067 Label loop; |
4068 __ bind(&loop); | 4068 __ bind(&loop); |
4069 // Pre-decrement a2 with kPointerSize on each iteration. | 4069 // Pre-decrement a2 with kPointerSize on each iteration. |
4070 // Pre-decrement in order to skip receiver. | 4070 // Pre-decrement in order to skip receiver. |
4071 __ Daddu(a2, a2, Operand(-kPointerSize)); | 4071 __ Daddu(a2, a2, Operand(-kPointerSize)); |
4072 __ ld(a3, MemOperand(a2)); | 4072 __ ld(a4, MemOperand(a2)); |
4073 __ Push(a3); | 4073 __ Push(a4); |
4074 __ Daddu(a1, a1, Operand(-1)); | 4074 __ Daddu(a1, a1, Operand(-1)); |
4075 __ Branch(&loop, ne, a1, Operand(zero_reg)); | 4075 __ Branch(&loop, ne, a1, Operand(zero_reg)); |
4076 } | 4076 } |
4077 | 4077 |
4078 __ bind(&args_set_up); | 4078 __ bind(&args_set_up); |
4079 __ dsll(at, a0, kPointerSizeLog2); | 4079 __ dsll(at, a0, kPointerSizeLog2); |
4080 __ Daddu(at, at, Operand(sp)); | 4080 __ Daddu(at, at, Operand(sp)); |
4081 __ ld(a1, MemOperand(at, 0)); | 4081 __ ld(a1, MemOperand(at, 0)); |
4082 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 4082 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); |
4083 | |
4084 CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL); | |
4085 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | |
4086 | 4083 |
4087 // Restore context register. | 4084 // Restore context register. |
4088 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4085 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
4089 | 4086 |
4090 context()->DropAndPlug(1, result_register()); | 4087 context()->DropAndPlug(1, result_register()); |
4091 } | 4088 } |
4092 | 4089 |
4093 | 4090 |
4094 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { | 4091 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { |
4095 RegExpConstructResultStub stub(isolate()); | 4092 RegExpConstructResultStub stub(isolate()); |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5239 reinterpret_cast<uint64_t>( | 5236 reinterpret_cast<uint64_t>( |
5240 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5237 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5241 return OSR_AFTER_STACK_CHECK; | 5238 return OSR_AFTER_STACK_CHECK; |
5242 } | 5239 } |
5243 | 5240 |
5244 | 5241 |
5245 } // namespace internal | 5242 } // namespace internal |
5246 } // namespace v8 | 5243 } // namespace v8 |
5247 | 5244 |
5248 #endif // V8_TARGET_ARCH_MIPS64 | 5245 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |