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

Unified Diff: test/mjsunit/string-case.js

Issue 180063002: Use fast path for sliced and external strings in ConvertCase. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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/runtime.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/string-case.js
diff --git a/test/mjsunit/string-case.js b/test/mjsunit/string-case.js
index 283e703fc33d31df4a75944c7558c68eef7f2e64..34c2340d33c2ff676549e8a571a149dc9b4b26dc 100644
--- a/test/mjsunit/string-case.js
+++ b/test/mjsunit/string-case.js
@@ -25,7 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --random-seed=17
+// Flags: --random-seed=17 --allow-natives-syntax
+// Flags: --expose-externalize-string
assertEquals("ΚΟΣΜΟΣ ΚΟΣΜΟΣ".toLowerCase(), "κοσμος κοσμος");
@@ -58,6 +59,19 @@ function test(length) {
strLower += String.fromCharCode(charCodeToLower(c));
strUpper += String.fromCharCode(charCodeToUpper(c));
}
+ %FlattenString(strLower);
+ %FlattenString(strUpper);
+ // Sequential string.
+ assertEquals(strLower, str.toLowerCase());
+ assertEquals(strUpper, str.toUpperCase());
+ // Cons string.
+ assertEquals(strLower + strLower, (str + str).toLowerCase());
+ assertEquals(strUpper + strUpper, (str + str).toUpperCase());
+ // Sliced string.
+ assertEquals(strLower.substring(1), str.substring(1).toLowerCase());
+ assertEquals(strUpper.substring(1), str.substring(1).toUpperCase());
+ // External string.
+ externalizeString(str, false);
assertEquals(strLower, str.toLowerCase());
assertEquals(strUpper, str.toUpperCase());
}
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698