| 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 #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 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1210 | 1210 |
| 1211 // Clobbers {t2, t3, a4, a5}. | 1211 // Clobbers {t2, t3, a4, a5}. |
| 1212 static void CompatibleReceiverCheck(MacroAssembler* masm, Register receiver, | 1212 static void CompatibleReceiverCheck(MacroAssembler* masm, Register receiver, |
| 1213 Register function_template_info, | 1213 Register function_template_info, |
| 1214 Label* receiver_check_failed) { | 1214 Label* receiver_check_failed) { |
| 1215 Register signature = t2; | 1215 Register signature = t2; |
| 1216 Register map = t3; | 1216 Register map = t3; |
| 1217 Register constructor = a4; | 1217 Register constructor = a4; |
| 1218 Register scratch = a5; | 1218 Register scratch = a5; |
| 1219 | 1219 |
| 1220 // If the receiver is not an object, jump to receiver_check_failed. | |
| 1221 __ GetObjectType(receiver, map, scratch); | |
| 1222 __ Branch(receiver_check_failed, lo, scratch, Operand(FIRST_JS_OBJECT_TYPE)); | |
| 1223 | |
| 1224 // If there is no signature, return the holder. | 1220 // If there is no signature, return the holder. |
| 1225 __ ld(signature, FieldMemOperand(function_template_info, | 1221 __ ld(signature, FieldMemOperand(function_template_info, |
| 1226 FunctionTemplateInfo::kSignatureOffset)); | 1222 FunctionTemplateInfo::kSignatureOffset)); |
| 1227 Label receiver_check_passed; | 1223 Label receiver_check_passed; |
| 1228 __ JumpIfRoot(signature, Heap::kUndefinedValueRootIndex, | 1224 __ JumpIfRoot(signature, Heap::kUndefinedValueRootIndex, |
| 1229 &receiver_check_passed); | 1225 &receiver_check_passed); |
| 1230 | 1226 |
| 1231 // Walk the prototype chain. | 1227 // Walk the prototype chain. |
| 1232 Label prototype_loop_start; | 1228 Label prototype_loop_start; |
| 1233 __ bind(&prototype_loop_start); | 1229 __ bind(&prototype_loop_start); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 // ----------- S t a t e ------------- | 1276 // ----------- S t a t e ------------- |
| 1281 // -- a0 : number of arguments excluding receiver | 1277 // -- a0 : number of arguments excluding receiver |
| 1282 // -- a1 : callee | 1278 // -- a1 : callee |
| 1283 // -- ra : return address | 1279 // -- ra : return address |
| 1284 // -- sp[0] : last argument | 1280 // -- sp[0] : last argument |
| 1285 // -- ... | 1281 // -- ... |
| 1286 // -- sp[8 * (argc - 1)] : first argument | 1282 // -- sp[8 * (argc - 1)] : first argument |
| 1287 // -- sp[8 * argc] : receiver | 1283 // -- sp[8 * argc] : receiver |
| 1288 // ----------------------------------- | 1284 // ----------------------------------- |
| 1289 | 1285 |
| 1290 // Load the receiver. | |
| 1291 __ sll(at, a0, kPointerSizeLog2); | |
| 1292 __ Daddu(t8, sp, at); | |
| 1293 __ ld(t0, MemOperand(t8)); | |
| 1294 | |
| 1295 // Update the receiver if this is a contextual call. | |
| 1296 Label set_global_proxy, valid_receiver; | |
| 1297 __ JumpIfRoot(t0, Heap::kUndefinedValueRootIndex, &set_global_proxy); | |
| 1298 | |
| 1299 // Load the FunctionTemplateInfo. | 1286 // Load the FunctionTemplateInfo. |
| 1300 __ ld(t1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 1287 __ ld(t1, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
| 1301 __ bind(&valid_receiver); | |
| 1302 __ ld(t1, FieldMemOperand(t1, SharedFunctionInfo::kFunctionDataOffset)); | 1288 __ ld(t1, FieldMemOperand(t1, SharedFunctionInfo::kFunctionDataOffset)); |
| 1303 | 1289 |
| 1304 // Do the compatible receiver check | 1290 // Do the compatible receiver check |
| 1305 Label receiver_check_failed; | 1291 Label receiver_check_failed; |
| 1292 __ sll(at, a0, kPointerSizeLog2); |
| 1293 __ Daddu(t8, sp, at); |
| 1294 __ ld(t0, MemOperand(t8)); |
| 1306 CompatibleReceiverCheck(masm, t0, t1, &receiver_check_failed); | 1295 CompatibleReceiverCheck(masm, t0, t1, &receiver_check_failed); |
| 1307 | 1296 |
| 1308 // Get the callback offset from the FunctionTemplateInfo, and jump to the | 1297 // Get the callback offset from the FunctionTemplateInfo, and jump to the |
| 1309 // beginning of the code. | 1298 // beginning of the code. |
| 1310 __ ld(t2, FieldMemOperand(t1, FunctionTemplateInfo::kCallCodeOffset)); | 1299 __ ld(t2, FieldMemOperand(t1, FunctionTemplateInfo::kCallCodeOffset)); |
| 1311 __ ld(t2, FieldMemOperand(t2, CallHandlerInfo::kFastHandlerOffset)); | 1300 __ ld(t2, FieldMemOperand(t2, CallHandlerInfo::kFastHandlerOffset)); |
| 1312 __ Daddu(t2, t2, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1301 __ Daddu(t2, t2, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1313 __ Jump(t2); | 1302 __ Jump(t2); |
| 1314 | 1303 |
| 1315 __ bind(&set_global_proxy); | |
| 1316 __ LoadGlobalProxy(t0); | |
| 1317 __ sd(t0, MemOperand(t8)); | |
| 1318 __ Branch(&valid_receiver); | |
| 1319 | |
| 1320 // Compatible receiver check failed: throw an Illegal Invocation exception. | 1304 // Compatible receiver check failed: throw an Illegal Invocation exception. |
| 1321 __ bind(&receiver_check_failed); | 1305 __ bind(&receiver_check_failed); |
| 1322 // Drop the arguments (including the receiver); | 1306 // Drop the arguments (including the receiver); |
| 1323 __ Daddu(t8, t8, Operand(kPointerSize)); | 1307 __ Daddu(t8, t8, Operand(kPointerSize)); |
| 1324 __ daddu(sp, t8, zero_reg); | 1308 __ daddu(sp, t8, zero_reg); |
| 1325 __ TailCallRuntime(Runtime::kThrowIllegalInvocation); | 1309 __ TailCallRuntime(Runtime::kThrowIllegalInvocation); |
| 1326 } | 1310 } |
| 1327 | 1311 |
| 1328 | 1312 |
| 1329 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1313 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2456 } | 2440 } |
| 2457 } | 2441 } |
| 2458 | 2442 |
| 2459 | 2443 |
| 2460 #undef __ | 2444 #undef __ |
| 2461 | 2445 |
| 2462 } // namespace internal | 2446 } // namespace internal |
| 2463 } // namespace v8 | 2447 } // namespace v8 |
| 2464 | 2448 |
| 2465 #endif // V8_TARGET_ARCH_MIPS64 | 2449 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |