d7a8170d2d
Bug: v8:8801,v8:8394,v8:9183 Change-Id: If482c6a14f389d54c6ca3891aa7b8475f7a1fce1 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1660617 Commit-Queue: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Mythri Alle <mythria@chromium.org> Auto-Submit: Ross McIlroy <rmcilroy@chromium.org> Cr-Commit-Position: refs/heads/master@{#62192}
44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
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
|
|
|
|
(function TestDeoptInNamedSuperGetter() {
|
|
class C { m() { return 23 } }
|
|
class D extends C { f() { return super.boom() } }
|
|
|
|
var should_deoptimize_caller = false;
|
|
Object.defineProperty(C.prototype, "boom", { get: function() {
|
|
if (should_deoptimize_caller) %DeoptimizeFunction(D.prototype.f);
|
|
return this.m
|
|
}});
|
|
|
|
%PrepareFunctionForOptimization(D.prototype.f);
|
|
assertEquals(23, new D().f());
|
|
assertEquals(23, new D().f());
|
|
%OptimizeFunctionOnNextCall(D.prototype.f);
|
|
assertEquals(23, new D().f());
|
|
should_deoptimize_caller = true;
|
|
assertEquals(23, new D().f());
|
|
})();
|
|
|
|
(function TestDeoptInKeyedSuperGetter() {
|
|
class C { m() { return 23 } }
|
|
class D extends C { f(name) { return super[name]() } }
|
|
|
|
var should_deoptimize_caller = false;
|
|
Object.defineProperty(C.prototype, "boom", { get: function() {
|
|
if (should_deoptimize_caller) %DeoptimizeFunction(D.prototype.f);
|
|
return this.m
|
|
}});
|
|
|
|
%PrepareFunctionForOptimization(D.prototype.f);
|
|
assertEquals(23, new D().f("boom"));
|
|
assertEquals(23, new D().f("boom"));
|
|
%OptimizeFunctionOnNextCall(D.prototype.f);
|
|
assertEquals(23, new D().f("boom"));
|
|
should_deoptimize_caller = true;
|
|
assertEquals(23, new D().f("boom"));
|
|
})();
|