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

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

Issue 2371833007: [wasm] Initial signal handler (Closed)
Patch Set: Feedback from mseaborn Created 3 years, 11 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-internal.h
diff --git a/src/trap-handler/trap-handler-internal.h b/src/trap-handler/trap-handler-internal.h
new file mode 100644
index 0000000000000000000000000000000000000000..d6233bec5d000f78ad46c78e991ea7408084aeb3
--- /dev/null
+++ b/src/trap-handler/trap-handler-internal.h
@@ -0,0 +1,55 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TRAP_HANDLER_INTERNAL_H_
+#define TRAP_HANDLER_INTERNAL_H_
+
+// This file should not be included (even transitively) by files outside of
+// src/trap-handler.
+
+#include "src/trap-handler/trap-handler.h"
+
+#include <atomic>
+
+#if V8_OS_WIN
+#define THREAD_LOCAL __declspec(thread)
+#elif V8_OS_ANDROID
+// TODO(eholk): fix this before enabling for trap handlers for Android.
+#define THREAD_LOCAL
+#else
+#define THREAD_LOCAL __thread
+#endif
+
+namespace v8 {
+namespace internal {
+namespace trap_handler {
+
+struct CodeProtectionInfo {
+ void* base;
+ size_t size;
+ size_t num_protected_instructions;
+ ProtectedInstructionData instructions[1];
+};
+
+class MetadataLock {
+ static std::atomic_flag spinlock_;
+
+ public:
+ MetadataLock();
+ ~MetadataLock();
+
+ MetadataLock(const MetadataLock&) = delete;
+ void operator=(const MetadataLock&) = delete;
+};
+
+extern THREAD_LOCAL bool g_thread_in_wasm_code;
+
+extern size_t gNumCodeObjects;
+extern CodeProtectionInfo** gCodeObjects;
+
+} // namespace trap_handler
+} // namespace internal
+} // namespace v8
+
+#endif // TRAP_HANDLER_INTERNAL_H_

Powered by Google App Engine
This is Rietveld 408576698