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

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

Issue 2031123003: Avoid creating weak cells for literal arrays that are empty of literals. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 4 years, 6 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/ia32/builtins-ia32.cc ('k') | src/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 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 __ Addu(array_pointer, map, Operand(at)); 1287 __ Addu(array_pointer, map, Operand(at));
1288 __ lw(temp, FieldMemOperand(array_pointer, 1288 __ lw(temp, FieldMemOperand(array_pointer,
1289 SharedFunctionInfo::kOffsetToPreviousContext)); 1289 SharedFunctionInfo::kOffsetToPreviousContext));
1290 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1290 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1291 __ Branch(&loop_bottom, ne, temp, Operand(native_context)); 1291 __ Branch(&loop_bottom, ne, temp, Operand(native_context));
1292 // OSR id set to none? 1292 // OSR id set to none?
1293 __ lw(temp, FieldMemOperand(array_pointer, 1293 __ lw(temp, FieldMemOperand(array_pointer,
1294 SharedFunctionInfo::kOffsetToPreviousOsrAstId)); 1294 SharedFunctionInfo::kOffsetToPreviousOsrAstId));
1295 const int bailout_id = BailoutId::None().ToInt(); 1295 const int bailout_id = BailoutId::None().ToInt();
1296 __ Branch(&loop_bottom, ne, temp, Operand(Smi::FromInt(bailout_id))); 1296 __ Branch(&loop_bottom, ne, temp, Operand(Smi::FromInt(bailout_id)));
1297
1297 // Literals available? 1298 // Literals available?
1299 Label got_literals, maybe_cleared_weakcell;
1298 __ lw(temp, FieldMemOperand(array_pointer, 1300 __ lw(temp, FieldMemOperand(array_pointer,
1299 SharedFunctionInfo::kOffsetToPreviousLiterals)); 1301 SharedFunctionInfo::kOffsetToPreviousLiterals));
1302 // temp contains either a WeakCell pointing to the literals array or the
1303 // literals array directly.
1304 STATIC_ASSERT(WeakCell::kValueOffset == FixedArray::kLengthOffset);
1305 __ lw(t0, FieldMemOperand(temp, WeakCell::kValueOffset));
1306 __ JumpIfSmi(t0, &maybe_cleared_weakcell);
1307 // t0 is a pointer, therefore temp is a WeakCell pointing to a literals array.
1300 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1308 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1301 __ JumpIfSmi(temp, &gotta_call_runtime); 1309 __ jmp(&got_literals);
1310
1311 // t0 is a smi. If it's 0, then we are looking at a cleared WeakCell
1312 // around the literals array, and we should visit the runtime. If it's > 0,
1313 // then temp already contains the literals array.
1314 __ bind(&maybe_cleared_weakcell);
1315 __ Branch(&gotta_call_runtime, eq, t0, Operand(Smi::FromInt(0)));
1302 1316
1303 // Save the literals in the closure. 1317 // Save the literals in the closure.
1318 __ bind(&got_literals);
1304 __ lw(t0, MemOperand(sp, 0)); 1319 __ lw(t0, MemOperand(sp, 0));
1305 __ sw(temp, FieldMemOperand(t0, JSFunction::kLiteralsOffset)); 1320 __ sw(temp, FieldMemOperand(t0, JSFunction::kLiteralsOffset));
1306 __ push(index); 1321 __ push(index);
1307 __ RecordWriteField(t0, JSFunction::kLiteralsOffset, temp, index, 1322 __ RecordWriteField(t0, JSFunction::kLiteralsOffset, temp, index,
1308 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, 1323 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1309 OMIT_SMI_CHECK); 1324 OMIT_SMI_CHECK);
1310 __ pop(index); 1325 __ pop(index);
1311 1326
1312 // Code available? 1327 // Code available?
1313 Register entry = t0; 1328 Register entry = t0;
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
2881 } 2896 }
2882 } 2897 }
2883 2898
2884 2899
2885 #undef __ 2900 #undef __
2886 2901
2887 } // namespace internal 2902 } // namespace internal
2888 } // namespace v8 2903 } // namespace v8
2889 2904
2890 #endif // V8_TARGET_ARCH_MIPS 2905 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/builtins-ia32.cc ('k') | src/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698