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