| Index: src/ia32/stub-cache-ia32.cc
|
| diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc
|
| index 28a39946df8978f1adbaf543d0d40f1c3ed655b7..8d45789c2562ffeeca4e230e010ee321b17d9600 100644
|
| --- a/src/ia32/stub-cache-ia32.cc
|
| +++ b/src/ia32/stub-cache-ia32.cc
|
| @@ -584,20 +584,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);
|
| @@ -611,10 +600,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|.
|
| @@ -627,17 +617,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.
|
| @@ -2309,9 +2294,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;
|
|
|
| @@ -2332,9 +2315,10 @@ Handle<Code> CallStubCompiler::CompileFastApiCall(
|
| // before calling any runtime function.
|
| __ sub(esp, 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), edx, holder, ebx, eax, edi,
|
| - name, depth, &miss);
|
| + name, 0, &miss);
|
|
|
| // Move the return address on top of the stack.
|
| __ mov(eax, Operand(esp, 4 * kPointerSize));
|
|
|