Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Side by Side Diff: src/builtins/mips/builtins-mips.cc

Issue 2620753003: [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: GCSTRESS fix. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/builtins/ia32/builtins-ia32.cc ('k') | src/builtins/mips64/builtins-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 // -- a1 : target function (preserved for callee) 1342 // -- a1 : target function (preserved for callee)
1343 // ----------------------------------- 1343 // -----------------------------------
1344 // First lookup code, maybe we don't need to compile! 1344 // First lookup code, maybe we don't need to compile!
1345 Label gotta_call_runtime, gotta_call_runtime_no_stack; 1345 Label gotta_call_runtime, gotta_call_runtime_no_stack;
1346 Label try_shared; 1346 Label try_shared;
1347 Label loop_top, loop_bottom; 1347 Label loop_top, loop_bottom;
1348 1348
1349 Register argument_count = a0; 1349 Register argument_count = a0;
1350 Register closure = a1; 1350 Register closure = a1;
1351 Register new_target = a3; 1351 Register new_target = a3;
1352 Register map = a0;
1353 Register index = a2;
1354
1355 // Do we have a valid feedback vector?
1356 __ lw(index, FieldMemOperand(closure, JSFunction::kLiteralsOffset));
1357 __ lw(index, FieldMemOperand(index, LiteralsArray::kFeedbackVectorOffset));
1358 __ JumpIfRoot(index, Heap::kUndefinedValueRootIndex,
1359 &gotta_call_runtime_no_stack);
1360
1352 __ push(argument_count); 1361 __ push(argument_count);
1353 __ push(new_target); 1362 __ push(new_target);
1354 __ push(closure); 1363 __ push(closure);
1355 1364
1356 Register map = a0;
1357 Register index = a2;
1358 __ lw(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1365 __ lw(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1359 __ lw(map, FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset)); 1366 __ lw(map, FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1360 __ lw(index, FieldMemOperand(map, FixedArray::kLengthOffset)); 1367 __ lw(index, FieldMemOperand(map, FixedArray::kLengthOffset));
1361 __ Branch(&gotta_call_runtime, lt, index, Operand(Smi::FromInt(2))); 1368 __ Branch(&gotta_call_runtime, lt, index, Operand(Smi::FromInt(2)));
1362 1369
1363 // Find literals.
1364 // a3 : native context 1370 // a3 : native context
1365 // a2 : length / index 1371 // a2 : length / index
1366 // a0 : optimized code map 1372 // a0 : optimized code map
1367 // stack[0] : new target 1373 // stack[0] : new target
1368 // stack[4] : closure 1374 // stack[4] : closure
1369 Register native_context = a3; 1375 Register native_context = a3;
1370 __ lw(native_context, NativeContextMemOperand()); 1376 __ lw(native_context, NativeContextMemOperand());
1371 1377
1372 __ bind(&loop_top); 1378 __ bind(&loop_top);
1373 Register temp = a1; 1379 Register temp = a1;
1374 Register array_pointer = t1; 1380 Register array_pointer = t1;
1375 1381
1376 // Does the native context match? 1382 // Does the native context match?
1377 __ sll(at, index, kPointerSizeLog2 - kSmiTagSize); 1383 __ sll(at, index, kPointerSizeLog2 - kSmiTagSize);
1378 __ Addu(array_pointer, map, Operand(at)); 1384 __ Addu(array_pointer, map, Operand(at));
1379 __ lw(temp, FieldMemOperand(array_pointer, 1385 __ lw(temp, FieldMemOperand(array_pointer,
1380 SharedFunctionInfo::kOffsetToPreviousContext)); 1386 SharedFunctionInfo::kOffsetToPreviousContext));
1381 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1387 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1382 __ Branch(&loop_bottom, ne, temp, Operand(native_context)); 1388 __ 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 1389
1398 // Code available? 1390 // Code available?
1399 Register entry = t0; 1391 Register entry = t0;
1400 __ lw(entry, 1392 __ lw(entry,
1401 FieldMemOperand(array_pointer, 1393 FieldMemOperand(array_pointer,
1402 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1394 SharedFunctionInfo::kOffsetToPreviousCachedCode));
1403 __ lw(entry, FieldMemOperand(entry, WeakCell::kValueOffset)); 1395 __ lw(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1404 __ JumpIfSmi(entry, &try_shared); 1396 __ JumpIfSmi(entry, &try_shared);
1405 1397
1406 // Found literals and code. Get them into the closure and return. 1398 // Found code. Get it into the closure and return.
1407 __ pop(closure); 1399 __ pop(closure);
1408 // Store code entry in the closure. 1400 // Store code entry in the closure.
1409 __ Addu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag)); 1401 __ Addu(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1410 __ sw(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset)); 1402 __ sw(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1411 __ RecordWriteCodeEntryField(closure, entry, t1); 1403 __ RecordWriteCodeEntryField(closure, entry, t1);
1412 1404
1413 // Link the closure into the optimized function list. 1405 // Link the closure into the optimized function list.
1414 // t0 : code entry 1406 // t0 : code entry
1415 // a3 : native context 1407 // a3 : native context
1416 // a1 : closure 1408 // a1 : closure
(...skipping 14 matching lines...) Expand all
1431 __ mov(closure, t1); 1423 __ mov(closure, t1);
1432 __ pop(new_target); 1424 __ pop(new_target);
1433 __ pop(argument_count); 1425 __ pop(argument_count);
1434 __ Jump(entry); 1426 __ Jump(entry);
1435 1427
1436 __ bind(&loop_bottom); 1428 __ bind(&loop_bottom);
1437 __ Subu(index, index, 1429 __ Subu(index, index,
1438 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength))); 1430 Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength)));
1439 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1))); 1431 __ Branch(&loop_top, gt, index, Operand(Smi::FromInt(1)));
1440 1432
1441 // We found neither literals nor code. 1433 // We found no code.
1442 __ jmp(&gotta_call_runtime); 1434 __ jmp(&gotta_call_runtime);
1443 1435
1444 __ bind(&try_shared); 1436 __ bind(&try_shared);
1445 __ pop(closure); 1437 __ pop(closure);
1446 __ pop(new_target); 1438 __ pop(new_target);
1447 __ pop(argument_count); 1439 __ pop(argument_count);
1448 __ lw(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset)); 1440 __ lw(entry, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1449 // Is the shared function marked for tier up? 1441 // Is the shared function marked for tier up?
1450 __ lbu(t1, FieldMemOperand(entry, 1442 __ lbu(t1, FieldMemOperand(entry,
1451 SharedFunctionInfo::kMarkedForTierUpByteOffset)); 1443 SharedFunctionInfo::kMarkedForTierUpByteOffset));
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after
2971 __ break_(0xCC); 2963 __ break_(0xCC);
2972 } 2964 }
2973 } 2965 }
2974 2966
2975 #undef __ 2967 #undef __
2976 2968
2977 } // namespace internal 2969 } // namespace internal
2978 } // namespace v8 2970 } // namespace v8
2979 2971
2980 #endif // V8_TARGET_ARCH_MIPS 2972 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/builtins/ia32/builtins-ia32.cc ('k') | src/builtins/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698