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

Side by Side Diff: test/mjsunit/arguments.js

Issue 1865343002: [elements] revert overzealous optimzation for fast sloppy arguments delete (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressing comment Created 4 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/elements.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // Turn arguments into slow. 197 // Turn arguments into slow.
198 assertTrue(%HasSloppyArgumentsElements(a)); 198 assertTrue(%HasSloppyArgumentsElements(a));
199 a[10000] = 1; 199 a[10000] = 1;
200 assertTrue(%HasSloppyArgumentsElements(a)); 200 assertTrue(%HasSloppyArgumentsElements(a));
201 // Make it fast again by adding values. 201 // Make it fast again by adding values.
202 for (var i = 0; i < 1000; i++) { 202 for (var i = 0; i < 1000; i++) {
203 a[i] = 1.5; 203 a[i] = 1.5;
204 } 204 }
205 assertTrue(%HasSloppyArgumentsElements(a)); 205 assertTrue(%HasSloppyArgumentsElements(a));
206 })(); 206 })();
207
208 (function testDeleteArguments() {
209 function f() { return arguments };
210 var args = f(1, 2);
211 assertEquals(1, args[0]);
212 assertEquals(2, args[1]);
213 assertEquals(2, args.length);
214
215 delete args[0];
216 assertEquals(undefined, args[0]);
217 assertEquals(2, args[1]);
218 assertEquals(2, args.length);
219
220 delete args[1];
221 assertEquals(undefined, args[0]);
222 assertEquals(undefined, args[1]);
223 assertEquals(2, args.length);
224 })();
225
226 (function testDeleteFastSloppyArguments() {
227 function f(a) { return arguments };
228 var args = f(1, 2);
229 assertEquals(1, args[0]);
230 assertEquals(2, args[1]);
231 assertEquals(2, args.length);
232
233 delete args[0];
234 assertEquals(undefined, args[0]);
235 assertEquals(2, args[1]);
236 assertEquals(2, args.length);
237
238 delete args[1];
239 assertEquals(undefined, args[0]);
240 assertEquals(undefined, args[1]);
241 assertEquals(2, args.length);
242 })();
243
244 (function testDeleteSlowSloppyArguments() {
245 var key = 10000;
246 function f(a) {
247 arguments[key] = key;
248 return arguments
249 };
250 var args = f(1, 2);
251 assertEquals(1, args[0]);
252 assertEquals(2, args[1]);
253 assertEquals(key, args[key]);
254 assertEquals(2, args.length);
255
256 delete args[0];
257 assertEquals(undefined, args[0]);
258 assertEquals(2, args[1]);
259 assertEquals(key, args[key]);
260 assertEquals(2, args.length);
261
262 delete args[1];
263 assertEquals(undefined, args[0]);
264 assertEquals(undefined, args[1]);
265 assertEquals(key, args[key]);
266 assertEquals(2, args.length);
267
268 delete args[key];
269 assertEquals(undefined, args[0]);
270 assertEquals(undefined, args[1]);
271 assertEquals(undefined, args[key]);
272 assertEquals(2, args.length);
273 })();
OLDNEW
« no previous file with comments | « src/elements.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698