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 #if V8_TARGET_ARCH_PPC | 5 #if V8_TARGET_ARCH_PPC |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 __ LoadRoot(ip, Heap::kStackLimitRootIndex); | 548 __ LoadRoot(ip, Heap::kStackLimitRootIndex); |
549 __ cmpl(sp, ip); | 549 __ cmpl(sp, ip); |
550 __ bge(&ok); | 550 __ bge(&ok); |
551 | 551 |
552 GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode); | 552 GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode); |
553 | 553 |
554 __ bind(&ok); | 554 __ bind(&ok); |
555 GenerateTailCallToSharedCode(masm); | 555 GenerateTailCallToSharedCode(masm); |
556 } | 556 } |
557 | 557 |
558 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 558 namespace { |
559 bool is_api_function, | 559 |
560 bool create_implicit_receiver, | 560 void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function, |
561 bool check_derived_construct) { | 561 bool create_implicit_receiver, |
| 562 bool check_derived_construct) { |
562 // ----------- S t a t e ------------- | 563 // ----------- S t a t e ------------- |
563 // -- r3 : number of arguments | 564 // -- r3 : number of arguments |
564 // -- r4 : constructor function | 565 // -- r4 : constructor function |
565 // -- r5 : allocation site or undefined | |
566 // -- r6 : new target | 566 // -- r6 : new target |
567 // -- cp : context | 567 // -- cp : context |
568 // -- lr : return address | 568 // -- lr : return address |
569 // -- sp[...]: constructor arguments | 569 // -- sp[...]: constructor arguments |
570 // ----------------------------------- | 570 // ----------------------------------- |
571 | 571 |
572 Isolate* isolate = masm->isolate(); | 572 Isolate* isolate = masm->isolate(); |
573 | 573 |
574 // Enter a construct frame. | 574 // Enter a construct frame. |
575 { | 575 { |
576 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); | 576 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); |
577 | 577 |
578 // Preserve the incoming parameters on the stack. | 578 // Preserve the incoming parameters on the stack. |
579 __ AssertUndefinedOrAllocationSite(r5, r7); | |
580 | 579 |
581 if (!create_implicit_receiver) { | 580 if (!create_implicit_receiver) { |
582 __ SmiTag(r7, r3, SetRC); | 581 __ SmiTag(r7, r3, SetRC); |
583 __ Push(cp, r5, r7); | 582 __ Push(cp, r7); |
584 __ PushRoot(Heap::kTheHoleValueRootIndex); | 583 __ PushRoot(Heap::kTheHoleValueRootIndex); |
585 } else { | 584 } else { |
586 __ SmiTag(r3); | 585 __ SmiTag(r3); |
587 __ Push(cp, r5, r3); | 586 __ Push(cp, r3); |
588 | 587 |
589 // Allocate the new receiver object. | 588 // Allocate the new receiver object. |
590 __ Push(r4, r6); | 589 __ Push(r4, r6); |
591 FastNewObjectStub stub(masm->isolate()); | 590 FastNewObjectStub stub(masm->isolate()); |
592 __ CallStub(&stub); | 591 __ CallStub(&stub); |
593 __ mr(r7, r3); | 592 __ mr(r7, r3); |
594 __ Pop(r4, r6); | 593 __ Pop(r4, r6); |
595 | 594 |
596 // ----------- S t a t e ------------- | 595 // ----------- S t a t e ------------- |
597 // -- r4: constructor function | 596 // -- r4: constructor function |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 | 703 |
705 __ SmiToPtrArrayOffset(r4, r4); | 704 __ SmiToPtrArrayOffset(r4, r4); |
706 __ add(sp, sp, r4); | 705 __ add(sp, sp, r4); |
707 __ addi(sp, sp, Operand(kPointerSize)); | 706 __ addi(sp, sp, Operand(kPointerSize)); |
708 if (create_implicit_receiver) { | 707 if (create_implicit_receiver) { |
709 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, r4, r5); | 708 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, r4, r5); |
710 } | 709 } |
711 __ blr(); | 710 __ blr(); |
712 } | 711 } |
713 | 712 |
| 713 } // namespace |
| 714 |
714 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { | 715 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
715 Generate_JSConstructStubHelper(masm, false, true, false); | 716 Generate_JSConstructStubHelper(masm, false, true, false); |
716 } | 717 } |
717 | 718 |
718 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 719 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
719 Generate_JSConstructStubHelper(masm, true, false, false); | 720 Generate_JSConstructStubHelper(masm, true, false, false); |
720 } | 721 } |
721 | 722 |
722 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { | 723 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { |
723 Generate_JSConstructStubHelper(masm, false, false, false); | 724 Generate_JSConstructStubHelper(masm, false, false, false); |
(...skipping 2271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2995 __ CallRuntime(Runtime::kThrowStackOverflow); | 2996 __ CallRuntime(Runtime::kThrowStackOverflow); |
2996 __ bkpt(0); | 2997 __ bkpt(0); |
2997 } | 2998 } |
2998 } | 2999 } |
2999 | 3000 |
3000 #undef __ | 3001 #undef __ |
3001 } // namespace internal | 3002 } // namespace internal |
3002 } // namespace v8 | 3003 } // namespace v8 |
3003 | 3004 |
3004 #endif // V8_TARGET_ARCH_PPC | 3005 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |