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