From d7f3985e33c51a6fc0aa5bb51b584bd2f20b898c Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Mon, 17 Oct 2011 13:39:56 +0000 Subject: [PATCH] Rolling back r9662. Review URL: http://codereview.chromium.org/8321001 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9665 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- .../externalize-string-extension.cc | 4 +- test/mjsunit/string-slices.js | 38 +++++-------------- 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/src/extensions/externalize-string-extension.cc b/src/extensions/externalize-string-extension.cc index d98c586b8f..9fbf329818 100644 --- a/src/extensions/externalize-string-extension.cc +++ b/src/extensions/externalize-string-extension.cc @@ -127,8 +127,8 @@ v8::Handle ExternalizeStringExtension::IsAscii( return v8::ThrowException(v8::String::New( "isAsciiString() requires a single string argument.")); } - Handle string = Utils::OpenHandle(*args[0].As()); - return string->IsAsciiRepresentationUnderneath() ? v8::True() : v8::False(); + return Utils::OpenHandle(*args[0].As())->IsAsciiRepresentation() ? + v8::True() : v8::False(); } diff --git a/test/mjsunit/string-slices.js b/test/mjsunit/string-slices.js index 2ef10c4efc..7c40229c75 100755 --- a/test/mjsunit/string-slices.js +++ b/test/mjsunit/string-slices.js @@ -190,33 +190,15 @@ assertEquals("\u03B2\u03B3\u03B4\u03B5\u03B4\u03B5\u03B6\u03B7", utf.substring(5,1) + utf.substring(3,7)); // Externalizing strings. -seq = "123456789qwertyuiopasdfghjklzxcvbnm"; -cons = "123456789" + "qwertyuiopasdfghjklzxcvbnm"; -check = "23456789qwertyuiopasdfghjklzxcvbn"; +var a = "123456789" + "qwertyuiopasdfghjklzxcvbnm"; +var b = "23456789qwertyuiopasdfghjklzxcvbn" +assertEquals(a.slice(1,-1), b); -// Externalizing a sequential string changes its encoding from ascii to -// two-byte. The encoding of the sliced string must reflect this change too. -slice = seq.slice(1,-1); -assertEquals(check, slice); +assertTrue(isAsciiString(a)); +externalizeString(a, true); +assertFalse(isAsciiString(a)); -// Seq strings can only be externalized once across multiple stress-opt runs. -if (isAsciiString(seq)) externalizeString(seq, true); -assertFalse(isAsciiString(seq)); -assertFalse(isAsciiString(slice)); - -assertEquals(check, seq.slice(1,-1)); -assertEquals(check, slice); -assertTrue(/3456789qwe/.test(seq)); -assertEquals(5, seq.indexOf("678")); -assertEquals("12345", seq.split("6")[0]); - -// Externalizing a cons string changes its encoding from ascii to two-byte, -// but the slice depending on the cons string does not, as it still points to -// the original cons string. -slice = cons.slice(1,-1); -assertEquals(check, slice); - -assertTrue(isAsciiString(cons)); -externalizeString(cons, true); -assertFalse(isAsciiString(cons)); -assertTrue(isAsciiString(slice)); +assertEquals(a.slice(1,-1), b); +assertTrue(/3456789qwe/.test(a)); +assertEquals(5, a.indexOf("678")); +assertEquals("12345", a.split("6")[0]);