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

Generated by: LCOV version 1.10