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

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

Issue 2342443004: Only pass the outer scope info with ParseInfo (Closed)
Patch Set: Created 4 years, 3 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
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/compilation-info.h" 8 #include "src/compilation-info.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/global-handles.h" 10 #include "src/global-handles.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 parse_info_->set_hash_seed(isolate_->heap()->HashSeed()); 76 parse_info_->set_hash_seed(isolate_->heap()->HashSeed());
77 parse_info_->set_is_named_expression(shared->is_named_expression()); 77 parse_info_->set_is_named_expression(shared->is_named_expression());
78 parse_info_->set_calls_eval(shared->scope_info()->CallsEval()); 78 parse_info_->set_calls_eval(shared->scope_info()->CallsEval());
79 parse_info_->set_compiler_hints(shared->compiler_hints()); 79 parse_info_->set_compiler_hints(shared->compiler_hints());
80 parse_info_->set_start_position(shared->start_position()); 80 parse_info_->set_start_position(shared->start_position());
81 parse_info_->set_end_position(shared->end_position()); 81 parse_info_->set_end_position(shared->end_position());
82 parse_info_->set_unicode_cache(unicode_cache_.get()); 82 parse_info_->set_unicode_cache(unicode_cache_.get());
83 parse_info_->set_language_mode(shared->language_mode()); 83 parse_info_->set_language_mode(shared->language_mode());
84 84
85 parser_.reset(new Parser(parse_info_.get())); 85 parser_.reset(new Parser(parse_info_.get()));
86 parser_->DeserializeScopeChain(parse_info_.get(), 86 parser_->DeserializeScopeChain(
87 handle(function_->context(), isolate_)); 87 parse_info_.get(),
88 function_->context()->IsNativeContext()
89 ? MaybeHandle<ScopeInfo>()
90 : MaybeHandle<ScopeInfo>(function_->context()->scope_info(),
91 isolate_));
88 92
89 Handle<String> name(String::cast(shared->name())); 93 Handle<String> name(String::cast(shared->name()));
90 parse_info_->set_function_name( 94 parse_info_->set_function_name(
91 parse_info_->ast_value_factory()->GetString(name)); 95 parse_info_->ast_value_factory()->GetString(name));
92 status_ = CompileJobStatus::kReadyToParse; 96 status_ = CompileJobStatus::kReadyToParse;
93 } 97 }
94 98
95 void CompilerDispatcherJob::Parse() { 99 void CompilerDispatcherJob::Parse() {
96 DCHECK(can_parse_on_background_thread_ || 100 DCHECK(can_parse_on_background_thread_ ||
97 ThreadId::Current().Equals(isolate_->thread_id())); 101 ThreadId::Current().Equals(isolate_->thread_id()));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 { 143 {
140 // Create a canonical handle scope before internalizing parsed values if 144 // Create a canonical handle scope before internalizing parsed values if
141 // compiling bytecode. This is required for off-thread bytecode generation. 145 // compiling bytecode. This is required for off-thread bytecode generation.
142 std::unique_ptr<CanonicalHandleScope> canonical; 146 std::unique_ptr<CanonicalHandleScope> canonical;
143 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate_)); 147 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate_));
144 148
145 Handle<SharedFunctionInfo> shared(function_->shared(), isolate_); 149 Handle<SharedFunctionInfo> shared(function_->shared(), isolate_);
146 Handle<Script> script(Script::cast(shared->script()), isolate_); 150 Handle<Script> script(Script::cast(shared->script()), isolate_);
147 151
148 parse_info_->set_script(script); 152 parse_info_->set_script(script);
149 parse_info_->set_context(handle(function_->context(), isolate_)); 153 if (!function_->context()->IsNativeContext()) {
154 parse_info_->set_outer_scope_info(
155 handle(function_->context()->scope_info(), isolate_));
156 }
150 parse_info_->set_shared_info(handle(function_->shared(), isolate_)); 157 parse_info_->set_shared_info(handle(function_->shared(), isolate_));
151 158
152 // Do the parsing tasks which need to be done on the main thread. This will 159 // Do the parsing tasks which need to be done on the main thread. This will
153 // also handle parse errors. 160 // also handle parse errors.
154 parser_->Internalize(isolate_, script, parse_info_->literal() == nullptr); 161 parser_->Internalize(isolate_, script, parse_info_->literal() == nullptr);
155 parser_->HandleSourceURLComments(isolate_, script); 162 parser_->HandleSourceURLComments(isolate_, script);
156 163
157 parse_info_->set_character_stream(nullptr); 164 parse_info_->set_character_stream(nullptr);
158 parse_info_->set_unicode_cache(nullptr); 165 parse_info_->set_unicode_cache(nullptr);
159 parser_.reset(); 166 parser_.reset();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 if (!source_.is_null()) { 259 if (!source_.is_null()) {
253 i::GlobalHandles::Destroy(Handle<Object>::cast(source_).location()); 260 i::GlobalHandles::Destroy(Handle<Object>::cast(source_).location());
254 source_ = Handle<String>::null(); 261 source_ = Handle<String>::null();
255 } 262 }
256 263
257 status_ = CompileJobStatus::kInitial; 264 status_ = CompileJobStatus::kInitial;
258 } 265 }
259 266
260 } // namespace internal 267 } // namespace internal
261 } // namespace v8 268 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698