Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 42c1db46194a2e5ac6060bf0d13521bb24c7fb8b..958d1af55839a3c0ba98bb82d5b13cb0d1a77af1 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -1160,14 +1160,22 @@ void ObjectTemplate::SetInternalFieldCount(int value) { |
ScriptData* ScriptData::PreCompile(const char* input, int length) { |
- unibrow::Utf8InputBuffer<> buf(input, length); |
- return i::ParserApi::PreParse(i::Handle<i::String>(), &buf, NULL); |
+ i::Utf8ToUC16CharacterStream stream( |
+ reinterpret_cast<const unsigned char*>(input), length); |
+ return i::ParserApi::PreParse(&stream, NULL); |
} |
ScriptData* ScriptData::PreCompile(v8::Handle<String> source) { |
i::Handle<i::String> str = Utils::OpenHandle(*source); |
- return i::ParserApi::PreParse(str, NULL, NULL); |
+ if (str->IsExternalTwoByteString()) { |
+ i::ExternalTwoByteStringUC16CharacterStream stream( |
+ i::Handle<i::ExternalTwoByteString>::cast(str), 0, str->length()); |
+ return i::ParserApi::PreParse(&stream, NULL); |
+ } else { |
+ i::GenericStringUC16CharacterStream stream(str, 0, str->length()); |
+ return i::ParserApi::PreParse(&stream, NULL); |
+ } |
} |