Commit bf505216 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[wasm][traphandler] Mark code object validation check as slow

In the trap handler we validate the list of registered code objects
every time we register or de-register a new code object. The complexity
of this validation is O(num-code-objects * num-instructions). For big
WebAssembly modules with several hundred thousand code objects, this
validation causes significant overhead (we saw up to 10x) and makes
debugging very tedious. With this CL I mark the validation as slow.
Thereby it is still enabled in most tests on our bots, but it is
possible to disable validation when debugging large web applications.

The referenced bug issue was created by developers who had problems
with debugging because of this issue.

R=mark@chromium.org

Bug: v8:8536
Change-Id: If7ecb554eebcb04eb43a1f791b96c7a42a47e60f
Reviewed-on: https://chromium-review.googlesource.com/c/1442634Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59181}
parent 0cabc546
......@@ -13,7 +13,7 @@
// should be as self-contained as possible to make it easy to audit the code.
//
// 2. Any changes must be reviewed by someone from the crash reporting
// or security team. Se OWNERS for suggested reviewers.
// or security team. See OWNERS for suggested reviewers.
//
// For more information, see https://goo.gl/yMeyUY.
//
......@@ -33,10 +33,10 @@
namespace {
size_t gNextCodeObject = 0;
#ifdef DEBUG
constexpr bool kEnableDebug = true;
#ifdef ENABLE_SLOW_DCHECKS
constexpr bool kEnableSlowChecks = true;
#else
constexpr bool kEnableDebug = false;
constexpr bool kEnableSlowChecks = false;
#endif
}
......@@ -143,7 +143,7 @@ int RegisterHandlerData(
MetadataLock lock;
if (kEnableDebug) {
if (kEnableSlowChecks) {
VerifyCodeRangeIsDisjoint(data);
}
......@@ -196,7 +196,7 @@ int RegisterHandlerData(
if (i <= int_max) {
gCodeObjects[i].code_info = data;
if (kEnableDebug) {
if (kEnableSlowChecks) {
ValidateCodeObjects();
}
......@@ -224,7 +224,7 @@ void ReleaseHandlerData(int index) {
gCodeObjects[index].next_free = gNextCodeObject;
gNextCodeObject = index;
if (kEnableDebug) {
if (kEnableSlowChecks) {
ValidateCodeObjects();
}
}
......
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