| 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 | 5 |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_MIPS | 9 #if V8_TARGET_ARCH_MIPS |
| 10 | 10 |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 if (create_memento) { | 445 if (create_memento) { |
| 446 __ Addu(a3, a3, Operand(AllocationMemento::kSize / kPointerSize)); | 446 __ Addu(a3, a3, Operand(AllocationMemento::kSize / kPointerSize)); |
| 447 } | 447 } |
| 448 | 448 |
| 449 __ Allocate(a3, t4, t5, t6, &rt_call, SIZE_IN_WORDS); | 449 __ Allocate(a3, t4, t5, t6, &rt_call, SIZE_IN_WORDS); |
| 450 | 450 |
| 451 // Allocated the JSObject, now initialize the fields. Map is set to | 451 // Allocated the JSObject, now initialize the fields. Map is set to |
| 452 // initial map and properties and elements are set to empty fixed array. | 452 // initial map and properties and elements are set to empty fixed array. |
| 453 // a1: constructor function | 453 // a1: constructor function |
| 454 // a2: initial map | 454 // a2: initial map |
| 455 // a3: object size (not including memento if create_memento) | 455 // a3: object size (including memento if create_memento) |
| 456 // t4: JSObject (not tagged) | 456 // t4: JSObject (not tagged) |
| 457 __ LoadRoot(t6, Heap::kEmptyFixedArrayRootIndex); | 457 __ LoadRoot(t6, Heap::kEmptyFixedArrayRootIndex); |
| 458 __ mov(t5, t4); | 458 __ mov(t5, t4); |
| 459 __ sw(a2, MemOperand(t5, JSObject::kMapOffset)); | 459 __ sw(a2, MemOperand(t5, JSObject::kMapOffset)); |
| 460 __ sw(t6, MemOperand(t5, JSObject::kPropertiesOffset)); | 460 __ sw(t6, MemOperand(t5, JSObject::kPropertiesOffset)); |
| 461 __ sw(t6, MemOperand(t5, JSObject::kElementsOffset)); | 461 __ sw(t6, MemOperand(t5, JSObject::kElementsOffset)); |
| 462 __ Addu(t5, t5, Operand(3*kPointerSize)); | 462 __ Addu(t5, t5, Operand(3*kPointerSize)); |
| 463 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); | 463 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); |
| 464 DCHECK_EQ(1 * kPointerSize, JSObject::kPropertiesOffset); | 464 DCHECK_EQ(1 * kPointerSize, JSObject::kPropertiesOffset); |
| 465 DCHECK_EQ(2 * kPointerSize, JSObject::kElementsOffset); | 465 DCHECK_EQ(2 * kPointerSize, JSObject::kElementsOffset); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 __ InitializeFieldsWithFiller(t5, a0, t7); | 525 __ InitializeFieldsWithFiller(t5, a0, t7); |
| 526 } | 526 } |
| 527 | 527 |
| 528 // Add the object tag to make the JSObject real, so that we can continue | 528 // Add the object tag to make the JSObject real, so that we can continue |
| 529 // and jump into the continuation code at any time from now on. Any | 529 // and jump into the continuation code at any time from now on. Any |
| 530 // failures need to undo the allocation, so that the heap is in a | 530 // failures need to undo the allocation, so that the heap is in a |
| 531 // consistent state and verifiable. | 531 // consistent state and verifiable. |
| 532 __ Addu(t4, t4, Operand(kHeapObjectTag)); | 532 __ Addu(t4, t4, Operand(kHeapObjectTag)); |
| 533 | 533 |
| 534 // Check if a non-empty properties array is needed. Continue with | 534 // Check if a non-empty properties array is needed. Continue with |
| 535 // allocated object if not fall through to runtime call if it is. | 535 // allocated object if not; allocate and initialize a FixedArray if yes. |
| 536 // a1: constructor function | 536 // a1: constructor function |
| 537 // t4: JSObject | 537 // t4: JSObject |
| 538 // t5: start of next object (not tagged) | 538 // t5: start of next object (not tagged) |
| 539 __ lbu(a3, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset)); | 539 __ lbu(a3, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset)); |
| 540 // The field instance sizes contains both pre-allocated property fields | 540 // The field instance sizes contains both pre-allocated property fields |
| 541 // and in-object properties. | 541 // and in-object properties. |
| 542 __ lbu(t6, FieldMemOperand(a2, Map::kPreAllocatedPropertyFieldsOffset)); | 542 __ lbu(t6, FieldMemOperand(a2, Map::kPreAllocatedPropertyFieldsOffset)); |
| 543 __ Addu(a3, a3, Operand(t6)); | 543 __ Addu(a3, a3, Operand(t6)); |
| 544 __ lbu(t6, FieldMemOperand(a2, Map::kInObjectPropertiesOffset)); | 544 __ lbu(t6, FieldMemOperand(a2, Map::kInObjectPropertiesOffset)); |
| 545 __ subu(a3, a3, t6); | 545 __ subu(a3, a3, t6); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 561 t5, | 561 t5, |
| 562 t6, | 562 t6, |
| 563 a2, | 563 a2, |
| 564 &undo_allocation, | 564 &undo_allocation, |
| 565 static_cast<AllocationFlags>(RESULT_CONTAINS_TOP | SIZE_IN_WORDS)); | 565 static_cast<AllocationFlags>(RESULT_CONTAINS_TOP | SIZE_IN_WORDS)); |
| 566 | 566 |
| 567 // Initialize the FixedArray. | 567 // Initialize the FixedArray. |
| 568 // a1: constructor | 568 // a1: constructor |
| 569 // a3: number of elements in properties array (untagged) | 569 // a3: number of elements in properties array (untagged) |
| 570 // t4: JSObject | 570 // t4: JSObject |
| 571 // t5: start of next object | 571 // t5: start of FixedArray (untagged) |
| 572 __ LoadRoot(t6, Heap::kFixedArrayMapRootIndex); | 572 __ LoadRoot(t6, Heap::kFixedArrayMapRootIndex); |
| 573 __ mov(a2, t5); | 573 __ mov(a2, t5); |
| 574 __ sw(t6, MemOperand(a2, JSObject::kMapOffset)); | 574 __ sw(t6, MemOperand(a2, JSObject::kMapOffset)); |
| 575 __ sll(a0, a3, kSmiTagSize); | 575 __ sll(a0, a3, kSmiTagSize); |
| 576 __ sw(a0, MemOperand(a2, FixedArray::kLengthOffset)); | 576 __ sw(a0, MemOperand(a2, FixedArray::kLengthOffset)); |
| 577 __ Addu(a2, a2, Operand(2 * kPointerSize)); | 577 __ Addu(a2, a2, Operand(2 * kPointerSize)); |
| 578 | 578 |
| 579 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); | 579 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); |
| 580 DCHECK_EQ(1 * kPointerSize, FixedArray::kLengthOffset); | 580 DCHECK_EQ(1 * kPointerSize, FixedArray::kLengthOffset); |
| 581 | 581 |
| 582 // Initialize the fields to undefined. | 582 // Initialize the fields to undefined. |
| 583 // a1: constructor | 583 // a1: constructor |
| 584 // a2: First element of FixedArray (not tagged) | 584 // a2: First element of FixedArray (not tagged) |
| 585 // a3: number of elements in properties array | 585 // a3: number of elements in properties array |
| 586 // t4: JSObject | 586 // t4: JSObject |
| 587 // t5: FixedArray (not tagged) | 587 // t5: FixedArray (not tagged) |
| 588 __ sll(t3, a3, kPointerSizeLog2); | 588 __ sll(t3, a3, kPointerSizeLog2); |
| 589 __ addu(t6, a2, t3); // End of object. | 589 __ addu(t6, a2, t3); // End of object. |
| 590 DCHECK_EQ(2 * kPointerSize, FixedArray::kHeaderSize); | 590 DCHECK_EQ(2 * kPointerSize, FixedArray::kHeaderSize); |
| 591 { Label loop, entry; | 591 if (!is_api_function || create_memento) { |
| 592 if (!is_api_function || create_memento) { | 592 __ LoadRoot(t7, Heap::kUndefinedValueRootIndex); |
| 593 __ LoadRoot(t7, Heap::kUndefinedValueRootIndex); | 593 } else if (FLAG_debug_code) { |
| 594 } else if (FLAG_debug_code) { | 594 __ LoadRoot(t2, Heap::kUndefinedValueRootIndex); |
| 595 __ LoadRoot(t2, Heap::kUndefinedValueRootIndex); | 595 __ Assert(eq, kUndefinedValueNotLoaded, t7, Operand(t2)); |
| 596 __ Assert(eq, kUndefinedValueNotLoaded, t7, Operand(t2)); | |
| 597 } | |
| 598 __ jmp(&entry); | |
| 599 __ bind(&loop); | |
| 600 __ sw(t7, MemOperand(a2)); | |
| 601 __ addiu(a2, a2, kPointerSize); | |
| 602 __ bind(&entry); | |
| 603 __ Branch(&loop, less, a2, Operand(t6)); | |
| 604 } | 596 } |
| 597 __ InitializeFieldsWithFiller(a2, t6, t7); |
| 605 | 598 |
| 606 // Store the initialized FixedArray into the properties field of | 599 // Store the initialized FixedArray into the properties field of |
| 607 // the JSObject. | 600 // the JSObject. |
| 608 // a1: constructor function | 601 // a1: constructor function |
| 609 // t4: JSObject | 602 // t4: JSObject |
| 610 // t5: FixedArray (not tagged) | 603 // t5: FixedArray (not tagged) |
| 611 __ Addu(t5, t5, Operand(kHeapObjectTag)); // Add the heap tag. | 604 __ Addu(t5, t5, Operand(kHeapObjectTag)); // Add the heap tag. |
| 612 __ sw(t5, FieldMemOperand(t4, JSObject::kPropertiesOffset)); | 605 __ sw(t5, FieldMemOperand(t4, JSObject::kPropertiesOffset)); |
| 613 | 606 |
| 614 // Continue with JSObject being successfully allocated. | 607 // Continue with JSObject being successfully allocated. |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1837 } | 1830 } |
| 1838 } | 1831 } |
| 1839 | 1832 |
| 1840 | 1833 |
| 1841 #undef __ | 1834 #undef __ |
| 1842 | 1835 |
| 1843 } // namespace internal | 1836 } // namespace internal |
| 1844 } // namespace v8 | 1837 } // namespace v8 |
| 1845 | 1838 |
| 1846 #endif // V8_TARGET_ARCH_MIPS | 1839 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |