Commit 68efcd66 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[OptimizingCompileDispatcher] Make CompileTasks cancelable

CompileTasks contain a pointer to the isolate. All tasks which have a
pointer to the isolate have to be cancelable to make sure that the task
does not execute after the isolate shut down.

R=rmcilroy@chromium.org

Change-Id: I10b2af0177b5cb60ab1dfdad47529fb8c7301ba0
Reviewed-on: https://chromium-review.googlesource.com/774441Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49418}
parent 430e03b3
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h"
#include "src/base/atomicops.h" #include "src/base/atomicops.h"
#include "src/cancelable-task.h"
#include "src/compilation-info.h" #include "src/compilation-info.h"
#include "src/compiler.h" #include "src/compiler.h"
#include "src/isolate.h" #include "src/isolate.h"
...@@ -34,11 +35,11 @@ void DisposeCompilationJob(CompilationJob* job, bool restore_function_code) { ...@@ -34,11 +35,11 @@ void DisposeCompilationJob(CompilationJob* job, bool restore_function_code) {
} // namespace } // namespace
class OptimizingCompileDispatcher::CompileTask : public v8::Task { class OptimizingCompileDispatcher::CompileTask : public CancelableTask {
public: public:
explicit CompileTask(Isolate* isolate, explicit CompileTask(Isolate* isolate,
OptimizingCompileDispatcher* dispatcher) OptimizingCompileDispatcher* dispatcher)
: isolate_(isolate), dispatcher_(dispatcher) { : CancelableTask(isolate), isolate_(isolate), dispatcher_(dispatcher) {
base::LockGuard<base::Mutex> lock_guard(&dispatcher_->ref_count_mutex_); base::LockGuard<base::Mutex> lock_guard(&dispatcher_->ref_count_mutex_);
++dispatcher_->ref_count_; ++dispatcher_->ref_count_;
} }
...@@ -47,7 +48,7 @@ class OptimizingCompileDispatcher::CompileTask : public v8::Task { ...@@ -47,7 +48,7 @@ class OptimizingCompileDispatcher::CompileTask : public v8::Task {
private: private:
// v8::Task overrides. // v8::Task overrides.
void Run() override { void RunInternal() override {
DisallowHeapAllocation no_allocation; DisallowHeapAllocation no_allocation;
DisallowHandleAllocation no_handles; DisallowHandleAllocation no_handles;
DisallowHandleDereference no_deref; DisallowHandleDereference no_deref;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment