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