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

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

Issue 1567024: Land patch by Pavel Podivilov (podivilov@chromium.org). (Closed)
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
« 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 var c = String.fromCharCode(i); 159 var c = String.fromCharCode(i);
160 alpha[i] = c[0]; 160 alpha[i] = c[0];
161 } 161 }
162 var alphaStr = alpha.join(""); 162 var alphaStr = alpha.join("");
163 163
164 // Now test chars. 164 // Now test chars.
165 for (var i = 1; i < 128; i++) { 165 for (var i = 1; i < 128; i++) {
166 assertEquals(alpha[i], alphaStr[i]); 166 assertEquals(alpha[i], alphaStr[i]);
167 assertEquals(String.fromCharCode(i), alphaStr[i]); 167 assertEquals(String.fromCharCode(i), alphaStr[i]);
168 } 168 }
169
170 // Test for keyed ic.
171 var foo = ['a12', ['a', 2, 'c'], 'a31', 42];
172 var results = [1, 2, 3, NaN];
173 for (var i = 0; i < 200; ++i) {
174 var index = Math.floor(i / 50);
175 var receiver = foo[index];
176 var expected = results[index];
177 var actual = +(receiver[1]);
178 assertEquals(expected, actual);
179 }
180
181 var keys = [0, '1', 2, 3.0];
182 var str = 'abcd', arr = ['a', 'b', 'c', 'd'];
183 for (var i = 0; i < 200; ++i) {
184 var index = Math.floor(i / 50);
185 var key = keys[index];
186 var expected = arr[index];
187 var actual = str[key];
188 assertEquals(expected, actual);
189 }
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