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

Side by Side Diff: src/arm/builtins-arm.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 | « no previous file | src/arm64/builtins-arm64.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_ARM 5 #if V8_TARGET_ARCH_ARM
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 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 SharedFunctionInfo::kOffsetToPreviousContext)); 1290 SharedFunctionInfo::kOffsetToPreviousContext));
1291 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1291 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1292 __ cmp(temp, native_context); 1292 __ cmp(temp, native_context);
1293 __ b(ne, &loop_bottom); 1293 __ b(ne, &loop_bottom);
1294 // OSR id set to none? 1294 // OSR id set to none?
1295 __ ldr(temp, FieldMemOperand(array_pointer, 1295 __ ldr(temp, FieldMemOperand(array_pointer,
1296 SharedFunctionInfo::kOffsetToPreviousOsrAstId)); 1296 SharedFunctionInfo::kOffsetToPreviousOsrAstId));
1297 const int bailout_id = BailoutId::None().ToInt(); 1297 const int bailout_id = BailoutId::None().ToInt();
1298 __ cmp(temp, Operand(Smi::FromInt(bailout_id))); 1298 __ cmp(temp, Operand(Smi::FromInt(bailout_id)));
1299 __ b(ne, &loop_bottom); 1299 __ b(ne, &loop_bottom);
1300
1300 // Literals available? 1301 // Literals available?
1302 Label got_literals, maybe_cleared_weakcell;
1301 __ ldr(temp, FieldMemOperand(array_pointer, 1303 __ ldr(temp, FieldMemOperand(array_pointer,
1302 SharedFunctionInfo::kOffsetToPreviousLiterals)); 1304 SharedFunctionInfo::kOffsetToPreviousLiterals));
1305 // temp contains either a WeakCell pointing to the literals array or the
1306 // literals array directly.
1307 STATIC_ASSERT(WeakCell::kValueOffset == FixedArray::kLengthOffset);
1308 __ ldr(r4, FieldMemOperand(temp, WeakCell::kValueOffset));
1309 __ JumpIfSmi(r4, &maybe_cleared_weakcell);
1310 // r4 is a pointer, therefore temp is a WeakCell pointing to a literals array.
1303 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1311 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1304 __ JumpIfSmi(temp, &gotta_call_runtime); 1312 __ jmp(&got_literals);
1313
1314 // r4 is a smi. If it's 0, then we are looking at a cleared WeakCell
1315 // around the literals array, and we should visit the runtime. If it's > 0,
1316 // then temp already contains the literals array.
1317 __ bind(&maybe_cleared_weakcell);
1318 __ cmp(r4, Operand(Smi::FromInt(0)));
1319 __ b(eq, &gotta_call_runtime);
1305 1320
1306 // Save the literals in the closure. 1321 // Save the literals in the closure.
1322 __ bind(&got_literals);
1307 __ ldr(r4, MemOperand(sp, 0)); 1323 __ ldr(r4, MemOperand(sp, 0));
1308 __ str(temp, FieldMemOperand(r4, JSFunction::kLiteralsOffset)); 1324 __ str(temp, FieldMemOperand(r4, JSFunction::kLiteralsOffset));
1309 __ push(index); 1325 __ push(index);
1310 __ RecordWriteField(r4, JSFunction::kLiteralsOffset, temp, index, 1326 __ RecordWriteField(r4, JSFunction::kLiteralsOffset, temp, index,
1311 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, 1327 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1312 OMIT_SMI_CHECK); 1328 OMIT_SMI_CHECK);
1313 __ pop(index); 1329 __ pop(index);
1314 1330
1315 // Code available? 1331 // Code available?
1316 Register entry = r4; 1332 Register entry = r4;
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after
2797 } 2813 }
2798 } 2814 }
2799 2815
2800 2816
2801 #undef __ 2817 #undef __
2802 2818
2803 } // namespace internal 2819 } // namespace internal
2804 } // namespace v8 2820 } // namespace v8
2805 2821
2806 #endif // V8_TARGET_ARCH_ARM 2822 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/builtins-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698