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

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

Issue 2339443002: [regexp] Avoid unneeded accesses to lastIndex (Closed)
Patch Set: Update test262 status Created 4 years, 3 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 | « test/mjsunit/regress/regress-2437.js ('k') | test/test262/test262.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-2438.js
diff --git a/test/mjsunit/regress/regress-2438.js b/test/mjsunit/regress/regress-2438.js
index f694ff8e190765a9782770ef3c9b52c75cada0f0..51092788ac6f7fb8824f4df1e44f37f45cffd650 100644
--- a/test/mjsunit/regress/regress-2438.js
+++ b/test/mjsunit/regress/regress-2438.js
@@ -27,14 +27,20 @@
function testSideEffects(subject, re) {
var counter = 0;
+ var expected_counter = 0;
+ const accesses_lastindex = (re.global || re.sticky);
var side_effect_object = { valueOf: function() { return counter++; } };
re.lastIndex = side_effect_object;
re.exec(subject);
- assertEquals(1, counter);
+
+ if (accesses_lastindex) expected_counter++;
+ assertEquals(expected_counter, counter);
re.lastIndex = side_effect_object;
re.test(subject);
- assertEquals(2, counter);
+
+ if (accesses_lastindex) expected_counter++;
+ assertEquals(expected_counter, counter);
}
testSideEffects("zzzz", /a/);
« no previous file with comments | « test/mjsunit/regress/regress-2437.js ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698