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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 // -- a1 : target function (preserved for callee) | 1341 // -- a1 : target function (preserved for callee) |
1342 // ----------------------------------- | 1342 // ----------------------------------- |
1343 // First lookup code, maybe we don't need to compile! | 1343 // First lookup code, maybe we don't need to compile! |
1344 Label gotta_call_runtime, gotta_call_runtime_no_stack; | 1344 Label gotta_call_runtime, gotta_call_runtime_no_stack; |
1345 Label try_shared; | 1345 Label try_shared; |
1346 Label loop_top, loop_bottom; | 1346 Label loop_top, loop_bottom; |
1347 | 1347 |
1348 Register argument_count = a0; | 1348 Register argument_count = a0; |
1349 Register closure = a1; | 1349 Register closure = a1; |
1350 Register new_target = a3; | 1350 Register new_target = a3; |
1351 Register map = a0; | |
1352 Register index = a2; | |
1353 | |
1354 // Do we have a valid feedback vector? | |
1355 __ lw(index, FieldMemOperand(closure, JSFunction::kLiteralsOffset)); | |
1356 __ lw(index, FieldMemOperand(index, LiteralsArray::kFeedbackVectorOffset)); | |
1357 __ JumpIfRoot(index, Heap::kUndefinedValueRootIndex, | |
1358 &gotta_call_runtime_no_stack); | |
1359 | |
1360 __ push(argument_count); | 1351 __ push(argument_count); |
1361 __ push(new_target); | 1352 __ push(new_target); |
1362 __ push(closure); | 1353 __ push(closure); |
1363 | 1354 |
| 1355 Register map = a0; |
| 1356 Register index = a2; |
1364 __ lw(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1357 __ lw(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
1365 __ lw(map, FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); | 1358 __ lw(map, FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); |
1366 __ lw(index, FieldMemOperand(map, FixedArray::kLengthOffset)); | 1359 __ lw(index, FieldMemOperand(map, FixedArray::kLengthOffset)); |
1367 __ Branch(&gotta_call_runtime, lt, index, Operand(Smi::FromInt(2))); | 1360 __ Branch(&gotta_call_runtime, lt, index, Operand(Smi::FromInt(2))); |
1368 | 1361 |
| 1362 // Find literals. |
1369 // a3 : native context | 1363 // a3 : native context |
1370 // a2 : length / index | 1364 // a2 : length / index |
1371 // a0 : optimized code map | 1365 // a0 : optimized code map |
1372 // stack[0] : new target | 1366 // stack[0] : new target |
1373 // stack[4] : closure | 1367 // stack[4] : closure |
1374 Register native_context = a3; | 1368 Register native_context = a3; |
1375 __ lw(native_context, NativeContextMemOperand()); | 1369 __ lw(native_context, NativeContextMemOperand()); |
1376 | 1370 |
1377 __ bind(&loop_top); | 1371 __ bind(&loop_top); |
1378 Register temp = a1; | 1372 Register temp = a1; |
1379 Register array_pointer = t1; | 1373 Register array_pointer = t1; |
1380 | 1374 |
1381 // Does the native context match? | 1375 // Does the native context match? |
1382 __ sll(at, index, kPointerSizeLog2 - kSmiTagSize); | 1376 __ sll(at, index, kPointerSizeLog2 - kSmiTagSize); |
1383 __ Addu(array_pointer, map, Operand(at)); | 1377 __ Addu(array_pointer, map, Operand(at)); |
1384 __ lw(temp, FieldMemOperand(array_pointer, | 1378 __ lw(temp, FieldMemOperand(array_pointer, |
1385 SharedFunctionInfo::kOffsetToPreviousContext)); | 1379 SharedFunctionInfo::kOffsetToPreviousContext)); |
1386 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); | 1380 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); |
1387 __ Branch(&loop_bottom, ne, temp, Operand(native_context)); | 1381 __ Branch(&loop_bottom, ne, temp, Operand(native_context)); |
| 1382 // Literals available? |
| 1383 __ lw(temp, FieldMemOperand(array_pointer, |
| 1384 SharedFunctionInfo::kOffsetToPreviousLiterals)); |
| 1385 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); |
| 1386 __ JumpIfSmi(temp, &gotta_call_runtime); |
| 1387 |
| 1388 // Save the literals in the closure. |
| 1389 __ lw(t0, MemOperand(sp, 0)); |
| 1390 __ sw(temp, FieldMemOperand(t0, JSFunction::kLiteralsOffset)); |
| 1391 __ push(index); |
| 1392 __ RecordWriteField(t0, JSFunction::kLiteralsOffset, temp, index, |
| 1393 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, |
| 1394 OMIT_SMI_CHECK); |
| 1395 __ pop(index); |
1388 | 1396 |
1389 // Code available? | 1397 // Code available? |
1390 Register entry = t0; | 1398 Register entry = t0; |
1391 __ lw(entry, | 1399 __ lw(entry, |
1392 FieldMemOperand(array_pointer, | 1400 FieldMemOperand(array_pointer, |
1393 SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 1401 SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
1394 __ lw(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); | 1402 __ lw(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); |
1395 __ JumpIfSmi(entry, &try_shared); | 1403 __ JumpIfSmi(entry, &try_shared); |
1396 | 1404 |
1397 // Found code. Get it into the closure and return. | 1405 // Found literals and code. Get them into the closure and return. |
1398 __ pop(closure); | 1406 __ pop(closure); |
1399 // Store code entry in the closure. | 1407 // Store code entry in the closure. |
1400 __ Addu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1408 __ Addu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1401 __ sw(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); | 1409 __ sw(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); |
1402 __ RecordWriteCodeEntryField(closure, entry, t1); | 1410 __ RecordWriteCodeEntryField(closure, entry, t1); |
1403 | 1411 |
1404 // Link the closure into the optimized function list. | 1412 // Link the closure into the optimized function list. |
1405 // t0 : code entry | 1413 // t0 : code entry |
1406 // a3 : native context | 1414 // a3 : native context |
1407 // a1 : closure | 1415 // a1 : closure |
(...skipping 14 matching lines...) Expand all Loading... |
1422 __ mov(closure, t1); | 1430 __ mov(closure, t1); |
1423 __ pop(new_target); | 1431 __ pop(new_target); |
1424 __ pop(argument_count); | 1432 __ pop(argument_count); |
1425 __ Jump(entry); | 1433 __ Jump(entry); |
1426 | 1434 |
1427 __ bind(&loop_bottom); | 1435 __ bind(&loop_bottom); |
1428 __ Subu(index, index, | 1436 __ Subu(index, index, |
1429 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); | 1437 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); |
1430 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); | 1438 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); |
1431 | 1439 |
1432 // We found no code. | 1440 // We found neither literals nor code. |
1433 __ jmp(&gotta_call_runtime); | 1441 __ jmp(&gotta_call_runtime); |
1434 | 1442 |
1435 __ bind(&try_shared); | 1443 __ bind(&try_shared); |
1436 __ pop(closure); | 1444 __ pop(closure); |
1437 __ pop(new_target); | 1445 __ pop(new_target); |
1438 __ pop(argument_count); | 1446 __ pop(argument_count); |
1439 __ lw(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1447 __ lw(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
1440 // Is the shared function marked for tier up? | 1448 // Is the shared function marked for tier up? |
1441 __ lbu(t1, FieldMemOperand(entry, | 1449 __ lbu(t1, FieldMemOperand(entry, |
1442 SharedFunctionInfo::kMarkedForTierUpByteOffset)); | 1450 SharedFunctionInfo::kMarkedForTierUpByteOffset)); |
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2961 __ break_(0xCC); | 2969 __ break_(0xCC); |
2962 } | 2970 } |
2963 } | 2971 } |
2964 | 2972 |
2965 #undef __ | 2973 #undef __ |
2966 | 2974 |
2967 } // namespace internal | 2975 } // namespace internal |
2968 } // namespace v8 | 2976 } // namespace v8 |
2969 | 2977 |
2970 #endif // V8_TARGET_ARCH_MIPS | 2978 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |