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