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

Unified Diff: test/mjsunit/string-external-cached.js

Issue 8889012: Avoid bailing out to runtime for short substrings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years 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
Index: test/mjsunit/string-external-cached.js
diff --git a/test/mjsunit/string-external-cached.js b/test/mjsunit/string-external-cached.js
index 12312ac76aa385f9be26a1230ba61e02262f27ce..0a95830d0b7824b9cd6f1f046831d52f638749bb 100644
--- a/test/mjsunit/string-external-cached.js
+++ b/test/mjsunit/string-external-cached.js
@@ -59,7 +59,7 @@ function test() {
} catch (ex) { }
assertEquals("1", charat_short.charAt(1));
- // Test regexp.
+ // Test regexp and short substring.
var re = /(A|B)/;
var rere = /(T.{1,2}B)/;
var ascii = "ABCDEFGHIJKLMNOPQRST";
@@ -81,6 +81,10 @@ function test() {
assertEquals(["A", "A"], re.exec(twobyte));
assertEquals(["B", "B"], re.exec(twobyte_slice));
assertEquals(["T_AB", "T_AB"], rere.exec(twobyte_cons));
+ assertEquals("DEFG", ascii_slice.substr(2, 4));
+ assertEquals("DEFG", twobyte_slice.substr(2, 4));
+ assertEquals("DEFG", ascii_cons.substr(3, 4));
+ assertEquals("DEFG", twobyte_cons.substr(4, 4));
}
}

Powered by Google App Engine
This is Rietveld 408576698