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 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 // -- a1 : target function (preserved for callee) | 1345 // -- a1 : target function (preserved for callee) |
1346 // ----------------------------------- | 1346 // ----------------------------------- |
1347 // First lookup code, maybe we don't need to compile! | 1347 // First lookup code, maybe we don't need to compile! |
1348 Label gotta_call_runtime, gotta_call_runtime_no_stack; | 1348 Label gotta_call_runtime, gotta_call_runtime_no_stack; |
1349 Label try_shared; | 1349 Label try_shared; |
1350 Label loop_top, loop_bottom; | 1350 Label loop_top, loop_bottom; |
1351 | 1351 |
1352 Register argument_count = a0; | 1352 Register argument_count = a0; |
1353 Register closure = a1; | 1353 Register closure = a1; |
1354 Register new_target = a3; | 1354 Register new_target = a3; |
1355 Register map = a0; | |
1356 Register index = a2; | |
1357 | |
1358 // Do we have a valid feedback vector? | |
1359 __ lw(index, FieldMemOperand(closure, JSFunction::kLiteralsOffset)); | |
1360 __ lw(index, FieldMemOperand(index, LiteralsArray::kFeedbackVectorOffset)); | |
1361 __ JumpIfRoot(index, Heap::kUndefinedValueRootIndex, | |
1362 &gotta_call_runtime_no_stack); | |
1363 | |
1364 __ push(argument_count); | 1355 __ push(argument_count); |
1365 __ push(new_target); | 1356 __ push(new_target); |
1366 __ push(closure); | 1357 __ push(closure); |
1367 | 1358 |
| 1359 Register map = a0; |
| 1360 Register index = a2; |
1368 __ lw(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1361 __ lw(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
1369 __ lw(map, FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); | 1362 __ lw(map, FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); |
1370 __ lw(index, FieldMemOperand(map, FixedArray::kLengthOffset)); | 1363 __ lw(index, FieldMemOperand(map, FixedArray::kLengthOffset)); |
1371 __ Branch(&gotta_call_runtime, lt, index, Operand(Smi::FromInt(2))); | 1364 __ Branch(&gotta_call_runtime, lt, index, Operand(Smi::FromInt(2))); |
1372 | 1365 |
| 1366 // Find literals. |
1373 // a3 : native context | 1367 // a3 : native context |
1374 // a2 : length / index | 1368 // a2 : length / index |
1375 // a0 : optimized code map | 1369 // a0 : optimized code map |
1376 // stack[0] : new target | 1370 // stack[0] : new target |
1377 // stack[4] : closure | 1371 // stack[4] : closure |
1378 Register native_context = a3; | 1372 Register native_context = a3; |
1379 __ lw(native_context, NativeContextMemOperand()); | 1373 __ lw(native_context, NativeContextMemOperand()); |
1380 | 1374 |
1381 __ bind(&loop_top); | 1375 __ bind(&loop_top); |
1382 Register temp = a1; | 1376 Register temp = a1; |
1383 Register array_pointer = t1; | 1377 Register array_pointer = t1; |
1384 | 1378 |
1385 // Does the native context match? | 1379 // Does the native context match? |
1386 __ sll(at, index, kPointerSizeLog2 - kSmiTagSize); | 1380 __ sll(at, index, kPointerSizeLog2 - kSmiTagSize); |
1387 __ Addu(array_pointer, map, Operand(at)); | 1381 __ Addu(array_pointer, map, Operand(at)); |
1388 __ lw(temp, FieldMemOperand(array_pointer, | 1382 __ lw(temp, FieldMemOperand(array_pointer, |
1389 SharedFunctionInfo::kOffsetToPreviousContext)); | 1383 SharedFunctionInfo::kOffsetToPreviousContext)); |
1390 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); | 1384 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); |
1391 __ Branch(&loop_bottom, ne, temp, Operand(native_context)); | 1385 __ Branch(&loop_bottom, ne, temp, Operand(native_context)); |
| 1386 // Literals available? |
| 1387 __ lw(temp, FieldMemOperand(array_pointer, |
| 1388 SharedFunctionInfo::kOffsetToPreviousLiterals)); |
| 1389 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); |
| 1390 __ JumpIfSmi(temp, &gotta_call_runtime); |
| 1391 |
| 1392 // Save the literals in the closure. |
| 1393 __ lw(t0, MemOperand(sp, 0)); |
| 1394 __ sw(temp, FieldMemOperand(t0, JSFunction::kLiteralsOffset)); |
| 1395 __ push(index); |
| 1396 __ RecordWriteField(t0, JSFunction::kLiteralsOffset, temp, index, |
| 1397 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
| 1398 OMIT_SMI_CHECK); |
| 1399 __ pop(index); |
1392 | 1400 |
1393 // Code available? | 1401 // Code available? |
1394 Register entry = t0; | 1402 Register entry = t0; |
1395 __ lw(entry, | 1403 __ lw(entry, |
1396 FieldMemOperand(array_pointer, | 1404 FieldMemOperand(array_pointer, |
1397 SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 1405 SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
1398 __ lw(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); | 1406 __ lw(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); |
1399 __ JumpIfSmi(entry, &try_shared); | 1407 __ JumpIfSmi(entry, &try_shared); |
1400 | 1408 |
1401 // Found code. Get it into the closure and return. | 1409 // Found literals and code. Get them into the closure and return. |
1402 __ pop(closure); | 1410 __ pop(closure); |
1403 // Store code entry in the closure. | 1411 // Store code entry in the closure. |
1404 __ Addu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1412 __ Addu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1405 __ sw(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); | 1413 __ sw(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); |
1406 __ RecordWriteCodeEntryField(closure, entry, t1); | 1414 __ RecordWriteCodeEntryField(closure, entry, t1); |
1407 | 1415 |
1408 // Link the closure into the optimized function list. | 1416 // Link the closure into the optimized function list. |
1409 // t0 : code entry | 1417 // t0 : code entry |
1410 // a3 : native context | 1418 // a3 : native context |
1411 // a1 : closure | 1419 // a1 : closure |
(...skipping 14 matching lines...) Expand all Loading... |
1426 __ mov(closure, t1); | 1434 __ mov(closure, t1); |
1427 __ pop(new_target); | 1435 __ pop(new_target); |
1428 __ pop(argument_count); | 1436 __ pop(argument_count); |
1429 __ Jump(entry); | 1437 __ Jump(entry); |
1430 | 1438 |
1431 __ bind(&loop_bottom); | 1439 __ bind(&loop_bottom); |
1432 __ Subu(index, index, | 1440 __ Subu(index, index, |
1433 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); | 1441 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); |
1434 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); | 1442 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); |
1435 | 1443 |
1436 // We found no code. | 1444 // We found neither literals nor code. |
1437 __ jmp(&gotta_call_runtime); | 1445 __ jmp(&gotta_call_runtime); |
1438 | 1446 |
1439 __ bind(&try_shared); | 1447 __ bind(&try_shared); |
1440 __ pop(closure); | 1448 __ pop(closure); |
1441 __ pop(new_target); | 1449 __ pop(new_target); |
1442 __ pop(argument_count); | 1450 __ pop(argument_count); |
1443 __ lw(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1451 __ lw(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
1444 // Is the shared function marked for tier up? | 1452 // Is the shared function marked for tier up? |
1445 __ lbu(t1, FieldMemOperand(entry, | 1453 __ lbu(t1, FieldMemOperand(entry, |
1446 SharedFunctionInfo::kMarkedForTierUpByteOffset)); | 1454 SharedFunctionInfo::kMarkedForTierUpByteOffset)); |
(...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3098 __ break_(0xCC); | 3106 __ break_(0xCC); |
3099 } | 3107 } |
3100 } | 3108 } |
3101 | 3109 |
3102 #undef __ | 3110 #undef __ |
3103 | 3111 |
3104 } // namespace internal | 3112 } // namespace internal |
3105 } // namespace v8 | 3113 } // namespace v8 |
3106 | 3114 |
3107 #endif // V8_TARGET_ARCH_MIPS | 3115 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |