2019-11-27 12:29:03 +00:00
|
|
|
// Copyright 2019 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.
|
|
|
|
|
2022-04-28 14:22:23 +00:00
|
|
|
// Flags: --allow-natives-syntax --turbofan --no-always-turbofan
|
2019-11-28 09:23:19 +00:00
|
|
|
|
|
|
|
var expect_interpreted = true;
|
2019-11-27 12:29:03 +00:00
|
|
|
|
|
|
|
class C {
|
|
|
|
get prop() {
|
|
|
|
return 42;
|
|
|
|
}
|
|
|
|
set prop(v) {
|
2021-03-26 17:02:15 +00:00
|
|
|
if (!%IsDictPropertyConstTrackingEnabled()) {
|
|
|
|
// TODO(v8:11457) If v8_dict_property_const_tracking is enabled, then
|
|
|
|
// C.prototype is a dictionary mode object and we cannot inline the call
|
|
|
|
// to this setter, yet.
|
|
|
|
assertEquals(expect_interpreted, %IsBeingInterpreted());
|
|
|
|
}
|
2019-11-27 12:29:03 +00:00
|
|
|
%TurbofanStaticAssert(v === 43);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const c = new C();
|
|
|
|
|
|
|
|
function foo() {
|
2019-11-28 09:23:19 +00:00
|
|
|
assertEquals(expect_interpreted, %IsBeingInterpreted());
|
2019-11-27 12:29:03 +00:00
|
|
|
%TurbofanStaticAssert(c.prop === 42);
|
|
|
|
c.prop = 43;
|
|
|
|
}
|
|
|
|
|
|
|
|
%PrepareFunctionForOptimization(
|
|
|
|
Object.getOwnPropertyDescriptor(C.prototype, 'prop').get);
|
|
|
|
%PrepareFunctionForOptimization(
|
|
|
|
Object.getOwnPropertyDescriptor(C.prototype, 'prop').set);
|
|
|
|
%PrepareFunctionForOptimization(foo);
|
2019-11-28 09:23:19 +00:00
|
|
|
|
2019-11-27 12:29:03 +00:00
|
|
|
foo();
|
|
|
|
foo();
|
2019-11-28 09:23:19 +00:00
|
|
|
expect_interpreted = false;
|
2022-02-23 13:48:02 +00:00
|
|
|
%OptimizeFunctionOnNextCall(foo);
|
2019-11-27 12:29:03 +00:00
|
|
|
foo();
|