Line data Source code
1 : // Copyright 2017 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 V8_WASM_MEMORY_TRACING_H_
6 : #define V8_WASM_MEMORY_TRACING_H_
7 :
8 : #include <cstdint>
9 :
10 : #include "src/machine-type.h"
11 : #include "src/wasm/wasm-tier.h"
12 :
13 : namespace v8 {
14 : namespace internal {
15 : namespace wasm {
16 :
17 : // This struct is create in generated code, hence use low-level types.
18 : struct MemoryTracingInfo {
19 : uint32_t address;
20 : uint8_t is_store; // 0 or 1
21 : uint8_t mem_rep;
22 : static_assert(
23 : std::is_same<decltype(mem_rep),
24 : std::underlying_type<MachineRepresentation>::type>::value,
25 : "MachineRepresentation uses uint8_t");
26 :
27 : MemoryTracingInfo(uint32_t addr, bool is_store, MachineRepresentation rep)
28 36 : : address(addr), is_store(is_store), mem_rep(static_cast<uint8_t>(rep)) {}
29 : };
30 :
31 : // Callback for tracing a memory operation for debugging.
32 : // Triggered by --wasm-trace-memory.
33 : void TraceMemoryOperation(ExecutionTier, const MemoryTracingInfo* info,
34 : int func_index, int position, uint8_t* mem_start);
35 :
36 : } // namespace wasm
37 : } // namespace internal
38 : } // namespace v8
39 :
40 : #endif // V8_WASM_MEMORY_TRACING_H_
|