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_ARRAY_ITERATOR_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_ITERATOR_H_ |
| 6 #define V8_INTERPRETER_BYTECODE_ARRAY_ITERATOR_H_ | 6 #define V8_INTERPRETER_BYTECODE_ARRAY_ITERATOR_H_ |
| 7 | 7 |
| 8 #include "src/handles.h" | 8 #include "src/handles.h" |
| 9 #include "src/interpreter/bytecodes.h" | 9 #include "src/interpreter/bytecodes.h" |
| 10 #include "src/objects.h" | 10 #include "src/objects.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 namespace interpreter { | 14 namespace interpreter { |
| 15 | 15 |
| 16 class BytecodeArrayIterator { | 16 class BytecodeArrayIterator { |
| 17 public: | 17 public: |
| 18 explicit BytecodeArrayIterator(Handle<BytecodeArray> bytecode_array); | 18 explicit BytecodeArrayIterator(Handle<BytecodeArray> bytecode_array); |
| 19 | 19 |
| 20 void Advance(); | 20 void Advance(); |
| 21 void AdvanceToOffset(int offset); | |
| 21 bool done() const; | 22 bool done() const; |
| 22 Bytecode current_bytecode() const; | 23 Bytecode current_bytecode() const; |
| 23 int current_offset() const { return bytecode_offset_; } | 24 int current_offset() const { return bytecode_offset_; } |
| 25 int current_size() const { return Bytecodes::Size(current_bytecode()); } | |
|
rmcilroy
2015/12/08 13:25:08
nit - current_bytecode_size
oth
2015/12/09 11:26:45
Removed.
| |
| 24 const Handle<BytecodeArray>& bytecode_array() const { | 26 const Handle<BytecodeArray>& bytecode_array() const { |
| 25 return bytecode_array_; | 27 return bytecode_array_; |
| 26 } | 28 } |
| 27 | 29 |
| 28 int8_t GetImmediateOperand(int operand_index) const; | 30 int8_t GetImmediateOperand(int operand_index) const; |
| 29 int GetIndexOperand(int operand_index) const; | 31 int GetIndexOperand(int operand_index) const; |
| 30 int GetCountOperand(int operand_index) const; | 32 int GetCountOperand(int operand_index) const; |
| 31 Register GetRegisterOperand(int operand_index) const; | 33 Register GetRegisterOperand(int operand_index) const; |
| 32 Handle<Object> GetConstantForIndexOperand(int operand_index) const; | 34 Handle<Object> GetConstantForIndexOperand(int operand_index) const; |
| 33 | 35 |
| 34 // Get the raw byte for the given operand. Note: you should prefer using the | 36 // Get the raw byte for the given operand. Note: you should prefer using the |
| 35 // typed versions above which cast the return to an appropriate type. | 37 // typed versions above which cast the return to an appropriate type. |
| 36 uint32_t GetRawOperand(int operand_index, OperandType operand_type) const; | 38 uint32_t GetRawOperand(int operand_index, OperandType operand_type) const; |
| 37 | 39 |
| 38 private: | 40 private: |
| 39 Handle<BytecodeArray> bytecode_array_; | 41 Handle<BytecodeArray> bytecode_array_; |
| 40 int bytecode_offset_; | 42 int bytecode_offset_; |
| 41 | 43 |
| 42 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayIterator); | 44 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayIterator); |
| 43 }; | 45 }; |
| 44 | 46 |
| 45 } // namespace interpreter | 47 } // namespace interpreter |
| 46 } // namespace internal | 48 } // namespace internal |
| 47 } // namespace v8 | 49 } // namespace v8 |
| 48 | 50 |
| 49 #endif // V8_INTERPRETER_BYTECODE_GRAPH_ITERATOR_H_ | 51 #endif // V8_INTERPRETER_BYTECODE_GRAPH_ITERATOR_H_ |
| OLD | NEW |