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

Side by Side Diff: test/mjsunit/string-index.js

Issue 1750017: Port string keyed load IC improvements (r4444) to x64. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/ic-x64.cc ('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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 var keys = [0, '1', 2, 3.0, -1, 10]; 189 var keys = [0, '1', 2, 3.0, -1, 10];
190 var str = 'abcd', arr = ['a', 'b', 'c', 'd', undefined, undefined]; 190 var str = 'abcd', arr = ['a', 'b', 'c', 'd', undefined, undefined];
191 for (var i = 0; i < 300; ++i) { 191 for (var i = 0; i < 300; ++i) {
192 var index = Math.floor(i / 50); 192 var index = Math.floor(i / 50);
193 var key = keys[index]; 193 var key = keys[index];
194 var expected = arr[index]; 194 var expected = arr[index];
195 var actual = str[key]; 195 var actual = str[key];
196 assertEquals(expected, actual); 196 assertEquals(expected, actual);
197 } 197 }
198
199 // Test heap number case.
200 var keys = [0, Math.floor(2) * 0.5];
201 var str = 'ab', arr = ['a', 'b'];
202 for (var i = 0; i < 100; ++i) {
203 var index = Math.floor(i / 50);
204 var key = keys[index];
205 var expected = arr[index];
206 var actual = str[key];
207 assertEquals(expected, actual);
208 }
209
210 // Test out of range case.
211 var keys = [0, -1];
212 var str = 'ab', arr = ['a', undefined];
213 for (var i = 0; i < 100; ++i) {
214 var index = Math.floor(i / 50);
215 var key = keys[index];
216 var expected = arr[index];
217 var actual = str[key];
218 assertEquals(expected, actual);
219 }
220
221 var keys = [0, 10];
222 var str = 'ab', arr = ['a', undefined];
223 for (var i = 0; i < 100; ++i) {
224 var index = Math.floor(i / 50);
225 var key = keys[index];
226 var expected = arr[index];
227 var actual = str[key];
228 assertEquals(expected, actual);
229 }
OLDNEW
« no previous file with comments | « src/x64/ic-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698