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.h" | 5 #include "src/compiler-dispatcher/compiler-dispatcher.h" |
6 | 6 |
7 #include "include/v8-platform.h" | 7 #include "include/v8-platform.h" |
8 #include "include/v8.h" | 8 #include "include/v8.h" |
9 #include "src/base/platform/time.h" | 9 #include "src/base/platform/time.h" |
10 #include "src/cancelable-task.h" | 10 #include "src/cancelable-task.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 function->ShortPrint(); | 280 function->ShortPrint(); |
281 PrintF("\n"); | 281 PrintF("\n"); |
282 } | 282 } |
283 JobMap::const_iterator job = GetJobFor(function); | 283 JobMap::const_iterator job = GetJobFor(function); |
284 DoNextStepOnMainThread(isolate_, job->second.get(), | 284 DoNextStepOnMainThread(isolate_, job->second.get(), |
285 ExceptionHandling::kSwallow); | 285 ExceptionHandling::kSwallow); |
286 ConsiderJobForBackgroundProcessing(job->second.get()); | 286 ConsiderJobForBackgroundProcessing(job->second.get()); |
287 return true; | 287 return true; |
288 } | 288 } |
289 | 289 |
290 bool CompilerDispatcher::Enqueue(Handle<SharedFunctionInfo> function, | 290 bool CompilerDispatcher::Enqueue( |
291 FunctionLiteral* literal) { | 291 Handle<SharedFunctionInfo> function, FunctionLiteral* literal, |
| 292 std::shared_ptr<Zone> parse_zone, |
| 293 std::shared_ptr<DeferredHandles> parse_handles, |
| 294 std::shared_ptr<DeferredHandles> compile_handles) { |
292 if (!CanEnqueue(function)) return false; | 295 if (!CanEnqueue(function)) return false; |
293 if (IsEnqueued(function)) return true; | 296 if (IsEnqueued(function)) return true; |
294 | 297 |
295 if (trace_compiler_dispatcher_) { | 298 if (trace_compiler_dispatcher_) { |
296 PrintF("CompilerDispatcher: enqueuing "); | 299 PrintF("CompilerDispatcher: enqueuing "); |
297 function->ShortPrint(); | 300 function->ShortPrint(); |
298 PrintF(" for compile\n"); | 301 PrintF(" for compile\n"); |
299 } | 302 } |
300 | 303 |
301 std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob( | 304 std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob( |
302 isolate_, tracer_.get(), function, literal, max_stack_size_)); | 305 isolate_, tracer_.get(), function, literal, parse_zone, parse_handles, |
| 306 compile_handles, max_stack_size_)); |
303 std::pair<int, int> key(Script::cast(function->script())->id(), | 307 std::pair<int, int> key(Script::cast(function->script())->id(), |
304 function->function_literal_id()); | 308 function->function_literal_id()); |
305 jobs_.insert(std::make_pair(key, std::move(job))); | 309 jobs_.insert(std::make_pair(key, std::move(job))); |
306 ScheduleIdleTaskIfNeeded(); | 310 ScheduleIdleTaskIfNeeded(); |
307 return true; | 311 return true; |
308 } | 312 } |
309 | 313 |
310 bool CompilerDispatcher::EnqueueAndStep(Handle<SharedFunctionInfo> function, | 314 bool CompilerDispatcher::EnqueueAndStep( |
311 FunctionLiteral* literal) { | 315 Handle<SharedFunctionInfo> function, FunctionLiteral* literal, |
312 if (!Enqueue(function, literal)) return false; | 316 std::shared_ptr<Zone> parse_zone, |
| 317 std::shared_ptr<DeferredHandles> parse_handles, |
| 318 std::shared_ptr<DeferredHandles> compile_handles) { |
| 319 if (!Enqueue(function, literal, parse_zone, parse_handles, compile_handles)) { |
| 320 return false; |
| 321 } |
313 | 322 |
314 if (trace_compiler_dispatcher_) { | 323 if (trace_compiler_dispatcher_) { |
315 PrintF("CompilerDispatcher: stepping "); | 324 PrintF("CompilerDispatcher: stepping "); |
316 function->ShortPrint(); | 325 function->ShortPrint(); |
317 PrintF("\n"); | 326 PrintF("\n"); |
318 } | 327 } |
319 JobMap::const_iterator job = GetJobFor(function); | 328 JobMap::const_iterator job = GetJobFor(function); |
320 DoNextStepOnMainThread(isolate_, job->second.get(), | 329 DoNextStepOnMainThread(isolate_, job->second.get(), |
321 ExceptionHandling::kSwallow); | 330 ExceptionHandling::kSwallow); |
322 ConsiderJobForBackgroundProcessing(job->second.get()); | 331 ConsiderJobForBackgroundProcessing(job->second.get()); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 lock.reset(); | 702 lock.reset(); |
694 DoNextStepOnMainThread(isolate_, job->second.get(), | 703 DoNextStepOnMainThread(isolate_, job->second.get(), |
695 ExceptionHandling::kSwallow); | 704 ExceptionHandling::kSwallow); |
696 } | 705 } |
697 } | 706 } |
698 if (jobs_.size() > too_long_jobs) ScheduleIdleTaskIfNeeded(); | 707 if (jobs_.size() > too_long_jobs) ScheduleIdleTaskIfNeeded(); |
699 } | 708 } |
700 | 709 |
701 } // namespace internal | 710 } // namespace internal |
702 } // namespace v8 | 711 } // namespace v8 |
OLD | NEW |