bytecode-label.cc 887 Bytes
Newer Older
1 2 3 4 5 6 7
// Copyright 2016 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.

#include "src/interpreter/bytecode-label.h"

#include "src/interpreter/bytecode-array-builder.h"
8
#include "src/objects-inl.h"
9 10 11 12 13 14

namespace v8 {
namespace internal {
namespace interpreter {

BytecodeLabel* BytecodeLabels::New() {
15
  DCHECK(!is_bound());
16
  labels_.emplace_back(BytecodeLabel());
17 18 19 20
  return &labels_.back();
}

void BytecodeLabels::Bind(BytecodeArrayBuilder* builder) {
21
  for (auto& label : labels_) {
22 23 24 25
    builder->Bind(&label);
  }
}

26 27 28 29 30 31 32
void BytecodeLabels::BindToLabel(BytecodeArrayBuilder* builder,
                                 const BytecodeLabel& target) {
  for (auto& label : labels_) {
    builder->Bind(target, &label);
  }
}

33 34 35
}  // namespace interpreter
}  // namespace internal
}  // namespace v8