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 #if V8_TARGET_ARCH_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 Label ok; | 541 Label ok; |
542 __ LoadRoot(t0, Heap::kStackLimitRootIndex); | 542 __ LoadRoot(t0, Heap::kStackLimitRootIndex); |
543 __ Branch(&ok, hs, sp, Operand(t0)); | 543 __ Branch(&ok, hs, sp, Operand(t0)); |
544 | 544 |
545 GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode); | 545 GenerateTailCallToReturnedCode(masm, Runtime::kTryInstallOptimizedCode); |
546 | 546 |
547 __ bind(&ok); | 547 __ bind(&ok); |
548 GenerateTailCallToSharedCode(masm); | 548 GenerateTailCallToSharedCode(masm); |
549 } | 549 } |
550 | 550 |
551 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 551 namespace { |
552 bool is_api_function, | 552 |
553 bool create_implicit_receiver, | 553 void Generate_JSConstructStubHelper(MacroAssembler* masm, bool is_api_function, |
554 bool check_derived_construct) { | 554 bool create_implicit_receiver, |
| 555 bool check_derived_construct) { |
555 // ----------- S t a t e ------------- | 556 // ----------- S t a t e ------------- |
556 // -- a0 : number of arguments | 557 // -- a0 : number of arguments |
557 // -- a1 : constructor function | 558 // -- a1 : constructor function |
558 // -- a2 : allocation site or undefined | |
559 // -- a3 : new target | 559 // -- a3 : new target |
560 // -- cp : context | 560 // -- cp : context |
561 // -- ra : return address | 561 // -- ra : return address |
562 // -- sp[...]: constructor arguments | 562 // -- sp[...]: constructor arguments |
563 // ----------------------------------- | 563 // ----------------------------------- |
564 | 564 |
565 Isolate* isolate = masm->isolate(); | 565 Isolate* isolate = masm->isolate(); |
566 | 566 |
567 // Enter a construct frame. | 567 // Enter a construct frame. |
568 { | 568 { |
569 FrameScope scope(masm, StackFrame::CONSTRUCT); | 569 FrameScope scope(masm, StackFrame::CONSTRUCT); |
570 | 570 |
571 // Preserve the incoming parameters on the stack. | 571 // Preserve the incoming parameters on the stack. |
572 __ AssertUndefinedOrAllocationSite(a2, t0); | |
573 __ SmiTag(a0); | 572 __ SmiTag(a0); |
574 __ Push(cp, a2, a0); | 573 __ Push(cp, a0); |
575 | 574 |
576 if (create_implicit_receiver) { | 575 if (create_implicit_receiver) { |
577 // Allocate the new receiver object. | 576 // Allocate the new receiver object. |
578 __ Push(a1, a3); | 577 __ Push(a1, a3); |
579 FastNewObjectStub stub(masm->isolate()); | 578 FastNewObjectStub stub(masm->isolate()); |
580 __ CallStub(&stub); | 579 __ CallStub(&stub); |
581 __ mov(t4, v0); | 580 __ mov(t4, v0); |
582 __ Pop(a1, a3); | 581 __ Pop(a1, a3); |
583 | 582 |
584 // ----------- S t a t e ------------- | 583 // ----------- S t a t e ------------- |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 } | 690 } |
692 | 691 |
693 __ Lsa(sp, sp, a1, kPointerSizeLog2 - 1); | 692 __ Lsa(sp, sp, a1, kPointerSizeLog2 - 1); |
694 __ Addu(sp, sp, kPointerSize); | 693 __ Addu(sp, sp, kPointerSize); |
695 if (create_implicit_receiver) { | 694 if (create_implicit_receiver) { |
696 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, a1, a2); | 695 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, a1, a2); |
697 } | 696 } |
698 __ Ret(); | 697 __ Ret(); |
699 } | 698 } |
700 | 699 |
| 700 } // namespace |
| 701 |
701 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { | 702 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
702 Generate_JSConstructStubHelper(masm, false, true, false); | 703 Generate_JSConstructStubHelper(masm, false, true, false); |
703 } | 704 } |
704 | 705 |
705 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 706 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
706 Generate_JSConstructStubHelper(masm, true, false, false); | 707 Generate_JSConstructStubHelper(masm, true, false, false); |
707 } | 708 } |
708 | 709 |
709 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { | 710 void Builtins::Generate_JSBuiltinsConstructStub(MacroAssembler* masm) { |
710 Generate_JSConstructStubHelper(masm, false, false, false); | 711 Generate_JSConstructStubHelper(masm, false, false, false); |
(...skipping 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2981 __ break_(0xCC); | 2982 __ break_(0xCC); |
2982 } | 2983 } |
2983 } | 2984 } |
2984 | 2985 |
2985 #undef __ | 2986 #undef __ |
2986 | 2987 |
2987 } // namespace internal | 2988 } // namespace internal |
2988 } // namespace v8 | 2989 } // namespace v8 |
2989 | 2990 |
2990 #endif // V8_TARGET_ARCH_MIPS | 2991 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |