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

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

Issue 1226203011: Remove unused byte from Map::instance_sizes field. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ported to all architectures. Created 5 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/runtime/runtime-regexp.cc ('k') | src/x64/macro-assembler-x64.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_X64 7 #if V8_TARGET_ARCH_X64
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 __ cmpp(rdx, rdi); 166 __ cmpp(rdx, rdi);
167 __ j(equal, &normal_new); 167 __ j(equal, &normal_new);
168 168
169 Generate_Runtime_NewObject(masm, create_memento, rdx, &count_incremented, 169 Generate_Runtime_NewObject(masm, create_memento, rdx, &count_incremented,
170 &allocated); 170 &allocated);
171 171
172 __ bind(&normal_new); 172 __ bind(&normal_new);
173 // Try to allocate the object without transitioning into C code. If any of 173 // Try to allocate the object without transitioning into C code. If any of
174 // the preconditions is not met, the code bails out to the runtime call. 174 // the preconditions is not met, the code bails out to the runtime call.
175 if (FLAG_inline_new) { 175 if (FLAG_inline_new) {
176 Label undo_allocation;
177
178 ExternalReference debug_step_in_fp = 176 ExternalReference debug_step_in_fp =
179 ExternalReference::debug_step_in_fp_address(masm->isolate()); 177 ExternalReference::debug_step_in_fp_address(masm->isolate());
180 __ Move(kScratchRegister, debug_step_in_fp); 178 __ Move(kScratchRegister, debug_step_in_fp);
181 __ cmpp(Operand(kScratchRegister, 0), Immediate(0)); 179 __ cmpp(Operand(kScratchRegister, 0), Immediate(0));
182 __ j(not_equal, &rt_call); 180 __ j(not_equal, &rt_call);
183 181
184 // Verified that the constructor is a JSFunction. 182 // Verified that the constructor is a JSFunction.
185 // Load the initial map and verify that it is in fact a map. 183 // Load the initial map and verify that it is in fact a map.
186 // rdi: constructor 184 // rdi: constructor
187 __ movp(rax, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); 185 __ movp(rax, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 __ leap(rcx, Operand(rbx, JSObject::kHeaderSize)); 257 __ leap(rcx, Operand(rbx, JSObject::kHeaderSize));
260 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); 258 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex);
261 if (!is_api_function) { 259 if (!is_api_function) {
262 Label no_inobject_slack_tracking; 260 Label no_inobject_slack_tracking;
263 261
264 // Check if slack tracking is enabled. 262 // Check if slack tracking is enabled.
265 __ cmpl(rsi, Immediate(Map::kSlackTrackingCounterEnd)); 263 __ cmpl(rsi, Immediate(Map::kSlackTrackingCounterEnd));
266 __ j(less, &no_inobject_slack_tracking); 264 __ j(less, &no_inobject_slack_tracking);
267 265
268 // Allocate object with a slack. 266 // Allocate object with a slack.
269 __ movzxbp(rsi, 267 __ movzxbp(rsi, FieldOperand(rax, Map::kInObjectPropertiesOffset));
270 FieldOperand(rax, Map::kPreAllocatedPropertyFieldsOffset)); 268 __ movzxbp(rax, FieldOperand(rax, Map::kUnusedPropertyFieldsOffset));
269 __ subp(rsi, rax);
271 __ leap(rsi, 270 __ leap(rsi,
272 Operand(rbx, rsi, times_pointer_size, JSObject::kHeaderSize)); 271 Operand(rbx, rsi, times_pointer_size, JSObject::kHeaderSize));
273 // rsi: offset of first field after pre-allocated fields 272 // rsi: offset of first field after pre-allocated fields
274 if (FLAG_debug_code) { 273 if (FLAG_debug_code) {
275 __ cmpp(rsi, rdi); 274 __ cmpp(rsi, rdi);
276 __ Assert(less_equal, 275 __ Assert(less_equal,
277 kUnexpectedNumberOfPreAllocatedPropertyFields); 276 kUnexpectedNumberOfPreAllocatedPropertyFields);
278 } 277 }
279 __ InitializeFieldsWithFiller(rcx, rsi, rdx); 278 __ InitializeFieldsWithFiller(rcx, rsi, rdx);
280 __ LoadRoot(rdx, Heap::kOnePointerFillerMapRootIndex); 279 __ LoadRoot(rdx, Heap::kOnePointerFillerMapRootIndex);
(...skipping 10 matching lines...) Expand all
291 __ Move(Operand(rsi, AllocationMemento::kMapOffset), 290 __ Move(Operand(rsi, AllocationMemento::kMapOffset),
292 factory->allocation_memento_map()); 291 factory->allocation_memento_map());
293 // Get the cell or undefined. 292 // Get the cell or undefined.
294 __ movp(rdx, Operand(rsp, kPointerSize*2)); 293 __ movp(rdx, Operand(rsp, kPointerSize*2));
295 __ movp(Operand(rsi, AllocationMemento::kAllocationSiteOffset), rdx); 294 __ movp(Operand(rsi, AllocationMemento::kAllocationSiteOffset), rdx);
296 } else { 295 } else {
297 __ InitializeFieldsWithFiller(rcx, rdi, rdx); 296 __ InitializeFieldsWithFiller(rcx, rdi, rdx);
298 } 297 }
299 298
300 // Add the object tag to make the JSObject real, so that we can continue 299 // Add the object tag to make the JSObject real, so that we can continue
301 // and jump into the continuation code at any time from now on. Any 300 // and jump into the continuation code at any time from now on.
302 // failures need to undo the allocation, so that the heap is in a 301 // rbx: JSObject (untagged)
303 // consistent state and verifiable.
304 // rax: initial map
305 // rbx: JSObject
306 // rdi: start of next object
307 __ orp(rbx, Immediate(kHeapObjectTag)); 302 __ orp(rbx, Immediate(kHeapObjectTag));
308 303
309 // Check if a non-empty properties array is needed.
310 // Allocate and initialize a FixedArray if it is.
311 // rax: initial map
312 // rbx: JSObject
313 // rdi: start of next object
314 // Calculate total properties described map.
315 __ movzxbp(rdx, FieldOperand(rax, Map::kUnusedPropertyFieldsOffset));
316 __ movzxbp(rcx,
317 FieldOperand(rax, Map::kPreAllocatedPropertyFieldsOffset));
318 __ addp(rdx, rcx);
319 // Calculate unused properties past the end of the in-object properties.
320 __ movzxbp(rcx, FieldOperand(rax, Map::kInObjectPropertiesOffset));
321 __ subp(rdx, rcx);
322 // Done if no extra properties are to be allocated.
323 __ j(zero, &allocated);
324 __ Assert(positive, kPropertyAllocationCountFailed);
325
326 // Scale the number of elements by pointer size and add the header for
327 // FixedArrays to the start of the next object calculation from above.
328 // rbx: JSObject
329 // rdi: start of next object (will be start of FixedArray)
330 // rdx: number of elements in properties array
331 __ Allocate(FixedArray::kHeaderSize,
332 times_pointer_size,
333 rdx,
334 rdi,
335 rax,
336 no_reg,
337 &undo_allocation,
338 RESULT_CONTAINS_TOP);
339
340 // Initialize the FixedArray.
341 // rbx: JSObject
342 // rdi: FixedArray
343 // rdx: number of elements
344 // rax: start of next object
345 __ LoadRoot(rcx, Heap::kFixedArrayMapRootIndex);
346 __ movp(Operand(rdi, HeapObject::kMapOffset), rcx); // setup the map
347 __ Integer32ToSmi(rdx, rdx);
348 __ movp(Operand(rdi, FixedArray::kLengthOffset), rdx); // and length
349
350 // Initialize the fields to undefined.
351 // rbx: JSObject
352 // rdi: FixedArray
353 // rax: start of next object
354 // rdx: number of elements
355 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex);
356 __ leap(rcx, Operand(rdi, FixedArray::kHeaderSize));
357 __ InitializeFieldsWithFiller(rcx, rax, rdx);
358
359 // Store the initialized FixedArray into the properties field of
360 // the JSObject
361 // rbx: JSObject
362 // rdi: FixedArray
363 __ orp(rdi, Immediate(kHeapObjectTag)); // add the heap tag
364 __ movp(FieldOperand(rbx, JSObject::kPropertiesOffset), rdi);
365
366
367 // Continue with JSObject being successfully allocated 304 // Continue with JSObject being successfully allocated
368 // rbx: JSObject 305 // rbx: JSObject (tagged)
369 __ jmp(&allocated); 306 __ jmp(&allocated);
370
371 // Undo the setting of the new top so that the heap is verifiable. For
372 // example, the map's unused properties potentially do not match the
373 // allocated objects unused properties.
374 // rbx: JSObject (previous new top)
375 __ bind(&undo_allocation);
376 __ UndoAllocationInNewSpace(rbx);
377 } 307 }
378 308
379 // Allocate the new receiver object using the runtime call. 309 // Allocate the new receiver object using the runtime call.
380 // rdi: function (constructor) 310 // rdi: function (constructor)
381 __ bind(&rt_call); 311 __ bind(&rt_call);
382 Generate_Runtime_NewObject(masm, create_memento, rdi, &count_incremented, 312 Generate_Runtime_NewObject(masm, create_memento, rdi, &count_incremented,
383 &allocated); 313 &allocated);
384 314
385 // New object allocated. 315 // New object allocated.
386 // rbx: newly allocated object 316 // rbx: newly allocated object
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 __ ret(0); 1719 __ ret(0);
1790 } 1720 }
1791 1721
1792 1722
1793 #undef __ 1723 #undef __
1794 1724
1795 } // namespace internal 1725 } // namespace internal
1796 } // namespace v8 1726 } // namespace v8
1797 1727
1798 #endif // V8_TARGET_ARCH_X64 1728 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime/runtime-regexp.cc ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698