OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --allow-natives-syntax | 5 // Flags: --allow-natives-syntax |
6 | 6 |
7 var log = []; | 7 var log = []; |
8 | 8 |
9 function check(predicate, item) { | 9 function check(predicate, item) { |
10 if (!predicate) log.push(item); | 10 if (!predicate) log.push(item); |
(...skipping 13 matching lines...) Expand all Loading... |
24 // Skip non-natives. | 24 // Skip non-natives. |
25 if (!obj.toString().includes('native')) return; | 25 if (!obj.toString().includes('native')) return; |
26 | 26 |
27 // Construct an instance. | 27 // Construct an instance. |
28 try { | 28 try { |
29 new obj(); | 29 new obj(); |
30 } catch (e) { | 30 } catch (e) { |
31 } | 31 } |
32 | 32 |
33 // Check the object. | 33 // Check the object. |
34 check(% HasFastProperties(obj), `${name}`); | 34 check(%HasFastProperties(obj), `${name}`); |
35 | 35 |
36 // Check the constructor. | 36 // Check the constructor. |
37 var constructor = obj.constructor; | 37 var constructor = obj.constructor; |
38 if (! % IsJSReceiver(constructor)) return; | 38 if (!%IsJSReceiver(constructor)) return; |
39 check(% HasFastProperties(constructor), `${name}.constructor`); | 39 check(%HasFastProperties(constructor), `${name}.constructor`); |
40 | 40 |
41 // Check the prototype. | 41 // Check the prototype. |
42 var prototype = obj.prototype; | 42 var prototype = obj.prototype; |
43 if (! % IsJSReceiver(prototype)) return; | 43 if (!%IsJSReceiver(prototype)) return; |
44 check(% HasFastProperties(prototype), `${name}.prototype`); | 44 check(%HasFastProperties(prototype), `${name}.prototype`); |
45 | 45 |
46 // Check the prototype.constructor. | 46 // Check the prototype.constructor. |
47 var prototype_constructor = prototype.constructor; | 47 var prototype_constructor = prototype.constructor; |
48 if (! % IsJSReceiver(prototype_constructor)) return; | 48 if (!%IsJSReceiver(prototype_constructor)) return; |
49 check( | 49 check( |
50 % HasFastProperties(prototype_constructor), | 50 %HasFastProperties(prototype_constructor), |
51 `${name}.prototype.constructor`); | 51 `${name}.prototype.constructor`); |
52 }); | 52 }); |
53 | 53 |
54 // This is the current set of dictionary mode objects. | 54 // This is the current set of dictionary mode objects. |
55 // Remove items as we fix them. See issue 5902. | 55 // Remove items as we fix them. See issue 5902. |
56 assertEquals( | 56 assertEquals( |
57 [ | 57 [ |
58 'RegExp', 'RegExp.prototype.constructor', 'Error.prototype', | 58 'RegExp', 'RegExp.prototype.constructor', 'Error.prototype', |
59 'EvalError.prototype', 'RangeError.prototype', 'ReferenceError.prototype', | 59 'EvalError.prototype', 'RangeError.prototype', 'ReferenceError.prototype', |
60 'SyntaxError.prototype', 'TypeError.prototype', 'URIError.prototype', | 60 'SyntaxError.prototype', 'TypeError.prototype', 'URIError.prototype', |
61 'Map', 'Map.prototype.constructor', 'Set', 'Set.prototype.constructor' | 61 'Map', 'Map.prototype.constructor', 'Set', 'Set.prototype.constructor' |
62 ], | 62 ], |
63 log); | 63 log); |
OLD | NEW |