Commit 7d4cb943 authored by kschimpf's avatar kschimpf Committed by Commit bot

Separate function decoding counter into asm and wasm counters.

Currently, V8 uses the same counter to collect decoding time for both asm.js and
WASM. This separates the function decoding counter into two separate counters,
and then uses the appropriate counter when decoding a module.

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

Review-Url: https://codereview.chromium.org/2772363002
Cr-Commit-Position: refs/heads/master@{#44197}
parent e3c484dc
......@@ -968,8 +968,11 @@ class RuntimeCallTimerScope {
MICROSECOND) \
HT(wasm_decode_wasm_module_time, V8.WasmDecodeModuleMicroSeconds, 1000000, \
MICROSECOND) \
HT(wasm_decode_function_time, V8.WasmDecodeFunctionMicroSeconds, 1000000, \
MICROSECOND) \
/* TODO(karlschimpf) Update chrome flags to reflect asm/wasm split. */ \
HT(wasm_decode_asm_function_time, V8.WasmDecodeFunctionMicroSeconds, \
1000000, MICROSECOND) \
HT(wasm_decode_wasm_function_time, V8.WasmDecodeFunctionMicroSeconds, \
1000000, MICROSECOND) \
/* TODO(kschimpf) Update chrome flags to reflect asm/wasm split. */ \
HT(wasm_compile_asm_module_time, V8.WasmCompileModuleMicroSeconds, 1000000, \
MICROSECOND) \
......
......@@ -1196,7 +1196,9 @@ FunctionResult DecodeWasmFunction(Isolate* isolate, Zone* zone,
const byte* function_start,
const byte* function_end) {
HistogramTimerScope wasm_decode_function_time_scope(
isolate->counters()->wasm_decode_function_time());
module_env->module_env.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)
......
......@@ -334,7 +334,8 @@ struct V8_EXPORT_PRIVATE ModuleEnv {
return &module->function_tables[index];
}
bool asm_js() { return module->is_asm_js(); }
bool is_asm_js() const { return module->is_asm_js(); }
bool is_wasm() const { return module->is_wasm(); }
// Only used for testing.
Handle<Code> GetFunctionCode(uint32_t index) {
......
......@@ -919,7 +919,21 @@ TEST_F(WasmSignatureDecodeTest, Fail_invalid_param_type2) {
EXPECT_EQ(nullptr, sig);
}
class WasmFunctionVerifyTest : public TestWithIsolateAndZone {};
class WasmFunctionVerifyTest : public TestWithIsolateAndZone {
public:
WasmFunctionVerifyTest()
: instance(&module), env(&module, &instance, bytes) {}
virtual ~WasmFunctionVerifyTest() {}
ModuleBytesEnv* get_env() { return &env; }
private:
WasmModule module;
WasmInstance instance;
Vector<const byte> bytes;
ModuleBytesEnv env;
DISALLOW_COPY_AND_ASSIGN(WasmFunctionVerifyTest);
};
TEST_F(WasmFunctionVerifyTest, Ok_v_v_empty) {
static const byte data[] = {
......@@ -936,8 +950,8 @@ TEST_F(WasmFunctionVerifyTest, Ok_v_v_empty) {
kExprEnd // body
};
FunctionResult result =
DecodeWasmFunction(isolate(), zone(), nullptr, data, data + sizeof(data));
FunctionResult result = DecodeWasmFunction(isolate(), zone(), get_env(), data,
data + sizeof(data));
EXPECT_OK(result);
if (result.val && result.ok()) {
......
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