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

Side by Side Diff: src/interpreter/bytecode-pipeline.h

Issue 2041913002: [interpreter] Remove OperandScale from front stages of pipeline. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Minor clean-up. Created 4 years, 6 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
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_PIPELINE_H_ 5 #ifndef V8_INTERPRETER_BYTECODE_PIPELINE_H_
6 #define V8_INTERPRETER_BYTECODE_PIPELINE_H_ 6 #define V8_INTERPRETER_BYTECODE_PIPELINE_H_
7 7
8 #include "src/interpreter/bytecode-register-allocator.h" 8 #include "src/interpreter/bytecode-register-allocator.h"
9 #include "src/interpreter/bytecodes.h" 9 #include "src/interpreter/bytecodes.h"
10 #include "src/zone-containers.h" 10 #include "src/zone-containers.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 bool is_statement_; 86 bool is_statement_;
87 87
88 DISALLOW_COPY_AND_ASSIGN(BytecodeSourceInfo); 88 DISALLOW_COPY_AND_ASSIGN(BytecodeSourceInfo);
89 }; 89 };
90 90
91 // A container for a generated bytecode, it's operands, and source information. 91 // A container for a generated bytecode, it's operands, and source information.
92 // These must be allocated by a BytecodeNodeAllocator instance. 92 // These must be allocated by a BytecodeNodeAllocator instance.
93 class BytecodeNode final : ZoneObject { 93 class BytecodeNode final : ZoneObject {
94 public: 94 public:
95 explicit BytecodeNode(Bytecode bytecode = Bytecode::kIllegal); 95 explicit BytecodeNode(Bytecode bytecode = Bytecode::kIllegal);
96 BytecodeNode(Bytecode bytecode, uint32_t operand0, 96 BytecodeNode(Bytecode bytecode, uint32_t operand0);
97 OperandScale operand_scale); 97 BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1);
98 BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1, 98 BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
99 OperandScale operand_scale); 99 uint32_t operand2);
100 BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1, 100 BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
101 uint32_t operand2, OperandScale operand_scale); 101 uint32_t operand2, uint32_t operand3);
102 BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
103 uint32_t operand2, uint32_t operand3,
104 OperandScale operand_scale);
105 102
106 BytecodeNode(const BytecodeNode& other); 103 BytecodeNode(const BytecodeNode& other);
107 BytecodeNode& operator=(const BytecodeNode& other); 104 BytecodeNode& operator=(const BytecodeNode& other);
108 105
109 void set_bytecode(Bytecode bytecode); 106 void set_bytecode(Bytecode bytecode);
110 void set_bytecode(Bytecode bytecode, uint32_t operand0, 107 void set_bytecode(Bytecode bytecode, uint32_t operand0);
111 OperandScale operand_scale);
112 108
113 // Clone |other|. 109 // Clone |other|.
114 void Clone(const BytecodeNode* const other); 110 void Clone(const BytecodeNode* const other);
115 111
116 // Print to stream |os|. 112 // Print to stream |os|.
117 void Print(std::ostream& os) const; 113 void Print(std::ostream& os) const;
118 114
119 // Return the size when this node is serialized to a bytecode array.
120 size_t Size() const;
121
122 // Transform to a node representing |new_bytecode| which has one 115 // Transform to a node representing |new_bytecode| which has one
123 // operand more than the current bytecode. 116 // operand more than the current bytecode.
124 void Transform(Bytecode new_bytecode, uint32_t extra_operand, 117 void Transform(Bytecode new_bytecode, uint32_t extra_operand);
125 OperandScale extra_operand_scale);
126 118
127 Bytecode bytecode() const { return bytecode_; } 119 Bytecode bytecode() const { return bytecode_; }
128 120
129 uint32_t operand(int i) const { 121 uint32_t operand(int i) const {
130 DCHECK_LT(i, operand_count()); 122 DCHECK_LT(i, operand_count());
131 return operands_[i]; 123 return operands_[i];
132 } 124 }
133 uint32_t* operands() { return operands_; } 125 uint32_t* operands() { return operands_; }
134 const uint32_t* operands() const { return operands_; } 126 const uint32_t* operands() const { return operands_; }
135 127
136 int operand_count() const { return Bytecodes::NumberOfOperands(bytecode_); } 128 int operand_count() const { return Bytecodes::NumberOfOperands(bytecode_); }
137 OperandScale operand_scale() const { return operand_scale_; }
138 void set_operand_scale(OperandScale operand_scale) {
139 operand_scale_ = operand_scale;
140 }
141 129
142 const BytecodeSourceInfo& source_info() const { return source_info_; } 130 const BytecodeSourceInfo& source_info() const { return source_info_; }
143 BytecodeSourceInfo& source_info() { return source_info_; } 131 BytecodeSourceInfo& source_info() { return source_info_; }
144 132
145 bool operator==(const BytecodeNode& other) const; 133 bool operator==(const BytecodeNode& other) const;
146 bool operator!=(const BytecodeNode& other) const { return !(*this == other); } 134 bool operator!=(const BytecodeNode& other) const { return !(*this == other); }
147 135
148 private: 136 private:
149 static const int kInvalidPosition = kMinInt; 137 static const int kInvalidPosition = kMinInt;
150 static const size_t kMaxOperands = 4; 138 static const size_t kMaxOperands = 4;
151 139
152 Bytecode bytecode_; 140 Bytecode bytecode_;
153 uint32_t operands_[kMaxOperands]; 141 uint32_t operands_[kMaxOperands];
154 OperandScale operand_scale_;
155 BytecodeSourceInfo source_info_; 142 BytecodeSourceInfo source_info_;
156 }; 143 };
157 144
158 std::ostream& operator<<(std::ostream& os, const BytecodeSourceInfo& info); 145 std::ostream& operator<<(std::ostream& os, const BytecodeSourceInfo& info);
159 std::ostream& operator<<(std::ostream& os, const BytecodeNode& node); 146 std::ostream& operator<<(std::ostream& os, const BytecodeNode& node);
160 147
161 } // namespace interpreter 148 } // namespace interpreter
162 } // namespace internal 149 } // namespace internal
163 } // namespace v8 150 } // namespace v8
164 151
165 #endif // V8_INTERPRETER_BYTECODE_PIPELINE_H_ 152 #endif // V8_INTERPRETER_BYTECODE_PIPELINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698