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 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.
| |
29 void* base; | |
30 size_t size; | |
31 size_t num_protected_instructions; | |
32 ProtectedInstructionData instructions[1]; | |
33 }; | |
34 | |
35 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.
| |
36 static std::atomic_flag spinlock_; | |
37 | |
38 public: | |
39 MetadataLock(); | |
40 ~MetadataLock(); | |
41 | |
42 MetadataLock(const MetadataLock&) = delete; | |
43 void operator=(const MetadataLock&) = delete; | |
44 }; | |
45 | |
46 extern THREAD_LOCAL bool g_thread_in_wasm_code; | |
47 | |
48 extern size_t gNumCodeObjects; | |
49 extern CodeProtectionInfo** gCodeObjects; | |
50 | |
51 } // namespace trap_handler | |
52 } // namespace internal | |
53 } // namespace v8 | |
54 | |
55 #endif // TRAP_HANDLER_INTERNAL_H_ | |
OLD | NEW |