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

Side by Side Diff: test/mjsunit/harmony/sharedarraybuffer.js

Issue 1554523002: Revert of Use ES2015-style TypedArray prototype chain (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 assertSame(abLen0, aOverAbLen0.buffer); 197 assertSame(abLen0, aOverAbLen0.buffer);
198 assertSame(elementSize, aOverAbLen0.BYTES_PER_ELEMENT); 198 assertSame(elementSize, aOverAbLen0.BYTES_PER_ELEMENT);
199 assertSame(0, aOverAbLen0.length); 199 assertSame(0, aOverAbLen0.length);
200 assertSame(0, aOverAbLen0.byteLength); 200 assertSame(0, aOverAbLen0.byteLength);
201 assertSame(0, aOverAbLen0.byteOffset); 201 assertSame(0, aOverAbLen0.byteOffset);
202 202
203 var a = new constr(sab, 64*elementSize, 128); 203 var a = new constr(sab, 64*elementSize, 128);
204 assertEquals("[object " + constr.name + "]", 204 assertEquals("[object " + constr.name + "]",
205 Object.prototype.toString.call(a)); 205 Object.prototype.toString.call(a));
206 var desc = Object.getOwnPropertyDescriptor( 206 var desc = Object.getOwnPropertyDescriptor(
207 constr.prototype.__proto__, Symbol.toStringTag); 207 constr.prototype, Symbol.toStringTag);
208 assertTrue(desc.configurable); 208 assertTrue(desc.configurable);
209 assertFalse(desc.enumerable); 209 assertFalse(desc.enumerable);
210 assertFalse(!!desc.writable); 210 assertFalse(!!desc.writable);
211 assertFalse(!!desc.set); 211 assertFalse(!!desc.set);
212 assertEquals("function", typeof desc.get); 212 assertEquals("function", typeof desc.get);
213 } 213 }
214 214
215 TestTypedArray(Uint8Array, 1, 0xFF); 215 TestTypedArray(Uint8Array, 1, 0xFF);
216 TestTypedArray(Int8Array, 1, -0x7F); 216 TestTypedArray(Int8Array, 1, -0x7F);
217 TestTypedArray(Uint16Array, 2, 0xFFFF); 217 TestTypedArray(Uint16Array, 2, 0xFFFF);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 Uint16Array, 303 Uint16Array,
304 Int16Array, 304 Int16Array,
305 Uint32Array, 305 Uint32Array,
306 Int32Array, 306 Int32Array,
307 Uint8ClampedArray, 307 Uint8ClampedArray,
308 Float32Array, 308 Float32Array,
309 Float64Array]; 309 Float64Array];
310 310
311 function TestPropertyTypeChecks(constructor) { 311 function TestPropertyTypeChecks(constructor) {
312 function CheckProperty(name) { 312 function CheckProperty(name) {
313 var d = Object.getOwnPropertyDescriptor(constructor.prototype.__proto__, 313 var d = Object.getOwnPropertyDescriptor(constructor.prototype, name);
314 name);
315 var o = {}; 314 var o = {};
316 assertThrows(function() {d.get.call(o);}, TypeError); 315 assertThrows(function() {d.get.call(o);}, TypeError);
317 for (var i = 0; i < typedArrayConstructors.length; i++) { 316 for (var i = 0; i < typedArrayConstructors.length; i++) {
318 var ctor = typedArrayConstructors[i]; 317 var ctor = typedArrayConstructors[i];
319 var a = MakeSharedTypedArray(ctor, 10); 318 var a = MakeSharedTypedArray(ctor, 10);
320 d.get.call(a); // shouldn't throw 319 if (ctor === constructor) {
320 d.get.call(a); // shouldn't throw
321 } else {
322 assertThrows(function() {d.get.call(a);}, TypeError);
323 }
321 } 324 }
322 } 325 }
323 326
324 CheckProperty("buffer"); 327 CheckProperty("buffer");
325 CheckProperty("byteOffset"); 328 CheckProperty("byteOffset");
326 CheckProperty("byteLength"); 329 CheckProperty("byteLength");
327 CheckProperty("length"); 330 CheckProperty("length");
328 } 331 }
329 332
330 for(i = 0; i < typedArrayConstructors.length; i++) { 333 for(i = 0; i < typedArrayConstructors.length; i++) {
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 for(i = 0; i < typedArrayConstructors.length; i++) { 568 for(i = 0; i < typedArrayConstructors.length; i++) {
566 TestArbitrary(MakeSharedTypedArray(typedArrayConstructors[i], 10)); 569 TestArbitrary(MakeSharedTypedArray(typedArrayConstructors[i], 10));
567 } 570 }
568 571
569 // Test direct constructor call 572 // Test direct constructor call
570 assertThrows(function() { SharedArrayBuffer(); }, TypeError); 573 assertThrows(function() { SharedArrayBuffer(); }, TypeError);
571 for(i = 0; i < typedArrayConstructors.length; i++) { 574 for(i = 0; i < typedArrayConstructors.length; i++) {
572 assertThrows(function(i) { typedArrayConstructors[i](); }.bind(this, i), 575 assertThrows(function(i) { typedArrayConstructors[i](); }.bind(this, i),
573 TypeError); 576 TypeError);
574 } 577 }
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/reflect-get-prototype-of.js ('k') | test/mjsunit/regress/regress-typedarray-length.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698