OLD | NEW |
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 Loading... |
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } else { | 138 } else { |
135 status_ = CompileJobStatus::kReadyToAnalyse; | 139 status_ = CompileJobStatus::kReadyToAnalyse; |
136 } | 140 } |
137 | 141 |
138 DeferredHandleScope scope(isolate_); | 142 DeferredHandleScope scope(isolate_); |
139 { | 143 { |
140 Handle<SharedFunctionInfo> shared(function_->shared(), isolate_); | 144 Handle<SharedFunctionInfo> shared(function_->shared(), isolate_); |
141 Handle<Script> script(Script::cast(shared->script()), isolate_); | 145 Handle<Script> script(Script::cast(shared->script()), isolate_); |
142 | 146 |
143 parse_info_->set_script(script); | 147 parse_info_->set_script(script); |
144 parse_info_->set_context(handle(function_->context(), isolate_)); | 148 if (!function_->context()->IsNativeContext()) { |
| 149 parse_info_->set_outer_scope_info( |
| 150 handle(function_->context()->scope_info(), isolate_)); |
| 151 } |
145 parse_info_->set_shared_info(handle(function_->shared(), isolate_)); | 152 parse_info_->set_shared_info(handle(function_->shared(), isolate_)); |
146 | 153 |
147 { | 154 { |
148 // Create a canonical handle scope if compiling ignition bytecode. This is | 155 // Create a canonical handle scope if compiling ignition bytecode. This is |
149 // required by the constant array builder to de-duplicate objects without | 156 // required by the constant array builder to de-duplicate objects without |
150 // dereferencing handles. | 157 // dereferencing handles. |
151 std::unique_ptr<CanonicalHandleScope> canonical; | 158 std::unique_ptr<CanonicalHandleScope> canonical; |
152 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate_)); | 159 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate_)); |
153 | 160 |
154 // Do the parsing tasks which need to be done on the main thread. This | 161 // Do the parsing tasks which need to be done on the main thread. This |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 if (!source_.is_null()) { | 255 if (!source_.is_null()) { |
249 i::GlobalHandles::Destroy(Handle<Object>::cast(source_).location()); | 256 i::GlobalHandles::Destroy(Handle<Object>::cast(source_).location()); |
250 source_ = Handle<String>::null(); | 257 source_ = Handle<String>::null(); |
251 } | 258 } |
252 | 259 |
253 status_ = CompileJobStatus::kInitial; | 260 status_ = CompileJobStatus::kInitial; |
254 } | 261 } |
255 | 262 |
256 } // namespace internal | 263 } // namespace internal |
257 } // namespace v8 | 264 } // namespace v8 |
OLD | NEW |