Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/builtins/ppc/builtins-ppc.cc

Issue 2783043002: PPC/s390: [cleanup] combine 3 ResumeGenerator stubs into one (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/builtins/s390/builtins-s390.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 Generate_JSConstructStubHelper(masm, false, false, false); 648 Generate_JSConstructStubHelper(masm, false, false, false);
649 } 649 }
650 650
651 void Builtins::Generate_JSBuiltinsConstructStubForDerived( 651 void Builtins::Generate_JSBuiltinsConstructStubForDerived(
652 MacroAssembler* masm) { 652 MacroAssembler* masm) {
653 Generate_JSConstructStubHelper(masm, false, false, true); 653 Generate_JSConstructStubHelper(masm, false, false, true);
654 } 654 }
655 655
656 // static 656 // static
657 void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { 657 void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
658 Generate_ResumeGenerator(masm, ResumeGeneratorType::kGenerator);
659 }
660
661 // static
662 void Builtins::Generate_ResumeAsyncGeneratorTrampoline(MacroAssembler* masm) {
663 Generate_ResumeGenerator(masm, ResumeGeneratorType::kAsyncGenerator);
664 }
665
666 // static
667 void Builtins::Generate_ResumeAwaitedAsyncGeneratorTrampoline(
668 MacroAssembler* masm) {
669 Generate_ResumeGenerator(masm, ResumeGeneratorType::kAwaitedAsyncGenerator);
670 }
671
672 void Builtins::Generate_ResumeGenerator(MacroAssembler* masm,
673 ResumeGeneratorType type) {
674 // ----------- S t a t e ------------- 658 // ----------- S t a t e -------------
675 // -- r3 : the value to pass to the generator 659 // -- r3 : the value to pass to the generator
676 // -- r4 : the JSGeneratorObject to resume 660 // -- r4 : the JSGeneratorObject to resume
677 // -- r5 : the resume mode (tagged) 661 // -- r5 : the resume mode (tagged)
662 // -- r6 : the SuspendFlags of the earlier suspend call (tagged)
678 // -- lr : return address 663 // -- lr : return address
679 // ----------------------------------- 664 // -----------------------------------
680 if (type == ResumeGeneratorType::kGenerator) { 665 __ SmiUntag(r6);
681 __ AssertGeneratorObject(r4); 666 __ AssertGeneratorObject(r4, r6);
682 } else {
683 __ AssertAsyncGeneratorObject(r4);
684 }
685 667
686 // Store input value into generator object. 668 // Store input value into generator object.
687 int offset = type == ResumeGeneratorType::kAwaitedAsyncGenerator 669 Label async_await, done_store_input;
688 ? JSAsyncGeneratorObject::kAwaitInputOrDebugPosOffset 670
689 : JSGeneratorObject::kInputOrDebugPosOffset; 671 __ And(r6, r6, Operand(static_cast<int>(SuspendFlags::kAsyncGeneratorAwait)));
690 __ StoreP(r3, FieldMemOperand(r4, offset), r0); 672 __ cmpi(r6, Operand(static_cast<int>(SuspendFlags::kAsyncGeneratorAwait)));
691 __ RecordWriteField(r4, offset, r3, r6, kLRHasNotBeenSaved, kDontSaveFPRegs); 673 __ beq(&async_await);
674
675 __ StoreP(r3, FieldMemOperand(r4, JSGeneratorObject::kInputOrDebugPosOffset),
676 r0);
677 __ RecordWriteField(r4, JSGeneratorObject::kInputOrDebugPosOffset, r3, r6,
678 kLRHasNotBeenSaved, kDontSaveFPRegs);
679 __ b(&done_store_input);
680
681 __ bind(&async_await);
682 __ StoreP(
683 r3,
684 FieldMemOperand(r4, JSAsyncGeneratorObject::kAwaitInputOrDebugPosOffset),
685 r0);
686 __ RecordWriteField(r4, JSAsyncGeneratorObject::kAwaitInputOrDebugPosOffset,
687 r3, r6, kLRHasNotBeenSaved, kDontSaveFPRegs);
688 __ b(&done_store_input);
689
690 __ bind(&done_store_input);
691 // `r6` no longer holds SuspendFlags
692 692
693 // Store resume mode into generator object. 693 // Store resume mode into generator object.
694 __ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kResumeModeOffset), r0); 694 __ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kResumeModeOffset), r0);
695 695
696 // Load suspended function and context. 696 // Load suspended function and context.
697 __ LoadP(r7, FieldMemOperand(r4, JSGeneratorObject::kFunctionOffset)); 697 __ LoadP(r7, FieldMemOperand(r4, JSGeneratorObject::kFunctionOffset));
698 __ LoadP(cp, FieldMemOperand(r7, JSFunction::kContextOffset)); 698 __ LoadP(cp, FieldMemOperand(r7, JSFunction::kContextOffset));
699 699
700 // Flood function if we are stepping. 700 // Flood function if we are stepping.
701 Label prepare_step_in_if_stepping, prepare_step_in_suspended_generator; 701 Label prepare_step_in_if_stepping, prepare_step_in_suspended_generator;
(...skipping 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after
3073 } 3073 }
3074 // Now jump to the instructions of the returned code object. 3074 // Now jump to the instructions of the returned code object.
3075 __ Jump(r11); 3075 __ Jump(r11);
3076 } 3076 }
3077 3077
3078 #undef __ 3078 #undef __
3079 } // namespace internal 3079 } // namespace internal
3080 } // namespace v8 3080 } // namespace v8
3081 3081
3082 #endif // V8_TARGET_ARCH_PPC 3082 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | src/builtins/s390/builtins-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698