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

Unified Diff: test/mjsunit/regress/regress-4825.js

Issue 1778023004: [runtime] fix getting element keys from SLOW_SLOPPY_ARGUMENTS_ELEMENTS (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix a few related bugs Created 4 years, 9 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
« src/elements.cc ('K') | « 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/regress/regress-4825.js
diff --git a/test/mjsunit/regress/regress-4825.js b/test/mjsunit/regress/regress-4825.js
new file mode 100644
index 0000000000000000000000000000000000000000..6033cddcee797f65ce63cd48aa604878fa0f923c
--- /dev/null
+++ b/test/mjsunit/regress/regress-4825.js
@@ -0,0 +1,45 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function() {
+ function slowSloppyArgumentsElements(a, b, c) {
+ arguments[10000] = 1;
+ return Object.keys(arguments);
+ }
+ assertEquals(["0", "1", "2", "10000"], slowSloppyArgumentsElements(1, 2, 3));
+
+ function slowSloppyArguments(a, b, c) {
+ arguments[10000] = 1;
+ return arguments;
+ }
+
+ var args = slowSloppyArguments(1,2,3);
+ var keys = [];
+ for (var key in args) keys.push(key);
+
+ assertEquals(["0", "1", "2", "10000"], keys);
+})();
+
+(function() {
+ function slowSloppyArgumentsElements2(a, b, c) {
+ Object.defineProperty(arguments, 10000, {
+ enumerable: false, configurable: false, value: "NOPE"
+ });
+ return Object.keys(arguments);
+ }
+ assertEquals(["0", "1", "2"], slowSloppyArgumentsElements2(1, 2, 3));
+
+ function slowSloppyArguments2(a, b, c) {
+ Object.defineProperty(arguments, 10000, {
+ enumerable: false, configurable: false, value: "NOPE"
+ });
+ return arguments;
+ }
+
+ var args = slowSloppyArguments2(1,2,3);
+ var keys = [];
+ for (var key in args) keys.push(key);
+
+ assertEquals(["0", "1", "2"], keys);
+})();
Camillo Bruni 2016/03/10 09:15:14 Nice tests! Could you create a second set with a l
caitp (gmail) 2016/03/10 16:58:34 Done
« src/elements.cc ('K') | « src/elements.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698