v8/test/mjsunit/compiler/promise-species.js
Georg Neis e3d4dd0805 Add missing deopt-trigger to invalidation of some protector cells.
R=bmeurer@chromium.org

Change-Id: Idd9c45f733e2e5d518c69a6ead2b56f6433ca30e
Reviewed-on: https://chromium-review.googlesource.com/1114598
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54020}
2018-06-26 09:38:20 +00:00

30 lines
571 B
JavaScript

// Copyright 2018 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
class Foo extends Promise {};
function f() {
return new Promise(r => 88).then(x => 88);
}
let y;
y = f();
assertFalse(y instanceof Foo);
y = f();
assertFalse(y instanceof Foo);
%OptimizeFunctionOnNextCall(f);
y = f();
assertFalse(y instanceof Foo);
assertTrue(Reflect.defineProperty(Promise, Symbol.species, {value: Foo}));
y = f();
assertInstanceof(y, Foo);