Index: src/parser.cc |
diff --git a/src/parser.cc b/src/parser.cc |
index 0b5673561b4bf27bfcf9adb03a1976af7e29a4d8..9953dc63ff76a0097a3049ff4384fa1e46e4042b 100644 |
--- a/src/parser.cc |
+++ b/src/parser.cc |
@@ -5375,7 +5375,7 @@ static ScriptDataImpl* DoPreParse(UC16CharacterStream* source, |
// Preparse, but only collect data that is immediately useful, |
// even if the preparser data is only used once. |
-ScriptDataImpl* ParserApi::PartialPreParse(UC16CharacterStream* source, |
+ScriptDataImpl* ParserApi::PartialPreParse(Handle<String> source, |
v8::Extension* extension, |
int flags) { |
bool allow_lazy = FLAG_lazy && (extension == NULL); |
@@ -5386,7 +5386,15 @@ ScriptDataImpl* ParserApi::PartialPreParse(UC16CharacterStream* source, |
} |
flags |= kAllowLazy; |
PartialParserRecorder recorder; |
- return DoPreParse(source, flags, &recorder); |
+ int source_length = source->length(); |
+ if (source->IsExternalTwoByteString()) { |
+ ExternalTwoByteStringUC16CharacterStream stream( |
+ Handle<ExternalTwoByteString>::cast(source), 0, source_length); |
+ return DoPreParse(&stream, flags, &recorder); |
+ } else { |
+ GenericStringUC16CharacterStream stream(source, 0, source_length); |
+ return DoPreParse(&stream, flags, &recorder); |
+ } |
} |