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