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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_TRAP_HANDLER_H_ 5 #ifndef V8_TRAP_HANDLER_H_
6 #define V8_TRAP_HANDLER_H_ 6 #define V8_TRAP_HANDLER_H_
7 7
8 #include <stdint.h>
9 #include <stdlib.h>
10
11 #include "src/base/build_config.h"
12
8 namespace v8 { 13 namespace v8 {
9 namespace internal { 14 namespace internal {
10 namespace trap_handler { 15 namespace trap_handler {
11 16
17 // TODO(eholk): Support trap handlers on other platforms.
18 #if V8_TARGET_ARCH_X64 && V8_OS_LINUX
19 #define V8_TRAP_HANDLER_SUPPORTED 1
20 const bool kTrapHandlerSupported = true;
21 #else
22 #define V8_TRAP_HANDLER_SUPPORTED 0
23 const bool kTrapHandlerSupported = false;
24 #endif
25
26 struct CodeObjectData;
27
12 struct ProtectedInstructionData { 28 struct ProtectedInstructionData {
13 // The offset of this instruction from the start of its code object. 29 // The offset of this instruction from the start of its code object.
14 int32_t instr_offset; 30 int32_t instr_offset;
15 31
16 // The offset of the landing pad from the start of its code object. 32 // The offset of the landing pad from the start of its code object.
17 // 33 //
18 // TODO(eholk): Using a single landing pad and store parameters here. 34 // TODO(eholk): Using a single landing pad and store parameters here.
19 int32_t landing_offset; 35 int32_t landing_offset;
20 }; 36 };
21 37
38 /// Allocates space to hold all the handler data for a given code object.
39 CodeObjectData *CreateHandlerData(
40 void *base, size_t size, size_t num_protected_instructions,
41 ProtectedInstructionData *protected_instructions);
42
43 /// Allocates a new handler data that is a copy of the previous one.
44 CodeObjectData *CloneHandlerData(CodeObjectData *data);
45
46 /// Adjusts the base code pointer.
47 void UpdateCodePointer(int index, void *base);
48
49 /// Adds the handler data to the place where the signal handler will find it.
50 int RegisterHandlerData(CodeObjectData *data);
51
52 /// Removes the data from the master list and frees any memory, if necessary.
53 void ReleaseHandlerData(int index);
54
55 void SetThreadInWasm();
56 void ClearThreadInWasm();
57
58 bool IsThreadInWasm();
59
60 bool EnableTrapHandler();
61
22 } // namespace trap_handler 62 } // namespace trap_handler
23 } // namespace internal 63 } // namespace internal
24 } // namespace v8 64 } // namespace v8
25 65
26 #endif // V8_TRAP_HANDLER_H_ 66 #endif // V8_TRAP_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698