Remove is_sync counter flag from module_decoder.cc
This turns on collection of function size bytes, and decode time for functions in all cases (both background and foreground). Bug: v8:6361 Change-Id: I5d982ec4452596210b3ea9858126820ad0c3eacf Reviewed-on: https://chromium-review.googlesource.com/568781 Commit-Queue: Karl Schimpf <kschimpf@chromium.org> Reviewed-by: Bill Budge <bbudge@chromium.org> Cr-Commit-Position: refs/heads/master@{#46605}
This commit is contained in:
parent
fa4ec9fdbe
commit
e1ab347dac
@ -1257,12 +1257,9 @@ class ModuleDecoder : public Decoder {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
ModuleResult DecodeWasmModule(Isolate* isolate, const byte* module_start,
|
||||
const byte* module_end, bool verify_functions,
|
||||
ModuleOrigin origin, Counters* counters,
|
||||
bool is_sync) {
|
||||
ModuleOrigin origin, Counters* counters) {
|
||||
auto counter = origin == kWasmOrigin
|
||||
? counters->wasm_decode_wasm_module_time()
|
||||
: counters->wasm_decode_asm_module_time();
|
||||
@ -1272,14 +1269,10 @@ ModuleResult DecodeWasmModule(Isolate* isolate, const byte* module_start,
|
||||
if (size >= kV8MaxWasmModuleSize)
|
||||
return ModuleResult::Error("size > maximum module size: %zu", size);
|
||||
// TODO(bradnelson): Improve histogram handling of size_t.
|
||||
if (is_sync) {
|
||||
// TODO(karlschimpf): Make this work when asynchronous.
|
||||
// https://bugs.chromium.org/p/v8/issues/detail?id=6361
|
||||
auto counter = origin == kWasmOrigin
|
||||
auto size_counter = origin == kWasmOrigin
|
||||
? counters->wasm_wasm_module_size_bytes()
|
||||
: counters->wasm_asm_module_size_bytes();
|
||||
counter->AddSample(static_cast<int>(size));
|
||||
}
|
||||
size_counter->AddSample(static_cast<int>(size));
|
||||
// Signatures are stored in zone memory, which have the same lifetime
|
||||
// as the {module}.
|
||||
ModuleDecoder decoder(module_start, module_end, origin);
|
||||
@ -1288,23 +1281,24 @@ ModuleResult DecodeWasmModule(Isolate* isolate, const byte* module_start,
|
||||
// TODO(titzer): this isn't accurate, since it doesn't count the data
|
||||
// allocated on the C++ heap.
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=657320
|
||||
if (is_sync && result.ok()) {
|
||||
// TODO(karlschimpf): Make this work when asynchronous.
|
||||
// https://bugs.chromium.org/p/v8/issues/detail?id=6361
|
||||
auto counter = origin == kWasmOrigin
|
||||
if (result.ok()) {
|
||||
auto peak_counter =
|
||||
origin == kWasmOrigin
|
||||
? counters->wasm_decode_wasm_module_peak_memory_bytes()
|
||||
: counters->wasm_decode_asm_module_peak_memory_bytes();
|
||||
counter->AddSample(
|
||||
peak_counter->AddSample(
|
||||
static_cast<int>(result.val->signature_zone->allocation_size()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
ModuleResult SyncDecodeWasmModule(Isolate* isolate, const byte* module_start,
|
||||
const byte* module_end, bool verify_functions,
|
||||
ModuleOrigin origin) {
|
||||
return DecodeWasmModule(isolate, module_start, module_end, verify_functions,
|
||||
origin, isolate->counters(), true);
|
||||
origin, isolate->counters());
|
||||
}
|
||||
|
||||
ModuleResult AsyncDecodeWasmModule(
|
||||
@ -1312,7 +1306,7 @@ ModuleResult AsyncDecodeWasmModule(
|
||||
bool verify_functions, ModuleOrigin origin,
|
||||
const std::shared_ptr<Counters> async_counters) {
|
||||
return DecodeWasmModule(isolate, module_start, module_end, verify_functions,
|
||||
origin, async_counters.get(), false);
|
||||
origin, async_counters.get());
|
||||
}
|
||||
|
||||
FunctionSig* DecodeWasmSignatureForTesting(Zone* zone, const byte* start,
|
||||
@ -1332,8 +1326,8 @@ namespace {
|
||||
FunctionResult DecodeWasmFunction(Isolate* isolate, Zone* zone,
|
||||
ModuleBytesEnv* module_env,
|
||||
const byte* function_start,
|
||||
const byte* function_end, Counters* counters,
|
||||
bool is_sync) {
|
||||
const byte* function_end,
|
||||
Counters* counters) {
|
||||
size_t size = function_end - function_start;
|
||||
bool is_wasm = module_env->module_env.is_wasm();
|
||||
auto size_histogram = is_wasm ? counters->wasm_wasm_function_size_bytes()
|
||||
@ -1358,7 +1352,7 @@ FunctionResult SyncDecodeWasmFunction(Isolate* isolate, Zone* zone,
|
||||
const byte* function_start,
|
||||
const byte* function_end) {
|
||||
return DecodeWasmFunction(isolate, zone, module_env, function_start,
|
||||
function_end, isolate->counters(), true);
|
||||
function_end, isolate->counters());
|
||||
}
|
||||
|
||||
FunctionResult AsyncDecodeWasmFunction(
|
||||
@ -1366,7 +1360,7 @@ FunctionResult AsyncDecodeWasmFunction(
|
||||
const byte* function_start, const byte* function_end,
|
||||
std::shared_ptr<Counters> async_counters) {
|
||||
return DecodeWasmFunction(isolate, zone, module_env, function_start,
|
||||
function_end, async_counters.get(), false);
|
||||
function_end, async_counters.get());
|
||||
}
|
||||
|
||||
AsmJsOffsetsResult DecodeAsmJsOffsets(const byte* tables_start,
|
||||
|
Loading…
Reference in New Issue
Block a user