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 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 RelocInfo::CODE_TARGET); | 1191 RelocInfo::CODE_TARGET); |
1192 } else { | 1192 } else { |
1193 DCHECK_EQ(function_type, CallableType::kAny); | 1193 DCHECK_EQ(function_type, CallableType::kAny); |
1194 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 1194 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
1195 tail_call_mode), | 1195 tail_call_mode), |
1196 RelocInfo::CODE_TARGET); | 1196 RelocInfo::CODE_TARGET); |
1197 } | 1197 } |
1198 } | 1198 } |
1199 | 1199 |
1200 // static | 1200 // static |
1201 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 1201 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( |
| 1202 MacroAssembler* masm, CallableType construct_type) { |
1202 // ----------- S t a t e ------------- | 1203 // ----------- S t a t e ------------- |
1203 // -- a0 : argument count (not including receiver) | 1204 // -- a0 : argument count (not including receiver) |
1204 // -- a3 : new target | 1205 // -- a3 : new target |
1205 // -- a1 : constructor to call | 1206 // -- a1 : constructor to call |
1206 // -- a2 : address of the first argument | 1207 // -- a2 : address of the first argument |
1207 // ----------------------------------- | 1208 // ----------------------------------- |
1208 | 1209 |
1209 // Find the address of the last argument. | 1210 // Find the address of the last argument. |
1210 __ sll(t0, a0, kPointerSizeLog2); | 1211 __ sll(t0, a0, kPointerSizeLog2); |
1211 __ Subu(t0, a2, Operand(t0)); | 1212 __ Subu(t0, a2, Operand(t0)); |
1212 | 1213 |
1213 // Push a slot for the receiver. | 1214 // Push a slot for the receiver. |
1214 __ push(zero_reg); | 1215 __ push(zero_reg); |
1215 | 1216 |
1216 // Push the arguments. | 1217 // Push the arguments. |
1217 Label loop_header, loop_check; | 1218 Label loop_header, loop_check; |
1218 __ Branch(&loop_check); | 1219 __ Branch(&loop_check); |
1219 __ bind(&loop_header); | 1220 __ bind(&loop_header); |
1220 __ lw(t1, MemOperand(a2)); | 1221 __ lw(t1, MemOperand(a2)); |
1221 __ Addu(a2, a2, Operand(-kPointerSize)); | 1222 __ Addu(a2, a2, Operand(-kPointerSize)); |
1222 __ push(t1); | 1223 __ push(t1); |
1223 __ bind(&loop_check); | 1224 __ bind(&loop_check); |
1224 __ Branch(&loop_header, gt, a2, Operand(t0)); | 1225 __ Branch(&loop_header, gt, a2, Operand(t0)); |
1225 | 1226 |
1226 // Call the constructor with a0, a1, and a3 unmodified. | 1227 if (construct_type == CallableType::kJSFunction) { |
1227 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 1228 // TODO(mythria): Change this when allocation site feedback is available. |
| 1229 // ConstructFunction initializes allocation site to undefined. |
| 1230 __ Jump(masm->isolate()->builtins()->ConstructFunction(), |
| 1231 RelocInfo::CODE_TARGET); |
| 1232 } else { |
| 1233 DCHECK_EQ(construct_type, CallableType::kAny); |
| 1234 // Call the constructor with a0, a1, and a3 unmodified. |
| 1235 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
| 1236 } |
1228 } | 1237 } |
1229 | 1238 |
1230 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { | 1239 void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { |
1231 // Set the return address to the correct point in the interpreter entry | 1240 // Set the return address to the correct point in the interpreter entry |
1232 // trampoline. | 1241 // trampoline. |
1233 Smi* interpreter_entry_return_pc_offset( | 1242 Smi* interpreter_entry_return_pc_offset( |
1234 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); | 1243 masm->isolate()->heap()->interpreter_entry_return_pc_offset()); |
1235 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); | 1244 DCHECK_NE(interpreter_entry_return_pc_offset, Smi::FromInt(0)); |
1236 __ li(t0, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); | 1245 __ li(t0, Operand(masm->isolate()->builtins()->InterpreterEntryTrampoline())); |
1237 __ Addu(ra, t0, Operand(interpreter_entry_return_pc_offset->value() + | 1246 __ Addu(ra, t0, Operand(interpreter_entry_return_pc_offset->value() + |
(...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2980 __ break_(0xCC); | 2989 __ break_(0xCC); |
2981 } | 2990 } |
2982 } | 2991 } |
2983 | 2992 |
2984 #undef __ | 2993 #undef __ |
2985 | 2994 |
2986 } // namespace internal | 2995 } // namespace internal |
2987 } // namespace v8 | 2996 } // namespace v8 |
2988 | 2997 |
2989 #endif // V8_TARGET_ARCH_MIPS | 2998 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |