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