11cb0ef41Sopenharmony_ci// Copyright 2016 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#include "src/compiler/bytecode-liveness-map.h"
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_cinamespace v8 {
81cb0ef41Sopenharmony_cinamespace internal {
91cb0ef41Sopenharmony_cinamespace compiler {
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_cistd::string ToString(const BytecodeLivenessState& liveness) {
121cb0ef41Sopenharmony_ci  std::string out;
131cb0ef41Sopenharmony_ci  out.resize(liveness.register_count() + 1);
141cb0ef41Sopenharmony_ci  for (int i = 0; i < liveness.register_count(); ++i) {
151cb0ef41Sopenharmony_ci    if (liveness.RegisterIsLive(i)) {
161cb0ef41Sopenharmony_ci      out[i] = 'L';
171cb0ef41Sopenharmony_ci    } else {
181cb0ef41Sopenharmony_ci      out[i] = '.';
191cb0ef41Sopenharmony_ci    }
201cb0ef41Sopenharmony_ci  }
211cb0ef41Sopenharmony_ci  if (liveness.AccumulatorIsLive()) {
221cb0ef41Sopenharmony_ci    out[liveness.register_count()] = 'L';
231cb0ef41Sopenharmony_ci  } else {
241cb0ef41Sopenharmony_ci    out[liveness.register_count()] = '.';
251cb0ef41Sopenharmony_ci  }
261cb0ef41Sopenharmony_ci  return out;
271cb0ef41Sopenharmony_ci}
281cb0ef41Sopenharmony_ci
291cb0ef41Sopenharmony_ci}  // namespace compiler
301cb0ef41Sopenharmony_ci}  // namespace internal
311cb0ef41Sopenharmony_ci}  // namespace v8
32