[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}
This commit is contained in:
rmcilroy 2016-07-22 02:39:16 -07:00 committed by Commit bot
parent 06bfc8421b
commit 1df29e190f
2 changed files with 7 additions and 0 deletions

View File

@ -607,6 +607,11 @@ PipelineCompilationJob::Status PipelineCompilationJob::CreateGraphImpl() {
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()));
if (!pipeline_.CreateGraph()) {

View File

@ -217,6 +217,8 @@ class CallInterfaceDescriptor {
void Initialize(Isolate* isolate, CallDescriptors::Key key) {
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);
DCHECK(d == data()); // d should be a modifiable pointer to data().
InitializePlatformSpecific(d);