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

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

Issue 1459083003: Fix object initialization when slack tracking for it's map is still enabled. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@toon
Patch Set: Fixed second nit in all platforms Created 5 years, 1 month 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 | src/arm/macro-assembler-arm.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 #if V8_TARGET_ARCH_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 419
420 __ bind(&allocate); 420 __ bind(&allocate);
421 } 421 }
422 422
423 // Now allocate the JSObject on the heap. 423 // Now allocate the JSObject on the heap.
424 // r1: constructor function 424 // r1: constructor function
425 // r2: initial map 425 // r2: initial map
426 Label rt_call_reload_new_target; 426 Label rt_call_reload_new_target;
427 __ ldrb(r3, FieldMemOperand(r2, Map::kInstanceSizeOffset)); 427 __ ldrb(r3, FieldMemOperand(r2, Map::kInstanceSizeOffset));
428 428
429 __ Allocate(r3, r4, r5, r6, &rt_call_reload_new_target, SIZE_IN_WORDS); 429 __ Allocate(r3, r4, r3, r6, &rt_call_reload_new_target, SIZE_IN_WORDS);
430 430
431 // Allocated the JSObject, now initialize the fields. Map is set to 431 // Allocated the JSObject, now initialize the fields. Map is set to
432 // initial map and properties and elements are set to empty fixed array. 432 // initial map and properties and elements are set to empty fixed array.
433 // r1: constructor function 433 // r1: constructor function
434 // r2: initial map 434 // r2: initial map
435 // r3: object size
436 // r4: JSObject (not tagged) 435 // r4: JSObject (not tagged)
436 // r3: start of next object
437 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex); 437 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex);
438 __ mov(r5, r4); 438 __ mov(r5, r4);
439 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); 439 STATIC_ASSERT(0 * kPointerSize == JSObject::kMapOffset);
440 __ str(r2, MemOperand(r5, kPointerSize, PostIndex)); 440 __ str(r2, MemOperand(r5, kPointerSize, PostIndex));
441 DCHECK_EQ(1 * kPointerSize, JSObject::kPropertiesOffset); 441 STATIC_ASSERT(1 * kPointerSize == JSObject::kPropertiesOffset);
442 __ str(r6, MemOperand(r5, kPointerSize, PostIndex)); 442 __ str(r6, MemOperand(r5, kPointerSize, PostIndex));
443 DCHECK_EQ(2 * kPointerSize, JSObject::kElementsOffset); 443 STATIC_ASSERT(2 * kPointerSize == JSObject::kElementsOffset);
444 __ str(r6, MemOperand(r5, kPointerSize, PostIndex)); 444 __ str(r6, MemOperand(r5, kPointerSize, PostIndex));
445 445
446 // Fill all the in-object properties with the appropriate filler. 446 // Fill all the in-object properties with the appropriate filler.
447 // r1: constructor function 447 // r1: constructor function
448 // r2: initial map 448 // r2: initial map
449 // r3: object size
450 // r4: JSObject (not tagged) 449 // r4: JSObject (not tagged)
450 // r3: start of next object
451 // r5: First in-object property of JSObject (not tagged) 451 // r5: First in-object property of JSObject (not tagged)
452 DCHECK_EQ(3 * kPointerSize, JSObject::kHeaderSize); 452 DCHECK_EQ(3 * kPointerSize, JSObject::kHeaderSize);
453 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); 453 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex);
454 454
455 if (!is_api_function) { 455 if (!is_api_function) {
456 Label no_inobject_slack_tracking; 456 Label no_inobject_slack_tracking;
457 457
458 // Check if slack tracking is enabled. 458 // Check if slack tracking is enabled.
459 __ ldr(ip, FieldMemOperand(r2, Map::kBitField3Offset)); 459 __ ldr(ip, FieldMemOperand(r2, Map::kBitField3Offset));
460 __ DecodeField<Map::Counter>(ip); 460 __ DecodeField<Map::Counter>(ip);
461 __ cmp(ip, Operand(Map::kSlackTrackingCounterEnd)); 461 __ cmp(ip, Operand(Map::kSlackTrackingCounterEnd));
462 __ b(lt, &no_inobject_slack_tracking); 462 __ b(lt, &no_inobject_slack_tracking);
463 463
464 // Allocate object with a slack. 464 // Allocate object with a slack.
465 __ ldr(r0, FieldMemOperand(r2, Map::kInstanceSizesOffset));
466 __ Ubfx(r0, r0,
467 Map::kInObjectPropertiesOrConstructorFunctionIndexByte *
468 kBitsPerByte,
469 kBitsPerByte);
470 __ ldr(r2, FieldMemOperand(r2, Map::kInstanceAttributesOffset)); 465 __ ldr(r2, FieldMemOperand(r2, Map::kInstanceAttributesOffset));
471 __ Ubfx(r2, r2, Map::kUnusedPropertyFieldsByte * kBitsPerByte, 466 __ Ubfx(r2, r2, Map::kUnusedPropertyFieldsByte * kBitsPerByte,
472 kBitsPerByte); 467 kBitsPerByte);
473 __ sub(r0, r0, Operand(r2)); 468 __ sub(r0, r3, Operand(r2, LSL, kPointerSizeLog2));
474 __ add(r0, r5, Operand(r0, LSL, kPointerSizeLog2));
475 // r0: offset of first field after pre-allocated fields 469 // r0: offset of first field after pre-allocated fields
476 if (FLAG_debug_code) { 470 if (FLAG_debug_code) {
477 __ add(ip, r4, 471 __ cmp(r5, r0);
478 Operand(r3, LSL, kPointerSizeLog2)); // End of object.
479 __ cmp(r0, ip);
480 __ Assert(le, kUnexpectedNumberOfPreAllocatedPropertyFields); 472 __ Assert(le, kUnexpectedNumberOfPreAllocatedPropertyFields);
481 } 473 }
482 __ InitializeFieldsWithFiller(r5, r0, r6); 474 __ InitializeFieldsWithFiller(r5, r0, r6);
483 // To allow for truncation. 475 // To allow for truncation.
484 __ LoadRoot(r6, Heap::kOnePointerFillerMapRootIndex); 476 __ LoadRoot(r6, Heap::kOnePointerFillerMapRootIndex);
485 // Fill the remaining fields with one pointer filler map. 477 // Fill the remaining fields with one pointer filler map.
486 478
487 __ bind(&no_inobject_slack_tracking); 479 __ bind(&no_inobject_slack_tracking);
488 } 480 }
489 481
490 __ add(r0, r4, Operand(r3, LSL, kPointerSizeLog2)); // End of object. 482 __ InitializeFieldsWithFiller(r5, r3, r6);
491 __ InitializeFieldsWithFiller(r5, r0, r6);
492 483
493 // Add the object tag to make the JSObject real, so that we can continue 484 // Add the object tag to make the JSObject real, so that we can continue
494 // and jump into the continuation code at any time from now on. 485 // and jump into the continuation code at any time from now on.
495 __ add(r4, r4, Operand(kHeapObjectTag)); 486 __ add(r4, r4, Operand(kHeapObjectTag));
496 487
497 // Continue with JSObject being successfully allocated 488 // Continue with JSObject being successfully allocated
498 // r4: JSObject 489 // r4: JSObject
499 __ jmp(&allocated); 490 __ jmp(&allocated);
500 491
501 // Reload the new target and fall-through. 492 // Reload the new target and fall-through.
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 } 1834 }
1844 } 1835 }
1845 1836
1846 1837
1847 #undef __ 1838 #undef __
1848 1839
1849 } // namespace internal 1840 } // namespace internal
1850 } // namespace v8 1841 } // namespace v8
1851 1842
1852 #endif // V8_TARGET_ARCH_ARM 1843 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698