• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/base/optional.h"
11 #include "src/codegen/machine-type.h"
12 #include "src/wasm/wasm-tier.h"
13 
14 namespace v8 {
15 namespace internal {
16 namespace wasm {
17 
18 // This struct is create in generated code, hence use low-level types.
19 struct MemoryTracingInfo {
20   uintptr_t offset;
21   uint8_t is_store;  // 0 or 1
22   uint8_t mem_rep;
23   static_assert(
24       std::is_same<decltype(mem_rep),
25                    std::underlying_type<MachineRepresentation>::type>::value,
26       "MachineRepresentation uses uint8_t");
27 
MemoryTracingInfoMemoryTracingInfo28   MemoryTracingInfo(uintptr_t offset, bool is_store, MachineRepresentation rep)
29       : offset(offset),
30         is_store(is_store),
31         mem_rep(static_cast<uint8_t>(rep)) {}
32 };
33 
34 // Callback for tracing a memory operation for debugging.
35 // Triggered by --wasm-trace-memory.
36 V8_EXPORT_PRIVATE void TraceMemoryOperation(base::Optional<ExecutionTier>,
37                                             const MemoryTracingInfo* info,
38                                             int func_index, int position,
39                                             uint8_t* mem_start);
40 
41 }  // namespace wasm
42 }  // namespace internal
43 }  // namespace v8
44 
45 #endif  // V8_WASM_MEMORY_TRACING_H_
46