Commit 1df29e19 authored by rmcilroy's avatar rmcilroy Committed by Commit bot

[Turbofan] Fix a race on CallInterfaceDescriptor initialization.

The effect control linearizer runs off-thread and needs the ToNumber
call descriptor. Add a hack to create this on the main thread to
ensure off-thread's don't race on it's construction. Also add a
DCHEK to the CallInterfaceDescriptor to ensure they are always
initilaized on the main thread.

Review-Url: https://codereview.chromium.org/2168843003
Cr-Commit-Position: refs/heads/master@{#37973}
parent 06bfc842
...@@ -607,6 +607,11 @@ PipelineCompilationJob::Status PipelineCompilationJob::CreateGraphImpl() { ...@@ -607,6 +607,11 @@ PipelineCompilationJob::Status PipelineCompilationJob::CreateGraphImpl() {
if (!Compiler::EnsureDeoptimizationSupport(info())) return FAILED; if (!Compiler::EnsureDeoptimizationSupport(info())) return FAILED;
} }
// TODO(mstarzinger): Hack to ensure that the ToNumber call descriptor is
// initialized on the main thread, since it is needed off-thread by the
// effect control linearizer.
CodeFactory::ToNumber(info()->isolate());
linkage_ = new (&zone_) Linkage(Linkage::ComputeIncoming(&zone_, info())); linkage_ = new (&zone_) Linkage(Linkage::ComputeIncoming(&zone_, info()));
if (!pipeline_.CreateGraph()) { if (!pipeline_.CreateGraph()) {
......
...@@ -217,6 +217,8 @@ class CallInterfaceDescriptor { ...@@ -217,6 +217,8 @@ class CallInterfaceDescriptor {
void Initialize(Isolate* isolate, CallDescriptors::Key key) { void Initialize(Isolate* isolate, CallDescriptors::Key key) {
if (!data()->IsInitialized()) { if (!data()->IsInitialized()) {
// We should only initialize descriptors on the isolate's main thread.
DCHECK(ThreadId::Current().Equals(isolate->thread_id()));
CallInterfaceDescriptorData* d = isolate->call_descriptor_data(key); CallInterfaceDescriptorData* d = isolate->call_descriptor_data(key);
DCHECK(d == data()); // d should be a modifiable pointer to data(). DCHECK(d == data()); // d should be a modifiable pointer to data().
InitializePlatformSpecific(d); InitializePlatformSpecific(d);
......
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