2017-10-02 07:39:30 +00:00
|
|
|
// 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.
|
|
|
|
|
2018-01-12 17:46:03 +00:00
|
|
|
#ifndef V8_WASM_MEMORY_TRACING_H_
|
|
|
|
#define V8_WASM_MEMORY_TRACING_H_
|
2017-10-02 07:39:30 +00:00
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
2019-05-21 09:30:15 +00:00
|
|
|
#include "src/codegen/machine-type.h"
|
2018-08-21 15:01:31 +00:00
|
|
|
#include "src/wasm/wasm-tier.h"
|
2017-10-02 07:39:30 +00:00
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2018-01-12 17:46:03 +00:00
|
|
|
namespace wasm {
|
2017-10-02 07:39:30 +00:00
|
|
|
|
2018-01-12 17:46:03 +00:00
|
|
|
// 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)) {}
|
|
|
|
};
|
2017-10-02 07:39:30 +00:00
|
|
|
|
|
|
|
// Callback for tracing a memory operation for debugging.
|
|
|
|
// Triggered by --wasm-trace-memory.
|
2018-08-21 15:01:31 +00:00
|
|
|
void TraceMemoryOperation(ExecutionTier, const MemoryTracingInfo* info,
|
2018-01-12 17:46:03 +00:00
|
|
|
int func_index, int position, uint8_t* mem_start);
|
2017-10-02 07:39:30 +00:00
|
|
|
|
2018-01-12 17:46:03 +00:00
|
|
|
} // namespace wasm
|
2017-10-02 07:39:30 +00:00
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
|
|
|
|
2018-01-12 17:46:03 +00:00
|
|
|
#endif // V8_WASM_MEMORY_TRACING_H_
|