Index: src/arm/stub-cache-arm.cc |
diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc |
index 60a2129a60273eda55f7d6ca8b8b353ef7d1a267..ae4d64abd74e462c0132ddc6fa797cc8cb97b68c 100644 |
--- a/src/arm/stub-cache-arm.cc |
+++ b/src/arm/stub-cache-arm.cc |
@@ -801,20 +801,10 @@ class CallInterceptorCompiler BASE_EMBEDDED { |
ASSERT(optimization.is_constant_call()); |
ASSERT(!lookup->holder()->IsGlobalObject()); |
Counters* counters = masm->isolate()->counters(); |
- int depth1 = kInvalidProtoDepth; |
- int depth2 = kInvalidProtoDepth; |
- bool can_do_fast_api_call = false; |
- if (optimization.is_simple_api_call() && |
- !lookup->holder()->IsGlobalObject()) { |
- depth1 = optimization.GetPrototypeDepthOfExpectedType( |
- object, interceptor_holder); |
- if (depth1 == kInvalidProtoDepth) { |
- depth2 = optimization.GetPrototypeDepthOfExpectedType( |
- interceptor_holder, Handle<JSObject>(lookup->holder())); |
- } |
- can_do_fast_api_call = |
- depth1 != kInvalidProtoDepth || depth2 != kInvalidProtoDepth; |
- } |
+ |
+ bool can_do_fast_api_call = !lookup->holder()->IsGlobalObject() && |
+ optimization.is_simple_api_call() && |
+ optimization.IsCompatibleReceiver(object); |
__ IncrementCounter(counters->call_const_interceptor(), 1, |
scratch1, scratch2); |
@@ -829,10 +819,11 @@ class CallInterceptorCompiler BASE_EMBEDDED { |
// haven't changed and thus we can invoke interceptor. |
Label miss_cleanup; |
Label* miss = can_do_fast_api_call ? &miss_cleanup : miss_label; |
+ int depth = can_do_fast_api_call ? 0 : kInvalidProtoDepth; |
Register holder = |
stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder, |
scratch1, scratch2, scratch3, |
- name, depth1, miss); |
+ name, depth, miss); |
// Invoke an interceptor and if it provides a value, |
// branch to |regular_invoke|. |
@@ -845,17 +836,12 @@ class CallInterceptorCompiler BASE_EMBEDDED { |
// Check that the maps from interceptor's holder to constant function's |
// holder haven't changed and thus we can use cached constant function. |
+ // TODO(2268): Switch to return holder once embedders have adapted. |
if (*interceptor_holder != lookup->holder()) { |
stub_compiler_->CheckPrototypes(interceptor_holder, receiver, |
Handle<JSObject>(lookup->holder()), |
scratch1, scratch2, scratch3, |
- name, depth2, miss); |
- } else { |
- // CheckPrototypes has a side effect of fetching a 'holder' |
- // for API (object which is instanceof for the signature). It's |
- // safe to omit it here, as if present, it should be fetched |
- // by the previous CheckPrototypes. |
- ASSERT(depth2 == kInvalidProtoDepth); |
+ name, kInvalidProtoDepth, miss); |
} |
// Invoke function. |
@@ -2424,9 +2410,7 @@ Handle<Code> CallStubCompiler::CompileFastApiCall( |
if (object->IsGlobalObject()) return Handle<Code>::null(); |
if (!cell.is_null()) return Handle<Code>::null(); |
if (!object->IsJSObject()) return Handle<Code>::null(); |
- int depth = optimization.GetPrototypeDepthOfExpectedType( |
- Handle<JSObject>::cast(object), holder); |
- if (depth == kInvalidProtoDepth) return Handle<Code>::null(); |
+ if (!optimization.IsCompatibleReceiver(object)) return Handle<Code>::null(); |
Label miss, miss_before_stack_reserved; |
GenerateNameCheck(name, &miss_before_stack_reserved); |
@@ -2443,9 +2427,10 @@ Handle<Code> CallStubCompiler::CompileFastApiCall( |
ReserveSpaceForFastApiCall(masm(), r0); |
- // Check that the maps haven't changed and find a Holder as a side effect. |
+ // Check that the maps haven't changed and find holder as a side effect. |
+ // TODO(2268): Switch to return holder once embedders have adapted. |
CheckPrototypes(Handle<JSObject>::cast(object), r1, holder, r0, r3, r4, name, |
- depth, &miss); |
+ 0, &miss); |
GenerateFastApiDirectCall(masm(), optimization, argc); |