OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 | 76 |
77 // Builtin constructors. | 77 // Builtin constructors. |
78 var functions = [ | 78 var functions = [ |
79 Array, | 79 Array, |
80 ArrayBuffer, | 80 ArrayBuffer, |
81 Boolean, | 81 Boolean, |
82 // DataView, | 82 // DataView, |
83 Date, | 83 Date, |
84 Error, | 84 Error, |
85 Float32Array, | |
86 Float64Array, | |
87 Function, | 85 Function, |
88 Int16Array, | |
89 Int32Array, | |
90 Int8Array, | |
91 Map, | 86 Map, |
92 Number, | 87 Number, |
93 Object, | 88 Object, |
94 // Promise, | 89 // Promise, |
95 RegExp, | 90 RegExp, |
96 Set, | 91 Set, |
97 String, | 92 String, |
98 // Symbol, not constructible | 93 // Symbol, not constructible |
99 Uint16Array, | |
100 Uint32Array, | |
101 Uint8Array, | |
102 Uint8ClampedArray, | |
103 WeakMap, | 94 WeakMap, |
104 WeakSet, | 95 WeakSet, |
105 ]; | 96 ]; |
106 | 97 |
107 for (var f of functions) { | 98 for (var f of functions) { |
108 assertPrototypeOf(f, Function.prototype); | 99 assertPrototypeOf(f, Function.prototype); |
109 assertPrototypeOf(new f(), f.prototype); | 100 assertPrototypeOf(new f(), f.prototype); |
110 } | 101 } |
111 | 102 |
| 103 var typedArrayConstructors = [ |
| 104 Float32Array, |
| 105 Float64Array, |
| 106 Int16Array, |
| 107 Int32Array, |
| 108 Int8Array, |
| 109 Uint16Array, |
| 110 Uint32Array, |
| 111 Uint8Array, |
| 112 Uint8ClampedArray, |
| 113 ]; |
| 114 |
| 115 for (var t of typedArrayConstructors) { |
| 116 assertPrototypeOf(t, Uint8Array.__proto__); |
| 117 assertPrototypeOf(new t(), t.prototype); |
| 118 } |
| 119 |
112 var p = new Promise(function() {}); | 120 var p = new Promise(function() {}); |
113 assertPrototypeOf(p, Promise.prototype); | 121 assertPrototypeOf(p, Promise.prototype); |
114 | 122 |
115 var dv = new DataView(new ArrayBuffer()); | 123 var dv = new DataView(new ArrayBuffer()); |
116 assertPrototypeOf(dv, DataView.prototype); | 124 assertPrototypeOf(dv, DataView.prototype); |
OLD | NEW |