| 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; | |
| 1367 Label try_shared; | 1366 Label try_shared; |
| 1368 Label loop_top, loop_bottom; | 1367 Label loop_top, loop_bottom; |
| 1369 | 1368 |
| 1370 Register argument_count = a0; | 1369 Register argument_count = a0; |
| 1371 Register closure = a1; | 1370 Register closure = a1; |
| 1372 Register new_target = a3; | 1371 Register new_target = a3; |
| 1373 __ push(argument_count); | 1372 __ push(argument_count); |
| 1374 __ push(new_target); | 1373 __ push(new_target); |
| 1375 __ push(closure); | 1374 __ push(closure); |
| 1376 | 1375 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, | 1419 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
| 1421 OMIT_SMI_CHECK); | 1420 OMIT_SMI_CHECK); |
| 1422 __ pop(index); | 1421 __ pop(index); |
| 1423 | 1422 |
| 1424 // Code available? | 1423 // Code available? |
| 1425 Register entry = a4; | 1424 Register entry = a4; |
| 1426 __ ld(entry, | 1425 __ ld(entry, |
| 1427 FieldMemOperand(array_pointer, | 1426 FieldMemOperand(array_pointer, |
| 1428 SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 1427 SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
| 1429 __ ld(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); | 1428 __ ld(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); |
| 1430 __ JumpIfSmi(entry, &maybe_call_runtime); | 1429 __ JumpIfSmi(entry, &try_shared); |
| 1431 | 1430 |
| 1432 // Found literals and code. Get them into the closure and return. | 1431 // Found literals and code. Get them into the closure and return. |
| 1433 __ pop(closure); | 1432 __ pop(closure); |
| 1434 // Store code entry in the closure. | 1433 // Store code entry in the closure. |
| 1435 __ Daddu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1434 __ Daddu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1436 | 1435 |
| 1437 Label install_optimized_code_and_tailcall; | 1436 Label install_optimized_code_and_tailcall; |
| 1438 __ bind(&install_optimized_code_and_tailcall); | 1437 __ bind(&install_optimized_code_and_tailcall); |
| 1439 __ sd(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); | 1438 __ sd(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); |
| 1440 __ RecordWriteCodeEntryField(closure, entry, a5); | 1439 __ RecordWriteCodeEntryField(closure, entry, a5); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1463 __ Jump(entry); | 1462 __ Jump(entry); |
| 1464 | 1463 |
| 1465 __ bind(&loop_bottom); | 1464 __ bind(&loop_bottom); |
| 1466 __ Dsubu(index, index, | 1465 __ Dsubu(index, index, |
| 1467 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); | 1466 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); |
| 1468 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); | 1467 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); |
| 1469 | 1468 |
| 1470 // We found neither literals nor code. | 1469 // We found neither literals nor code. |
| 1471 __ jmp(&gotta_call_runtime); | 1470 __ jmp(&gotta_call_runtime); |
| 1472 | 1471 |
| 1473 __ bind(&maybe_call_runtime); | 1472 __ bind(&try_shared); |
| 1474 __ pop(closure); | 1473 __ 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 | |
| 1486 __ bind(&try_shared); | |
| 1487 __ pop(new_target); | 1474 __ pop(new_target); |
| 1488 __ pop(argument_count); | 1475 __ pop(argument_count); |
| 1489 // Is the full code valid? | 1476 // Is the full code valid? |
| 1490 __ ld(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1477 __ ld(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
| 1491 __ ld(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset)); | 1478 __ ld(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset)); |
| 1492 __ lw(a5, FieldMemOperand(entry, Code::kFlagsOffset)); | 1479 __ lw(a5, FieldMemOperand(entry, Code::kFlagsOffset)); |
| 1493 __ And(a5, a5, Operand(Code::KindField::kMask)); | 1480 __ And(a5, a5, Operand(Code::KindField::kMask)); |
| 1494 __ dsrl(a5, a5, Code::KindField::kShift); | 1481 __ dsrl(a5, a5, Code::KindField::kShift); |
| 1495 __ Branch(&gotta_call_runtime_no_stack, eq, a5, Operand(Code::BUILTIN)); | 1482 __ Branch(&gotta_call_runtime_no_stack, eq, a5, Operand(Code::BUILTIN)); |
| 1496 // Yes, install the full code. | 1483 // Yes, install the full code. |
| (...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2992 __ break_(0xCC); | 2979 __ break_(0xCC); |
| 2993 } | 2980 } |
| 2994 } | 2981 } |
| 2995 | 2982 |
| 2996 #undef __ | 2983 #undef __ |
| 2997 | 2984 |
| 2998 } // namespace internal | 2985 } // namespace internal |
| 2999 } // namespace v8 | 2986 } // namespace v8 |
| 3000 | 2987 |
| 3001 #endif // V8_TARGET_ARCH_MIPS64 | 2988 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |