Index: src/x64/macro-assembler-x64.cc |
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc |
index a80feeb778365762451f037f20716c1bc5945abb..7b5dd7816b9e773854fd8e04597d4d0f075b176d 100644 |
--- a/src/x64/macro-assembler-x64.cc |
+++ b/src/x64/macro-assembler-x64.cc |
@@ -3768,6 +3768,35 @@ 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, Label::kNear); |
+ |
+ // Check for valid Oddballs. |
+ JumpIfRoot(object, Heap::kTrueValueRootIndex, &done_checking, Label::kNear); |
+ JumpIfRoot(object, Heap::kFalseValueRootIndex, &done_checking, |
+ Label::kNear); |
+ JumpIfRoot(object, Heap::kNullValueRootIndex, &done_checking, Label::kNear); |
+ JumpIfRoot(object, Heap::kUndefinedValueRootIndex, &done_checking, |
+ Label::kNear); |
+ |
+ // Check for other primitives (String, Symbol and HeapNumber). |
+ STATIC_ASSERT(LAST_PRIMITIVE_TYPE == ODDBALL_TYPE); |
+ CmpObjectType(object, LAST_PRIMITIVE_TYPE, object); |
+ j(below, &done_checking, Label::kNear); |
+ |
+ // Check for JSReceivers. |
+ CmpInstanceType(object, FIRST_JS_RECEIVER_TYPE); |
+ Check(above_equal, kAPICallReturnedInvalidObject); |
+ |
+ bind(&done_checking); |
+ Pop(object); |
+ } |
+} |
Condition MacroAssembler::IsObjectStringType(Register heap_object, |
Register map, |