LCOV - code coverage report
Current view: top level - src/wasm - memory-tracing.cc (source / functions) Hit Total Coverage
Test: app.info Lines: 14 19 73.7 %
Date: 2019-04-17 Functions: 2 2 100.0 %

          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             : #include "src/wasm/memory-tracing.h"
       6             : 
       7             : #include "src/utils.h"
       8             : #include "src/v8memory.h"
       9             : #include "src/vector.h"
      10             : 
      11             : namespace v8 {
      12             : namespace internal {
      13             : namespace wasm {
      14             : 
      15         108 : void TraceMemoryOperation(ExecutionTier tier, const MemoryTracingInfo* info,
      16             :                           int func_index, int position, uint8_t* mem_start) {
      17             :   EmbeddedVector<char, 64> value;
      18         108 :   auto mem_rep = static_cast<MachineRepresentation>(info->mem_rep);
      19         108 :   switch (mem_rep) {
      20             : #define TRACE_TYPE(rep, str, format, ctype1, ctype2)                     \
      21             :   case MachineRepresentation::rep:                                       \
      22             :     SNPrintF(value, str ":" format,                                      \
      23             :              ReadLittleEndianValue<ctype1>(                              \
      24             :                  reinterpret_cast<Address>(mem_start) + info->address),  \
      25             :              ReadLittleEndianValue<ctype2>(                              \
      26             :                  reinterpret_cast<Address>(mem_start) + info->address)); \
      27             :     break;
      28          72 :     TRACE_TYPE(kWord8, " i8", "%d / %02x", uint8_t, uint8_t)
      29           0 :     TRACE_TYPE(kWord16, "i16", "%d / %04x", uint16_t, uint16_t)
      30          96 :     TRACE_TYPE(kWord32, "i32", "%d / %08x", uint32_t, uint32_t)
      31           0 :     TRACE_TYPE(kWord64, "i64", "%" PRId64 " / %016" PRIx64, uint64_t, uint64_t)
      32          24 :     TRACE_TYPE(kFloat32, "f32", "%f / %08x", float, uint32_t)
      33           0 :     TRACE_TYPE(kFloat64, "f64", "%f / %016" PRIx64, double, uint64_t)
      34             : #undef TRACE_TYPE
      35             :     default:
      36           0 :       SNPrintF(value, "???");
      37             :   }
      38             :   const char* eng = "?";
      39         108 :   switch (tier) {
      40             :     case ExecutionTier::kTurbofan:
      41             :       eng = "turbofan";
      42          36 :       break;
      43             :     case ExecutionTier::kLiftoff:
      44             :       eng = "liftoff";
      45          36 :       break;
      46             :     case ExecutionTier::kInterpreter:
      47             :       eng = "interpreter";
      48          36 :       break;
      49             :     case ExecutionTier::kNone:
      50           0 :       UNREACHABLE();
      51             :   }
      52         108 :   printf("%-11s func:%6d+0x%-6x%s %08x val: %s\n", eng, func_index, position,
      53         108 :          info->is_store ? " store to" : "load from", info->address,
      54             :          value.start());
      55         108 : }
      56             : 
      57             : }  // namespace wasm
      58             : }  // namespace internal
      59      122004 : }  // namespace v8

Generated by: LCOV version 1.10