1// Copyright 2016 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/compiler/bytecode-liveness-map.h"
6
7namespace v8 {
8namespace internal {
9namespace compiler {
10
11std::string ToString(const BytecodeLivenessState& liveness) {
12  std::string out;
13  out.resize(liveness.register_count() + 1);
14  for (int i = 0; i < liveness.register_count(); ++i) {
15    if (liveness.RegisterIsLive(i)) {
16      out[i] = 'L';
17    } else {
18      out[i] = '.';
19    }
20  }
21  if (liveness.AccumulatorIsLive()) {
22    out[liveness.register_count()] = 'L';
23  } else {
24    out[liveness.register_count()] = '.';
25  }
26  return out;
27}
28
29}  // namespace compiler
30}  // namespace internal
31}  // namespace v8
32