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

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

Issue 1822043005: [Interpreter] Add ValidBytecodeOperandSizeCombinationsIterator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@move-hasbch-to-bytecodes
Patch Set: Rename class. 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/bytecodes.h ('k') | no next file » | 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 #include "src/interpreter/bytecodes.h" 5 #include "src/interpreter/bytecodes.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 8
9 #include "src/frames.h" 9 #include "src/frames.h"
10 #include "src/interpreter/bytecode-traits.h" 10 #include "src/interpreter/bytecode-traits.h"
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 s << "a" << parameter_index - 1; 690 s << "a" << parameter_index - 1;
691 return s.str(); 691 return s.str();
692 } 692 }
693 } else { 693 } else {
694 std::ostringstream s; 694 std::ostringstream s;
695 s << "r" << index(); 695 s << "r" << index();
696 return s.str(); 696 return s.str();
697 } 697 }
698 } 698 }
699 699
700 ValidBytecodeOperandSizeCombinationsIterator::
701 ValidBytecodeOperandSizeCombinationsIterator()
702 : reached_end_(false),
703 operand_scale_(OperandScale::kSingle),
704 bytecode_(kFirstBytecode) {
705 // Advance to the first valid combination
706 while (!done() && !CurrentCombinationIsValid()) {
707 IncrementPosition();
708 }
709 DCHECK(!done());
710 }
711
712 void ValidBytecodeOperandSizeCombinationsIterator::Advance() {
713 do {
714 IncrementPosition();
715 } while (!done() && !CurrentCombinationIsValid());
716 }
717
718 void ValidBytecodeOperandSizeCombinationsIterator::IncrementPosition() {
719 if (bytecode_ == Bytecode::kLast) {
720 if (operand_scale_ == OperandScale::kMaxValid) {
721 reached_end_ = true;
722 return;
723 }
724 bytecode_ = kFirstBytecode;
725 operand_scale_ = Bytecodes::NextOperandScale(operand_scale_);
726 } else {
727 bytecode_ = Bytecodes::FromByte(static_cast<int>(bytecode_) + 1);
728 }
729 }
730
731 bool ValidBytecodeOperandSizeCombinationsIterator::CurrentCombinationIsValid() {
732 return Bytecodes::BytecodeHasHandler(bytecode_, operand_scale_);
733 }
734
700 } // namespace interpreter 735 } // namespace interpreter
701 } // namespace internal 736 } // namespace internal
702 } // namespace v8 737 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698