Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(931)

Side by Side Diff: test/mjsunit/regress/regress-5902.js

Issue 2669423002: Add test case for built-in objects' property mode. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --allow-natives-syntax
6
7 var log = [];
8
9 function check(predicate, item) {
10 if (!predicate) log.push(item);
11 }
12
13 var global = this;
14
15 Object.getOwnPropertyNames(global).forEach(function(name) {
16 // Only check for global properties with uppercase names.
17 if (name[0] != name[0].toUpperCase()) return;
18
19 var obj = global[name];
20
21 // Skip non-receivers.
22 if (! % IsJSReceiver(obj)) return;
23
24 // Skip non-natives.
25 if (!obj.toString().includes('native')) return;
26
27 // Construct an instance.
28 try {
29 new obj();
30 } catch (e) {
31 }
32
33 // Check the object.
34 check(% HasFastProperties(obj), `${name}`);
35
36 // Check the constructor.
37 var constructor = obj.constructor;
38 if (! % IsJSReceiver(constructor)) return;
39 check(% HasFastProperties(constructor), `${name}.constructor`);
40
41 // Check the prototype.
42 var prototype = obj.prototype;
43 if (! % IsJSReceiver(prototype)) return;
44 check(% HasFastProperties(prototype), `${name}.prototype`);
45
46 // Check the prototype.constructor.
47 var prototype_constructor = prototype.constructor;
48 if (! % IsJSReceiver(prototype_constructor)) return;
49 check(
50 % HasFastProperties(prototype_constructor),
51 `${name}.prototype.constructor`);
52 });
53
54 // This is the current set of dictionary mode objects.
55 // Remove items as we fix them. See issue 5902.
56 assertEquals(
57 [
58 'RegExp', 'RegExp.prototype.constructor', 'Error.prototype',
59 'EvalError.prototype', 'RangeError.prototype', 'ReferenceError.prototype',
60 'SyntaxError.prototype', 'TypeError.prototype', 'URIError.prototype',
61 'Map', 'Map.prototype.constructor', 'Set', 'Set.prototype.constructor'
62 ],
63 log);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698