888acb2f3c
1) Make sure we don't enable prototype setup mode for parent class and its prototype objects. 2) Make sure we create builtins and their prototypes with completed setup mode. 3) Drive-by-fix: setup typed array classes in bootstrapper.cc instead of typedarray.js, and drop %FunctionSetPrototype(). Bug: v8:7115, v8:5902 Change-Id: I58ac091d85647abc3307bd47baf48e378e3695c5 Reviewed-on: https://chromium-review.googlesource.com/790992 Commit-Queue: Igor Sheludko <ishell@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#49655}
56 lines
1.4 KiB
JavaScript
56 lines
1.4 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.
|
|
assertEquals([], log);
|