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 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 } | 1356 } |
1357 | 1357 |
1358 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1358 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
1359 // ----------- S t a t e ------------- | 1359 // ----------- S t a t e ------------- |
1360 // -- a0 : argument count (preserved for callee) | 1360 // -- a0 : argument count (preserved for callee) |
1361 // -- a3 : new target (preserved for callee) | 1361 // -- a3 : new target (preserved for callee) |
1362 // -- a1 : target function (preserved for callee) | 1362 // -- a1 : target function (preserved for callee) |
1363 // ----------------------------------- | 1363 // ----------------------------------- |
1364 // First lookup code, maybe we don't need to compile! | 1364 // First lookup code, maybe we don't need to compile! |
1365 Label gotta_call_runtime, gotta_call_runtime_no_stack; | 1365 Label gotta_call_runtime, gotta_call_runtime_no_stack; |
| 1366 Label maybe_call_runtime; |
1366 Label try_shared; | 1367 Label try_shared; |
1367 Label loop_top, loop_bottom; | 1368 Label loop_top, loop_bottom; |
1368 | 1369 |
1369 Register argument_count = a0; | 1370 Register argument_count = a0; |
1370 Register closure = a1; | 1371 Register closure = a1; |
1371 Register new_target = a3; | 1372 Register new_target = a3; |
1372 __ push(argument_count); | 1373 __ push(argument_count); |
1373 __ push(new_target); | 1374 __ push(new_target); |
1374 __ push(closure); | 1375 __ push(closure); |
1375 | 1376 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, | 1420 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
1420 OMIT_SMI_CHECK); | 1421 OMIT_SMI_CHECK); |
1421 __ pop(index); | 1422 __ pop(index); |
1422 | 1423 |
1423 // Code available? | 1424 // Code available? |
1424 Register entry = a4; | 1425 Register entry = a4; |
1425 __ ld(entry, | 1426 __ ld(entry, |
1426 FieldMemOperand(array_pointer, | 1427 FieldMemOperand(array_pointer, |
1427 SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 1428 SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
1428 __ ld(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); | 1429 __ ld(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); |
1429 __ JumpIfSmi(entry, &try_shared); | 1430 __ JumpIfSmi(entry, &maybe_call_runtime); |
1430 | 1431 |
1431 // Found literals and code. Get them into the closure and return. | 1432 // Found literals and code. Get them into the closure and return. |
1432 __ pop(closure); | 1433 __ pop(closure); |
1433 // Store code entry in the closure. | 1434 // Store code entry in the closure. |
1434 __ Daddu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1435 __ Daddu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1436 |
| 1437 Label install_optimized_code_and_tailcall; |
| 1438 __ bind(&install_optimized_code_and_tailcall); |
1435 __ sd(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); | 1439 __ sd(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); |
1436 __ RecordWriteCodeEntryField(closure, entry, a5); | 1440 __ RecordWriteCodeEntryField(closure, entry, a5); |
1437 | 1441 |
1438 // Link the closure into the optimized function list. | 1442 // Link the closure into the optimized function list. |
1439 // a4 : code entry | 1443 // a4 : code entry |
1440 // a3 : native context | 1444 // a3 : native context |
1441 // a1 : closure | 1445 // a1 : closure |
1442 __ ld(a5, | 1446 __ ld(a5, |
1443 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); | 1447 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); |
1444 __ sd(a5, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset)); | 1448 __ sd(a5, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset)); |
(...skipping 14 matching lines...) Expand all Loading... |
1459 __ Jump(entry); | 1463 __ Jump(entry); |
1460 | 1464 |
1461 __ bind(&loop_bottom); | 1465 __ bind(&loop_bottom); |
1462 __ Dsubu(index, index, | 1466 __ Dsubu(index, index, |
1463 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); | 1467 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); |
1464 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); | 1468 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); |
1465 | 1469 |
1466 // We found neither literals nor code. | 1470 // We found neither literals nor code. |
1467 __ jmp(&gotta_call_runtime); | 1471 __ jmp(&gotta_call_runtime); |
1468 | 1472 |
| 1473 __ bind(&maybe_call_runtime); |
| 1474 __ pop(closure); |
| 1475 |
| 1476 // Last possibility. Check the context free optimized code map entry. |
| 1477 __ ld(entry, FieldMemOperand(map, FixedArray::kHeaderSize + |
| 1478 SharedFunctionInfo::kSharedCodeIndex)); |
| 1479 __ ld(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); |
| 1480 __ JumpIfSmi(entry, &try_shared); |
| 1481 |
| 1482 // Store code entry in the closure. |
| 1483 __ Daddu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1484 __ jmp(&install_optimized_code_and_tailcall); |
| 1485 |
1469 __ bind(&try_shared); | 1486 __ bind(&try_shared); |
1470 __ pop(closure); | |
1471 __ pop(new_target); | 1487 __ pop(new_target); |
1472 __ pop(argument_count); | 1488 __ pop(argument_count); |
1473 // Is the full code valid? | 1489 // Is the full code valid? |
1474 __ ld(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1490 __ ld(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
1475 __ ld(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset)); | 1491 __ ld(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset)); |
1476 __ lw(a5, FieldMemOperand(entry, Code::kFlagsOffset)); | 1492 __ lw(a5, FieldMemOperand(entry, Code::kFlagsOffset)); |
1477 __ And(a5, a5, Operand(Code::KindField::kMask)); | 1493 __ And(a5, a5, Operand(Code::KindField::kMask)); |
1478 __ dsrl(a5, a5, Code::KindField::kShift); | 1494 __ dsrl(a5, a5, Code::KindField::kShift); |
1479 __ Branch(&gotta_call_runtime_no_stack, eq, a5, Operand(Code::BUILTIN)); | 1495 __ Branch(&gotta_call_runtime_no_stack, eq, a5, Operand(Code::BUILTIN)); |
1480 // Yes, install the full code. | 1496 // Yes, install the full code. |
(...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2976 __ break_(0xCC); | 2992 __ break_(0xCC); |
2977 } | 2993 } |
2978 } | 2994 } |
2979 | 2995 |
2980 #undef __ | 2996 #undef __ |
2981 | 2997 |
2982 } // namespace internal | 2998 } // namespace internal |
2983 } // namespace v8 | 2999 } // namespace v8 |
2984 | 3000 |
2985 #endif // V8_TARGET_ARCH_MIPS64 | 3001 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |