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 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 RelocInfo::CODE_TARGET); | 1194 RelocInfo::CODE_TARGET); |
1195 } else { | 1195 } else { |
1196 DCHECK_EQ(function_type, CallableType::kAny); | 1196 DCHECK_EQ(function_type, CallableType::kAny); |
1197 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 1197 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
1198 tail_call_mode), | 1198 tail_call_mode), |
1199 RelocInfo::CODE_TARGET); | 1199 RelocInfo::CODE_TARGET); |
1200 } | 1200 } |
1201 } | 1201 } |
1202 | 1202 |
1203 // static | 1203 // static |
1204 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 1204 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( |
| 1205 MacroAssembler* masm, CallableType construct_type) { |
1205 // ----------- S t a t e ------------- | 1206 // ----------- S t a t e ------------- |
1206 // -- a0 : argument count (not including receiver) | 1207 // -- a0 : argument count (not including receiver) |
1207 // -- a3 : new target | 1208 // -- a3 : new target |
1208 // -- a1 : constructor to call | 1209 // -- a1 : constructor to call |
1209 // -- a2 : address of the first argument | 1210 // -- a2 : allocation site feedback if available, undefined otherwise. |
| 1211 // -- t4 : address of the first argument |
1210 // ----------------------------------- | 1212 // ----------------------------------- |
1211 | 1213 |
1212 // Find the address of the last argument. | 1214 // Find the address of the last argument. |
1213 __ sll(t0, a0, kPointerSizeLog2); | 1215 __ sll(t0, a0, kPointerSizeLog2); |
1214 __ Subu(t0, a2, Operand(t0)); | 1216 __ Subu(t0, t4, Operand(t0)); |
1215 | 1217 |
1216 // Push a slot for the receiver. | 1218 // Push a slot for the receiver. |
1217 __ push(zero_reg); | 1219 __ push(zero_reg); |
1218 | 1220 |
1219 // Push the arguments. | 1221 // Push the arguments. |
1220 Label loop_header, loop_check; | 1222 Label loop_header, loop_check; |
1221 __ Branch(&loop_check); | 1223 __ Branch(&loop_check); |
1222 __ bind(&loop_header); | 1224 __ bind(&loop_header); |
1223 __ lw(t1, MemOperand(a2)); | 1225 __ lw(t1, MemOperand(t4)); |
1224 __ Addu(a2, a2, Operand(-kPointerSize)); | 1226 __ Addu(t4, t4, Operand(-kPointerSize)); |
1225 __ push(t1); | 1227 __ push(t1); |
1226 __ bind(&loop_check); | 1228 __ bind(&loop_check); |
1227 __ Branch(&loop_header, gt, a2, Operand(t0)); | 1229 __ Branch(&loop_header, gt, t4, Operand(t0)); |
1228 | 1230 |
1229 // Call the constructor with a0, a1, and a3 unmodified. | 1231 __ AssertUndefinedOrAllocationSite(a2, t0); |
1230 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 1232 if (construct_type == CallableType::kJSFunction) { |
| 1233 __ AssertFunction(a1); |
| 1234 |
| 1235 // Tail call to the function-specific construct stub (still in the caller |
| 1236 // context at this point). |
| 1237 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
| 1238 __ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kConstructStubOffset)); |
| 1239 __ Addu(at, t0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1240 __ Jump(at); |
| 1241 } else { |
| 1242 DCHECK_EQ(construct_type, CallableType::kAny); |
| 1243 // Call the constructor with a0, a1, and a3 unmodified. |
| 1244 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
| 1245 } |
1231 } | 1246 } |
1232 | 1247 |
1233 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { | 1248 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
1234 // Set the return address to the correct point in the interpreter entry | 1249 // Set the return address to the correct point in the interpreter entry |
1235 // trampoline. | 1250 // trampoline. |
1236 Smi* interpreter_entry_return_pc_offset( | 1251 Smi* interpreter_entry_return_pc_offset( |
1237 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); | 1252 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); |
1238 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); | 1253 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); |
1239 __ li(t0, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); | 1254 __ li(t0, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); |
1240 __ Addu(ra, t0, Operand(interpreter_entry_return_pc_offset->value() + | 1255 __ Addu(ra, t0, Operand(interpreter_entry_return_pc_offset->value() + |
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3015 __ break_(0xCC); | 3030 __ break_(0xCC); |
3016 } | 3031 } |
3017 } | 3032 } |
3018 | 3033 |
3019 #undef __ | 3034 #undef __ |
3020 | 3035 |
3021 } // namespace internal | 3036 } // namespace internal |
3022 } // namespace v8 | 3037 } // namespace v8 |
3023 | 3038 |
3024 #endif // V8_TARGET_ARCH_MIPS | 3039 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |