Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_INTERPRETER_BYTECODE_LABEL_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_LABEL_H_ |
| 6 #define V8_INTERPRETER_BYTECODE_LABEL_H_ | 6 #define V8_INTERPRETER_BYTECODE_LABEL_H_ |
| 7 | 7 |
| 8 #include "src/zone-containers.h" | 8 #include "src/zone-containers.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 | 55 |
| 56 // Class representing a branch target of multiple jumps. | 56 // Class representing a branch target of multiple jumps. |
| 57 class BytecodeLabels { | 57 class BytecodeLabels { |
| 58 public: | 58 public: |
| 59 explicit BytecodeLabels(Zone* zone) : labels_(zone) {} | 59 explicit BytecodeLabels(Zone* zone) : labels_(zone) {} |
| 60 | 60 |
| 61 BytecodeLabel* New(); | 61 BytecodeLabel* New(); |
| 62 | 62 |
| 63 void Bind(BytecodeArrayBuilder* builder); | 63 void Bind(BytecodeArrayBuilder* builder); |
| 64 | 64 |
| 65 void BindToLabel(BytecodeArrayBuilder* builder, const BytecodeLabel& target); | |
| 66 | |
| 67 bool is_bound() const { return !labels_.empty() && labels_.at(0).is_bound(); } | |
|
rmcilroy
2016/08/17 16:20:43
Could you add a DCHECK that if one label is bound
klaasb
2016/08/18 11:40:00
Done.
| |
| 68 | |
| 69 bool empty() const { return labels_.empty(); } | |
| 70 | |
| 65 private: | 71 private: |
| 66 ZoneVector<BytecodeLabel> labels_; | 72 ZoneVector<BytecodeLabel> labels_; |
| 67 | 73 |
| 68 DISALLOW_COPY_AND_ASSIGN(BytecodeLabels); | 74 DISALLOW_COPY_AND_ASSIGN(BytecodeLabels); |
| 69 }; | 75 }; |
| 70 | 76 |
| 71 } // namespace interpreter | 77 } // namespace interpreter |
| 72 } // namespace internal | 78 } // namespace internal |
| 73 } // namespace v8 | 79 } // namespace v8 |
| 74 | 80 |
| 75 #endif // V8_INTERPRETER_BYTECODE_LABEL_H_ | 81 #endif // V8_INTERPRETER_BYTECODE_LABEL_H_ |
| OLD | NEW |