| 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 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 } | 1364 } |
| 1365 | 1365 |
| 1366 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1366 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
| 1367 // ----------- S t a t e ------------- | 1367 // ----------- S t a t e ------------- |
| 1368 // -- a0 : argument count (preserved for callee) | 1368 // -- a0 : argument count (preserved for callee) |
| 1369 // -- a3 : new target (preserved for callee) | 1369 // -- a3 : new target (preserved for callee) |
| 1370 // -- a1 : target function (preserved for callee) | 1370 // -- a1 : target function (preserved for callee) |
| 1371 // ----------------------------------- | 1371 // ----------------------------------- |
| 1372 // First lookup code, maybe we don't need to compile! | 1372 // First lookup code, maybe we don't need to compile! |
| 1373 Label gotta_call_runtime, gotta_call_runtime_no_stack; | 1373 Label gotta_call_runtime, gotta_call_runtime_no_stack; |
| 1374 Label maybe_call_runtime; |
| 1374 Label try_shared; | 1375 Label try_shared; |
| 1375 Label loop_top, loop_bottom; | 1376 Label loop_top, loop_bottom; |
| 1376 | 1377 |
| 1377 Register argument_count = a0; | 1378 Register argument_count = a0; |
| 1378 Register closure = a1; | 1379 Register closure = a1; |
| 1379 Register new_target = a3; | 1380 Register new_target = a3; |
| 1380 __ push(argument_count); | 1381 __ push(argument_count); |
| 1381 __ push(new_target); | 1382 __ push(new_target); |
| 1382 __ push(closure); | 1383 __ push(closure); |
| 1383 | 1384 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, | 1428 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
| 1428 OMIT_SMI_CHECK); | 1429 OMIT_SMI_CHECK); |
| 1429 __ pop(index); | 1430 __ pop(index); |
| 1430 | 1431 |
| 1431 // Code available? | 1432 // Code available? |
| 1432 Register entry = t0; | 1433 Register entry = t0; |
| 1433 __ lw(entry, | 1434 __ lw(entry, |
| 1434 FieldMemOperand(array_pointer, | 1435 FieldMemOperand(array_pointer, |
| 1435 SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 1436 SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
| 1436 __ lw(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); | 1437 __ lw(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); |
| 1437 __ JumpIfSmi(entry, &try_shared); | 1438 __ JumpIfSmi(entry, &maybe_call_runtime); |
| 1438 | 1439 |
| 1439 // Found literals and code. Get them into the closure and return. | 1440 // Found literals and code. Get them into the closure and return. |
| 1440 __ pop(closure); | 1441 __ pop(closure); |
| 1441 // Store code entry in the closure. | 1442 // Store code entry in the closure. |
| 1442 __ Addu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1443 __ Addu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1444 |
| 1445 Label install_optimized_code_and_tailcall; |
| 1446 __ bind(&install_optimized_code_and_tailcall); |
| 1443 __ sw(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); | 1447 __ sw(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); |
| 1444 __ RecordWriteCodeEntryField(closure, entry, t1); | 1448 __ RecordWriteCodeEntryField(closure, entry, t1); |
| 1445 | 1449 |
| 1446 // Link the closure into the optimized function list. | 1450 // Link the closure into the optimized function list. |
| 1447 // t0 : code entry | 1451 // t0 : code entry |
| 1448 // a3 : native context | 1452 // a3 : native context |
| 1449 // a1 : closure | 1453 // a1 : closure |
| 1450 __ lw(t1, | 1454 __ lw(t1, |
| 1451 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); | 1455 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); |
| 1452 __ sw(t1, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset)); | 1456 __ sw(t1, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1467 __ Jump(entry); | 1471 __ Jump(entry); |
| 1468 | 1472 |
| 1469 __ bind(&loop_bottom); | 1473 __ bind(&loop_bottom); |
| 1470 __ Subu(index, index, | 1474 __ Subu(index, index, |
| 1471 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); | 1475 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); |
| 1472 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); | 1476 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); |
| 1473 | 1477 |
| 1474 // We found neither literals nor code. | 1478 // We found neither literals nor code. |
| 1475 __ jmp(&gotta_call_runtime); | 1479 __ jmp(&gotta_call_runtime); |
| 1476 | 1480 |
| 1481 __ bind(&maybe_call_runtime); |
| 1482 __ pop(closure); |
| 1483 |
| 1484 // Last possibility. Check the context free optimized code map entry. |
| 1485 __ lw(entry, FieldMemOperand(map, FixedArray::kHeaderSize + |
| 1486 SharedFunctionInfo::kSharedCodeIndex)); |
| 1487 __ lw(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); |
| 1488 __ JumpIfSmi(entry, &try_shared); |
| 1489 |
| 1490 // Store code entry in the closure. |
| 1491 __ Addu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1492 __ jmp(&install_optimized_code_and_tailcall); |
| 1493 |
| 1477 __ bind(&try_shared); | 1494 __ bind(&try_shared); |
| 1478 __ pop(closure); | |
| 1479 __ pop(new_target); | 1495 __ pop(new_target); |
| 1480 __ pop(argument_count); | 1496 __ pop(argument_count); |
| 1481 // Is the full code valid? | 1497 // Is the full code valid? |
| 1482 __ lw(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1498 __ lw(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
| 1483 __ lw(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset)); | 1499 __ lw(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset)); |
| 1484 __ lw(t1, FieldMemOperand(entry, Code::kFlagsOffset)); | 1500 __ lw(t1, FieldMemOperand(entry, Code::kFlagsOffset)); |
| 1485 __ And(t1, t1, Operand(Code::KindField::kMask)); | 1501 __ And(t1, t1, Operand(Code::KindField::kMask)); |
| 1486 __ srl(t1, t1, Code::KindField::kShift); | 1502 __ srl(t1, t1, Code::KindField::kShift); |
| 1487 __ Branch(&gotta_call_runtime_no_stack, eq, t1, Operand(Code::BUILTIN)); | 1503 __ Branch(&gotta_call_runtime_no_stack, eq, t1, Operand(Code::BUILTIN)); |
| 1488 // Yes, install the full code. | 1504 // Yes, install the full code. |
| (...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2981 __ break_(0xCC); | 2997 __ break_(0xCC); |
| 2982 } | 2998 } |
| 2983 } | 2999 } |
| 2984 | 3000 |
| 2985 #undef __ | 3001 #undef __ |
| 2986 | 3002 |
| 2987 } // namespace internal | 3003 } // namespace internal |
| 2988 } // namespace v8 | 3004 } // namespace v8 |
| 2989 | 3005 |
| 2990 #endif // V8_TARGET_ARCH_MIPS | 3006 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |