Fix a crash due to enabling VTune JIT support

When VTune JIT support is enabled, the WasmEngine of an Isolate tries to
enable code logging by EnableCodeLogging() method. This multithreaded
method requires a Mutex for safety. However, as the WasmEngine is not
created, the Mutex of it is not initialized. An attempt of acquiring
this Mutex results in an error. The bug is fixed by creating WasmEngine
before it enables code logging.

Change-Id: I59e749190288ec412f6661233e8f62b0dff3cd7f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1337376
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60060}
This commit is contained in:
zhiguo 2019-03-06 12:05:43 +08:00 committed by Commit Bot
parent d36fd844a2
commit f044f91d87

View File

@ -1930,7 +1930,9 @@ void Logger::SetCodeEventHandler(uint32_t options,
}
if (event_handler) {
isolate_->wasm_engine()->EnableCodeLogging(isolate_);
if (isolate_->wasm_engine() != nullptr) {
isolate_->wasm_engine()->EnableCodeLogging(isolate_);
}
jit_logger_.reset(new JitLogger(isolate_, event_handler));
AddCodeEventListener(jit_logger_.get());
if (options & kJitCodeEventEnumExisting) {