Index: src/ppc/macro-assembler-ppc.cc |
diff --git a/src/ppc/macro-assembler-ppc.cc b/src/ppc/macro-assembler-ppc.cc |
index 56e78762453b98da202b91048a7d76c7e5db90b1..66fd73bd245082c2f2f07cfd6058f7cbd37709dc 100644 |
--- a/src/ppc/macro-assembler-ppc.cc |
+++ b/src/ppc/macro-assembler-ppc.cc |
@@ -2625,28 +2625,34 @@ void MacroAssembler::AssertBoundFunction(Register object) { |
} |
} |
-void MacroAssembler::AssertGeneratorObject(Register object) { |
- if (emit_debug_code()) { |
- STATIC_ASSERT(kSmiTag == 0); |
- TestIfSmi(object, r0); |
- 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, r0); |
+ Check(ne, kOperandIsASmiAndNotAGeneratorObject); |
+ |
+ // 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, r0); |
- 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))); |
+ cmpi(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, |