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