| 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 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 // -- r1 : target function (preserved for callee) | 1333 // -- r1 : target function (preserved for callee) |
| 1334 // ----------------------------------- | 1334 // ----------------------------------- |
| 1335 // First lookup code, maybe we don't need to compile! | 1335 // First lookup code, maybe we don't need to compile! |
| 1336 Label gotta_call_runtime, gotta_call_runtime_no_stack; | 1336 Label gotta_call_runtime, gotta_call_runtime_no_stack; |
| 1337 Label try_shared; | 1337 Label try_shared; |
| 1338 Label loop_top, loop_bottom; | 1338 Label loop_top, loop_bottom; |
| 1339 | 1339 |
| 1340 Register argument_count = r0; | 1340 Register argument_count = r0; |
| 1341 Register closure = r1; | 1341 Register closure = r1; |
| 1342 Register new_target = r3; | 1342 Register new_target = r3; |
| 1343 Register map = argument_count; |
| 1344 Register index = r2; |
| 1345 |
| 1346 // Do we have a valid feedback vector? |
| 1347 __ ldr(index, FieldMemOperand(closure, JSFunction::kFeedbackVectorOffset)); |
| 1348 __ ldr(index, FieldMemOperand(index, Cell::kValueOffset)); |
| 1349 __ JumpIfRoot(index, Heap::kUndefinedValueRootIndex, |
| 1350 &gotta_call_runtime_no_stack); |
| 1351 |
| 1343 __ push(argument_count); | 1352 __ push(argument_count); |
| 1344 __ push(new_target); | 1353 __ push(new_target); |
| 1345 __ push(closure); | 1354 __ push(closure); |
| 1346 | 1355 |
| 1347 Register map = argument_count; | |
| 1348 Register index = r2; | |
| 1349 __ ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1356 __ ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
| 1350 __ ldr(map, | 1357 __ ldr(map, |
| 1351 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); | 1358 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); |
| 1352 __ ldr(index, FieldMemOperand(map, FixedArray::kLengthOffset)); | 1359 __ ldr(index, FieldMemOperand(map, FixedArray::kLengthOffset)); |
| 1353 __ cmp(index, Operand(Smi::FromInt(2))); | 1360 __ cmp(index, Operand(Smi::FromInt(2))); |
| 1354 __ b(lt, &gotta_call_runtime); | 1361 __ b(lt, &try_shared); |
| 1355 | 1362 |
| 1356 // Find literals. | |
| 1357 // r3 : native context | 1363 // r3 : native context |
| 1358 // r2 : length / index | 1364 // r2 : length / index |
| 1359 // r0 : optimized code map | 1365 // r0 : optimized code map |
| 1360 // stack[0] : new target | 1366 // stack[0] : new target |
| 1361 // stack[4] : closure | 1367 // stack[4] : closure |
| 1362 Register native_context = r3; | 1368 Register native_context = r3; |
| 1363 __ ldr(native_context, NativeContextMemOperand()); | 1369 __ ldr(native_context, NativeContextMemOperand()); |
| 1364 | 1370 |
| 1365 __ bind(&loop_top); | 1371 __ bind(&loop_top); |
| 1366 Register temp = r1; | 1372 Register temp = r1; |
| 1367 Register array_pointer = r5; | 1373 Register array_pointer = r5; |
| 1368 | 1374 |
| 1369 // Does the native context match? | 1375 // Does the native context match? |
| 1370 __ add(array_pointer, map, Operand::PointerOffsetFromSmiKey(index)); | 1376 __ add(array_pointer, map, Operand::PointerOffsetFromSmiKey(index)); |
| 1371 __ ldr(temp, FieldMemOperand(array_pointer, | 1377 __ ldr(temp, FieldMemOperand(array_pointer, |
| 1372 SharedFunctionInfo::kOffsetToPreviousContext)); | 1378 SharedFunctionInfo::kOffsetToPreviousContext)); |
| 1373 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); | 1379 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); |
| 1374 __ cmp(temp, native_context); | 1380 __ cmp(temp, native_context); |
| 1375 __ b(ne, &loop_bottom); | 1381 __ b(ne, &loop_bottom); |
| 1376 // Feedback vector available? | |
| 1377 __ ldr(temp, FieldMemOperand(array_pointer, | |
| 1378 SharedFunctionInfo::kOffsetToPreviousLiterals)); | |
| 1379 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); | |
| 1380 __ JumpIfSmi(temp, &gotta_call_runtime); | |
| 1381 | |
| 1382 // Save the feedback vector in the closure. | |
| 1383 __ ldr(r4, MemOperand(sp, 0)); | |
| 1384 __ str(temp, FieldMemOperand(r4, JSFunction::kFeedbackVectorOffset)); | |
| 1385 __ push(index); | |
| 1386 __ RecordWriteField(r4, JSFunction::kFeedbackVectorOffset, temp, index, | |
| 1387 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, | |
| 1388 OMIT_SMI_CHECK); | |
| 1389 __ pop(index); | |
| 1390 | 1382 |
| 1391 // Code available? | 1383 // Code available? |
| 1392 Register entry = r4; | 1384 Register entry = r4; |
| 1393 __ ldr(entry, | 1385 __ ldr(entry, |
| 1394 FieldMemOperand(array_pointer, | 1386 FieldMemOperand(array_pointer, |
| 1395 SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 1387 SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
| 1396 __ ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); | 1388 __ ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); |
| 1397 __ JumpIfSmi(entry, &try_shared); | 1389 __ JumpIfSmi(entry, &try_shared); |
| 1398 | 1390 |
| 1399 // Found literals and code. Get them into the closure and return. | 1391 // Found code. Get it into the closure and return. |
| 1400 __ pop(closure); | 1392 __ pop(closure); |
| 1401 // Store code entry in the closure. | 1393 // Store code entry in the closure. |
| 1402 __ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1394 __ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1403 __ str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); | 1395 __ str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); |
| 1404 __ RecordWriteCodeEntryField(closure, entry, r5); | 1396 __ RecordWriteCodeEntryField(closure, entry, r5); |
| 1405 | 1397 |
| 1406 // Link the closure into the optimized function list. | 1398 // Link the closure into the optimized function list. |
| 1407 // r4 : code entry | 1399 // r4 : code entry |
| 1408 // r3 : native context | 1400 // r3 : native context |
| 1409 // r1 : closure | 1401 // r1 : closure |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1424 __ mov(closure, r5); | 1416 __ mov(closure, r5); |
| 1425 __ pop(new_target); | 1417 __ pop(new_target); |
| 1426 __ pop(argument_count); | 1418 __ pop(argument_count); |
| 1427 __ Jump(entry); | 1419 __ Jump(entry); |
| 1428 | 1420 |
| 1429 __ bind(&loop_bottom); | 1421 __ bind(&loop_bottom); |
| 1430 __ sub(index, index, Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); | 1422 __ sub(index, index, Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); |
| 1431 __ cmp(index, Operand(Smi::FromInt(1))); | 1423 __ cmp(index, Operand(Smi::FromInt(1))); |
| 1432 __ b(gt, &loop_top); | 1424 __ b(gt, &loop_top); |
| 1433 | 1425 |
| 1434 // We found neither literals nor code. | 1426 // We found no code. |
| 1435 __ jmp(&gotta_call_runtime); | |
| 1436 | |
| 1437 __ bind(&try_shared); | 1427 __ bind(&try_shared); |
| 1438 __ pop(closure); | 1428 __ pop(closure); |
| 1439 __ pop(new_target); | 1429 __ pop(new_target); |
| 1440 __ pop(argument_count); | 1430 __ pop(argument_count); |
| 1441 __ ldr(entry, | 1431 __ ldr(entry, |
| 1442 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1432 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
| 1443 // Is the shared function marked for tier up? | 1433 // Is the shared function marked for tier up? |
| 1444 __ ldrb(r5, FieldMemOperand(entry, | 1434 __ ldrb(r5, FieldMemOperand(entry, |
| 1445 SharedFunctionInfo::kMarkedForTierUpByteOffset)); | 1435 SharedFunctionInfo::kMarkedForTierUpByteOffset)); |
| 1446 __ tst(r5, Operand(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte)); | 1436 __ tst(r5, Operand(1 << SharedFunctionInfo::kMarkedForTierUpBitWithinByte)); |
| (...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3121 __ bkpt(0); | 3111 __ bkpt(0); |
| 3122 } | 3112 } |
| 3123 } | 3113 } |
| 3124 | 3114 |
| 3125 #undef __ | 3115 #undef __ |
| 3126 | 3116 |
| 3127 } // namespace internal | 3117 } // namespace internal |
| 3128 } // namespace v8 | 3118 } // namespace v8 |
| 3129 | 3119 |
| 3130 #endif // V8_TARGET_ARCH_ARM | 3120 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |