2017-02-03 12:19:21 +00:00
|
|
|
// 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.
|
2017-06-02 22:37:41 +00:00
|
|
|
if (!%IsJSReceiver(obj)) return;
|
2017-02-03 12:19:21 +00:00
|
|
|
|
|
|
|
// Skip non-natives.
|
|
|
|
if (!obj.toString().includes('native')) return;
|
|
|
|
|
|
|
|
// Construct an instance.
|
|
|
|
try {
|
|
|
|
new obj();
|
|
|
|
} catch (e) {
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check the object.
|
2017-02-09 16:46:06 +00:00
|
|
|
check(%HasFastProperties(obj), `${name}`);
|
2017-02-03 12:19:21 +00:00
|
|
|
|
|
|
|
// Check the constructor.
|
|
|
|
var constructor = obj.constructor;
|
2017-02-09 16:46:06 +00:00
|
|
|
if (!%IsJSReceiver(constructor)) return;
|
|
|
|
check(%HasFastProperties(constructor), `${name}.constructor`);
|
2017-02-03 12:19:21 +00:00
|
|
|
|
|
|
|
// Check the prototype.
|
|
|
|
var prototype = obj.prototype;
|
2017-02-09 16:46:06 +00:00
|
|
|
if (!%IsJSReceiver(prototype)) return;
|
|
|
|
check(%HasFastProperties(prototype), `${name}.prototype`);
|
2017-02-03 12:19:21 +00:00
|
|
|
|
|
|
|
// Check the prototype.constructor.
|
|
|
|
var prototype_constructor = prototype.constructor;
|
2017-02-09 16:46:06 +00:00
|
|
|
if (!%IsJSReceiver(prototype_constructor)) return;
|
2017-02-03 12:19:21 +00:00
|
|
|
check(
|
2017-02-09 16:46:06 +00:00
|
|
|
%HasFastProperties(prototype_constructor),
|
2017-02-03 12:19:21 +00:00
|
|
|
`${name}.prototype.constructor`);
|
|
|
|
});
|
|
|
|
|
2017-11-28 08:35:49 +00:00
|
|
|
// There should be no dictionary mode builtin objects.
|
2021-02-04 10:42:49 +00:00
|
|
|
if (!%IsDictPropertyConstTrackingEnabled())
|
|
|
|
assertEquals([], log);
|