Index: src/arm/macro-assembler-arm.cc |
diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc |
index 30fb52729d0df377afc7b0404d0e81d2f94890e4..26d488d66222dcd6e87cefae46a53b37737863e0 100644 |
--- a/src/arm/macro-assembler-arm.cc |
+++ b/src/arm/macro-assembler-arm.cc |
@@ -2822,6 +2822,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, Operand(FIRST_JS_RECEIVER_TYPE)); |
+ Check(hs, kAPICallReturnedInvalidObject); |
+ |
+ bind(&done_checking); |
+ Pop(object); |
+ } |
+} |
void MacroAssembler::AssertIsRoot(Register reg, Heap::RootListIndex index) { |
if (emit_debug_code()) { |