Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: src/interpreter/bytecode-array-iterator.h

Issue 1783483002: [interpreter] Add support for scalable operands. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix tests. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecode-array-iterator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 bool done() const; 21 bool done() const;
22 Bytecode current_bytecode() const; 22 Bytecode current_bytecode() const;
23 int current_bytecode_size() const; 23 int current_bytecode_size() const;
24 void set_current_offset(int offset) { bytecode_offset_ = offset; } 24 void set_current_offset(int offset) { bytecode_offset_ = offset; }
rmcilroy 2016/03/11 11:35:20 Just though about this - we need to do something f
oth 2016/03/11 16:26:13 Good catch. The latest rev does multiple Advance(
25 int current_offset() const { return bytecode_offset_; } 25 int current_offset() const { return bytecode_offset_; }
26 int current_operand_scale() const { return operand_scale_; }
27 int current_prefix_offset() const { return prefix_offset_; }
26 const Handle<BytecodeArray>& bytecode_array() const { 28 const Handle<BytecodeArray>& bytecode_array() const {
27 return bytecode_array_; 29 return bytecode_array_;
28 } 30 }
29 31
30 int8_t GetImmediateOperand(int operand_index) const; 32 uint32_t GetFlagOperand(int operand_index) const;
31 int GetIndexOperand(int operand_index) const; 33 int32_t GetImmediateOperand(int operand_index) const;
32 int GetRegisterCountOperand(int operand_index) const; 34 uint32_t GetIndexOperand(int operand_index) const;
35 uint32_t GetRegisterCountOperand(int operand_index) const;
33 Register GetRegisterOperand(int operand_index) const; 36 Register GetRegisterOperand(int operand_index) const;
34 int GetRegisterOperandRange(int operand_index) const; 37 int GetRegisterOperandRange(int operand_index) const;
38 uint32_t GetRuntimeIdOperand(int operand_index) const;
35 Handle<Object> GetConstantForIndexOperand(int operand_index) const; 39 Handle<Object> GetConstantForIndexOperand(int operand_index) const;
36 40
37 // Get the raw byte for the given operand. Note: you should prefer using the 41 // Get the raw byte for the given operand. Note: you should prefer using the
38 // typed versions above which cast the return to an appropriate type. 42 // typed versions above which cast the return to an appropriate type.
39 uint32_t GetRawOperand(int operand_index, OperandType operand_type) const; 43 uint32_t GetRawOperand(int operand_index, OperandType operand_type) const;
44 int32_t GetRawOperandSigned(int operand_index,
45 OperandType operand_type) const;
40 46
41 // Returns the absolute offset of the branch target at the current 47 // Returns the absolute offset of the branch target at the current
42 // bytecode. It is an error to call this method if the bytecode is 48 // bytecode. It is an error to call this method if the bytecode is
43 // not for a jump or conditional jump. 49 // not for a jump or conditional jump.
44 int GetJumpTargetOffset() const; 50 int GetJumpTargetOffset() const;
45 51
46 private: 52 private:
53 void update_operand_scale();
54
47 Handle<BytecodeArray> bytecode_array_; 55 Handle<BytecodeArray> bytecode_array_;
48 int bytecode_offset_; 56 int bytecode_offset_;
57 int operand_scale_;
58 int prefix_offset_;
49 59
50 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayIterator); 60 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayIterator);
51 }; 61 };
52 62
53 } // namespace interpreter 63 } // namespace interpreter
54 } // namespace internal 64 } // namespace internal
55 } // namespace v8 65 } // namespace v8
56 66
57 #endif // V8_INTERPRETER_BYTECODE_GRAPH_ITERATOR_H_ 67 #endif // V8_INTERPRETER_BYTECODE_GRAPH_ITERATOR_H_
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecode-array-iterator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698