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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/elements.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/arguments.js
diff --git a/test/mjsunit/arguments.js b/test/mjsunit/arguments.js
index 26eb38912a0e552dc6d61243ccb8b3480ae892ed..97ec7cca6d9c51595f118d0ab9ab9b34e777e465 100644
--- a/test/mjsunit/arguments.js
+++ b/test/mjsunit/arguments.js
@@ -204,3 +204,70 @@ assertEquals(117, arg_set(0xFFFFFFFF));
}
assertTrue(%HasSloppyArgumentsElements(a));
})();
+
+(function testDeleteArguments() {
+ function f() { return arguments };
+ var args = f(1, 2);
+ assertEquals(1, args[0]);
+ assertEquals(2, args[1]);
+ assertEquals(2, args.length);
+
+ delete args[0];
+ assertEquals(undefined, args[0]);
+ assertEquals(2, args[1]);
+ assertEquals(2, args.length);
+
+ delete args[1];
+ assertEquals(undefined, args[0]);
+ assertEquals(undefined, args[1]);
+ assertEquals(2, args.length);
+})();
+
+(function testDeleteFastSloppyArguments() {
+ function f(a) { return arguments };
+ var args = f(1, 2);
+ assertEquals(1, args[0]);
+ assertEquals(2, args[1]);
+ assertEquals(2, args.length);
+
+ delete args[0];
+ assertEquals(undefined, args[0]);
+ assertEquals(2, args[1]);
+ assertEquals(2, args.length);
+
+ delete args[1];
+ assertEquals(undefined, args[0]);
+ assertEquals(undefined, args[1]);
+ assertEquals(2, args.length);
+})();
+
+(function testDeleteSlowSloppyArguments() {
+ var key = 10000;
+ function f(a) {
+ arguments[key] = key;
+ return arguments
+ };
+ var args = f(1, 2);
+ assertEquals(1, args[0]);
+ assertEquals(2, args[1]);
+ assertEquals(key, args[key]);
+ assertEquals(2, args.length);
+
+ delete args[0];
+ assertEquals(undefined, args[0]);
+ assertEquals(2, args[1]);
+ assertEquals(key, args[key]);
+ assertEquals(2, args.length);
+
+ delete args[1];
+ assertEquals(undefined, args[0]);
+ assertEquals(undefined, args[1]);
+ assertEquals(key, args[key]);
+ assertEquals(2, args.length);
+
+ delete args[key];
+ assertEquals(undefined, args[0]);
+ assertEquals(undefined, args[1]);
+ assertEquals(undefined, args[key]);
+ assertEquals(2, args.length);
+})();
« 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