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

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

Issue 2211393003: Revert of Hook up compiler dispatcher jobs to lazy parser. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
51 Handle<String> source(String::cast(script->source()), isolate_); 49 Handle<String> source(String::cast(script->source()), isolate_);
52 if (source->IsExternalTwoByteString()) { 50 if (source->IsExternalTwoByteString()) {
53 character_stream_.reset(new ExternalTwoByteStringUtf16CharacterStream( 51 character_stream_.reset(new ExternalTwoByteStringUtf16CharacterStream(
54 Handle<ExternalTwoByteString>::cast(source), shared->start_position(), 52 Handle<ExternalTwoByteString>::cast(source), shared->start_position(),
55 shared->end_position())); 53 shared->end_position()));
56 } else if (source->IsExternalOneByteString()) { 54 } else if (source->IsExternalOneByteString()) {
57 character_stream_.reset(new ExternalOneByteStringUtf16CharacterStream( 55 character_stream_.reset(new ExternalOneByteStringUtf16CharacterStream(
58 Handle<ExternalOneByteString>::cast(source), shared->start_position(), 56 Handle<ExternalOneByteString>::cast(source), shared->start_position(),
59 shared->end_position())); 57 shared->end_position()));
60 } else { 58 } else {
61 source = String::Flatten(source); 59 source = String::Flatten(source);
62 // Have to globalize the reference here, so it survives between function 60 // Have to globalize the reference here, so it survives between function
63 // calls. 61 // calls.
64 source_ = Handle<String>::cast(isolate_->global_handles()->Create(*source)); 62 source_ = Handle<String>::cast(isolate_->global_handles()->Create(*source));
65 character_stream_.reset(new GenericStringUtf16CharacterStream( 63 character_stream_.reset(new GenericStringUtf16CharacterStream(
66 source_, shared->start_position(), shared->end_position())); 64 source_, shared->start_position(), shared->end_position()));
67 } 65 }
68 parse_info_.reset(new ParseInfo(zone_.get())); 66 parse_info_.reset(new ParseInfo(zone_.get()));
69 parse_info_->set_isolate(isolate_); 67 parse_info_->set_isolate(isolate_);
70 parse_info_->set_character_stream(character_stream_.get()); 68 parse_info_->set_character_stream(character_stream_.get());
71 parse_info_->set_lazy();
72 parse_info_->set_hash_seed(isolate_->heap()->HashSeed()); 69 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());
78 parse_info_->set_unicode_cache(unicode_cache_.get()); 70 parse_info_->set_unicode_cache(unicode_cache_.get());
79 parse_info_->set_language_mode(shared->language_mode());
80
81 parser_.reset(new Parser(parse_info_.get())); 71 parser_.reset(new Parser(parse_info_.get()));
82 parser_->DeserializeScopeChain( 72 parser_->DeserializeScopeChain(
83 parse_info_.get(), handle(function_->context(), isolate_), 73 parse_info_.get(), handle(function_->context(), isolate_),
84 Scope::DeserializationMode::kDeserializeOffHeap); 74 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));
89 status_ = CompileJobStatus::kReadyToParse; 75 status_ = CompileJobStatus::kReadyToParse;
90 } 76 }
91 77
92 void CompilerDispatcherJob::Parse() { 78 void CompilerDispatcherJob::Parse() {
93 DCHECK(can_parse_on_background_thread_ || 79 DCHECK(can_parse_on_background_thread_ ||
94 ThreadId::Current().Equals(isolate_->thread_id())); 80 ThreadId::Current().Equals(isolate_->thread_id()));
95 DCHECK(status() == CompileJobStatus::kReadyToParse); 81 DCHECK(status() == CompileJobStatus::kReadyToParse);
96 82
97 DisallowHeapAllocation no_allocation; 83 DisallowHeapAllocation no_allocation;
98 DisallowHandleAllocation no_handles; 84 DisallowHandleAllocation no_handles;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 169
184 parse_info_->set_character_stream(nullptr); 170 parse_info_->set_character_stream(nullptr);
185 parse_info_->set_unicode_cache(nullptr); 171 parse_info_->set_unicode_cache(nullptr);
186 parser_.reset(); 172 parser_.reset();
187 unicode_cache_.reset(); 173 unicode_cache_.reset();
188 character_stream_.reset(); 174 character_stream_.reset();
189 } 175 }
190 176
191 } // namespace internal 177 } // namespace internal
192 } // namespace v8 178 } // 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