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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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 // -- a1 : target function (preserved for callee) | 1333 // -- a1 : 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 = a0; | 1340 Register argument_count = a0; |
1341 Register closure = a1; | 1341 Register closure = a1; |
1342 Register new_target = a3; | 1342 Register new_target = a3; |
1343 Register map = a0; | |
1344 Register index = a2; | |
1345 | |
1346 // Do we have a valid feedback vector? | |
1347 __ ld(index, FieldMemOperand(closure, JSFunction::kLiteralsOffset)); | |
1348 __ ld(index, FieldMemOperand(index, LiteralsArray::kFeedbackVectorOffset)); | |
1349 __ JumpIfRoot(index, Heap::kUndefinedValueRootIndex, | |
1350 &gotta_call_runtime_no_stack); | |
1351 | |
1352 __ push(argument_count); | 1343 __ push(argument_count); |
1353 __ push(new_target); | 1344 __ push(new_target); |
1354 __ push(closure); | 1345 __ push(closure); |
1355 | 1346 |
| 1347 Register map = a0; |
| 1348 Register index = a2; |
1356 __ ld(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1349 __ ld(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
1357 __ ld(map, FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); | 1350 __ ld(map, FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); |
1358 __ ld(index, FieldMemOperand(map, FixedArray::kLengthOffset)); | 1351 __ ld(index, FieldMemOperand(map, FixedArray::kLengthOffset)); |
1359 __ Branch(&gotta_call_runtime, lt, index, Operand(Smi::FromInt(2))); | 1352 __ Branch(&gotta_call_runtime, lt, index, Operand(Smi::FromInt(2))); |
1360 | 1353 |
| 1354 // Find literals. |
1361 // a3 : native context | 1355 // a3 : native context |
1362 // a2 : length / index | 1356 // a2 : length / index |
1363 // a0 : optimized code map | 1357 // a0 : optimized code map |
1364 // stack[0] : new target | 1358 // stack[0] : new target |
1365 // stack[4] : closure | 1359 // stack[4] : closure |
1366 Register native_context = a3; | 1360 Register native_context = a3; |
1367 __ ld(native_context, NativeContextMemOperand()); | 1361 __ ld(native_context, NativeContextMemOperand()); |
1368 | 1362 |
1369 __ bind(&loop_top); | 1363 __ bind(&loop_top); |
1370 Register temp = a1; | 1364 Register temp = a1; |
1371 Register array_pointer = a5; | 1365 Register array_pointer = a5; |
1372 | 1366 |
1373 // Does the native context match? | 1367 // Does the native context match? |
1374 __ SmiScale(at, index, kPointerSizeLog2); | 1368 __ SmiScale(at, index, kPointerSizeLog2); |
1375 __ Daddu(array_pointer, map, Operand(at)); | 1369 __ Daddu(array_pointer, map, Operand(at)); |
1376 __ ld(temp, FieldMemOperand(array_pointer, | 1370 __ ld(temp, FieldMemOperand(array_pointer, |
1377 SharedFunctionInfo::kOffsetToPreviousContext)); | 1371 SharedFunctionInfo::kOffsetToPreviousContext)); |
1378 __ ld(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); | 1372 __ ld(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); |
1379 __ Branch(&loop_bottom, ne, temp, Operand(native_context)); | 1373 __ Branch(&loop_bottom, ne, temp, Operand(native_context)); |
| 1374 // Literals available? |
| 1375 __ ld(temp, FieldMemOperand(array_pointer, |
| 1376 SharedFunctionInfo::kOffsetToPreviousLiterals)); |
| 1377 __ ld(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); |
| 1378 __ JumpIfSmi(temp, &gotta_call_runtime); |
| 1379 |
| 1380 // Save the literals in the closure. |
| 1381 __ ld(a4, MemOperand(sp, 0)); |
| 1382 __ sd(temp, FieldMemOperand(a4, JSFunction::kLiteralsOffset)); |
| 1383 __ push(index); |
| 1384 __ RecordWriteField(a4, JSFunction::kLiteralsOffset, temp, index, |
| 1385 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
| 1386 OMIT_SMI_CHECK); |
| 1387 __ pop(index); |
1380 | 1388 |
1381 // Code available? | 1389 // Code available? |
1382 Register entry = a4; | 1390 Register entry = a4; |
1383 __ ld(entry, | 1391 __ ld(entry, |
1384 FieldMemOperand(array_pointer, | 1392 FieldMemOperand(array_pointer, |
1385 SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 1393 SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
1386 __ ld(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); | 1394 __ ld(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); |
1387 __ JumpIfSmi(entry, &try_shared); | 1395 __ JumpIfSmi(entry, &try_shared); |
1388 | 1396 |
1389 // Found code. Get it into the closure and return. | 1397 // Found literals and code. Get them into the closure and return. |
1390 __ pop(closure); | 1398 __ pop(closure); |
1391 // Store code entry in the closure. | 1399 // Store code entry in the closure. |
1392 __ Daddu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1400 __ Daddu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1393 __ sd(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); | 1401 __ sd(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); |
1394 __ RecordWriteCodeEntryField(closure, entry, a5); | 1402 __ RecordWriteCodeEntryField(closure, entry, a5); |
1395 | 1403 |
1396 // Link the closure into the optimized function list. | 1404 // Link the closure into the optimized function list. |
1397 // a4 : code entry | 1405 // a4 : code entry |
1398 // a3 : native context | 1406 // a3 : native context |
1399 // a1 : closure | 1407 // a1 : closure |
(...skipping 14 matching lines...) Expand all Loading... |
1414 __ mov(closure, a5); | 1422 __ mov(closure, a5); |
1415 __ pop(new_target); | 1423 __ pop(new_target); |
1416 __ pop(argument_count); | 1424 __ pop(argument_count); |
1417 __ Jump(entry); | 1425 __ Jump(entry); |
1418 | 1426 |
1419 __ bind(&loop_bottom); | 1427 __ bind(&loop_bottom); |
1420 __ Dsubu(index, index, | 1428 __ Dsubu(index, index, |
1421 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); | 1429 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); |
1422 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); | 1430 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); |
1423 | 1431 |
1424 // We found no code. | 1432 // We found neither literals nor code. |
1425 __ jmp(&gotta_call_runtime); | 1433 __ jmp(&gotta_call_runtime); |
1426 | 1434 |
1427 __ bind(&try_shared); | 1435 __ bind(&try_shared); |
1428 __ pop(closure); | 1436 __ pop(closure); |
1429 __ pop(new_target); | 1437 __ pop(new_target); |
1430 __ pop(argument_count); | 1438 __ pop(argument_count); |
1431 __ ld(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1439 __ ld(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
1432 // Is the shared function marked for tier up? | 1440 // Is the shared function marked for tier up? |
1433 __ lbu(a5, FieldMemOperand(entry, | 1441 __ lbu(a5, FieldMemOperand(entry, |
1434 SharedFunctionInfo::kMarkedForTierUpByteOffset)); | 1442 SharedFunctionInfo::kMarkedForTierUpByteOffset)); |
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2989 __ break_(0xCC); | 2997 __ break_(0xCC); |
2990 } | 2998 } |
2991 } | 2999 } |
2992 | 3000 |
2993 #undef __ | 3001 #undef __ |
2994 | 3002 |
2995 } // namespace internal | 3003 } // namespace internal |
2996 } // namespace v8 | 3004 } // namespace v8 |
2997 | 3005 |
2998 #endif // V8_TARGET_ARCH_MIPS64 | 3006 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |