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