| 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 330 |
| 331 // Should never create mementos for api functions. | 331 // Should never create mementos for api functions. |
| 332 DCHECK(!is_api_function || !create_memento); | 332 DCHECK(!is_api_function || !create_memento); |
| 333 | 333 |
| 334 Isolate* isolate = masm->isolate(); | 334 Isolate* isolate = masm->isolate(); |
| 335 | 335 |
| 336 // Enter a construct frame. | 336 // Enter a construct frame. |
| 337 { | 337 { |
| 338 FrameScope scope(masm, StackFrame::CONSTRUCT); | 338 FrameScope scope(masm, StackFrame::CONSTRUCT); |
| 339 | 339 |
| 340 if (create_memento) { | |
| 341 __ AssertUndefinedOrAllocationSite(a2, t0); | |
| 342 __ push(a2); | |
| 343 } | |
| 344 | |
| 345 // Preserve the incoming parameters on the stack. | 340 // Preserve the incoming parameters on the stack. |
| 341 __ AssertUndefinedOrAllocationSite(a2, t0); |
| 346 __ SmiTag(a0); | 342 __ SmiTag(a0); |
| 347 __ Push(a0, a1, a3); | 343 __ Push(a2, a0, a1, a3); |
| 348 | 344 |
| 349 // Try to allocate the object without transitioning into C code. If any of | 345 // Try to allocate the object without transitioning into C code. If any of |
| 350 // the preconditions is not met, the code bails out to the runtime call. | 346 // the preconditions is not met, the code bails out to the runtime call. |
| 351 Label rt_call, allocated; | 347 Label rt_call, allocated; |
| 352 if (FLAG_inline_new) { | 348 if (FLAG_inline_new) { |
| 353 ExternalReference debug_step_in_fp = | 349 ExternalReference debug_step_in_fp = |
| 354 ExternalReference::debug_step_in_fp_address(isolate); | 350 ExternalReference::debug_step_in_fp_address(isolate); |
| 355 __ li(a2, Operand(debug_step_in_fp)); | 351 __ li(a2, Operand(debug_step_in_fp)); |
| 356 __ lw(a2, MemOperand(a2)); | 352 __ lw(a2, MemOperand(a2)); |
| 357 __ Branch(&rt_call, ne, a2, Operand(zero_reg)); | 353 __ Branch(&rt_call, ne, a2, Operand(zero_reg)); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 __ Addu(a0, t4, Operand(a0)); // End of object. | 465 __ Addu(a0, t4, Operand(a0)); // End of object. |
| 470 __ InitializeFieldsWithFiller(t5, a0, t7); | 466 __ InitializeFieldsWithFiller(t5, a0, t7); |
| 471 | 467 |
| 472 // Fill in memento fields. | 468 // Fill in memento fields. |
| 473 // t5: points to the allocated but uninitialized memento. | 469 // t5: points to the allocated but uninitialized memento. |
| 474 __ LoadRoot(t7, Heap::kAllocationMementoMapRootIndex); | 470 __ LoadRoot(t7, Heap::kAllocationMementoMapRootIndex); |
| 475 DCHECK_EQ(0 * kPointerSize, AllocationMemento::kMapOffset); | 471 DCHECK_EQ(0 * kPointerSize, AllocationMemento::kMapOffset); |
| 476 __ sw(t7, MemOperand(t5)); | 472 __ sw(t7, MemOperand(t5)); |
| 477 __ Addu(t5, t5, kPointerSize); | 473 __ Addu(t5, t5, kPointerSize); |
| 478 // Load the AllocationSite. | 474 // Load the AllocationSite. |
| 479 __ lw(t7, MemOperand(sp, 2 * kPointerSize)); | 475 __ lw(t7, MemOperand(sp, 3 * kPointerSize)); |
| 476 __ AssertUndefinedOrAllocationSite(a2, t0); |
| 480 DCHECK_EQ(1 * kPointerSize, AllocationMemento::kAllocationSiteOffset); | 477 DCHECK_EQ(1 * kPointerSize, AllocationMemento::kAllocationSiteOffset); |
| 481 __ sw(t7, MemOperand(t5)); | 478 __ sw(t7, MemOperand(t5)); |
| 482 __ Addu(t5, t5, kPointerSize); | 479 __ Addu(t5, t5, kPointerSize); |
| 483 } else { | 480 } else { |
| 484 __ sll(at, a3, kPointerSizeLog2); | 481 __ sll(at, a3, kPointerSizeLog2); |
| 485 __ Addu(a0, t4, Operand(at)); // End of object. | 482 __ Addu(a0, t4, Operand(at)); // End of object. |
| 486 __ InitializeFieldsWithFiller(t5, a0, t7); | 483 __ InitializeFieldsWithFiller(t5, a0, t7); |
| 487 } | 484 } |
| 488 | 485 |
| 489 // Add the object tag to make the JSObject real, so that we can continue | 486 // Add the object tag to make the JSObject real, so that we can continue |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { | 649 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { |
| 653 // ----------- S t a t e ------------- | 650 // ----------- S t a t e ------------- |
| 654 // -- a0 : number of arguments | 651 // -- a0 : number of arguments |
| 655 // -- a1 : constructor function | 652 // -- a1 : constructor function |
| 656 // -- a2 : allocation site or undefined | 653 // -- a2 : allocation site or undefined |
| 657 // -- a3 : original constructor | 654 // -- a3 : original constructor |
| 658 // -- ra : return address | 655 // -- ra : return address |
| 659 // -- sp[...]: constructor arguments | 656 // -- sp[...]: constructor arguments |
| 660 // ----------------------------------- | 657 // ----------------------------------- |
| 661 | 658 |
| 662 // TODO(dslomov): support pretenuring | |
| 663 CHECK(!FLAG_pretenuring_call_new); | |
| 664 | |
| 665 { | 659 { |
| 666 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); | 660 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); |
| 667 | 661 |
| 662 __ AssertUndefinedOrAllocationSite(a2, t0); |
| 663 __ push(a2); |
| 664 |
| 668 __ mov(t0, a0); | 665 __ mov(t0, a0); |
| 669 __ SmiTag(t0); | 666 __ SmiTag(t0); |
| 670 __ push(t0); // Smi-tagged arguments count. | 667 __ push(t0); // Smi-tagged arguments count. |
| 671 | 668 |
| 672 // Push new.target. | 669 // Push new.target. |
| 673 __ push(a3); | 670 __ push(a3); |
| 674 | 671 |
| 675 // receiver is the hole. | 672 // receiver is the hole. |
| 676 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 673 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 677 __ push(at); | 674 __ push(at); |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1737 } | 1734 } |
| 1738 } | 1735 } |
| 1739 | 1736 |
| 1740 | 1737 |
| 1741 #undef __ | 1738 #undef __ |
| 1742 | 1739 |
| 1743 } // namespace internal | 1740 } // namespace internal |
| 1744 } // namespace v8 | 1741 } // namespace v8 |
| 1745 | 1742 |
| 1746 #endif // V8_TARGET_ARCH_MIPS | 1743 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |