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

Unified Diff: src/builtins/ppc/builtins-ppc.cc

Issue 2783043002: PPC/s390: [cleanup] combine 3 ResumeGenerator stubs into one (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/builtins/s390/builtins-s390.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/ppc/builtins-ppc.cc
diff --git a/src/builtins/ppc/builtins-ppc.cc b/src/builtins/ppc/builtins-ppc.cc
index 836b405b4b1dcd32f67fb3ed5c0b8ad906928d45..44b6906eb921dc81231d8253a97761bc82b8b168 100644
--- a/src/builtins/ppc/builtins-ppc.cc
+++ b/src/builtins/ppc/builtins-ppc.cc
@@ -655,40 +655,40 @@ void Builtins::Generate_JSBuiltinsConstructStubForDerived(
// static
void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
- Generate_ResumeGenerator(masm, ResumeGeneratorType::kGenerator);
-}
-
-// static
-void Builtins::Generate_ResumeAsyncGeneratorTrampoline(MacroAssembler* masm) {
- Generate_ResumeGenerator(masm, ResumeGeneratorType::kAsyncGenerator);
-}
-
-// static
-void Builtins::Generate_ResumeAwaitedAsyncGeneratorTrampoline(
- MacroAssembler* masm) {
- Generate_ResumeGenerator(masm, ResumeGeneratorType::kAwaitedAsyncGenerator);
-}
-
-void Builtins::Generate_ResumeGenerator(MacroAssembler* masm,
- ResumeGeneratorType type) {
// ----------- S t a t e -------------
// -- r3 : the value to pass to the generator
// -- r4 : the JSGeneratorObject to resume
// -- r5 : the resume mode (tagged)
+ // -- r6 : the SuspendFlags of the earlier suspend call (tagged)
// -- lr : return address
// -----------------------------------
- if (type == ResumeGeneratorType::kGenerator) {
- __ AssertGeneratorObject(r4);
- } else {
- __ AssertAsyncGeneratorObject(r4);
- }
+ __ SmiUntag(r6);
+ __ AssertGeneratorObject(r4, r6);
// Store input value into generator object.
- int offset = type == ResumeGeneratorType::kAwaitedAsyncGenerator
- ? JSAsyncGeneratorObject::kAwaitInputOrDebugPosOffset
- : JSGeneratorObject::kInputOrDebugPosOffset;
- __ StoreP(r3, FieldMemOperand(r4, offset), r0);
- __ RecordWriteField(r4, offset, r3, r6, kLRHasNotBeenSaved, kDontSaveFPRegs);
+ Label async_await, done_store_input;
+
+ __ And(r6, r6, Operand(static_cast<int>(SuspendFlags::kAsyncGeneratorAwait)));
+ __ cmpi(r6, Operand(static_cast<int>(SuspendFlags::kAsyncGeneratorAwait)));
+ __ beq(&async_await);
+
+ __ StoreP(r3, FieldMemOperand(r4, JSGeneratorObject::kInputOrDebugPosOffset),
+ r0);
+ __ RecordWriteField(r4, JSGeneratorObject::kInputOrDebugPosOffset, r3, r6,
+ kLRHasNotBeenSaved, kDontSaveFPRegs);
+ __ b(&done_store_input);
+
+ __ bind(&async_await);
+ __ StoreP(
+ r3,
+ FieldMemOperand(r4, JSAsyncGeneratorObject::kAwaitInputOrDebugPosOffset),
+ r0);
+ __ RecordWriteField(r4, JSAsyncGeneratorObject::kAwaitInputOrDebugPosOffset,
+ r3, r6, kLRHasNotBeenSaved, kDontSaveFPRegs);
+ __ b(&done_store_input);
+
+ __ bind(&done_store_input);
+ // `r6` no longer holds SuspendFlags
// Store resume mode into generator object.
__ StoreP(r5, FieldMemOperand(r4, JSGeneratorObject::kResumeModeOffset), r0);
« 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