Chromium Code Reviews

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

Issue 2778623003: [typedarrays] Check detached buffer at start of typed array methods (Closed)
Patch Set: Use inline IS_TYPEDARRAY Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 buffer1 = new ArrayBuffer(100 * 1024); 7 var buffer1 = new ArrayBuffer(100 * 1024);
8 8
9 var array1 = new Uint8Array(buffer1, {valueOf : function() { 9 var array1 = new Uint8Array(buffer1, {valueOf : function() {
10 %ArrayBufferNeuter(buffer1); 10 %ArrayBufferNeuter(buffer1);
(...skipping 41 matching lines...)
52 var buffer7 = new ArrayBuffer(100 * 1024 * 1024); 52 var buffer7 = new ArrayBuffer(100 * 1024 * 1024);
53 assertThrows(function() { 53 assertThrows(function() {
54 buffer7.slice(0, {valueOf : function() { 54 buffer7.slice(0, {valueOf : function() {
55 %ArrayBufferNeuter(buffer7); 55 %ArrayBufferNeuter(buffer7);
56 return 100 * 1024 * 1024; 56 return 100 * 1024 * 1024;
57 }}); 57 }});
58 }, TypeError); 58 }, TypeError);
59 59
60 var buffer9 = new ArrayBuffer(1024); 60 var buffer9 = new ArrayBuffer(1024);
61 var array9 = new Uint8Array(buffer9); 61 var array9 = new Uint8Array(buffer9);
62 var array10 = array9.subarray({valueOf : function() { 62 assertThrows(() =>
63 array9.subarray({valueOf : function() {
63 %ArrayBufferNeuter(buffer9); 64 %ArrayBufferNeuter(buffer9);
64 return 0; 65 return 0;
65 }}, 1024); 66 }}, 1024), TypeError);
66 assertEquals(0, array9.length); 67 assertEquals(0, array9.length);
67 assertEquals(0, array10.length);
68
69 var buffer11 = new ArrayBuffer(1024);
70 var array11 = new Uint8Array(buffer11);
71 var array12 = array11.subarray(0, {valueOf : function() {
72 %ArrayBufferNeuter(buffer11);
73 return 1024;
74 }});
75 assertEquals(0, array11.length);
76 assertEquals(0, array12.length);
Dan Ehrenberg 2017/03/28 19:39:28 Rather than deleting the test, can you change it t
Choongwoo Han 2017/03/29 05:36:54 Done.
OLDNEW

Powered by Google App Engine