From 23c5ebdf61db6c4f3284be0847e2b7b1514c0dbc Mon Sep 17 00:00:00 2001 From: Fabian Date: Tue, 20 Nov 2018 16:28:55 -0600 Subject: [PATCH] Reduce value of WASM_TABLE_SIZE and incraese JIT_THRESHOLD Now that WASM_TABLE_SIZE may be capped, we set it slightly below the limit under which chromium crashes: https://bugs.chromium.org/p/v8/issues/detail?id=8427 JIT_THRESHOLD is also reduced due to two reasons: - With the lower WASM_TABLE_SIZE, we want to avoid compiling too many modules - It has occasionally been observed that under node, the engine's wasm compiler can't catch up with the number of modules we produce, thus resulting in 100s of pending compiled modules. This most likely happens only under node as we don't render the screen and the main loop (based on setImmediate) is faster. The new value doesn't seem to exhibit this problem, but we may want to increase the threshold further if the problem appears again --- src/const.js | 4 ++-- src/rust/jit.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/const.js b/src/const.js index bd0795df..01c58284 100644 --- a/src/const.js +++ b/src/const.js @@ -346,9 +346,9 @@ var PREFIX_66 = PREFIX_MASK_OPSIZE; // alias /** @const */ var MXCSR_MASK = (0xFFFF & ~(1 << 6)); - +// See same constant in jit.rs /** @const */ -var WASM_TABLE_SIZE = 0x10000; +var WASM_TABLE_SIZE = 900; /** @const */ var WASM_TABLE_OFFSET = 1024; diff --git a/src/rust/jit.rs b/src/rust/jit.rs index 60c090f6..f23ff445 100644 --- a/src/rust/jit.rs +++ b/src/rust/jit.rs @@ -15,7 +15,7 @@ use wasmgen::module_init; use wasmgen::module_init::WasmBuilder; use wasmgen::wasm_util::WasmBuf; -pub const WASM_TABLE_SIZE: u32 = 0x10000; +pub const WASM_TABLE_SIZE: u32 = 900; pub const HASH_PRIME: u32 = 6151; @@ -25,7 +25,7 @@ pub const JIT_MAX_ITERATIONS_PER_FUNCTION: u32 = 10000; pub const JIT_ALWAYS_USE_LOOP_SAFETY: bool = true; -pub const JIT_THRESHOLD: u32 = 8 * 10000; +pub const JIT_THRESHOLD: u32 = 200 * 1000; const CONDITION_FUNCTIONS: [&str; 16] = [ "test_o", "test_no", "test_b", "test_nb", "test_z", "test_nz", "test_be", "test_nbe", "test_s",