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

Side by Side Diff: src/interpreter/bytecodes.h

Issue 1546683002: [Interpreter] Add support for jumps using constants with wide operands. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rationalize jumps in bytecode-graph-builder.cc. Created 4 years, 12 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_BYTECODES_H_ 5 #ifndef V8_INTERPRETER_BYTECODES_H_
6 #define V8_INTERPRETER_BYTECODES_H_ 6 #define V8_INTERPRETER_BYTECODES_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 // Clients of this interface shouldn't depend on lots of interpreter internals. 10 // Clients of this interface shouldn't depend on lots of interpreter internals.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 V(CreateClosure, OperandType::kIdx8, OperandType::kImm8) \ 178 V(CreateClosure, OperandType::kIdx8, OperandType::kImm8) \
179 V(CreateClosureWide, OperandType::kIdx16, OperandType::kImm8) \ 179 V(CreateClosureWide, OperandType::kIdx16, OperandType::kImm8) \
180 \ 180 \
181 /* Arguments allocation */ \ 181 /* Arguments allocation */ \
182 V(CreateMappedArguments, OperandType::kNone) \ 182 V(CreateMappedArguments, OperandType::kNone) \
183 V(CreateUnmappedArguments, OperandType::kNone) \ 183 V(CreateUnmappedArguments, OperandType::kNone) \
184 \ 184 \
185 /* Control Flow */ \ 185 /* Control Flow */ \
186 V(Jump, OperandType::kImm8) \ 186 V(Jump, OperandType::kImm8) \
187 V(JumpConstant, OperandType::kIdx8) \ 187 V(JumpConstant, OperandType::kIdx8) \
188 V(JumpConstantWide, OperandType::kIdx16) \
188 V(JumpIfTrue, OperandType::kImm8) \ 189 V(JumpIfTrue, OperandType::kImm8) \
189 V(JumpIfTrueConstant, OperandType::kIdx8) \ 190 V(JumpIfTrueConstant, OperandType::kIdx8) \
191 V(JumpIfTrueConstantWide, OperandType::kIdx16) \
190 V(JumpIfFalse, OperandType::kImm8) \ 192 V(JumpIfFalse, OperandType::kImm8) \
191 V(JumpIfFalseConstant, OperandType::kIdx8) \ 193 V(JumpIfFalseConstant, OperandType::kIdx8) \
194 V(JumpIfFalseConstantWide, OperandType::kIdx16) \
192 V(JumpIfToBooleanTrue, OperandType::kImm8) \ 195 V(JumpIfToBooleanTrue, OperandType::kImm8) \
193 V(JumpIfToBooleanTrueConstant, OperandType::kIdx8) \ 196 V(JumpIfToBooleanTrueConstant, OperandType::kIdx8) \
197 V(JumpIfToBooleanTrueConstantWide, OperandType::kIdx16) \
194 V(JumpIfToBooleanFalse, OperandType::kImm8) \ 198 V(JumpIfToBooleanFalse, OperandType::kImm8) \
195 V(JumpIfToBooleanFalseConstant, OperandType::kIdx8) \ 199 V(JumpIfToBooleanFalseConstant, OperandType::kIdx8) \
200 V(JumpIfToBooleanFalseConstantWide, OperandType::kIdx16) \
196 V(JumpIfNull, OperandType::kImm8) \ 201 V(JumpIfNull, OperandType::kImm8) \
197 V(JumpIfNullConstant, OperandType::kIdx8) \ 202 V(JumpIfNullConstant, OperandType::kIdx8) \
203 V(JumpIfNullConstantWide, OperandType::kIdx16) \
198 V(JumpIfUndefined, OperandType::kImm8) \ 204 V(JumpIfUndefined, OperandType::kImm8) \
199 V(JumpIfUndefinedConstant, OperandType::kIdx8) \ 205 V(JumpIfUndefinedConstant, OperandType::kIdx8) \
206 V(JumpIfUndefinedConstantWide, OperandType::kIdx16) \
200 \ 207 \
201 /* Complex flow control For..in */ \ 208 /* Complex flow control For..in */ \
202 V(ForInPrepare, OperandType::kReg8, OperandType::kReg8, OperandType::kReg8) \ 209 V(ForInPrepare, OperandType::kReg8, OperandType::kReg8, OperandType::kReg8) \
203 V(ForInDone, OperandType::kReg8, OperandType::kReg8) \ 210 V(ForInDone, OperandType::kReg8, OperandType::kReg8) \
204 V(ForInNext, OperandType::kReg8, OperandType::kReg8, OperandType::kReg8, \ 211 V(ForInNext, OperandType::kReg8, OperandType::kReg8, OperandType::kReg8, \
205 OperandType::kReg8) \ 212 OperandType::kReg8) \
206 V(ForInStep, OperandType::kReg8) \ 213 V(ForInStep, OperandType::kReg8) \
207 \ 214 \
208 /* Non-local flow control */ \ 215 /* Non-local flow control */ \
209 V(Throw, OperandType::kNone) \ 216 V(Throw, OperandType::kNone) \
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 static int Size(Bytecode bytecode); 353 static int Size(Bytecode bytecode);
347 354
348 // Returns the size of |operand|. 355 // Returns the size of |operand|.
349 static OperandSize SizeOfOperand(OperandType operand); 356 static OperandSize SizeOfOperand(OperandType operand);
350 357
351 // Return true if the bytecode is a conditional jump taking 358 // Return true if the bytecode is a conditional jump taking
352 // an immediate byte operand (OperandType::kImm8). 359 // an immediate byte operand (OperandType::kImm8).
353 static bool IsConditionalJumpImmediate(Bytecode bytecode); 360 static bool IsConditionalJumpImmediate(Bytecode bytecode);
354 361
355 // Return true if the bytecode is a conditional jump taking 362 // Return true if the bytecode is a conditional jump taking
356 // a constant pool entry (OperandType::kIdx). 363 // a constant pool entry (OperandType::kIdx8).
357 static bool IsConditionalJumpConstant(Bytecode bytecode); 364 static bool IsConditionalJumpConstant(Bytecode bytecode);
358 365
359 // Return true if the bytecode is a conditional jump taking 366 // Return true if the bytecode is a conditional jump taking
367 // a constant pool entry (OperandType::kIdx16).
368 static bool IsConditionalJumpConstantWide(Bytecode bytecode);
369
370 // Return true if the bytecode is a conditional jump taking
360 // any kind of operand. 371 // any kind of operand.
361 static bool IsConditionalJump(Bytecode bytecode); 372 static bool IsConditionalJump(Bytecode bytecode);
362 373
363 // Return true if the bytecode is a jump or a conditional jump taking 374 // Return true if the bytecode is a jump or a conditional jump taking
364 // an immediate byte operand (OperandType::kImm8). 375 // an immediate byte operand (OperandType::kImm8).
365 static bool IsJumpImmediate(Bytecode bytecode); 376 static bool IsJumpImmediate(Bytecode bytecode);
366 377
367 // Return true if the bytecode is a jump or conditional jump taking a 378 // Return true if the bytecode is a jump or conditional jump taking a
368 // constant pool entry (OperandType::kIdx). 379 // constant pool entry (OperandType::kIdx8).
369 static bool IsJumpConstant(Bytecode bytecode); 380 static bool IsJumpConstant(Bytecode bytecode);
370 381
382 // Return true if the bytecode is a jump or conditional jump taking a
383 // constant pool entry (OperandType::kIdx16).
384 static bool IsJumpConstantWide(Bytecode bytecode);
385
371 // Return true if the bytecode is a jump or conditional jump taking 386 // Return true if the bytecode is a jump or conditional jump taking
372 // any kind of operand. 387 // any kind of operand.
373 static bool IsJump(Bytecode bytecode); 388 static bool IsJump(Bytecode bytecode);
374 389
375 // Return true if the bytecode is a conditional jump, a jump, or a return. 390 // Return true if the bytecode is a conditional jump, a jump, or a return.
376 static bool IsJumpOrReturn(Bytecode bytecode); 391 static bool IsJumpOrReturn(Bytecode bytecode);
377 392
378 // Decode a single bytecode and operands to |os|. 393 // Decode a single bytecode and operands to |os|.
379 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, 394 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start,
380 int number_of_parameters); 395 int number_of_parameters);
381 396
382 private: 397 private:
383 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); 398 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes);
384 }; 399 };
385 400
386 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); 401 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode);
387 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); 402 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type);
388 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); 403 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type);
389 404
390 } // namespace interpreter 405 } // namespace interpreter
391 } // namespace internal 406 } // namespace internal
392 } // namespace v8 407 } // namespace v8
393 408
394 #endif // V8_INTERPRETER_BYTECODES_H_ 409 #endif // V8_INTERPRETER_BYTECODES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698