551e0aa11b
This adds back the instanceof operator support in the backends and introduces a @@hasInstance protector cell on the isolate that guards the fast path for the InstanceOfStub. This way we recover the ~10% regression on Octane EarleyBoyer in Crankshaft and greatly improve TurboFan and Ignition performance of instanceof. R=ishell@chromium.org TBR=hpayer@chromium.org,rossberg@chromium.org BUG=chromium:597249, v8:4447 LOG=n Review-Url: https://codereview.chromium.org/1980483003 Cr-Commit-Position: refs/heads/master@{#36275}
18 lines
508 B
JavaScript
18 lines
508 B
JavaScript
// Copyright 2016 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// Flags: --allow-natives-syntax --harmony-instanceof
|
|
|
|
function F() {}
|
|
var f = new F
|
|
|
|
var proto = Object.getPrototypeOf(F);
|
|
Object.setPrototypeOf(F, null);
|
|
F[Symbol.hasInstance] = function(v) { return true };
|
|
Object.setPrototypeOf(F, proto);
|
|
|
|
function foo(x) { return x instanceof F };
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
assertTrue(foo(1));
|