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

Unified Diff: src/s390/macro-assembler-s390.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 | « src/s390/macro-assembler-s390.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/s390/macro-assembler-s390.cc
diff --git a/src/s390/macro-assembler-s390.cc b/src/s390/macro-assembler-s390.cc
index 6bfe522651cff39a5b52aaa45fe75107bd7231e7..687bf14095f8981ecf711937f881fa8f74dfe64a 100644
--- a/src/s390/macro-assembler-s390.cc
+++ b/src/s390/macro-assembler-s390.cc
@@ -2401,28 +2401,34 @@ void MacroAssembler::AssertBoundFunction(Register object) {
}
}
-void MacroAssembler::AssertGeneratorObject(Register object) {
- if (emit_debug_code()) {
- STATIC_ASSERT(kSmiTag == 0);
- TestIfSmi(object);
- Check(ne, kOperandIsASmiAndNotAGeneratorObject, cr0);
- push(object);
- CompareObjectType(object, object, object, JS_GENERATOR_OBJECT_TYPE);
- pop(object);
- Check(eq, kOperandIsNotAGeneratorObject);
- }
-}
+void MacroAssembler::AssertGeneratorObject(Register object, Register flags) {
+ // `flags` should be an untagged integer. See `SuspendFlags` in src/globals.h
+ if (!emit_debug_code()) return;
+ TestIfSmi(object);
+ Check(ne, kOperandIsASmiAndNotAGeneratorObject, cr0);
+
+ // Load map
+ Register map = object;
+ push(object);
+ LoadP(map, FieldMemOperand(object, HeapObject::kMapOffset));
-void MacroAssembler::AssertAsyncGeneratorObject(Register object) {
- if (emit_debug_code()) {
- STATIC_ASSERT(kSmiTag == 0);
- TestIfSmi(object);
- Check(ne, kOperandIsASmiAndNotAGeneratorObject);
- push(object);
- CompareObjectType(object, object, object, JS_ASYNC_GENERATOR_OBJECT_TYPE);
- pop(object);
- Check(eq, kOperandIsNotAGeneratorObject);
- }
+ Label async, do_check;
+ And(ip, flags, Operand(static_cast<int>(SuspendFlags::kGeneratorTypeMask)));
+ CmpP(ip, Operand(static_cast<int>(SuspendFlags::kGeneratorTypeMask)));
+ bne(&async);
+
+ // Check if JSGeneratorObject
+ CompareInstanceType(map, object, JS_GENERATOR_OBJECT_TYPE);
+ b(&do_check);
+
+ bind(&async);
+ // Check if JSAsyncGeneratorObject
+ CompareInstanceType(map, object, JS_ASYNC_GENERATOR_OBJECT_TYPE);
+
+ bind(&do_check);
+ // Restore generator object to register and perform assertion
+ pop(object);
+ Check(eq, kOperandIsNotAGeneratorObject);
}
void MacroAssembler::AssertUndefinedOrAllocationSite(Register object,
« no previous file with comments | « src/s390/macro-assembler-s390.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698