| 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_MIPS64 | 9 #if V8_TARGET_ARCH_MIPS64 |
| 10 | 10 |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 if (create_memento) { | 446 if (create_memento) { |
| 447 __ Daddu(a3, a3, Operand(AllocationMemento::kSize / kPointerSize)); | 447 __ Daddu(a3, a3, Operand(AllocationMemento::kSize / kPointerSize)); |
| 448 } | 448 } |
| 449 | 449 |
| 450 __ Allocate(a3, t0, t1, t2, &rt_call, SIZE_IN_WORDS); | 450 __ Allocate(a3, t0, t1, t2, &rt_call, SIZE_IN_WORDS); |
| 451 | 451 |
| 452 // Allocated the JSObject, now initialize the fields. Map is set to | 452 // Allocated the JSObject, now initialize the fields. Map is set to |
| 453 // initial map and properties and elements are set to empty fixed array. | 453 // initial map and properties and elements are set to empty fixed array. |
| 454 // a1: constructor function | 454 // a1: constructor function |
| 455 // a2: initial map | 455 // a2: initial map |
| 456 // a3: object size (not including memento if create_memento) | 456 // a3: object size (including memento if create_memento) |
| 457 // t0: JSObject (not tagged) | 457 // t0: JSObject (not tagged) |
| 458 __ LoadRoot(t2, Heap::kEmptyFixedArrayRootIndex); | 458 __ LoadRoot(t2, Heap::kEmptyFixedArrayRootIndex); |
| 459 __ mov(t1, t0); | 459 __ mov(t1, t0); |
| 460 __ sd(a2, MemOperand(t1, JSObject::kMapOffset)); | 460 __ sd(a2, MemOperand(t1, JSObject::kMapOffset)); |
| 461 __ sd(t2, MemOperand(t1, JSObject::kPropertiesOffset)); | 461 __ sd(t2, MemOperand(t1, JSObject::kPropertiesOffset)); |
| 462 __ sd(t2, MemOperand(t1, JSObject::kElementsOffset)); | 462 __ sd(t2, MemOperand(t1, JSObject::kElementsOffset)); |
| 463 __ Daddu(t1, t1, Operand(3*kPointerSize)); | 463 __ Daddu(t1, t1, Operand(3*kPointerSize)); |
| 464 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); | 464 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); |
| 465 DCHECK_EQ(1 * kPointerSize, JSObject::kPropertiesOffset); | 465 DCHECK_EQ(1 * kPointerSize, JSObject::kPropertiesOffset); |
| 466 DCHECK_EQ(2 * kPointerSize, JSObject::kElementsOffset); | 466 DCHECK_EQ(2 * kPointerSize, JSObject::kElementsOffset); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 __ InitializeFieldsWithFiller(t1, a0, t3); | 528 __ InitializeFieldsWithFiller(t1, a0, t3); |
| 529 } | 529 } |
| 530 | 530 |
| 531 // Add the object tag to make the JSObject real, so that we can continue | 531 // Add the object tag to make the JSObject real, so that we can continue |
| 532 // and jump into the continuation code at any time from now on. Any | 532 // and jump into the continuation code at any time from now on. Any |
| 533 // failures need to undo the allocation, so that the heap is in a | 533 // failures need to undo the allocation, so that the heap is in a |
| 534 // consistent state and verifiable. | 534 // consistent state and verifiable. |
| 535 __ Daddu(t0, t0, Operand(kHeapObjectTag)); | 535 __ Daddu(t0, t0, Operand(kHeapObjectTag)); |
| 536 | 536 |
| 537 // Check if a non-empty properties array is needed. Continue with | 537 // Check if a non-empty properties array is needed. Continue with |
| 538 // allocated object if not fall through to runtime call if it is. | 538 // allocated object if not; allocate and initialize a FixedArray if yes. |
| 539 // a1: constructor function | 539 // a1: constructor function |
| 540 // t0: JSObject | 540 // t0: JSObject |
| 541 // t1: start of next object (not tagged) | 541 // t1: start of next object (not tagged) |
| 542 __ lbu(a3, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset)); | 542 __ lbu(a3, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset)); |
| 543 // The field instance sizes contains both pre-allocated property fields | 543 // The field instance sizes contains both pre-allocated property fields |
| 544 // and in-object properties. | 544 // and in-object properties. |
| 545 __ lw(a0, FieldMemOperand(a2, Map::kInstanceSizesOffset)); | 545 __ lw(a0, FieldMemOperand(a2, Map::kInstanceSizesOffset)); |
| 546 __ Ext(t2, a0, Map::kPreAllocatedPropertyFieldsByte * kBitsPerByte, | 546 __ Ext(t2, a0, Map::kPreAllocatedPropertyFieldsByte * kBitsPerByte, |
| 547 kBitsPerByte); | 547 kBitsPerByte); |
| 548 __ Daddu(a3, a3, Operand(t2)); | 548 __ Daddu(a3, a3, Operand(t2)); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 567 t1, | 567 t1, |
| 568 t2, | 568 t2, |
| 569 a2, | 569 a2, |
| 570 &undo_allocation, | 570 &undo_allocation, |
| 571 static_cast<AllocationFlags>(RESULT_CONTAINS_TOP | SIZE_IN_WORDS)); | 571 static_cast<AllocationFlags>(RESULT_CONTAINS_TOP | SIZE_IN_WORDS)); |
| 572 | 572 |
| 573 // Initialize the FixedArray. | 573 // Initialize the FixedArray. |
| 574 // a1: constructor | 574 // a1: constructor |
| 575 // a3: number of elements in properties array (untagged) | 575 // a3: number of elements in properties array (untagged) |
| 576 // t0: JSObject | 576 // t0: JSObject |
| 577 // t1: start of next object | 577 // t1: start of FixedArray (untagged) |
| 578 __ LoadRoot(t2, Heap::kFixedArrayMapRootIndex); | 578 __ LoadRoot(t2, Heap::kFixedArrayMapRootIndex); |
| 579 __ mov(a2, t1); | 579 __ mov(a2, t1); |
| 580 __ sd(t2, MemOperand(a2, JSObject::kMapOffset)); | 580 __ sd(t2, MemOperand(a2, JSObject::kMapOffset)); |
| 581 // Tag number of elements. | 581 // Tag number of elements. |
| 582 __ dsll32(a0, a3, 0); | 582 __ dsll32(a0, a3, 0); |
| 583 __ sd(a0, MemOperand(a2, FixedArray::kLengthOffset)); | 583 __ sd(a0, MemOperand(a2, FixedArray::kLengthOffset)); |
| 584 __ Daddu(a2, a2, Operand(2 * kPointerSize)); | 584 __ Daddu(a2, a2, Operand(2 * kPointerSize)); |
| 585 | 585 |
| 586 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); | 586 DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); |
| 587 DCHECK_EQ(1 * kPointerSize, FixedArray::kLengthOffset); | 587 DCHECK_EQ(1 * kPointerSize, FixedArray::kLengthOffset); |
| 588 | 588 |
| 589 // Initialize the fields to undefined. | 589 // Initialize the fields to undefined. |
| 590 // a1: constructor | 590 // a1: constructor |
| 591 // a2: First element of FixedArray (not tagged) | 591 // a2: First element of FixedArray (not tagged) |
| 592 // a3: number of elements in properties array | 592 // a3: number of elements in properties array |
| 593 // t0: JSObject | 593 // t0: JSObject |
| 594 // t1: FixedArray (not tagged) | 594 // t1: FixedArray (not tagged) |
| 595 __ dsll(a7, a3, kPointerSizeLog2); | 595 __ dsll(a7, a3, kPointerSizeLog2); |
| 596 __ daddu(t2, a2, a7); // End of object. | 596 __ daddu(t2, a2, a7); // End of object. |
| 597 DCHECK_EQ(2 * kPointerSize, FixedArray::kHeaderSize); | 597 DCHECK_EQ(2 * kPointerSize, FixedArray::kHeaderSize); |
| 598 { Label loop, entry; | 598 if (!is_api_function || create_memento) { |
| 599 if (!is_api_function || create_memento) { | 599 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex); |
| 600 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex); | 600 } else if (FLAG_debug_code) { |
| 601 } else if (FLAG_debug_code) { | 601 __ LoadRoot(a6, Heap::kUndefinedValueRootIndex); |
| 602 __ LoadRoot(a6, Heap::kUndefinedValueRootIndex); | 602 __ Assert(eq, kUndefinedValueNotLoaded, t3, Operand(a6)); |
| 603 __ Assert(eq, kUndefinedValueNotLoaded, t3, Operand(a6)); | |
| 604 } | |
| 605 __ jmp(&entry); | |
| 606 __ bind(&loop); | |
| 607 __ sd(t3, MemOperand(a2)); | |
| 608 __ daddiu(a2, a2, kPointerSize); | |
| 609 __ bind(&entry); | |
| 610 __ Branch(&loop, less, a2, Operand(t2)); | |
| 611 } | 603 } |
| 604 __ InitializeFieldsWithFiller(a2, t2, t3); |
| 612 | 605 |
| 613 // Store the initialized FixedArray into the properties field of | 606 // Store the initialized FixedArray into the properties field of |
| 614 // the JSObject. | 607 // the JSObject. |
| 615 // a1: constructor function | 608 // a1: constructor function |
| 616 // t0: JSObject | 609 // t0: JSObject |
| 617 // t1: FixedArray (not tagged) | 610 // t1: FixedArray (not tagged) |
| 618 __ Daddu(t1, t1, Operand(kHeapObjectTag)); // Add the heap tag. | 611 __ Daddu(t1, t1, Operand(kHeapObjectTag)); // Add the heap tag. |
| 619 __ sd(t1, FieldMemOperand(t0, JSObject::kPropertiesOffset)); | 612 __ sd(t1, FieldMemOperand(t0, JSObject::kPropertiesOffset)); |
| 620 | 613 |
| 621 // Continue with JSObject being successfully allocated. | 614 // Continue with JSObject being successfully allocated. |
| (...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1846 } | 1839 } |
| 1847 } | 1840 } |
| 1848 | 1841 |
| 1849 | 1842 |
| 1850 #undef __ | 1843 #undef __ |
| 1851 | 1844 |
| 1852 } // namespace internal | 1845 } // namespace internal |
| 1853 } // namespace v8 | 1846 } // namespace v8 |
| 1854 | 1847 |
| 1855 #endif // V8_TARGET_ARCH_MIPS64 | 1848 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |