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

Side by Side Diff: test/mjsunit/regress/regress-typedarray-length.js

Issue 1186733002: Add %TypedArray% to proto chain (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: changes from arv's review Created 5 years, 6 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 | « test/mjsunit/harmony/typedarrays-of.js ('k') | 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
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 a = new Int32Array(100); 7 var a = new Int32Array(100);
8 a.__proto__ = null; 8 a.__proto__ = null;
9 9
10 function get(a) { 10 function get(a) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return a.length; 64 return a.length;
65 } 65 }
66 66
67 assertEquals(undefined, get(a)); 67 assertEquals(undefined, get(a));
68 assertEquals(undefined, get(a)); 68 assertEquals(undefined, get(a));
69 assertEquals(undefined, get(a)); 69 assertEquals(undefined, get(a));
70 %OptimizeFunctionOnNextCall(get); 70 %OptimizeFunctionOnNextCall(get);
71 assertEquals(undefined, get(a)); 71 assertEquals(undefined, get(a));
72 })(); 72 })();
73 73
74 // Ensure we cannot delete length, byteOffset, byteLength.
75 assertTrue(Int32Array.prototype.hasOwnProperty("length"));
76 assertTrue(Int32Array.prototype.hasOwnProperty("byteOffset"));
77 assertTrue(Int32Array.prototype.hasOwnProperty("byteLength"));
78 assertFalse(delete Int32Array.prototype.length);
79 assertFalse(delete Int32Array.prototype.byteOffset);
80 assertFalse(delete Int32Array.prototype.byteLength);
81
82 a = new Int32Array(100); 74 a = new Int32Array(100);
83 75
84 get = function(a) { 76 get = function(a) {
85 return a.length; 77 return a.length;
86 } 78 }
87 79
88 assertEquals(100, get(a)); 80 assertEquals(100, get(a));
89 assertEquals(100, get(a)); 81 assertEquals(100, get(a));
90 assertEquals(100, get(a)); 82 assertEquals(100, get(a));
91 %OptimizeFunctionOnNextCall(get); 83 %OptimizeFunctionOnNextCall(get);
(...skipping 11 matching lines...) Expand all
103 95
104 get = function(a) { 96 get = function(a) {
105 return a.byteOffset; 97 return a.byteOffset;
106 } 98 }
107 99
108 assertEquals(0, get(a)); 100 assertEquals(0, get(a));
109 assertEquals(0, get(a)); 101 assertEquals(0, get(a));
110 assertEquals(0, get(a)); 102 assertEquals(0, get(a));
111 %OptimizeFunctionOnNextCall(get); 103 %OptimizeFunctionOnNextCall(get);
112 assertEquals(0, get(a)); 104 assertEquals(0, get(a));
105
106 // Ensure we can delete length, byteOffset, byteLength.
107 for (var name of ['length', 'byteOffset', 'byteLength', 'buffer']) {
108 var property = Object.getOwnPropertyDescriptor(
109 Int32Array.prototype.__proto__, name);
110 assertEquals("object", typeof property);
111 assertEquals(true, property.configurable);
112 assertEquals(false, property.enumerable);
113 assertEquals("function", typeof property.get);
114 }
OLDNEW
« no previous file with comments | « test/mjsunit/harmony/typedarrays-of.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698