Chromium Code Reviews| 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 { |
|
Mark Seaborn
2017/02/09 16:44:36
Can you add a comment, e.g. This describes a chunk
Eric Holk
2017/02/15 02:02:45
Done.
|
| + void* base; |
| + size_t size; |
| + size_t num_protected_instructions; |
| + ProtectedInstructionData instructions[1]; |
| +}; |
| + |
| +class MetadataLock { |
|
Mark Mentovai
2017/02/09 17:39:41
Same question about the header file used for this
Eric Holk
2017/02/15 02:02:45
Hopefully my other comment answers this one too.
|
| + 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_ |