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/interpreter/bytecode-label.h"
6 
7 #include "src/interpreter/bytecode-array-builder.h"
8 
9 namespace v8 {
10 namespace internal {
11 namespace interpreter {
12 
New()13 BytecodeLabel* BytecodeLabels::New() {
14   DCHECK(!is_bound());
15   labels_.push_back(BytecodeLabel());
16   return &labels_.back();
17 }
18 
Bind(BytecodeArrayBuilder * builder)19 void BytecodeLabels::Bind(BytecodeArrayBuilder* builder) {
20   for (auto& label : labels_) {
21     builder->Bind(&label);
22   }
23 }
24 
BindToLabel(BytecodeArrayBuilder * builder,const BytecodeLabel & target)25 void BytecodeLabels::BindToLabel(BytecodeArrayBuilder* builder,
26                                  const BytecodeLabel& target) {
27   for (auto& label : labels_) {
28     builder->Bind(target, &label);
29   }
30 }
31 
32 }  // namespace interpreter
33 }  // namespace internal
34 }  // namespace v8
35