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