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

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

Issue 2519923002: [ignition] Refactor array iterator to separate out access (Closed)
Patch Set: Final class and private function Created 4 years, 1 month 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 | « BUILD.gn ('k') | src/interpreter/bytecode-array-accessor.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 2016 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_ACCESSOR_H_
6 #define V8_INTERPRETER_BYTECODE_ARRAY_ITERATOR_H_ 6 #define V8_INTERPRETER_BYTECODE_ARRAY_ACCESSOR_H_
7 7
8 #include "src/globals.h" 8 #include "src/globals.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/interpreter/bytecode-register.h" 10 #include "src/interpreter/bytecode-register.h"
11 #include "src/interpreter/bytecodes.h" 11 #include "src/interpreter/bytecodes.h"
12 #include "src/objects.h" 12 #include "src/objects.h"
13 #include "src/runtime/runtime.h" 13 #include "src/runtime/runtime.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 namespace interpreter { 17 namespace interpreter {
18 18
19 class V8_EXPORT_PRIVATE BytecodeArrayIterator { 19 class V8_EXPORT_PRIVATE BytecodeArrayAccessor {
20 public: 20 public:
21 explicit BytecodeArrayIterator(Handle<BytecodeArray> bytecode_array); 21 BytecodeArrayAccessor(Handle<BytecodeArray> bytecode_array,
22 int initial_offset);
22 23
23 void Advance(); 24 void SetOffset(int offset);
24 bool done() const; 25
25 Bytecode current_bytecode() const; 26 Bytecode current_bytecode() const;
26 int current_bytecode_size() const; 27 int current_bytecode_size() const;
27 int current_offset() const { return bytecode_offset_; } 28 int current_offset() const { return bytecode_offset_; }
28 OperandScale current_operand_scale() const { return operand_scale_; } 29 OperandScale current_operand_scale() const { return operand_scale_; }
29 int current_prefix_offset() const { return prefix_offset_; } 30 int current_prefix_offset() const { return prefix_offset_; }
30 const Handle<BytecodeArray>& bytecode_array() const { 31 const Handle<BytecodeArray>& bytecode_array() const {
31 return bytecode_array_; 32 return bytecode_array_;
32 } 33 }
33 34
34 uint32_t GetFlagOperand(int operand_index) const; 35 uint32_t GetFlagOperand(int operand_index) const;
35 uint32_t GetUnsignedImmediateOperand(int operand_index) const; 36 uint32_t GetUnsignedImmediateOperand(int operand_index) const;
36 int32_t GetImmediateOperand(int operand_index) const; 37 int32_t GetImmediateOperand(int operand_index) const;
37 uint32_t GetIndexOperand(int operand_index) const; 38 uint32_t GetIndexOperand(int operand_index) const;
38 uint32_t GetRegisterCountOperand(int operand_index) const; 39 uint32_t GetRegisterCountOperand(int operand_index) const;
39 Register GetRegisterOperand(int operand_index) const; 40 Register GetRegisterOperand(int operand_index) const;
40 int GetRegisterOperandRange(int operand_index) const; 41 int GetRegisterOperandRange(int operand_index) const;
41 Runtime::FunctionId GetRuntimeIdOperand(int operand_index) const; 42 Runtime::FunctionId GetRuntimeIdOperand(int operand_index) const;
42 Runtime::FunctionId GetIntrinsicIdOperand(int operand_index) const; 43 Runtime::FunctionId GetIntrinsicIdOperand(int operand_index) const;
43 Handle<Object> GetConstantForIndexOperand(int operand_index) const; 44 Handle<Object> GetConstantForIndexOperand(int operand_index) const;
44 45
45 // Returns the absolute offset of the branch target at the current 46 // Returns the absolute offset of the branch target at the current
46 // bytecode. It is an error to call this method if the bytecode is 47 // bytecode. It is an error to call this method if the bytecode is
47 // not for a jump or conditional jump. 48 // not for a jump or conditional jump.
48 int GetJumpTargetOffset() const; 49 int GetJumpTargetOffset() const;
49 50
50 private: 51 private:
52 bool OffsetInBounds() const;
53
51 uint32_t GetUnsignedOperand(int operand_index, 54 uint32_t GetUnsignedOperand(int operand_index,
52 OperandType operand_type) const; 55 OperandType operand_type) const;
53 int32_t GetSignedOperand(int operand_index, OperandType operand_type) const; 56 int32_t GetSignedOperand(int operand_index, OperandType operand_type) const;
54 57
55 void UpdateOperandScale(); 58 void UpdateOperandScale();
56 59
57 Handle<BytecodeArray> bytecode_array_; 60 Handle<BytecodeArray> bytecode_array_;
58 int bytecode_offset_; 61 int bytecode_offset_;
59 OperandScale operand_scale_; 62 OperandScale operand_scale_;
60 int prefix_offset_; 63 int prefix_offset_;
61 64
62 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayIterator); 65 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayAccessor);
63 }; 66 };
64 67
65 } // namespace interpreter 68 } // namespace interpreter
66 } // namespace internal 69 } // namespace internal
67 } // namespace v8 70 } // namespace v8
68 71
69 #endif // V8_INTERPRETER_BYTECODE_GRAPH_ITERATOR_H_ 72 #endif // V8_INTERPRETER_BYTECODE_GRAPH_ACCESSOR_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/interpreter/bytecode-array-accessor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698