OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef TRAP_HANDLER_INTERNAL_H_ | |
6 #define TRAP_HANDLER_INTERNAL_H_ | |
7 | |
8 // This file should not be included (even transitively) by files outside of | |
9 // src/trap-handler. | |
10 | |
11 #include "src/trap-handler/trap-handler.h" | |
12 | |
13 #include <atomic> | |
14 | |
15 #if V8_OS_WIN | |
16 #define THREAD_LOCAL __declspec(thread) | |
17 #elif V8_OS_ANDROID | |
18 // TODO(eholk): fix this before enabling for trap handlers for Android. | |
19 #define THREAD_LOCAL | |
20 #else | |
21 #define THREAD_LOCAL __thread | |
22 #endif | |
23 | |
24 namespace v8 { | |
25 namespace internal { | |
26 namespace trap_handler { | |
27 | |
28 // This describes a chunk of code that the signal handler will be able to | |
29 // handler faults in. base points to the beginning of the chunk, and size is the | |
ahaas
2017/02/20 09:27:24
handle
{base} points to ...
{size} is the ...
Eric Holk
2017/02/23 02:16:57
Done.
| |
30 // number of bytes in the code chunk. The remainder of the struct is a list of | |
31 // protected memory access instructions and an offset to a landing pad to handle | |
32 // faults on that instruction. | |
33 struct CodeProtectionInfo { | |
34 void* base; | |
35 size_t size; | |
36 size_t num_protected_instructions; | |
37 ProtectedInstructionData instructions[1]; | |
38 }; | |
39 | |
40 class MetadataLock { | |
41 static std::atomic_flag spinlock_; | |
42 | |
43 public: | |
44 MetadataLock(); | |
45 ~MetadataLock(); | |
46 | |
47 MetadataLock(const MetadataLock&) = delete; | |
Mark Seaborn
2017/02/17 21:41:12
You could put the same comment about base/macros.h
Eric Holk
2017/02/23 02:16:57
Done.
| |
48 void operator=(const MetadataLock&) = delete; | |
49 }; | |
50 | |
51 #if V8_TRAP_HANDLER_SUPPORTED | |
52 void HandleSignal(int signum, siginfo_t* info, void* context); | |
53 #endif | |
54 | |
55 extern THREAD_LOCAL bool g_thread_in_wasm_code; | |
56 | |
57 extern size_t gNumCodeObjects; | |
58 extern CodeProtectionInfo** gCodeObjects; | |
59 | |
60 } // namespace trap_handler | |
61 } // namespace internal | |
62 } // namespace v8 | |
63 | |
64 #endif // TRAP_HANDLER_INTERNAL_H_ | |
OLD | NEW |