Index: src/arm64/macro-assembler-arm64.cc |
diff --git a/src/arm64/macro-assembler-arm64.cc b/src/arm64/macro-assembler-arm64.cc |
index 59b2e249672376b2b3e8bca48fc6fc47fdbb43f0..d0b7f45374d0ef6d941deb7f50311e771c61525b 100644 |
--- a/src/arm64/macro-assembler-arm64.cc |
+++ b/src/arm64/macro-assembler-arm64.cc |
@@ -1688,6 +1688,33 @@ void MacroAssembler::AssertUndefinedOrAllocationSite(Register object, |
} |
} |
+void MacroAssembler::AssertApiCallResult(Register object) { |
+ if (emit_debug_code()) { |
+ Label done_checking; |
+ Push(object); |
+ |
+ // Check for Smis. |
+ JumpIfSmi(object, &done_checking); |
+ |
+ // Check for valid Oddballs. |
+ JumpIfRoot(object, Heap::kTrueValueRootIndex, &done_checking); |
+ JumpIfRoot(object, Heap::kFalseValueRootIndex, &done_checking); |
+ JumpIfRoot(object, Heap::kNullValueRootIndex, &done_checking); |
+ JumpIfRoot(object, Heap::kUndefinedValueRootIndex, &done_checking); |
+ |
+ // Check for other primitives (String, Symbol and HeapNumber). |
+ STATIC_ASSERT(LAST_PRIMITIVE_TYPE == ODDBALL_TYPE); |
+ CompareObjectType(object, object, object, LAST_PRIMITIVE_TYPE); |
+ B(lo, &done_checking); |
+ |
+ // Check for JSReceivers. |
+ Cmp(object, FIRST_JS_RECEIVER_TYPE); |
+ Check(hs, kAPICallReturnedInvalidObject); |
+ |
+ Bind(&done_checking); |
+ Pop(object); |
+ } |
+} |
void MacroAssembler::AssertPositiveOrZero(Register value) { |
if (emit_debug_code()) { |