Index: src/mips64/macro-assembler-mips64.cc |
diff --git a/src/mips64/macro-assembler-mips64.cc b/src/mips64/macro-assembler-mips64.cc |
index 13b4be0be60065500f3ba8cea41b835e4514bbbc..b4aa5ffa7f96d222f87fa512aabc2fbb7c99a2e2 100644 |
--- a/src/mips64/macro-assembler-mips64.cc |
+++ b/src/mips64/macro-assembler-mips64.cc |
@@ -6255,6 +6255,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); |
+ GetObjectType(object, object, object); |
+ Branch(&done_checking, lo, object, Operand(LAST_PRIMITIVE_TYPE)); |
+ |
+ // Check for JSReceivers. |
+ Check(hs, kAPICallReturnedInvalidObject, object, |
+ Operand(FIRST_JS_RECEIVER_TYPE)); |
+ |
+ bind(&done_checking); |
+ Pop(object); |
+ } |
+} |
void MacroAssembler::AssertIsRoot(Register reg, Heap::RootListIndex index) { |
if (emit_debug_code()) { |