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

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

Issue 2081663004: X87: 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: 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 | no next file » | 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_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 SharedFunctionInfo::kOffsetToPreviousContext)); 891 SharedFunctionInfo::kOffsetToPreviousContext));
892 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset)); 892 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset));
893 __ cmp(temp, native_context); 893 __ cmp(temp, native_context);
894 __ j(not_equal, &loop_bottom); 894 __ j(not_equal, &loop_bottom);
895 // OSR id set to none? 895 // OSR id set to none?
896 __ mov(temp, FieldOperand(map, index, times_half_pointer_size, 896 __ mov(temp, FieldOperand(map, index, times_half_pointer_size,
897 SharedFunctionInfo::kOffsetToPreviousOsrAstId)); 897 SharedFunctionInfo::kOffsetToPreviousOsrAstId));
898 const int bailout_id = BailoutId::None().ToInt(); 898 const int bailout_id = BailoutId::None().ToInt();
899 __ cmp(temp, Immediate(Smi::FromInt(bailout_id))); 899 __ cmp(temp, Immediate(Smi::FromInt(bailout_id)));
900 __ j(not_equal, &loop_bottom); 900 __ j(not_equal, &loop_bottom);
901
901 // Literals available? 902 // Literals available?
903 Label got_literals, maybe_cleared_weakcell;
902 __ mov(temp, FieldOperand(map, index, times_half_pointer_size, 904 __ mov(temp, FieldOperand(map, index, times_half_pointer_size,
903 SharedFunctionInfo::kOffsetToPreviousLiterals)); 905 SharedFunctionInfo::kOffsetToPreviousLiterals));
906
907 // temp contains either a WeakCell pointing to the literals array or the
908 // literals array directly.
909 STATIC_ASSERT(WeakCell::kValueOffset == FixedArray::kLengthOffset);
910 __ JumpIfSmi(FieldOperand(temp, WeakCell::kValueOffset),
911 &maybe_cleared_weakcell);
912 // The WeakCell value is a pointer, therefore it's a valid literals array.
904 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset)); 913 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset));
905 __ JumpIfSmi(temp, &gotta_call_runtime); 914 __ jmp(&got_literals);
915
916 // We have a smi. If it's 0, then we are looking at a cleared WeakCell
917 // around the literals array, and we should visit the runtime. If it's > 0,
918 // then temp already contains the literals array.
919 __ bind(&maybe_cleared_weakcell);
920 __ cmp(FieldOperand(temp, WeakCell::kValueOffset), Immediate(0));
921 __ j(equal, &gotta_call_runtime);
906 922
907 // Save the literals in the closure. 923 // Save the literals in the closure.
924 __ bind(&got_literals);
908 __ mov(ecx, Operand(esp, 0)); 925 __ mov(ecx, Operand(esp, 0));
909 __ mov(FieldOperand(ecx, JSFunction::kLiteralsOffset), temp); 926 __ mov(FieldOperand(ecx, JSFunction::kLiteralsOffset), temp);
910 __ push(index); 927 __ push(index);
911 __ RecordWriteField(ecx, JSFunction::kLiteralsOffset, temp, index, 928 __ RecordWriteField(ecx, JSFunction::kLiteralsOffset, temp, index,
912 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); 929 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
913 __ pop(index); 930 __ pop(index);
914 931
915 // Code available? 932 // Code available?
916 Register entry = ecx; 933 Register entry = ecx;
917 __ mov(entry, FieldOperand(map, index, times_half_pointer_size, 934 __ mov(entry, FieldOperand(map, index, times_half_pointer_size,
(...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after
2973 // And "return" to the OSR entry point of the function. 2990 // And "return" to the OSR entry point of the function.
2974 __ ret(0); 2991 __ ret(0);
2975 } 2992 }
2976 2993
2977 2994
2978 #undef __ 2995 #undef __
2979 } // namespace internal 2996 } // namespace internal
2980 } // namespace v8 2997 } // namespace v8
2981 2998
2982 #endif // V8_TARGET_ARCH_X87 2999 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698