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

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

Issue 1416623003: [Interpreter] Add support for for count operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix gcc error Created 5 years, 2 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/compiler/bytecode-graph-builder.cc ('k') | src/interpreter/bytecode-array-builder.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_BUILDER_H_ 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "src/ast.h" 10 #include "src/ast.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // Call the runtime function with |function_id|. The first argument should be 139 // Call the runtime function with |function_id|. The first argument should be
140 // in |first_arg| and all subsequent arguments should be in registers 140 // in |first_arg| and all subsequent arguments should be in registers
141 // <first_arg + 1> to <first_arg + 1 + arg_count>. 141 // <first_arg + 1> to <first_arg + 1 + arg_count>.
142 BytecodeArrayBuilder& CallRuntime(Runtime::FunctionId function_id, 142 BytecodeArrayBuilder& CallRuntime(Runtime::FunctionId function_id,
143 Register first_arg, size_t arg_count); 143 Register first_arg, size_t arg_count);
144 144
145 // Operators (register holds the lhs value, accumulator holds the rhs value). 145 // Operators (register holds the lhs value, accumulator holds the rhs value).
146 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg, 146 BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg,
147 Strength strength); 147 Strength strength);
148 148
149 // Count Operators (value stored in accumulator).
150 BytecodeArrayBuilder& CountOperation(Token::Value op, Strength strength);
151
149 // Unary Operators. 152 // Unary Operators.
150 BytecodeArrayBuilder& LogicalNot(); 153 BytecodeArrayBuilder& LogicalNot();
151 BytecodeArrayBuilder& TypeOf(); 154 BytecodeArrayBuilder& TypeOf();
152 155
153 // Tests. 156 // Tests.
154 BytecodeArrayBuilder& CompareOperation(Token::Value op, Register reg, 157 BytecodeArrayBuilder& CompareOperation(Token::Value op, Register reg,
155 Strength strength); 158 Strength strength);
156 159
157 // Casts. 160 // Casts.
158 BytecodeArrayBuilder& CastAccumulatorToBoolean(); 161 BytecodeArrayBuilder& CastAccumulatorToBoolean();
159 BytecodeArrayBuilder& CastAccumulatorToName(); 162 BytecodeArrayBuilder& CastAccumulatorToName();
163 BytecodeArrayBuilder& CastAccumulatorToNumber();
160 164
161 // Flow Control. 165 // Flow Control.
162 BytecodeArrayBuilder& Bind(BytecodeLabel* label); 166 BytecodeArrayBuilder& Bind(BytecodeLabel* label);
163 BytecodeArrayBuilder& Bind(const BytecodeLabel& target, BytecodeLabel* label); 167 BytecodeArrayBuilder& Bind(const BytecodeLabel& target, BytecodeLabel* label);
164 168
165 BytecodeArrayBuilder& Jump(BytecodeLabel* label); 169 BytecodeArrayBuilder& Jump(BytecodeLabel* label);
166 BytecodeArrayBuilder& JumpIfTrue(BytecodeLabel* label); 170 BytecodeArrayBuilder& JumpIfTrue(BytecodeLabel* label);
167 BytecodeArrayBuilder& JumpIfFalse(BytecodeLabel* label); 171 BytecodeArrayBuilder& JumpIfFalse(BytecodeLabel* label);
168 // TODO(mythria) The following two functions should be merged into 172 // TODO(mythria) The following two functions should be merged into
169 // JumpIfTrue/False. These bytecodes should be automatically chosen rather 173 // JumpIfTrue/False. These bytecodes should be automatically chosen rather
170 // than explicitly using them. 174 // than explicitly using them.
171 BytecodeArrayBuilder& JumpIfToBooleanTrue(BytecodeLabel* label); 175 BytecodeArrayBuilder& JumpIfToBooleanTrue(BytecodeLabel* label);
172 BytecodeArrayBuilder& JumpIfToBooleanFalse(BytecodeLabel* label); 176 BytecodeArrayBuilder& JumpIfToBooleanFalse(BytecodeLabel* label);
173 177
174 BytecodeArrayBuilder& Throw(); 178 BytecodeArrayBuilder& Throw();
175 BytecodeArrayBuilder& Return(); 179 BytecodeArrayBuilder& Return();
176 180
177 BytecodeArrayBuilder& EnterBlock(); 181 BytecodeArrayBuilder& EnterBlock();
178 BytecodeArrayBuilder& LeaveBlock(); 182 BytecodeArrayBuilder& LeaveBlock();
179 183
180 // Accessors 184 // Accessors
181 Zone* zone() const { return zone_; } 185 Zone* zone() const { return zone_; }
182 186
183 private: 187 private:
184 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; } 188 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; }
185 const ZoneVector<uint8_t>* bytecodes() const { return &bytecodes_; } 189 const ZoneVector<uint8_t>* bytecodes() const { return &bytecodes_; }
186 Isolate* isolate() const { return isolate_; } 190 Isolate* isolate() const { return isolate_; }
187 191
188 static Bytecode BytecodeForBinaryOperation(Token::Value op); 192 static Bytecode BytecodeForBinaryOperation(Token::Value op);
193 static Bytecode BytecodeForCountOperation(Token::Value op);
189 static Bytecode BytecodeForCompareOperation(Token::Value op); 194 static Bytecode BytecodeForCompareOperation(Token::Value op);
190 static Bytecode BytecodeForLoadIC(LanguageMode language_mode); 195 static Bytecode BytecodeForLoadIC(LanguageMode language_mode);
191 static Bytecode BytecodeForKeyedLoadIC(LanguageMode language_mode); 196 static Bytecode BytecodeForKeyedLoadIC(LanguageMode language_mode);
192 static Bytecode BytecodeForStoreIC(LanguageMode language_mode); 197 static Bytecode BytecodeForStoreIC(LanguageMode language_mode);
193 static Bytecode BytecodeForKeyedStoreIC(LanguageMode language_mode); 198 static Bytecode BytecodeForKeyedStoreIC(LanguageMode language_mode);
194 static Bytecode BytecodeForLoadGlobal(LanguageMode language_mode); 199 static Bytecode BytecodeForLoadGlobal(LanguageMode language_mode);
195 static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode); 200 static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode);
196 201
197 static bool FitsInIdx8Operand(int value); 202 static bool FitsInIdx8Operand(int value);
198 static bool FitsInIdx8Operand(size_t value); 203 static bool FitsInIdx8Operand(size_t value);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 320
316 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); 321 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope);
317 }; 322 };
318 323
319 324
320 } // namespace interpreter 325 } // namespace interpreter
321 } // namespace internal 326 } // namespace internal
322 } // namespace v8 327 } // namespace v8
323 328
324 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 329 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.cc ('k') | src/interpreter/bytecode-array-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698