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

Side by Side Diff: src/arm64/builtins-arm64.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/arm/builtins-arm.cc ('k') | src/ia32/builtins-ia32.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 5 #if V8_TARGET_ARCH_ARM64
6 6
7 #include "src/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 SharedFunctionInfo::kOffsetToPreviousContext)); 1301 SharedFunctionInfo::kOffsetToPreviousContext));
1302 __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1302 __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1303 __ Cmp(temp, native_context); 1303 __ Cmp(temp, native_context);
1304 __ B(ne, &loop_bottom); 1304 __ B(ne, &loop_bottom);
1305 // OSR id set to none? 1305 // OSR id set to none?
1306 __ Ldr(temp, FieldMemOperand(array_pointer, 1306 __ Ldr(temp, FieldMemOperand(array_pointer,
1307 SharedFunctionInfo::kOffsetToPreviousOsrAstId)); 1307 SharedFunctionInfo::kOffsetToPreviousOsrAstId));
1308 const int bailout_id = BailoutId::None().ToInt(); 1308 const int bailout_id = BailoutId::None().ToInt();
1309 __ Cmp(temp, Operand(Smi::FromInt(bailout_id))); 1309 __ Cmp(temp, Operand(Smi::FromInt(bailout_id)));
1310 __ B(ne, &loop_bottom); 1310 __ B(ne, &loop_bottom);
1311
1311 // Literals available? 1312 // Literals available?
1313 Label got_literals, maybe_cleared_weakcell;
1314 Register temp2 = x7;
1312 __ Ldr(temp, FieldMemOperand(array_pointer, 1315 __ Ldr(temp, FieldMemOperand(array_pointer,
1313 SharedFunctionInfo::kOffsetToPreviousLiterals)); 1316 SharedFunctionInfo::kOffsetToPreviousLiterals));
1317 // temp contains either a WeakCell pointing to the literals array or the
1318 // literals array directly.
1319 STATIC_ASSERT(WeakCell::kValueOffset == FixedArray::kLengthOffset);
1320 __ Ldr(temp2, FieldMemOperand(temp, WeakCell::kValueOffset));
1321 __ JumpIfSmi(temp2, &maybe_cleared_weakcell);
1322 // temp2 is a pointer, therefore temp is a WeakCell pointing to a literals
1323 // array.
1314 __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset)); 1324 __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1315 __ JumpIfSmi(temp, &gotta_call_runtime); 1325 __ jmp(&got_literals);
1326
1327 // r4 is a smi. If it's 0, then we are looking at a cleared WeakCell
1328 // around the literals array, and we should visit the runtime. If it's > 0,
1329 // then temp already contains the literals array.
1330 __ bind(&maybe_cleared_weakcell);
1331 __ Cmp(temp2, Operand(Smi::FromInt(0)));
1332 __ B(eq, &gotta_call_runtime);
1316 1333
1317 // Save the literals in the closure. 1334 // Save the literals in the closure.
1335 __ bind(&got_literals);
1318 __ Str(temp, FieldMemOperand(closure, JSFunction::kLiteralsOffset)); 1336 __ Str(temp, FieldMemOperand(closure, JSFunction::kLiteralsOffset));
1319 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, x7, 1337 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, x7,
1320 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET, 1338 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1321 OMIT_SMI_CHECK); 1339 OMIT_SMI_CHECK);
1322 1340
1323 // Code available? 1341 // Code available?
1324 Register entry = x7; 1342 Register entry = x7;
1325 __ Ldr(entry, 1343 __ Ldr(entry,
1326 FieldMemOperand(array_pointer, 1344 FieldMemOperand(array_pointer,
1327 SharedFunctionInfo::kOffsetToPreviousCachedCode)); 1345 SharedFunctionInfo::kOffsetToPreviousCachedCode));
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
2909 } 2927 }
2910 } 2928 }
2911 2929
2912 2930
2913 #undef __ 2931 #undef __
2914 2932
2915 } // namespace internal 2933 } // namespace internal
2916 } // namespace v8 2934 } // namespace v8
2917 2935
2918 #endif // V8_TARGET_ARCH_ARM 2936 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698