Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1027)

Unified Diff: src/wasm/module-decoder.cc

Issue 2929853003: Fix use of history timers in background threads. (Closed)
Patch Set: Fix nits. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/wasm/module-decoder.cc
diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc
index 88d68344692046d09a589cf0f869f53d09b64bbc..bed97e6d51c57ddebcf791cc6f5dc9382b6b163a 100644
--- a/src/wasm/module-decoder.cc
+++ b/src/wasm/module-decoder.cc
@@ -1220,11 +1220,14 @@ class ModuleDecoder : public Decoder {
}
};
-ModuleResult DecodeWasmModuleInternal(Isolate* isolate,
- const byte* module_start,
- const byte* module_end,
- bool verify_functions,
- ModuleOrigin origin, bool is_sync) {
+} // namespace
+
+ModuleResult DecodeWasmModule(Isolate* isolate, const byte* module_start,
+ const byte* module_end, bool verify_functions,
+ ModuleOrigin origin, bool is_sync) {
+ TimedHistogramScope wasm_decode_module_time_scope(
+ IsWasm(origin) ? isolate->counters()->wasm_decode_wasm_module_time()
jochen (gone - plz use gerrit) 2017/06/08 22:15:36 same here
kschimpf 2017/06/09 20:03:36 Good point. This code was massively reorganized (i
+ : isolate->counters()->wasm_decode_asm_module_time());
size_t size = module_end - module_start;
if (module_start > module_end) return ModuleResult::Error("start > end");
if (size >= kV8MaxWasmModuleSize)
@@ -1257,24 +1260,6 @@ ModuleResult DecodeWasmModuleInternal(Isolate* isolate,
return result;
}
-} // namespace
-
-ModuleResult DecodeWasmModule(Isolate* isolate, const byte* module_start,
- const byte* module_end, bool verify_functions,
- ModuleOrigin origin, bool is_sync) {
- if (is_sync) {
- // TODO(karlschimpf): Make this work when asynchronous.
- // https://bugs.chromium.org/p/v8/issues/detail?id=6361
- HistogramTimerScope wasm_decode_module_time_scope(
- IsWasm(origin) ? isolate->counters()->wasm_decode_wasm_module_time()
- : isolate->counters()->wasm_decode_asm_module_time());
- return DecodeWasmModuleInternal(isolate, module_start, module_end,
- verify_functions, origin, true);
- }
- return DecodeWasmModuleInternal(isolate, module_start, module_end,
- verify_functions, origin, false);
-}
-
FunctionSig* DecodeWasmSignatureForTesting(Zone* zone, const byte* start,
const byte* end) {
ModuleDecoder decoder(start, end, kWasmOrigin);
@@ -1287,14 +1272,18 @@ WasmInitExpr DecodeWasmInitExprForTesting(const byte* start, const byte* end) {
return decoder.DecodeInitExpr(start);
}
-namespace {
-
-FunctionResult DecodeWasmFunctionInternal(Isolate* isolate, Zone* zone,
- ModuleBytesEnv* module_env,
- const byte* function_start,
- const byte* function_end,
- bool is_sync) {
+FunctionResult DecodeWasmFunction(Isolate* isolate, Zone* zone,
+ ModuleBytesEnv* module_env,
+ const byte* function_start,
+ const byte* function_end, bool is_sync) {
size_t size = function_end - function_start;
+ bool is_wasm = module_env->module_env.is_wasm();
+ (is_wasm ? isolate->counters()->wasm_wasm_function_size_bytes()
+ : isolate->counters()->wasm_asm_function_size_bytes())
+ ->AddSample(static_cast<int>(size));
+ TimedHistogramScope wasm_decode_function_time_scope(
+ is_wasm ? isolate->counters()->wasm_decode_wasm_function_time()
+ : isolate->counters()->wasm_decode_asm_function_time());
if (function_start > function_end)
return FunctionResult::Error("start > end");
if (size > kV8MaxWasmFunctionSize)
@@ -1312,30 +1301,6 @@ FunctionResult DecodeWasmFunctionInternal(Isolate* isolate, Zone* zone,
zone, module_env, std::unique_ptr<WasmFunction>(new WasmFunction()));
}
-} // namespace
-
-FunctionResult DecodeWasmFunction(Isolate* isolate, Zone* zone,
- ModuleBytesEnv* module_env,
- const byte* function_start,
- const byte* function_end, bool is_sync) {
- if (is_sync) {
- // TODO(karlschimpf): Make this work when asynchronous.
- // https://bugs.chromium.org/p/v8/issues/detail?id=6361
- size_t size = function_end - function_start;
- bool is_wasm = module_env->module_env.is_wasm();
- (is_wasm ? isolate->counters()->wasm_wasm_function_size_bytes()
- : isolate->counters()->wasm_asm_function_size_bytes())
- ->AddSample(static_cast<int>(size));
- HistogramTimerScope wasm_decode_function_time_scope(
- is_wasm ? isolate->counters()->wasm_decode_wasm_function_time()
- : isolate->counters()->wasm_decode_asm_function_time());
- return DecodeWasmFunctionInternal(isolate, zone, module_env, function_start,
- function_end, true);
- }
- return DecodeWasmFunctionInternal(isolate, zone, module_env, function_start,
- function_end, false);
-}
-
AsmJsOffsetsResult DecodeAsmJsOffsets(const byte* tables_start,
const byte* tables_end) {
AsmJsOffsets table;

Powered by Google App Engine
This is Rietveld 408576698