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

Unified Diff: src/api.cc

Issue 98293004: Experimental scanner: support preparsing API. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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 | « no previous file | src/parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 65e73450239c352381676bedb560b332761ef3cd..f34bdd2ead20573210bf5f41766eb9dfe75b2f04 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -1656,24 +1656,18 @@ void ObjectTemplate::SetInternalFieldCount(int value) {
ScriptData* ScriptData::PreCompile(v8::Isolate* isolate,
const char* input,
int length) {
- i::Utf8ToUtf16CharacterStream stream(
- reinterpret_cast<const unsigned char*>(input), length);
- return i::PreParserApi::PreParse(
- reinterpret_cast<i::Isolate*>(isolate), &stream);
+ i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ i::HandleScope handle_scope(internal_isolate);
+ i::Handle<i::String> source = internal_isolate->factory()
+ ->NewStringFromAscii(i::Vector<const char>(input, length));
+ return i::PreParserApi::PreParse(internal_isolate, source);
}
ScriptData* ScriptData::PreCompile(v8::Handle<String> source) {
i::Handle<i::String> str = Utils::OpenHandle(*source);
i::Isolate* isolate = str->GetIsolate();
- if (str->IsExternalTwoByteString()) {
- i::ExternalTwoByteStringUtf16CharacterStream stream(
- i::Handle<i::ExternalTwoByteString>::cast(str), 0, str->length());
- return i::PreParserApi::PreParse(isolate, &stream);
- } else {
- i::GenericStringUtf16CharacterStream stream(str, 0, str->length());
- return i::PreParserApi::PreParse(isolate, &stream);
- }
+ return i::PreParserApi::PreParse(isolate, str);
}
« no previous file with comments | « no previous file | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698