Commit d7d201d4 authored by kschimpf's avatar kschimpf Committed by Commit bot

Separate function byte size counter for asm.js/wasm.

Currently, V8 uses the same size counter to measure function byte sizes for both
asm.js and WASM. This CL separates the counter into two separate counters, and
then uses the appropriate counter when decoding.

BUG=chromium:704922
R=bbudge@google.com,bradnelson@chromium.org

Review-Url: https://codereview.chromium.org/2780783003
Cr-Commit-Position: refs/heads/master@{#44205}
parent 1d482128
......@@ -1021,7 +1021,9 @@ class RuntimeCallTimerScope {
HM(wasm_asm_min_mem_pages_count, V8.WasmMinMemPagesCount) \
HM(wasm_wasm_min_mem_pages_count, V8.WasmMinMemPagesCount) \
HM(wasm_max_mem_pages_count, V8.WasmMaxMemPagesCount) \
HM(wasm_function_size_bytes, V8.WasmFunctionSizeBytes) \
/* TODO(karlschimpf) Update chrome flags to reflect asm/wasm split. */ \
HM(wasm_asm_function_size_bytes, V8.WasmFunctionSizeBytes) \
HM(wasm_wasm_function_size_bytes, V8.WasmFunctionSizeBytes) \
HM(wasm_module_size_bytes, V8.WasmModuleSizeBytes)
// WARNING: STATS_COUNTER_LIST_* is a very large macro that is causing MSVC
......
......@@ -1195,16 +1195,17 @@ FunctionResult DecodeWasmFunction(Isolate* isolate, Zone* zone,
ModuleBytesEnv* module_env,
const byte* function_start,
const byte* function_end) {
bool is_wasm = module_env->module_env.is_wasm();
HistogramTimerScope wasm_decode_function_time_scope(
module_env->module_env.is_wasm()
? isolate->counters()->wasm_decode_wasm_function_time()
is_wasm ? isolate->counters()->wasm_decode_wasm_function_time()
: isolate->counters()->wasm_decode_asm_function_time());
size_t size = function_end - function_start;
if (function_start > function_end) return FunctionError("start > end");
if (size > kV8MaxWasmFunctionSize)
return FunctionError("size > maximum function size");
isolate->counters()->wasm_function_size_bytes()->AddSample(
static_cast<int>(size));
(is_wasm ? isolate->counters()->wasm_wasm_function_size_bytes()
: isolate->counters()->wasm_asm_function_size_bytes())
->AddSample(static_cast<int>(size));
WasmFunction* function = new WasmFunction();
ModuleDecoder decoder(zone, function_start, function_end, kWasmOrigin);
return decoder.DecodeSingleFunction(module_env, function);
......
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