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

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

Issue 767253002: Refactor Map::ConstructionCount. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix assert Created 6 years 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/heap/heap.cc ('k') | src/objects.h » ('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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // comments in Runtime_NewObject in runtime.cc). In which case the 153 // comments in Runtime_NewObject in runtime.cc). In which case the
154 // initial map's instance type would be JS_FUNCTION_TYPE. 154 // initial map's instance type would be JS_FUNCTION_TYPE.
155 // edi: constructor 155 // edi: constructor
156 // eax: initial map 156 // eax: initial map
157 __ CmpInstanceType(eax, JS_FUNCTION_TYPE); 157 __ CmpInstanceType(eax, JS_FUNCTION_TYPE);
158 __ j(equal, &rt_call); 158 __ j(equal, &rt_call);
159 159
160 if (!is_api_function) { 160 if (!is_api_function) {
161 Label allocate; 161 Label allocate;
162 // The code below relies on these assumptions. 162 // The code below relies on these assumptions.
163 STATIC_ASSERT(JSFunction::kNoSlackTracking == 0); 163 STATIC_ASSERT(Map::Counter::kShift + Map::Counter::kSize == 32);
164 STATIC_ASSERT(Map::ConstructionCount::kShift +
165 Map::ConstructionCount::kSize == 32);
166 // Check if slack tracking is enabled. 164 // Check if slack tracking is enabled.
167 __ mov(esi, FieldOperand(eax, Map::kBitField3Offset)); 165 __ mov(esi, FieldOperand(eax, Map::kBitField3Offset));
168 __ shr(esi, Map::ConstructionCount::kShift); 166 __ shr(esi, Map::Counter::kShift);
169 __ j(zero, &allocate); // JSFunction::kNoSlackTracking 167 __ cmp(esi, Map::kSlackTrackingCounterEnd);
168 __ j(less, &allocate);
170 // Decrease generous allocation count. 169 // Decrease generous allocation count.
171 __ sub(FieldOperand(eax, Map::kBitField3Offset), 170 __ sub(FieldOperand(eax, Map::kBitField3Offset),
172 Immediate(1 << Map::ConstructionCount::kShift)); 171 Immediate(1 << Map::Counter::kShift));
173 172
174 __ cmp(esi, JSFunction::kFinishSlackTracking); 173 __ cmp(esi, Map::kSlackTrackingCounterEnd);
175 __ j(not_equal, &allocate); 174 __ j(not_equal, &allocate);
176 175
177 __ push(eax); 176 __ push(eax);
178 __ push(edi); 177 __ push(edi);
179 178
180 __ push(edi); // constructor 179 __ push(edi); // constructor
181 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1); 180 __ CallRuntime(Runtime::kFinalizeInstanceSize, 1);
182 181
183 __ pop(edi); 182 __ pop(edi);
184 __ pop(eax); 183 __ pop(eax);
185 __ xor_(esi, esi); // JSFunction::kNoSlackTracking 184 __ mov(esi, Map::kSlackTrackingCounterEnd - 1);
186 185
187 __ bind(&allocate); 186 __ bind(&allocate);
188 } 187 }
189 188
190 // Now allocate the JSObject on the heap. 189 // Now allocate the JSObject on the heap.
191 // edi: constructor 190 // edi: constructor
192 // eax: initial map 191 // eax: initial map
193 __ movzx_b(edi, FieldOperand(eax, Map::kInstanceSizeOffset)); 192 __ movzx_b(edi, FieldOperand(eax, Map::kInstanceSizeOffset));
194 __ shl(edi, kPointerSizeLog2); 193 __ shl(edi, kPointerSizeLog2);
195 if (create_memento) { 194 if (create_memento) {
(...skipping 16 matching lines...) Expand all
212 // eax: initial map 211 // eax: initial map
213 // ebx: JSObject 212 // ebx: JSObject
214 // edi: start of next object (including memento if create_memento) 213 // edi: start of next object (including memento if create_memento)
215 // esi: slack tracking counter (non-API function case) 214 // esi: slack tracking counter (non-API function case)
216 __ mov(edx, factory->undefined_value()); 215 __ mov(edx, factory->undefined_value());
217 __ lea(ecx, Operand(ebx, JSObject::kHeaderSize)); 216 __ lea(ecx, Operand(ebx, JSObject::kHeaderSize));
218 if (!is_api_function) { 217 if (!is_api_function) {
219 Label no_inobject_slack_tracking; 218 Label no_inobject_slack_tracking;
220 219
221 // Check if slack tracking is enabled. 220 // Check if slack tracking is enabled.
222 __ cmp(esi, JSFunction::kNoSlackTracking); 221 __ cmp(esi, Map::kSlackTrackingCounterEnd);
223 __ j(equal, &no_inobject_slack_tracking); 222 __ j(less, &no_inobject_slack_tracking);
224 223
225 // Allocate object with a slack. 224 // Allocate object with a slack.
226 __ movzx_b(esi, 225 __ movzx_b(esi,
227 FieldOperand(eax, Map::kPreAllocatedPropertyFieldsOffset)); 226 FieldOperand(eax, Map::kPreAllocatedPropertyFieldsOffset));
228 __ lea(esi, 227 __ lea(esi,
229 Operand(ebx, esi, times_pointer_size, JSObject::kHeaderSize)); 228 Operand(ebx, esi, times_pointer_size, JSObject::kHeaderSize));
230 // esi: offset of first field after pre-allocated fields 229 // esi: offset of first field after pre-allocated fields
231 if (FLAG_debug_code) { 230 if (FLAG_debug_code) {
232 __ cmp(esi, edi); 231 __ cmp(esi, edi);
233 __ Assert(less_equal, 232 __ Assert(less_equal,
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 1452
1454 __ bind(&ok); 1453 __ bind(&ok);
1455 __ ret(0); 1454 __ ret(0);
1456 } 1455 }
1457 1456
1458 #undef __ 1457 #undef __
1459 } 1458 }
1460 } // namespace v8::internal 1459 } // namespace v8::internal
1461 1460
1462 #endif // V8_TARGET_ARCH_IA32 1461 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698