Index: src/ic/call-optimization.cc |
diff --git a/src/ic/call-optimization.cc b/src/ic/call-optimization.cc |
index 5377988d1166fc10ba62f6a8485f809291bf116f..5d7ef7bbebdb283b07ea957dafe52edd1b8457ca 100644 |
--- a/src/ic/call-optimization.cc |
+++ b/src/ic/call-optimization.cc |
@@ -49,8 +49,14 @@ Handle<JSObject> CallOptimization::LookupHolderOfExpectedType( |
bool CallOptimization::IsCompatibleReceiver(Handle<Object> receiver, |
Handle<JSObject> holder) const { |
DCHECK(is_simple_api_call()); |
- if (!receiver->IsJSObject()) return false; |
- Handle<Map> map(JSObject::cast(*receiver)->map()); |
+ if (!receiver->IsHeapObject()) return false; |
+ Handle<Map> map(HeapObject::cast(*receiver)->map()); |
+ return IsCompatibleReceiverType(map, holder); |
+} |
+ |
+ |
+bool CallOptimization::IsCompatibleReceiverType(Handle<Map> map, |
+ Handle<JSObject> holder) const { |
HolderLookup holder_lookup; |
Handle<JSObject> api_holder = LookupHolderOfExpectedType(map, &holder_lookup); |
switch (holder_lookup) { |