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

Unified Diff: src/compiler-dispatcher/compiler-dispatcher-job.cc

Issue 2195603002: Create a character stream and hook it up to the parse info (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 5 months 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 | « src/compiler-dispatcher/compiler-dispatcher-job.h ('k') | src/parsing/parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler-dispatcher/compiler-dispatcher-job.cc
diff --git a/src/compiler-dispatcher/compiler-dispatcher-job.cc b/src/compiler-dispatcher/compiler-dispatcher-job.cc
index 59dc58583f1440ec122d7cd6a3239a4ad56809cd..7f4991a112d96dd9d6ecf56f96c191d96a36b87a 100644
--- a/src/compiler-dispatcher/compiler-dispatcher-job.cc
+++ b/src/compiler-dispatcher/compiler-dispatcher-job.cc
@@ -8,6 +8,7 @@
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "src/parsing/parser.h"
+#include "src/parsing/scanner-character-streams.h"
#include "src/unicode-cache.h"
#include "src/zone.h"
@@ -18,7 +19,8 @@ CompilerDispatcherJob::CompilerDispatcherJob(Isolate* isolate,
Handle<JSFunction> function)
: isolate_(isolate),
function_(Handle<JSFunction>::cast(
- isolate_->global_handles()->Create(*function))) {}
+ isolate_->global_handles()->Create(*function))),
+ can_parse_on_background_thread_(false) {}
CompilerDispatcherJob::~CompilerDispatcherJob() {
DCHECK(ThreadId::Current().Equals(isolate_->thread_id()));
@@ -28,11 +30,30 @@ CompilerDispatcherJob::~CompilerDispatcherJob() {
void CompilerDispatcherJob::PrepareToParseOnMainThread() {
DCHECK(ThreadId::Current().Equals(isolate_->thread_id()));
DCHECK(status_ == CompileJobStatus::kInitial);
+ HandleScope scope(isolate_);
unicode_cache_.reset(new UnicodeCache());
zone_.reset(new Zone(isolate_->allocator()));
+ Handle<SharedFunctionInfo> shared(function_->shared(), isolate_);
+ Handle<Script> script(Script::cast(shared->script()), isolate_);
+ Handle<String> source(String::cast(script->source()), isolate_);
+ if (source->IsExternalTwoByteString()) {
+ can_parse_on_background_thread_ = true;
+ character_stream_.reset(new ExternalTwoByteStringUtf16CharacterStream(
+ Handle<ExternalTwoByteString>::cast(source), shared->start_position(),
+ shared->end_position()));
+ } else if (source->IsExternalOneByteString()) {
+ can_parse_on_background_thread_ = true;
+ character_stream_.reset(new ExternalOneByteStringUtf16CharacterStream(
+ Handle<ExternalOneByteString>::cast(source), shared->start_position(),
+ shared->end_position()));
+ } else {
+ can_parse_on_background_thread_ = false;
+ character_stream_.reset(new GenericStringUtf16CharacterStream(
+ source, shared->start_position(), shared->end_position()));
+ }
parse_info_.reset(new ParseInfo(zone_.get()));
parse_info_->set_isolate(isolate_);
- // TODO(jochen): We need to hook up a fake source stream here.
+ parse_info_->set_character_stream(character_stream_.get());
parse_info_->set_hash_seed(isolate_->heap()->HashSeed());
parse_info_->set_unicode_cache(unicode_cache_.get());
status_ = CompileJobStatus::kReadyToParse;
« no previous file with comments | « src/compiler-dispatcher/compiler-dispatcher-job.h ('k') | src/parsing/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698