Index: src/x64/stub-cache-x64.cc |
diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc |
index 26a97abd20e33cba1473371dbe8092d220a5e906..cf23c1e5aa74963142d80d5a30aaabf536238ee9 100644 |
--- a/src/x64/stub-cache-x64.cc |
+++ b/src/x64/stub-cache-x64.cc |
@@ -570,20 +570,9 @@ class CallInterceptorCompiler BASE_EMBEDDED { |
ASSERT(optimization.is_constant_call()); |
ASSERT(!lookup->holder()->IsGlobalObject()); |
- 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); |
Counters* counters = masm->isolate()->counters(); |
__ IncrementCounter(counters->call_const_interceptor(), 1); |
@@ -597,10 +586,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|. |
@@ -613,17 +603,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. |
@@ -2132,9 +2117,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); |
@@ -2154,9 +2137,10 @@ Handle<Code> CallStubCompiler::CompileFastApiCall( |
// before calling any runtime function. |
__ subq(rsp, Immediate(kFastApiCallArguments * kPointerSize)); |
- // 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), rdx, holder, rbx, rax, rdi, |
- name, depth, &miss); |
+ name, 0, &miss); |
// Move the return address on top of the stack. |
__ movq(rax, Operand(rsp, 4 * kPointerSize)); |