Commit 67f43055 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Fix data race when concurrent compilation is aborted due to dependency change.

R=marja@chromium.org
BUG=chromium:419189
LOG=N

Review URL: https://codereview.chromium.org/616263003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24361 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b8288c75
...@@ -52,7 +52,8 @@ CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone) ...@@ -52,7 +52,8 @@ CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone)
parameter_count_(0), parameter_count_(0),
optimization_id_(-1), optimization_id_(-1),
ast_value_factory_(NULL), ast_value_factory_(NULL),
ast_value_factory_owned_(false) { ast_value_factory_owned_(false),
aborted_due_to_dependency_change_(false) {
Initialize(script->GetIsolate(), BASE, zone); Initialize(script->GetIsolate(), BASE, zone);
} }
...@@ -65,7 +66,8 @@ CompilationInfo::CompilationInfo(Isolate* isolate, Zone* zone) ...@@ -65,7 +66,8 @@ CompilationInfo::CompilationInfo(Isolate* isolate, Zone* zone)
parameter_count_(0), parameter_count_(0),
optimization_id_(-1), optimization_id_(-1),
ast_value_factory_(NULL), ast_value_factory_(NULL),
ast_value_factory_owned_(false) { ast_value_factory_owned_(false),
aborted_due_to_dependency_change_(false) {
Initialize(isolate, STUB, zone); Initialize(isolate, STUB, zone);
} }
...@@ -80,7 +82,8 @@ CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info, ...@@ -80,7 +82,8 @@ CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info,
parameter_count_(0), parameter_count_(0),
optimization_id_(-1), optimization_id_(-1),
ast_value_factory_(NULL), ast_value_factory_(NULL),
ast_value_factory_owned_(false) { ast_value_factory_owned_(false),
aborted_due_to_dependency_change_(false) {
Initialize(script_->GetIsolate(), BASE, zone); Initialize(script_->GetIsolate(), BASE, zone);
} }
...@@ -96,7 +99,8 @@ CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone) ...@@ -96,7 +99,8 @@ CompilationInfo::CompilationInfo(Handle<JSFunction> closure, Zone* zone)
parameter_count_(0), parameter_count_(0),
optimization_id_(-1), optimization_id_(-1),
ast_value_factory_(NULL), ast_value_factory_(NULL),
ast_value_factory_owned_(false) { ast_value_factory_owned_(false),
aborted_due_to_dependency_change_(false) {
Initialize(script_->GetIsolate(), BASE, zone); Initialize(script_->GetIsolate(), BASE, zone);
} }
...@@ -109,7 +113,8 @@ CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, Isolate* isolate, ...@@ -109,7 +113,8 @@ CompilationInfo::CompilationInfo(HydrogenCodeStub* stub, Isolate* isolate,
parameter_count_(0), parameter_count_(0),
optimization_id_(-1), optimization_id_(-1),
ast_value_factory_(NULL), ast_value_factory_(NULL),
ast_value_factory_owned_(false) { ast_value_factory_owned_(false),
aborted_due_to_dependency_change_(false) {
Initialize(isolate, STUB, zone); Initialize(isolate, STUB, zone);
code_stub_ = stub; code_stub_ = stub;
} }
...@@ -126,7 +131,8 @@ CompilationInfo::CompilationInfo( ...@@ -126,7 +131,8 @@ CompilationInfo::CompilationInfo(
parameter_count_(0), parameter_count_(0),
optimization_id_(-1), optimization_id_(-1),
ast_value_factory_(NULL), ast_value_factory_(NULL),
ast_value_factory_owned_(false) { ast_value_factory_owned_(false),
aborted_due_to_dependency_change_(false) {
Initialize(isolate, BASE, zone); Initialize(isolate, BASE, zone);
} }
......
...@@ -85,8 +85,7 @@ class CompilationInfo { ...@@ -85,8 +85,7 @@ class CompilationInfo {
kInliningEnabled = 1 << 17, kInliningEnabled = 1 << 17,
kTypingEnabled = 1 << 18, kTypingEnabled = 1 << 18,
kDisableFutureOptimization = 1 << 19, kDisableFutureOptimization = 1 << 19,
kAbortedDueToDependency = 1 << 20, kToplevel = 1 << 20
kToplevel = 1 << 21
}; };
CompilationInfo(Handle<JSFunction> closure, Zone* zone); CompilationInfo(Handle<JSFunction> closure, Zone* zone);
...@@ -371,12 +370,12 @@ class CompilationInfo { ...@@ -371,12 +370,12 @@ class CompilationInfo {
void AbortDueToDependencyChange() { void AbortDueToDependencyChange() {
DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate())); DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate()));
SetFlag(kAbortedDueToDependency); aborted_due_to_dependency_change_ = true;
} }
bool HasAbortedDueToDependencyChange() const { bool HasAbortedDueToDependencyChange() const {
DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate())); DCHECK(!OptimizingCompilerThread::IsOptimizerThread(isolate()));
return GetFlag(kAbortedDueToDependency); return aborted_due_to_dependency_change_;
} }
bool HasSameOsrEntry(Handle<JSFunction> function, BailoutId osr_ast_id) { bool HasSameOsrEntry(Handle<JSFunction> function, BailoutId osr_ast_id) {
...@@ -515,6 +514,10 @@ class CompilationInfo { ...@@ -515,6 +514,10 @@ class CompilationInfo {
bool ast_value_factory_owned_; bool ast_value_factory_owned_;
AstNode::IdGen ast_node_id_gen_; AstNode::IdGen ast_node_id_gen_;
// This flag is used by the main thread to track whether this compilation
// should be abandoned due to dependency change.
bool aborted_due_to_dependency_change_;
DISALLOW_COPY_AND_ASSIGN(CompilationInfo); DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
}; };
......
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