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

Unified Diff: src/trap-handler/trap-handler.h

Issue 2371833007: [wasm] Initial signal handler (Closed)
Patch Set: Addressing some of Jochen's feedback Created 3 years, 12 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/trap-handler/trap-handler.h
diff --git a/src/trap-handler/trap-handler.h b/src/trap-handler/trap-handler.h
index 7c78b1f2320ad512b06ca0306aaa7f4ec7060e77..dfe538e996bf2ddf8de2d1ccdcc74740b76e8356 100644
--- a/src/trap-handler/trap-handler.h
+++ b/src/trap-handler/trap-handler.h
@@ -5,10 +5,26 @@
#ifndef V8_TRAP_HANDLER_H_
#define V8_TRAP_HANDLER_H_
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "src/base/build_config.h"
+
namespace v8 {
namespace internal {
namespace trap_handler {
+// TODO(eholk): Support trap handlers on other platforms.
+#if V8_TARGET_ARCH_X64 && V8_OS_LINUX
+#define V8_TRAP_HANDLER_SUPPORTED 1
+const bool kTrapHandlerSupported = true;
+#else
+#define V8_TRAP_HANDLER_SUPPORTED 0
+const bool kTrapHandlerSupported = false;
+#endif
+
+struct CodeObjectData;
+
struct ProtectedInstructionData {
// The offset of this instruction from the start of its code object.
int32_t instr_offset;
@@ -19,6 +35,30 @@ struct ProtectedInstructionData {
int32_t landing_offset;
};
+/// Allocates space to hold all the handler data for a given code object.
+CodeObjectData *CreateHandlerData(
+ void *base, size_t size, size_t num_protected_instructions,
+ ProtectedInstructionData *protected_instructions);
+
+/// Allocates a new handler data that is a copy of the previous one.
+CodeObjectData *CloneHandlerData(CodeObjectData *data);
+
+/// Adjusts the base code pointer.
+void UpdateCodePointer(int index, void *base);
+
+/// Adds the handler data to the place where the signal handler will find it.
+int RegisterHandlerData(CodeObjectData *data);
+
+/// Removes the data from the master list and frees any memory, if necessary.
+void ReleaseHandlerData(int index);
+
+void SetThreadInWasm();
+void ClearThreadInWasm();
+
+bool IsThreadInWasm();
+
+bool EnableTrapHandler();
+
} // namespace trap_handler
} // namespace internal
} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698