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, |