OLD | NEW |
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_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug.h" | 10 #include "src/debug.h" |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 if (create_memento) { | 439 if (create_memento) { |
440 __ add(r3, r3, Operand(AllocationMemento::kSize / kPointerSize)); | 440 __ add(r3, r3, Operand(AllocationMemento::kSize / kPointerSize)); |
441 } | 441 } |
442 | 442 |
443 __ Allocate(r3, r4, r5, r6, &rt_call, SIZE_IN_WORDS); | 443 __ Allocate(r3, r4, r5, r6, &rt_call, SIZE_IN_WORDS); |
444 | 444 |
445 // Allocated the JSObject, now initialize the fields. Map is set to | 445 // Allocated the JSObject, now initialize the fields. Map is set to |
446 // initial map and properties and elements are set to empty fixed array. | 446 // initial map and properties and elements are set to empty fixed array. |
447 // r1: constructor function | 447 // r1: constructor function |
448 // r2: initial map | 448 // r2: initial map |
449 // r3: object size (not including memento if create_memento) | 449 // r3: object size (including memento if create_memento) |
450 // r4: JSObject (not tagged) | 450 // r4: JSObject (not tagged) |
451 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex); | 451 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex); |
452 __ mov(r5, r4); | 452 __ mov(r5, r4); |
453 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); | 453 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); |
454 __ str(r2, MemOperand(r5, kPointerSize, PostIndex)); | 454 __ str(r2, MemOperand(r5, kPointerSize, PostIndex)); |
455 DCHECK_EQ(1 * kPointerSize, JSObject::kPropertiesOffset); | 455 DCHECK_EQ(1 * kPointerSize, JSObject::kPropertiesOffset); |
456 __ str(r6, MemOperand(r5, kPointerSize, PostIndex)); | 456 __ str(r6, MemOperand(r5, kPointerSize, PostIndex)); |
457 DCHECK_EQ(2 * kPointerSize, JSObject::kElementsOffset); | 457 DCHECK_EQ(2 * kPointerSize, JSObject::kElementsOffset); |
458 __ str(r6, MemOperand(r5, kPointerSize, PostIndex)); | 458 __ str(r6, MemOperand(r5, kPointerSize, PostIndex)); |
459 | 459 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 __ InitializeFieldsWithFiller(r5, r0, r6); | 513 __ InitializeFieldsWithFiller(r5, r0, r6); |
514 } | 514 } |
515 | 515 |
516 // Add the object tag to make the JSObject real, so that we can continue | 516 // Add the object tag to make the JSObject real, so that we can continue |
517 // and jump into the continuation code at any time from now on. Any | 517 // and jump into the continuation code at any time from now on. Any |
518 // failures need to undo the allocation, so that the heap is in a | 518 // failures need to undo the allocation, so that the heap is in a |
519 // consistent state and verifiable. | 519 // consistent state and verifiable. |
520 __ add(r4, r4, Operand(kHeapObjectTag)); | 520 __ add(r4, r4, Operand(kHeapObjectTag)); |
521 | 521 |
522 // Check if a non-empty properties array is needed. Continue with | 522 // Check if a non-empty properties array is needed. Continue with |
523 // allocated object if not fall through to runtime call if it is. | 523 // allocated object if not; allocate and initialize a FixedArray if yes. |
524 // r1: constructor function | 524 // r1: constructor function |
525 // r4: JSObject | 525 // r4: JSObject |
526 // r5: start of next object (not tagged) | 526 // r5: start of next object (not tagged) |
527 __ ldrb(r3, FieldMemOperand(r2, Map::kUnusedPropertyFieldsOffset)); | 527 __ ldrb(r3, FieldMemOperand(r2, Map::kUnusedPropertyFieldsOffset)); |
528 // The field instance sizes contains both pre-allocated property fields | 528 // The field instance sizes contains both pre-allocated property fields |
529 // and in-object properties. | 529 // and in-object properties. |
530 __ ldr(r0, FieldMemOperand(r2, Map::kInstanceSizesOffset)); | 530 __ ldr(r0, FieldMemOperand(r2, Map::kInstanceSizesOffset)); |
531 __ Ubfx(r6, r0, Map::kPreAllocatedPropertyFieldsByte * kBitsPerByte, | 531 __ Ubfx(r6, r0, Map::kPreAllocatedPropertyFieldsByte * kBitsPerByte, |
532 kBitsPerByte); | 532 kBitsPerByte); |
533 __ add(r3, r3, Operand(r6)); | 533 __ add(r3, r3, Operand(r6)); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 __ str(r0, MemOperand(r2, kPointerSize, PostIndex)); | 568 __ str(r0, MemOperand(r2, kPointerSize, PostIndex)); |
569 | 569 |
570 // Initialize the fields to undefined. | 570 // Initialize the fields to undefined. |
571 // r1: constructor function | 571 // r1: constructor function |
572 // r2: First element of FixedArray (not tagged) | 572 // r2: First element of FixedArray (not tagged) |
573 // r3: number of elements in properties array | 573 // r3: number of elements in properties array |
574 // r4: JSObject | 574 // r4: JSObject |
575 // r5: FixedArray (not tagged) | 575 // r5: FixedArray (not tagged) |
576 __ add(r6, r2, Operand(r3, LSL, kPointerSizeLog2)); // End of object. | 576 __ add(r6, r2, Operand(r3, LSL, kPointerSizeLog2)); // End of object. |
577 DCHECK_EQ(2 * kPointerSize, FixedArray::kHeaderSize); | 577 DCHECK_EQ(2 * kPointerSize, FixedArray::kHeaderSize); |
578 { Label loop, entry; | 578 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
579 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 579 __ InitializeFieldsWithFiller(r2, r6, r0); |
580 __ b(&entry); | |
581 __ bind(&loop); | |
582 __ str(r0, MemOperand(r2, kPointerSize, PostIndex)); | |
583 __ bind(&entry); | |
584 __ cmp(r2, r6); | |
585 __ b(lt, &loop); | |
586 } | |
587 | 580 |
588 // Store the initialized FixedArray into the properties field of | 581 // Store the initialized FixedArray into the properties field of |
589 // the JSObject | 582 // the JSObject |
590 // r1: constructor function | 583 // r1: constructor function |
591 // r4: JSObject | 584 // r4: JSObject |
592 // r5: FixedArray (not tagged) | 585 // r5: FixedArray (not tagged) |
593 __ add(r5, r5, Operand(kHeapObjectTag)); // Add the heap tag. | 586 __ add(r5, r5, Operand(kHeapObjectTag)); // Add the heap tag. |
594 __ str(r5, FieldMemOperand(r4, JSObject::kPropertiesOffset)); | 587 __ str(r5, FieldMemOperand(r4, JSObject::kPropertiesOffset)); |
595 | 588 |
596 // Continue with JSObject being successfully allocated | 589 // Continue with JSObject being successfully allocated |
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1810 } | 1803 } |
1811 } | 1804 } |
1812 | 1805 |
1813 | 1806 |
1814 #undef __ | 1807 #undef __ |
1815 | 1808 |
1816 } // namespace internal | 1809 } // namespace internal |
1817 } // namespace v8 | 1810 } // namespace v8 |
1818 | 1811 |
1819 #endif // V8_TARGET_ARCH_ARM | 1812 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |