| Index: test/cctest/test-parsing.cc
|
| diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
|
| index 56a7258a5a73349c90bf62b304ac5d3505355934..f4400a4d5a69dcfba7701032b0d4c09ad714b699 100644
|
| --- a/test/cctest/test-parsing.cc
|
| +++ b/test/cctest/test-parsing.cc
|
| @@ -179,7 +179,7 @@ TEST(ScanHTMLEndComments) {
|
| }
|
|
|
|
|
| -class ScriptResource : public v8::String::ExternalAsciiStringResource {
|
| +class ScriptResource : public v8::String::ExternalOneByteStringResource {
|
| public:
|
| ScriptResource(const char* data, size_t length)
|
| : data_(data), length_(length) { }
|
| @@ -524,10 +524,8 @@ class TestExternalResource: public v8::String::ExternalStringResource {
|
|
|
| #define CHECK_EQU(v1, v2) CHECK_EQ(static_cast<int>(v1), static_cast<int>(v2))
|
|
|
| -void TestCharacterStream(const char* ascii_source,
|
| - unsigned length,
|
| - unsigned start = 0,
|
| - unsigned end = 0) {
|
| +void TestCharacterStream(const char* one_byte_source, unsigned length,
|
| + unsigned start = 0, unsigned end = 0) {
|
| if (end == 0) end = length;
|
| unsigned sub_length = end - start;
|
| i::Isolate* isolate = CcTest::i_isolate();
|
| @@ -535,20 +533,22 @@ void TestCharacterStream(const char* ascii_source,
|
| i::HandleScope test_scope(isolate);
|
| i::SmartArrayPointer<i::uc16> uc16_buffer(new i::uc16[length]);
|
| for (unsigned i = 0; i < length; i++) {
|
| - uc16_buffer[i] = static_cast<i::uc16>(ascii_source[i]);
|
| + uc16_buffer[i] = static_cast<i::uc16>(one_byte_source[i]);
|
| }
|
| - i::Vector<const char> ascii_vector(ascii_source, static_cast<int>(length));
|
| - i::Handle<i::String> ascii_string =
|
| - factory->NewStringFromAscii(ascii_vector).ToHandleChecked();
|
| + i::Vector<const char> one_byte_vector(one_byte_source,
|
| + static_cast<int>(length));
|
| + i::Handle<i::String> one_byte_string =
|
| + factory->NewStringFromAscii(one_byte_vector).ToHandleChecked();
|
| TestExternalResource resource(uc16_buffer.get(), length);
|
| i::Handle<i::String> uc16_string(
|
| factory->NewExternalStringFromTwoByte(&resource).ToHandleChecked());
|
|
|
| i::ExternalTwoByteStringUtf16CharacterStream uc16_stream(
|
| i::Handle<i::ExternalTwoByteString>::cast(uc16_string), start, end);
|
| - i::GenericStringUtf16CharacterStream string_stream(ascii_string, start, end);
|
| + i::GenericStringUtf16CharacterStream string_stream(one_byte_string, start,
|
| + end);
|
| i::Utf8ToUtf16CharacterStream utf8_stream(
|
| - reinterpret_cast<const i::byte*>(ascii_source), end);
|
| + reinterpret_cast<const i::byte*>(one_byte_source), end);
|
| utf8_stream.SeekForward(start);
|
|
|
| unsigned i = start;
|
| @@ -557,7 +557,7 @@ void TestCharacterStream(const char* ascii_source,
|
| CHECK_EQU(i, uc16_stream.pos());
|
| CHECK_EQU(i, string_stream.pos());
|
| CHECK_EQU(i, utf8_stream.pos());
|
| - int32_t c0 = ascii_source[i];
|
| + int32_t c0 = one_byte_source[i];
|
| int32_t c1 = uc16_stream.Advance();
|
| int32_t c2 = string_stream.Advance();
|
| int32_t c3 = utf8_stream.Advance();
|
| @@ -571,7 +571,7 @@ void TestCharacterStream(const char* ascii_source,
|
| }
|
| while (i > start + sub_length / 4) {
|
| // Pushback, re-read, pushback again.
|
| - int32_t c0 = ascii_source[i - 1];
|
| + int32_t c0 = one_byte_source[i - 1];
|
| CHECK_EQU(i, uc16_stream.pos());
|
| CHECK_EQU(i, string_stream.pos());
|
| CHECK_EQU(i, utf8_stream.pos());
|
| @@ -614,7 +614,7 @@ void TestCharacterStream(const char* ascii_source,
|
| CHECK_EQU(i, uc16_stream.pos());
|
| CHECK_EQU(i, string_stream.pos());
|
| CHECK_EQU(i, utf8_stream.pos());
|
| - int32_t c0 = ascii_source[i];
|
| + int32_t c0 = one_byte_source[i];
|
| int32_t c1 = uc16_stream.Advance();
|
| int32_t c2 = string_stream.Advance();
|
| int32_t c3 = utf8_stream.Advance();
|
| @@ -810,7 +810,7 @@ void TestScanRegExp(const char* re_source, const char* expected) {
|
| scanner.CurrentSymbol(&ast_value_factory)->string();
|
| i::DisallowHeapAllocation no_alloc;
|
| i::String::FlatContent content = val->GetFlatContent();
|
| - CHECK(content.IsAscii());
|
| + CHECK(content.IsOneByte());
|
| i::Vector<const uint8_t> actual = content.ToOneByteVector();
|
| for (int i = 0; i < actual.length(); i++) {
|
| CHECK_NE('\0', expected[i]);
|
| @@ -2795,7 +2795,7 @@ TEST(FuncNameInferrerTwoByte) {
|
| "var obj1 = { oXj2 : { foo1: function() {} } }; "
|
| "%FunctionGetInferredName(obj1.oXj2.foo1)");
|
| uint16_t* two_byte_name = AsciiToTwoByteString("obj1.oXj2.foo1");
|
| - // Make it really non-ASCII (replace the Xs with a non-ASCII character).
|
| + // Make it really non-Latin1 (replace the Xs with a non-Latin1 character).
|
| two_byte_source[14] = two_byte_source[78] = two_byte_name[6] = 0x010d;
|
| v8::Local<v8::String> source =
|
| v8::String::NewFromTwoByte(isolate, two_byte_source);
|
|
|