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

Side by Side Diff: test/mjsunit/object-seal.js

Issue 138443012: Reland ArrayPop / ArrayPush. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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-pop.js ('k') | test/mjsunit/regress/regress-array-pop-deopt.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 %OptimizeFunctionOnNextCall(push_call); 245 %OptimizeFunctionOnNextCall(push_call);
246 %OptimizeFunctionOnNextCall(shift_call); 246 %OptimizeFunctionOnNextCall(shift_call);
247 push_call(obj); 247 push_call(obj);
248 shift_call(obj); 248 shift_call(obj);
249 assertOptimized(push_call); 249 assertOptimized(push_call);
250 assertOptimized(shift_call); 250 assertOptimized(shift_call);
251 Object.seal(obj); 251 Object.seal(obj);
252 assertThrows(function() { push_call(obj); }, TypeError); 252 assertThrows(function() { push_call(obj); }, TypeError);
253 assertThrows(function() { shift_call(obj); }, TypeError); 253 assertThrows(function() { shift_call(obj); }, TypeError);
254 assertOptimized(push_call); 254 assertUnoptimized(push_call);
255 // shift() doesn't have a custom call generator, so deopt will occur.
256 assertUnoptimized(shift_call); 255 assertUnoptimized(shift_call);
257 assertDoesNotThrow(function() { push_call(objControl); }); 256 assertDoesNotThrow(function() { push_call(objControl); });
258 assertDoesNotThrow(function() { shift_call(objControl); }); 257 assertDoesNotThrow(function() { shift_call(objControl); });
259 258
260 // Verify special behavior of splice on sealed objects. 259 // Verify special behavior of splice on sealed objects.
261 obj = [1,2,3]; 260 obj = [1,2,3];
262 Object.seal(obj); 261 Object.seal(obj);
263 assertDoesNotThrow(function() { obj.splice(0,1,100); }); 262 assertDoesNotThrow(function() { obj.splice(0,1,100); });
264 assertEquals(100, obj[0]); 263 assertEquals(100, obj[0]);
265 assertDoesNotThrow(function() { obj.splice(0,2,1,2); }); 264 assertDoesNotThrow(function() { obj.splice(0,2,1,2); });
266 assertDoesNotThrow(function() { obj.splice(1,2,1,2); }); 265 assertDoesNotThrow(function() { obj.splice(1,2,1,2); });
267 // Count of items to delete is clamped by length. 266 // Count of items to delete is clamped by length.
268 assertDoesNotThrow(function() { obj.splice(1,2000,1,2); }); 267 assertDoesNotThrow(function() { obj.splice(1,2000,1,2); });
269 assertThrows(function() { obj.splice(0,0,1); }, TypeError); 268 assertThrows(function() { obj.splice(0,0,1); }, TypeError);
270 assertThrows(function() { obj.splice(1,2000,1,2,3); }, TypeError); 269 assertThrows(function() { obj.splice(1,2000,1,2,3); }, TypeError);
OLDNEW
« no previous file with comments | « test/mjsunit/array-pop.js ('k') | test/mjsunit/regress/regress-array-pop-deopt.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698