OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug.h" | 10 #include "src/debug.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 321 |
322 // Should never create mementos for api functions. | 322 // Should never create mementos for api functions. |
323 DCHECK(!is_api_function || !create_memento); | 323 DCHECK(!is_api_function || !create_memento); |
324 | 324 |
325 Isolate* isolate = masm->isolate(); | 325 Isolate* isolate = masm->isolate(); |
326 | 326 |
327 // Enter a construct frame. | 327 // Enter a construct frame. |
328 { | 328 { |
329 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); | 329 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); |
330 | 330 |
331 if (create_memento) { | |
332 __ AssertUndefinedOrAllocationSite(r5, r7); | |
333 __ push(r5); | |
334 } | |
335 | |
336 // Preserve the incoming parameters on the stack. | 331 // Preserve the incoming parameters on the stack. |
| 332 __ AssertUndefinedOrAllocationSite(r5, r7); |
337 __ SmiTag(r3); | 333 __ SmiTag(r3); |
338 __ Push(r3, r4, r6); | 334 __ Push(r5, r3, r4, r6); |
339 | 335 |
340 // Try to allocate the object without transitioning into C code. If any of | 336 // Try to allocate the object without transitioning into C code. If any of |
341 // the preconditions is not met, the code bails out to the runtime call. | 337 // the preconditions is not met, the code bails out to the runtime call. |
342 Label rt_call, allocated; | 338 Label rt_call, allocated; |
343 if (FLAG_inline_new) { | 339 if (FLAG_inline_new) { |
344 ExternalReference debug_step_in_fp = | 340 ExternalReference debug_step_in_fp = |
345 ExternalReference::debug_step_in_fp_address(isolate); | 341 ExternalReference::debug_step_in_fp_address(isolate); |
346 __ mov(r5, Operand(debug_step_in_fp)); | 342 __ mov(r5, Operand(debug_step_in_fp)); |
347 __ LoadP(r5, MemOperand(r5)); | 343 __ LoadP(r5, MemOperand(r5)); |
348 __ cmpi(r5, Operand::Zero()); | 344 __ cmpi(r5, Operand::Zero()); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 459 |
464 if (create_memento) { | 460 if (create_memento) { |
465 __ subi(r3, r9, Operand(AllocationMemento::kSize)); | 461 __ subi(r3, r9, Operand(AllocationMemento::kSize)); |
466 __ InitializeFieldsWithFiller(r8, r3, r10); | 462 __ InitializeFieldsWithFiller(r8, r3, r10); |
467 | 463 |
468 // Fill in memento fields. | 464 // Fill in memento fields. |
469 // r8: points to the allocated but uninitialized memento. | 465 // r8: points to the allocated but uninitialized memento. |
470 __ LoadRoot(r10, Heap::kAllocationMementoMapRootIndex); | 466 __ LoadRoot(r10, Heap::kAllocationMementoMapRootIndex); |
471 __ StoreP(r10, MemOperand(r8, AllocationMemento::kMapOffset)); | 467 __ StoreP(r10, MemOperand(r8, AllocationMemento::kMapOffset)); |
472 // Load the AllocationSite | 468 // Load the AllocationSite |
473 __ LoadP(r10, MemOperand(sp, 2 * kPointerSize)); | 469 __ LoadP(r10, MemOperand(sp, 3 * kPointerSize)); |
| 470 __ AssertUndefinedOrAllocationSite(r10, r3); |
474 __ StoreP(r10, | 471 __ StoreP(r10, |
475 MemOperand(r8, AllocationMemento::kAllocationSiteOffset)); | 472 MemOperand(r8, AllocationMemento::kAllocationSiteOffset)); |
476 __ addi(r8, r8, Operand(AllocationMemento::kAllocationSiteOffset + | 473 __ addi(r8, r8, Operand(AllocationMemento::kAllocationSiteOffset + |
477 kPointerSize)); | 474 kPointerSize)); |
478 } else { | 475 } else { |
479 __ InitializeFieldsWithFiller(r8, r9, r10); | 476 __ InitializeFieldsWithFiller(r8, r9, r10); |
480 } | 477 } |
481 | 478 |
482 // Add the object tag to make the JSObject real, so that we can continue | 479 // Add the object tag to make the JSObject real, so that we can continue |
483 // and jump into the continuation code at any time from now on. | 480 // and jump into the continuation code at any time from now on. |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { | 644 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { |
648 // ----------- S t a t e ------------- | 645 // ----------- S t a t e ------------- |
649 // -- r3 : number of arguments | 646 // -- r3 : number of arguments |
650 // -- r4 : constructor function | 647 // -- r4 : constructor function |
651 // -- r5 : allocation site or undefined | 648 // -- r5 : allocation site or undefined |
652 // -- r6 : original constructor | 649 // -- r6 : original constructor |
653 // -- lr : return address | 650 // -- lr : return address |
654 // -- sp[...]: constructor arguments | 651 // -- sp[...]: constructor arguments |
655 // ----------------------------------- | 652 // ----------------------------------- |
656 | 653 |
657 // TODO(dslomov): support pretenuring | |
658 CHECK(!FLAG_pretenuring_call_new); | |
659 | |
660 { | 654 { |
661 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); | 655 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); |
662 | 656 |
| 657 __ AssertUndefinedOrAllocationSite(r5, r7); |
| 658 |
663 // Smi-tagged arguments count. | 659 // Smi-tagged arguments count. |
664 __ mr(r7, r3); | 660 __ mr(r7, r3); |
665 __ SmiTag(r7, SetRC); | 661 __ SmiTag(r7, SetRC); |
666 | 662 |
667 // receiver is the hole. | 663 // receiver is the hole. |
668 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 664 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
669 | 665 |
670 // smi arguments count, new.target, receiver | 666 // allocation site, smi arguments count, new.target, receiver |
671 __ Push(r7, r6, ip); | 667 __ Push(r5, r7, r6, ip); |
672 | 668 |
673 // Set up pointer to last argument. | 669 // Set up pointer to last argument. |
674 __ addi(r5, fp, Operand(StandardFrameConstants::kCallerSPOffset)); | 670 __ addi(r5, fp, Operand(StandardFrameConstants::kCallerSPOffset)); |
675 | 671 |
676 // Copy arguments and receiver to the expression stack. | 672 // Copy arguments and receiver to the expression stack. |
677 // r3: number of arguments | 673 // r3: number of arguments |
678 // r4: constructor function | 674 // r4: constructor function |
679 // r5: address of last argument (caller sp) | 675 // r5: address of last argument (caller sp) |
680 // r7: number of arguments (smi-tagged) | 676 // r7: number of arguments (smi-tagged) |
681 // cr0: compare against zero of arguments | 677 // cr0: compare against zero of arguments |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 __ bkpt(0); | 1778 __ bkpt(0); |
1783 } | 1779 } |
1784 } | 1780 } |
1785 | 1781 |
1786 | 1782 |
1787 #undef __ | 1783 #undef __ |
1788 } // namespace internal | 1784 } // namespace internal |
1789 } // namespace v8 | 1785 } // namespace v8 |
1790 | 1786 |
1791 #endif // V8_TARGET_ARCH_PPC | 1787 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |