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