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

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

Issue 2144183002: Revert "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, 5 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/builtins/x64/builtins-x64.cc ('k') | src/objects.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_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 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 SharedFunctionInfo::kOffsetToPreviousContext)); 882 SharedFunctionInfo::kOffsetToPreviousContext));
883 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset)); 883 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset));
884 __ cmp(temp, native_context); 884 __ cmp(temp, native_context);
885 __ j(not_equal, &loop_bottom); 885 __ j(not_equal, &loop_bottom);
886 // OSR id set to none? 886 // OSR id set to none?
887 __ mov(temp, FieldOperand(map, index, times_half_pointer_size, 887 __ mov(temp, FieldOperand(map, index, times_half_pointer_size,
888 SharedFunctionInfo::kOffsetToPreviousOsrAstId)); 888 SharedFunctionInfo::kOffsetToPreviousOsrAstId));
889 const int bailout_id = BailoutId::None().ToInt(); 889 const int bailout_id = BailoutId::None().ToInt();
890 __ cmp(temp, Immediate(Smi::FromInt(bailout_id))); 890 __ cmp(temp, Immediate(Smi::FromInt(bailout_id)));
891 __ j(not_equal, &loop_bottom); 891 __ j(not_equal, &loop_bottom);
892
893 // Literals available? 892 // Literals available?
894 Label got_literals, maybe_cleared_weakcell;
895 __ mov(temp, FieldOperand(map, index, times_half_pointer_size, 893 __ mov(temp, FieldOperand(map, index, times_half_pointer_size,
896 SharedFunctionInfo::kOffsetToPreviousLiterals)); 894 SharedFunctionInfo::kOffsetToPreviousLiterals));
897
898 // temp contains either a WeakCell pointing to the literals array or the
899 // literals array directly.
900 STATIC_ASSERT(WeakCell::kValueOffset == FixedArray::kLengthOffset);
901 __ JumpIfSmi(FieldOperand(temp, WeakCell::kValueOffset),
902 &maybe_cleared_weakcell);
903 // The WeakCell value is a pointer, therefore it's a valid literals array.
904 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset)); 895 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset));
905 __ jmp(&got_literals); 896 __ JumpIfSmi(temp, &gotta_call_runtime);
906
907 // We have a smi. If it's 0, then we are looking at a cleared WeakCell
908 // around the literals array, and we should visit the runtime. If it's > 0,
909 // then temp already contains the literals array.
910 __ bind(&maybe_cleared_weakcell);
911 __ cmp(FieldOperand(temp, WeakCell::kValueOffset), Immediate(0));
912 __ j(equal, &gotta_call_runtime);
913 897
914 // Save the literals in the closure. 898 // Save the literals in the closure.
915 __ bind(&got_literals);
916 __ mov(ecx, Operand(esp, 0)); 899 __ mov(ecx, Operand(esp, 0));
917 __ mov(FieldOperand(ecx, JSFunction::kLiteralsOffset), temp); 900 __ mov(FieldOperand(ecx, JSFunction::kLiteralsOffset), temp);
918 __ push(index); 901 __ push(index);
919 __ RecordWriteField(ecx, JSFunction::kLiteralsOffset, temp, index, 902 __ RecordWriteField(ecx, JSFunction::kLiteralsOffset, temp, index,
920 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); 903 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
921 __ pop(index); 904 __ pop(index);
922 905
923 // Code available? 906 // Code available?
924 Register entry = ecx; 907 Register entry = ecx;
925 __ mov(entry, FieldOperand(map, index, times_half_pointer_size, 908 __ mov(entry, FieldOperand(map, index, times_half_pointer_size,
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after
3063 3046
3064 // And "return" to the OSR entry point of the function. 3047 // And "return" to the OSR entry point of the function.
3065 __ ret(0); 3048 __ ret(0);
3066 } 3049 }
3067 3050
3068 #undef __ 3051 #undef __
3069 } // namespace internal 3052 } // namespace internal
3070 } // namespace v8 3053 } // namespace v8
3071 3054
3072 #endif // V8_TARGET_ARCH_X87 3055 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/builtins/x64/builtins-x64.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698