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

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: Ports. 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
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 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 __ Addu(array_pointer, map, Operand(at)); 1266 __ Addu(array_pointer, map, Operand(at));
1267 __ lw(temp, FieldMemOperand(array_pointer, 1267 __ lw(temp, FieldMemOperand(array_pointer,
1268 SharedFunctionInfo::kOffsetToPreviousContext)); 1268 SharedFunctionInfo::kOffsetToPreviousContext));
1269 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1269 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1270 __ Branch(&loop_bottom, ne, temp, Operand(native_context)); 1270 __ Branch(&loop_bottom, ne, temp, Operand(native_context));
1271 // OSR id set to none? 1271 // OSR id set to none?
1272 __ lw(temp, FieldMemOperand(array_pointer, 1272 __ lw(temp, FieldMemOperand(array_pointer,
1273 SharedFunctionInfo::kOffsetToPreviousOsrAstId)); 1273 SharedFunctionInfo::kOffsetToPreviousOsrAstId));
1274 const int bailout_id = BailoutId::None().ToInt(); 1274 const int bailout_id = BailoutId::None().ToInt();
1275 __ Branch(&loop_bottom, ne, temp, Operand(Smi::FromInt(bailout_id))); 1275 __ Branch(&loop_bottom, ne, temp, Operand(Smi::FromInt(bailout_id)));
1276
1276 // Literals available? 1277 // Literals available?
1278 Label got_literals, maybe_cleared_weakcell;
1277 __ lw(temp, FieldMemOperand(array_pointer, 1279 __ lw(temp, FieldMemOperand(array_pointer,
1278 SharedFunctionInfo::kOffsetToPreviousLiterals)); 1280 SharedFunctionInfo::kOffsetToPreviousLiterals));
1281 // temp contains either a WeakCell pointing to the literals array or the
1282 // literals array directly.
1283 STATIC_ASSERT(WeakCell::kValueOffset == FixedArray::kLengthOffset);
1284 __ lw(t0, FieldMemOperand(temp, WeakCell::kValueOffset));
1285 __ JumpIfSmi(t0, &maybe_cleared_weakcell);
1286 // t0 is a pointer, therefore temp is a WeakCell pointing to a literals array.
1279 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1287 __ lw(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1280 __ JumpIfSmi(temp, &gotta_call_runtime); 1288 __ jmp(&got_literals);
1289
1290 // t0 is a smi. If it's 0, then we are looking at a cleared WeakCell
1291 // around the literals array, and we should visit the runtime. If it's > 0,
1292 // then temp already contains the literals array.
1293 __ bind(&maybe_cleared_weakcell);
1294 __ Branch(&gotta_call_runtime, eq, t0, Operand(Smi::FromInt(0)));
1281 1295
1282 // Save the literals in the closure. 1296 // Save the literals in the closure.
1297 __ bind(&got_literals);
1283 __ lw(t0, MemOperand(sp, 0)); 1298 __ lw(t0, MemOperand(sp, 0));
1284 __ sw(temp, FieldMemOperand(t0, JSFunction::kLiteralsOffset)); 1299 __ sw(temp, FieldMemOperand(t0, JSFunction::kLiteralsOffset));
1285 __ push(index); 1300 __ push(index);
1286 __ RecordWriteField(t0, JSFunction::kLiteralsOffset, temp, index, 1301 __ RecordWriteField(t0, JSFunction::kLiteralsOffset, temp, index,
1287 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, 1302 kRAHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1288 OMIT_SMI_CHECK); 1303 OMIT_SMI_CHECK);
1289 __ pop(index); 1304 __ pop(index);
1290 1305
1291 // Code available? 1306 // Code available?
1292 Register entry = t0; 1307 Register entry = t0;
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
2860 } 2875 }
2861 } 2876 }
2862 2877
2863 2878
2864 #undef __ 2879 #undef __
2865 2880
2866 } // namespace internal 2881 } // namespace internal
2867 } // namespace v8 2882 } // namespace v8
2868 2883
2869 #endif // V8_TARGET_ARCH_MIPS 2884 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698