From 074429a429a708ff4f661f585deb851e199cceeb Mon Sep 17 00:00:00 2001 From: Kim-Anh Tran Date: Wed, 25 Apr 2018 12:52:22 +0200 Subject: [PATCH] [wasm] Create runtime objects directly after compilation finishes We want to ensure that all runtime objects are created as soon as compilation finishes. Instead of scheduling another foreground thread to create these runtime objects, we now call it directly from the already executing foreground thread. Change-Id: I9e8f47dba237de16e0bac119f1649496c8525b37 Reviewed-on: https://chromium-review.googlesource.com/1027712 Reviewed-by: Clemens Hammacher Reviewed-by: Andreas Haas Commit-Queue: Kim-Anh Tran Cr-Commit-Position: refs/heads/master@{#52779} --- src/wasm/module-compiler.cc | 115 +++++++++++++++++------------------- src/wasm/module-compiler.h | 5 +- 2 files changed, 57 insertions(+), 63 deletions(-) diff --git a/src/wasm/module-compiler.cc b/src/wasm/module-compiler.cc index 63ccf811c2..2e41cd83f3 100644 --- a/src/wasm/module-compiler.cc +++ b/src/wasm/module-compiler.cc @@ -2720,6 +2720,48 @@ AsyncCompileJob::~AsyncCompileJob() { for (auto d : deferred_handles_) delete d; } +void AsyncCompileJob::FinishCompile() { + RecordStats(compiled_module_->GetNativeModule(), counters()); + + // Create heap objects for script and module bytes to be stored in the + // shared module data. Asm.js is not compiled asynchronously. + Handle