memory-tracing.h 1.2 KB
Newer Older
1 2 3 4
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5 6
#ifndef V8_WASM_MEMORY_TRACING_H_
#define V8_WASM_MEMORY_TRACING_H_
7 8 9 10

#include <cstdint>

#include "src/machine-type.h"
11
#include "src/wasm/wasm-tier.h"
12 13 14

namespace v8 {
namespace internal {
15
namespace wasm {
16

17 18 19 20 21 22 23 24 25 26 27 28 29
// This struct is create in generated code, hence use low-level types.
struct MemoryTracingInfo {
  uint32_t address;
  uint8_t is_store;  // 0 or 1
  uint8_t mem_rep;
  static_assert(
      std::is_same<decltype(mem_rep),
                   std::underlying_type<MachineRepresentation>::type>::value,
      "MachineRepresentation uses uint8_t");

  MemoryTracingInfo(uint32_t addr, bool is_store, MachineRepresentation rep)
      : address(addr), is_store(is_store), mem_rep(static_cast<uint8_t>(rep)) {}
};
30 31 32

// Callback for tracing a memory operation for debugging.
// 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 38 39
}  // namespace internal
}  // namespace v8

40
#endif  // V8_WASM_MEMORY_TRACING_H_