| 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 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 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1363 } | 1363 } |
| 1364 | 1364 |
| 1365 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1365 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
| 1366 // ----------- S t a t e ------------- | 1366 // ----------- S t a t e ------------- |
| 1367 // -- r0 : argument count (preserved for callee) | 1367 // -- r0 : argument count (preserved for callee) |
| 1368 // -- r3 : new target (preserved for callee) | 1368 // -- r3 : new target (preserved for callee) |
| 1369 // -- r1 : target function (preserved for callee) | 1369 // -- r1 : target function (preserved for callee) |
| 1370 // ----------------------------------- | 1370 // ----------------------------------- |
| 1371 // First lookup code, maybe we don't need to compile! | 1371 // First lookup code, maybe we don't need to compile! |
| 1372 Label gotta_call_runtime, gotta_call_runtime_no_stack; | 1372 Label gotta_call_runtime, gotta_call_runtime_no_stack; |
| 1373 Label maybe_call_runtime; | |
| 1374 Label try_shared; | 1373 Label try_shared; |
| 1375 Label loop_top, loop_bottom; | 1374 Label loop_top, loop_bottom; |
| 1376 | 1375 |
| 1377 Register argument_count = r0; | 1376 Register argument_count = r0; |
| 1378 Register closure = r1; | 1377 Register closure = r1; |
| 1379 Register new_target = r3; | 1378 Register new_target = r3; |
| 1380 __ push(argument_count); | 1379 __ push(argument_count); |
| 1381 __ push(new_target); | 1380 __ push(new_target); |
| 1382 __ push(closure); | 1381 __ push(closure); |
| 1383 | 1382 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, | 1429 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
| 1431 OMIT_SMI_CHECK); | 1430 OMIT_SMI_CHECK); |
| 1432 __ pop(index); | 1431 __ pop(index); |
| 1433 | 1432 |
| 1434 // Code available? | 1433 // Code available? |
| 1435 Register entry = r4; | 1434 Register entry = r4; |
| 1436 __ ldr(entry, | 1435 __ ldr(entry, |
| 1437 FieldMemOperand(array_pointer, | 1436 FieldMemOperand(array_pointer, |
| 1438 SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 1437 SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
| 1439 __ ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); | 1438 __ ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); |
| 1440 __ JumpIfSmi(entry, &maybe_call_runtime); | 1439 __ JumpIfSmi(entry, &try_shared); |
| 1441 | 1440 |
| 1442 // Found literals and code. Get them into the closure and return. | 1441 // Found literals and code. Get them into the closure and return. |
| 1443 __ pop(closure); | 1442 __ pop(closure); |
| 1444 // Store code entry in the closure. | 1443 // Store code entry in the closure. |
| 1445 __ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1444 __ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1446 | |
| 1447 Label install_optimized_code_and_tailcall; | |
| 1448 __ bind(&install_optimized_code_and_tailcall); | |
| 1449 __ str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); | 1445 __ str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); |
| 1450 __ RecordWriteCodeEntryField(closure, entry, r5); | 1446 __ RecordWriteCodeEntryField(closure, entry, r5); |
| 1451 | 1447 |
| 1452 // Link the closure into the optimized function list. | 1448 // Link the closure into the optimized function list. |
| 1453 // r4 : code entry | 1449 // r4 : code entry |
| 1454 // r3 : native context | 1450 // r3 : native context |
| 1455 // r1 : closure | 1451 // r1 : closure |
| 1456 __ ldr(r5, | 1452 __ ldr(r5, |
| 1457 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); | 1453 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); |
| 1458 __ str(r5, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset)); | 1454 __ str(r5, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1473 __ Jump(entry); | 1469 __ Jump(entry); |
| 1474 | 1470 |
| 1475 __ bind(&loop_bottom); | 1471 __ bind(&loop_bottom); |
| 1476 __ sub(index, index, Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); | 1472 __ sub(index, index, Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); |
| 1477 __ cmp(index, Operand(Smi::FromInt(1))); | 1473 __ cmp(index, Operand(Smi::FromInt(1))); |
| 1478 __ b(gt, &loop_top); | 1474 __ b(gt, &loop_top); |
| 1479 | 1475 |
| 1480 // We found neither literals nor code. | 1476 // We found neither literals nor code. |
| 1481 __ jmp(&gotta_call_runtime); | 1477 __ jmp(&gotta_call_runtime); |
| 1482 | 1478 |
| 1483 __ bind(&maybe_call_runtime); | 1479 __ bind(&try_shared); |
| 1484 __ pop(closure); | 1480 __ pop(closure); |
| 1485 | |
| 1486 // Last possibility. Check the context free optimized code map entry. | |
| 1487 __ ldr(entry, FieldMemOperand(map, FixedArray::kHeaderSize + | |
| 1488 SharedFunctionInfo::kSharedCodeIndex)); | |
| 1489 __ ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); | |
| 1490 __ JumpIfSmi(entry, &try_shared); | |
| 1491 | |
| 1492 // Store code entry in the closure. | |
| 1493 __ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
| 1494 __ jmp(&install_optimized_code_and_tailcall); | |
| 1495 | |
| 1496 __ bind(&try_shared); | |
| 1497 __ pop(new_target); | 1481 __ pop(new_target); |
| 1498 __ pop(argument_count); | 1482 __ pop(argument_count); |
| 1499 // Is the full code valid? | 1483 // Is the full code valid? |
| 1500 __ ldr(entry, | 1484 __ ldr(entry, |
| 1501 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1485 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
| 1502 __ ldr(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset)); | 1486 __ ldr(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset)); |
| 1503 __ ldr(r5, FieldMemOperand(entry, Code::kFlagsOffset)); | 1487 __ ldr(r5, FieldMemOperand(entry, Code::kFlagsOffset)); |
| 1504 __ and_(r5, r5, Operand(Code::KindField::kMask)); | 1488 __ and_(r5, r5, Operand(Code::KindField::kMask)); |
| 1505 __ mov(r5, Operand(r5, LSR, Code::KindField::kShift)); | 1489 __ mov(r5, Operand(r5, LSR, Code::KindField::kShift)); |
| 1506 __ cmp(r5, Operand(Code::BUILTIN)); | 1490 __ cmp(r5, Operand(Code::BUILTIN)); |
| (...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2923 __ bkpt(0); | 2907 __ bkpt(0); |
| 2924 } | 2908 } |
| 2925 } | 2909 } |
| 2926 | 2910 |
| 2927 #undef __ | 2911 #undef __ |
| 2928 | 2912 |
| 2929 } // namespace internal | 2913 } // namespace internal |
| 2930 } // namespace v8 | 2914 } // namespace v8 |
| 2931 | 2915 |
| 2932 #endif // V8_TARGET_ARCH_ARM | 2916 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |