summaryrefslogtreecommitdiff
path: root/deps/v8/src/trap-handler/handler-outside.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/trap-handler/handler-outside.cc')
-rw-r--r--deps/v8/src/trap-handler/handler-outside.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/deps/v8/src/trap-handler/handler-outside.cc b/deps/v8/src/trap-handler/handler-outside.cc
index 2c9225d485..4dc7057782 100644
--- a/deps/v8/src/trap-handler/handler-outside.cc
+++ b/deps/v8/src/trap-handler/handler-outside.cc
@@ -34,10 +34,10 @@
namespace {
size_t gNextCodeObject = 0;
-#if defined(DEBUG)
-const bool kEnableDebug = true;
+#ifdef DEBUG
+constexpr bool kEnableDebug = true;
#else
-const bool kEnableDebug = false;
+constexpr bool kEnableDebug = false;
#endif
}
@@ -54,7 +54,7 @@ constexpr size_t HandlerDataSize(size_t num_protected_instructions) {
}
namespace {
-template <typename = std::enable_if<kEnableDebug>>
+#ifdef DEBUG
bool IsDisjoint(const CodeProtectionInfo* a, const CodeProtectionInfo* b) {
if (a == nullptr || b == nullptr) {
return true;
@@ -65,6 +65,7 @@ bool IsDisjoint(const CodeProtectionInfo* a, const CodeProtectionInfo* b) {
return a_base >= b_base + b->size || b_base >= a_base + a->size;
}
+#endif
// Verify that the code range does not overlap any that have already been
// registered.
@@ -181,6 +182,7 @@ int RegisterHandlerData(
new_size = int_max;
}
if (new_size == gNumCodeObjects) {
+ free(data);
return kInvalidIndex;
}
@@ -215,6 +217,7 @@ int RegisterHandlerData(
return static_cast<int>(i);
} else {
+ free(data);
return kInvalidIndex;
}
}