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/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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 status_ = CompileJobStatus::kInitial; | 164 status_ = CompileJobStatus::kInitial; |
165 } | 165 } |
166 | 166 |
167 void CompilerDispatcherJob::InternalizeParsingResult() { | 167 void CompilerDispatcherJob::InternalizeParsingResult() { |
168 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); | 168 DCHECK(ThreadId::Current().Equals(isolate_->thread_id())); |
169 DCHECK(status() == CompileJobStatus::kParsed || | 169 DCHECK(status() == CompileJobStatus::kParsed || |
170 status() == CompileJobStatus::kFailed); | 170 status() == CompileJobStatus::kFailed); |
171 | 171 |
172 HandleScope scope(isolate_); | 172 HandleScope scope(isolate_); |
| 173 |
| 174 // Create a canonical handle scope before internalizing parsed values if |
| 175 // compiling bytecode. This is required for off-thread bytecode generation. |
| 176 std::unique_ptr<CanonicalHandleScope> canonical; |
| 177 if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate_)); |
| 178 |
173 Handle<SharedFunctionInfo> shared(function_->shared(), isolate_); | 179 Handle<SharedFunctionInfo> shared(function_->shared(), isolate_); |
174 Handle<Script> script(Script::cast(shared->script()), isolate_); | 180 Handle<Script> script(Script::cast(shared->script()), isolate_); |
175 | 181 |
176 parse_info_->set_script(script); | 182 parse_info_->set_script(script); |
177 parse_info_->set_context(handle(function_->context(), isolate_)); | 183 parse_info_->set_context(handle(function_->context(), isolate_)); |
178 | 184 |
179 // Do the parsing tasks which need to be done on the main thread. This will | 185 // Do the parsing tasks which need to be done on the main thread. This will |
180 // also handle parse errors. | 186 // also handle parse errors. |
181 parser_->Internalize(isolate_, script, parse_info_->literal() == nullptr); | 187 parser_->Internalize(isolate_, script, parse_info_->literal() == nullptr); |
182 parser_->HandleSourceURLComments(isolate_, script); | 188 parser_->HandleSourceURLComments(isolate_, script); |
183 | 189 |
184 parse_info_->set_character_stream(nullptr); | 190 parse_info_->set_character_stream(nullptr); |
185 parse_info_->set_unicode_cache(nullptr); | 191 parse_info_->set_unicode_cache(nullptr); |
186 parser_.reset(); | 192 parser_.reset(); |
187 unicode_cache_.reset(); | 193 unicode_cache_.reset(); |
188 character_stream_.reset(); | 194 character_stream_.reset(); |
189 } | 195 } |
190 | 196 |
191 } // namespace internal | 197 } // namespace internal |
192 } // namespace v8 | 198 } // namespace v8 |
OLD | NEW |