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

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

Issue 1034393002: Fix speedup of typedarray-length loading in the ICs as well as Crankshaft (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 | « src/v8natives.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
(Empty)
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
3 // found in the LICENSE file.
4
5 // Flags: --allow-natives-syntax
6
7 var a = new Int32Array(100);
8 a.__proto__ = null;
9
10 function get(a) {
11 return a.length;
12 }
13
14 assertEquals(undefined, get(a));
15 assertEquals(undefined, get(a));
16 assertEquals(undefined, get(a));
17 %OptimizeFunctionOnNextCall(get);
18 assertEquals(undefined, get(a));
19
20 get = function(a) {
21 return a.byteLength;
22 }
23
24 assertEquals(undefined, get(a));
25 assertEquals(undefined, get(a));
26 assertEquals(undefined, get(a));
27 %OptimizeFunctionOnNextCall(get);
28 assertEquals(undefined, get(a));
29
30 get = function(a) {
31 return a.byteOffset;
32 }
33
34 assertEquals(undefined, get(a));
35 assertEquals(undefined, get(a));
36 assertEquals(undefined, get(a));
37 %OptimizeFunctionOnNextCall(get);
38 assertEquals(undefined, get(a));
39
40 (function() {
41 "use strict";
42
43 class MyTypedArray extends Int32Array {
44 get length() {
45 return "length";
46 }
47 }
48
49 a = new MyTypedArray();
50
51 get = function(a) {
52 return a.length;
53 }
54
55 assertEquals("length", get(a));
56 assertEquals("length", get(a));
57 assertEquals("length", get(a));
58 %OptimizeFunctionOnNextCall(get);
59 assertEquals("length", get(a));
60
61 a.__proto__ = null;
62
63 get = function(a) {
64 return a.length;
65 }
66
67 assertEquals(undefined, get(a));
68 assertEquals(undefined, get(a));
69 assertEquals(undefined, get(a));
70 %OptimizeFunctionOnNextCall(get);
71 assertEquals(undefined, get(a));
72 })();
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);
83
84 get = function(a) {
85 return a.length;
86 }
87
88 assertEquals(100, get(a));
89 assertEquals(100, get(a));
90 assertEquals(100, get(a));
91 %OptimizeFunctionOnNextCall(get);
92 assertEquals(100, get(a));
93
94 get = function(a) {
95 return a.byteLength;
96 }
97
98 assertEquals(400, get(a));
99 assertEquals(400, get(a));
100 assertEquals(400, get(a));
101 %OptimizeFunctionOnNextCall(get);
102 assertEquals(400, get(a));
103
104 get = function(a) {
105 return a.byteOffset;
106 }
107
108 assertEquals(0, get(a));
109 assertEquals(0, get(a));
110 assertEquals(0, get(a));
111 %OptimizeFunctionOnNextCall(get);
112 assertEquals(0, get(a));
OLDNEW
« no previous file with comments | « src/v8natives.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698