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

Side by Side Diff: src/compiler-dispatcher/compiler-dispatcher-job.cc

Issue 2220463002: Hook up compiler dispatcher jobs to lazy parser. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/parsing/parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler-dispatcher/compiler-dispatcher-job.h" 5 #include "src/compiler-dispatcher/compiler-dispatcher-job.h"
6 6
7 #include "src/assert-scope.h" 7 #include "src/assert-scope.h"
8 #include "src/global-handles.h" 8 #include "src/global-handles.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 40
41 void CompilerDispatcherJob::PrepareToParseOnMainThread() { 41 void CompilerDispatcherJob::PrepareToParseOnMainThread() {
42 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); 42 DCHECK(ThreadId::Current().Equals(isolate_->thread_id()));
43 DCHECK(status() == CompileJobStatus::kInitial); 43 DCHECK(status() == CompileJobStatus::kInitial);
44 HandleScope scope(isolate_); 44 HandleScope scope(isolate_);
45 unicode_cache_.reset(new UnicodeCache()); 45 unicode_cache_.reset(new UnicodeCache());
46 zone_.reset(new Zone(isolate_->allocator())); 46 zone_.reset(new Zone(isolate_->allocator()));
47 Handle<SharedFunctionInfo> shared(function_->shared(), isolate_); 47 Handle<SharedFunctionInfo> shared(function_->shared(), isolate_);
48 Handle<Script> script(Script::cast(shared->script()), isolate_); 48 Handle<Script> script(Script::cast(shared->script()), isolate_);
49 DCHECK(script->type() != Script::TYPE_NATIVE);
50
49 Handle<String> source(String::cast(script->source()), isolate_); 51 Handle<String> source(String::cast(script->source()), isolate_);
50 if (source->IsExternalTwoByteString()) { 52 if (source->IsExternalTwoByteString()) {
51 character_stream_.reset(new ExternalTwoByteStringUtf16CharacterStream( 53 character_stream_.reset(new ExternalTwoByteStringUtf16CharacterStream(
52 Handle<ExternalTwoByteString>::cast(source), shared->start_position(), 54 Handle<ExternalTwoByteString>::cast(source), shared->start_position(),
53 shared->end_position())); 55 shared->end_position()));
54 } else if (source->IsExternalOneByteString()) { 56 } else if (source->IsExternalOneByteString()) {
55 character_stream_.reset(new ExternalOneByteStringUtf16CharacterStream( 57 character_stream_.reset(new ExternalOneByteStringUtf16CharacterStream(
56 Handle<ExternalOneByteString>::cast(source), shared->start_position(), 58 Handle<ExternalOneByteString>::cast(source), shared->start_position(),
57 shared->end_position())); 59 shared->end_position()));
58 } else { 60 } else {
59 source = String::Flatten(source); 61 source = String::Flatten(source);
60 // Have to globalize the reference here, so it survives between function 62 // Have to globalize the reference here, so it survives between function
61 // calls. 63 // calls.
62 source_ = Handle<String>::cast(isolate_->global_handles()->Create(*source)); 64 source_ = Handle<String>::cast(isolate_->global_handles()->Create(*source));
63 character_stream_.reset(new GenericStringUtf16CharacterStream( 65 character_stream_.reset(new GenericStringUtf16CharacterStream(
64 source_, shared->start_position(), shared->end_position())); 66 source_, shared->start_position(), shared->end_position()));
65 } 67 }
66 parse_info_.reset(new ParseInfo(zone_.get())); 68 parse_info_.reset(new ParseInfo(zone_.get()));
67 parse_info_->set_isolate(isolate_); 69 parse_info_->set_isolate(isolate_);
68 parse_info_->set_character_stream(character_stream_.get()); 70 parse_info_->set_character_stream(character_stream_.get());
71 parse_info_->set_lazy();
69 parse_info_->set_hash_seed(isolate_->heap()->HashSeed()); 72 parse_info_->set_hash_seed(isolate_->heap()->HashSeed());
73 parse_info_->set_is_named_expression(shared->is_named_expression());
74 parse_info_->set_calls_eval(shared->scope_info()->CallsEval());
75 parse_info_->set_compiler_hints(shared->compiler_hints());
76 parse_info_->set_start_position(shared->start_position());
77 parse_info_->set_end_position(shared->end_position());
70 parse_info_->set_unicode_cache(unicode_cache_.get()); 78 parse_info_->set_unicode_cache(unicode_cache_.get());
79 parse_info_->set_language_mode(shared->language_mode());
80
71 parser_.reset(new Parser(parse_info_.get())); 81 parser_.reset(new Parser(parse_info_.get()));
72 parser_->DeserializeScopeChain( 82 parser_->DeserializeScopeChain(
73 parse_info_.get(), handle(function_->context(), isolate_), 83 parse_info_.get(), handle(function_->context(), isolate_),
74 Scope::DeserializationMode::kDeserializeOffHeap); 84 Scope::DeserializationMode::kDeserializeOffHeap);
85
86 Handle<String> name(String::cast(shared->name()));
87 parse_info_->set_function_name(
88 parse_info_->ast_value_factory()->GetString(name));
75 status_ = CompileJobStatus::kReadyToParse; 89 status_ = CompileJobStatus::kReadyToParse;
76 } 90 }
77 91
78 void CompilerDispatcherJob::Parse() { 92 void CompilerDispatcherJob::Parse() {
79 DCHECK(can_parse_on_background_thread_ || 93 DCHECK(can_parse_on_background_thread_ ||
80 ThreadId::Current().Equals(isolate_->thread_id())); 94 ThreadId::Current().Equals(isolate_->thread_id()));
81 DCHECK(status() == CompileJobStatus::kReadyToParse); 95 DCHECK(status() == CompileJobStatus::kReadyToParse);
82 96
83 DisallowHeapAllocation no_allocation; 97 DisallowHeapAllocation no_allocation;
84 DisallowHandleAllocation no_handles; 98 DisallowHandleAllocation no_handles;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 183
170 parse_info_->set_character_stream(nullptr); 184 parse_info_->set_character_stream(nullptr);
171 parse_info_->set_unicode_cache(nullptr); 185 parse_info_->set_unicode_cache(nullptr);
172 parser_.reset(); 186 parser_.reset();
173 unicode_cache_.reset(); 187 unicode_cache_.reset();
174 character_stream_.reset(); 188 character_stream_.reset();
175 } 189 }
176 190
177 } // namespace internal 191 } // namespace internal
178 } // namespace v8 192 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698