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

Side by Side Diff: test/mjsunit/elements-kind.js

Issue 416403002: Keep new arrays allocated with 'new Array(N)' in fast mode (revisited) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/array-feedback.js ('k') | test/mjsunit/es7/object-observe.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 for (var i = 0; i < 1337; i++) { 138 for (var i = 0; i < 1337; i++) {
139 var val = i; 139 var val = i;
140 if (i == 1336) { 140 if (i == 1336) {
141 assertKind(elements_kind.fast_smi_only, you); 141 assertKind(elements_kind.fast_smi_only, you);
142 val = new Object(); 142 val = new Object();
143 } 143 }
144 you[i] = val; 144 you[i] = val;
145 } 145 }
146 assertKind(elements_kind.fast, you); 146 assertKind(elements_kind.fast, you);
147 147
148 assertKind(elements_kind.dictionary, new Array(0xDECAF)); 148 var temp = [];
149 temp[0xDECAF] = 0;
150 assertKind(elements_kind.dictionary, temp);
149 151
150 var fast_double_array = new Array(0xDECAF); 152 var fast_double_array = new Array(0xDECAF);
151 for (var i = 0; i < 0xDECAF; i++) fast_double_array[i] = i / 2; 153 for (var i = 0; i < 0xDECAF; i++) fast_double_array[i] = i / 2;
152 assertKind(elements_kind.fast_double, fast_double_array); 154 assertKind(elements_kind.fast_double, fast_double_array);
153 155
154 assertKind(elements_kind.fixed_int8, new Int8Array(007)); 156 assertKind(elements_kind.fixed_int8, new Int8Array(007));
155 assertKind(elements_kind.fixed_uint8, new Uint8Array(007)); 157 assertKind(elements_kind.fixed_uint8, new Uint8Array(007));
156 assertKind(elements_kind.fixed_int16, new Int16Array(666)); 158 assertKind(elements_kind.fixed_int16, new Int16Array(666));
157 assertKind(elements_kind.fixed_uint16, new Uint16Array(42)); 159 assertKind(elements_kind.fixed_uint16, new Uint16Array(42));
158 assertKind(elements_kind.fixed_int32, new Int32Array(0xF)); 160 assertKind(elements_kind.fixed_int32, new Int32Array(0xF));
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 // Test that Array.splice() and Array.slice() return correct ElementsKinds. 377 // Test that Array.splice() and Array.slice() return correct ElementsKinds.
376 var a = ["foo", "bar"]; 378 var a = ["foo", "bar"];
377 assertKind(elements_kind.fast, a); 379 assertKind(elements_kind.fast, a);
378 var b = a.splice(0, 1); 380 var b = a.splice(0, 1);
379 assertKind(elements_kind.fast, b); 381 assertKind(elements_kind.fast, b);
380 var c = a.slice(0, 1); 382 var c = a.slice(0, 1);
381 assertKind(elements_kind.fast, c); 383 assertKind(elements_kind.fast, c);
382 384
383 // Throw away type information in the ICs for next stress run. 385 // Throw away type information in the ICs for next stress run.
384 gc(); 386 gc();
OLDNEW
« no previous file with comments | « test/mjsunit/array-feedback.js ('k') | test/mjsunit/es7/object-observe.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698