v8/test/mjsunit/regress/regress-5902.js
Frank Emrich 527754fbae [dict-proto] Constness tracking of dictionary properties (jitless)
For dictionary mode objects, whether or not a property is constant was
not tracked before. This CL makes the required non-Turbofan changes,
guarded behind the new flag V8_DICT_PROPERTY_CONST_TRACKING.

In addition, prototypes are not converted to fast mode objects if this
flags is enabled.

Bug: v8:11247
Change-Id: Ia5942733239a97560b6efc015f0e25a35fea3d7a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2566757
Commit-Queue: Frank Emrich <emrich@google.com>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72524}
2021-02-04 11:42:33 +00:00

57 lines
1.5 KiB
JavaScript

// Copyright 2017 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
var log = [];
function check(predicate, item) {
if (!predicate) log.push(item);
}
var global = this;
Object.getOwnPropertyNames(global).forEach(function(name) {
// Only check for global properties with uppercase names.
if (name[0] != name[0].toUpperCase()) return;
var obj = global[name];
// Skip non-receivers.
if (!%IsJSReceiver(obj)) return;
// Skip non-natives.
if (!obj.toString().includes('native')) return;
// Construct an instance.
try {
new obj();
} catch (e) {
}
// Check the object.
check(%HasFastProperties(obj), `${name}`);
// Check the constructor.
var constructor = obj.constructor;
if (!%IsJSReceiver(constructor)) return;
check(%HasFastProperties(constructor), `${name}.constructor`);
// Check the prototype.
var prototype = obj.prototype;
if (!%IsJSReceiver(prototype)) return;
check(%HasFastProperties(prototype), `${name}.prototype`);
// Check the prototype.constructor.
var prototype_constructor = prototype.constructor;
if (!%IsJSReceiver(prototype_constructor)) return;
check(
%HasFastProperties(prototype_constructor),
`${name}.prototype.constructor`);
});
// There should be no dictionary mode builtin objects.
if (!%IsDictPropertyConstTrackingEnabled())
assertEquals([], log);