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

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

Issue 1894063002: [Interpreter] Remove register file register and replace with LoadParentFramePointer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix gcc Created 4 years, 8 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') | src/interpreter/interpreter-assembler.h » ('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 #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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 638
639 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale) { 639 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale) {
640 return os << Bytecodes::OperandScaleToString(operand_scale); 640 return os << Bytecodes::OperandScaleToString(operand_scale);
641 } 641 }
642 642
643 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type) { 643 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type) {
644 return os << Bytecodes::OperandTypeToString(operand_type); 644 return os << Bytecodes::OperandTypeToString(operand_type);
645 } 645 }
646 646
647 static const int kLastParamRegisterIndex = 647 static const int kLastParamRegisterIndex =
648 -InterpreterFrameConstants::kLastParamFromRegisterPointer / kPointerSize; 648 (InterpreterFrameConstants::kRegisterFileFromFp -
649 InterpreterFrameConstants::kLastParamFromFp) /
650 kPointerSize;
649 static const int kFunctionClosureRegisterIndex = 651 static const int kFunctionClosureRegisterIndex =
650 -InterpreterFrameConstants::kFunctionFromRegisterPointer / kPointerSize; 652 (InterpreterFrameConstants::kRegisterFileFromFp -
653 StandardFrameConstants::kFunctionOffset) /
654 kPointerSize;
651 static const int kCurrentContextRegisterIndex = 655 static const int kCurrentContextRegisterIndex =
652 -InterpreterFrameConstants::kContextFromRegisterPointer / kPointerSize; 656 (InterpreterFrameConstants::kRegisterFileFromFp -
657 StandardFrameConstants::kContextOffset) /
658 kPointerSize;
653 static const int kNewTargetRegisterIndex = 659 static const int kNewTargetRegisterIndex =
654 -InterpreterFrameConstants::kNewTargetFromRegisterPointer / kPointerSize; 660 (InterpreterFrameConstants::kRegisterFileFromFp -
655 661 InterpreterFrameConstants::kNewTargetFromFp) /
656 bool Register::is_byte_operand() const { 662 kPointerSize;
657 return index_ >= -kMaxInt8 && index_ <= -kMinInt8; 663 static const int kBytecodeArrayRegisterIndex =
658 } 664 (InterpreterFrameConstants::kRegisterFileFromFp -
659 665 InterpreterFrameConstants::kBytecodeArrayFromFp) /
660 bool Register::is_short_operand() const { 666 kPointerSize;
661 return index_ >= -kMaxInt16 && index_ <= -kMinInt16; 667 static const int kBytecodeOffsetRegisterIndex =
662 } 668 (InterpreterFrameConstants::kRegisterFileFromFp -
669 InterpreterFrameConstants::kBytecodeOffsetFromFp) /
670 kPointerSize;
663 671
664 Register Register::FromParameterIndex(int index, int parameter_count) { 672 Register Register::FromParameterIndex(int index, int parameter_count) {
665 DCHECK_GE(index, 0); 673 DCHECK_GE(index, 0);
666 DCHECK_LT(index, parameter_count); 674 DCHECK_LT(index, parameter_count);
667 int register_index = kLastParamRegisterIndex - parameter_count + index + 1; 675 int register_index = kLastParamRegisterIndex - parameter_count + index + 1;
668 DCHECK_LT(register_index, 0); 676 DCHECK_LT(register_index, 0);
669 return Register(register_index); 677 return Register(register_index);
670 } 678 }
671 679
672
673 int Register::ToParameterIndex(int parameter_count) const { 680 int Register::ToParameterIndex(int parameter_count) const {
674 DCHECK(is_parameter()); 681 DCHECK(is_parameter());
675 return index() - kLastParamRegisterIndex + parameter_count - 1; 682 return index() - kLastParamRegisterIndex + parameter_count - 1;
676 } 683 }
677 684
678
679 Register Register::function_closure() { 685 Register Register::function_closure() {
680 return Register(kFunctionClosureRegisterIndex); 686 return Register(kFunctionClosureRegisterIndex);
681 } 687 }
682 688
683
684 bool Register::is_function_closure() const { 689 bool Register::is_function_closure() const {
685 return index() == kFunctionClosureRegisterIndex; 690 return index() == kFunctionClosureRegisterIndex;
686 } 691 }
687 692
688
689 Register Register::current_context() { 693 Register Register::current_context() {
690 return Register(kCurrentContextRegisterIndex); 694 return Register(kCurrentContextRegisterIndex);
691 } 695 }
692 696
693
694 bool Register::is_current_context() const { 697 bool Register::is_current_context() const {
695 return index() == kCurrentContextRegisterIndex; 698 return index() == kCurrentContextRegisterIndex;
696 } 699 }
697 700
698
699 Register Register::new_target() { return Register(kNewTargetRegisterIndex); } 701 Register Register::new_target() { return Register(kNewTargetRegisterIndex); }
700 702
701
702 bool Register::is_new_target() const { 703 bool Register::is_new_target() const {
703 return index() == kNewTargetRegisterIndex; 704 return index() == kNewTargetRegisterIndex;
704 } 705 }
705 706
707 Register Register::bytecode_array() {
708 return Register(kBytecodeArrayRegisterIndex);
709 }
710
711 bool Register::is_bytecode_array() const {
712 return index() == kBytecodeArrayRegisterIndex;
713 }
714
715 Register Register::bytecode_offset() {
716 return Register(kBytecodeOffsetRegisterIndex);
717 }
718
719 bool Register::is_bytecode_offset() const {
720 return index() == kBytecodeOffsetRegisterIndex;
721 }
722
723 OperandSize Register::SizeOfOperand() const {
724 int32_t operand = ToOperand();
725 if (operand >= kMinInt8 && operand <= kMaxInt8) {
726 return OperandSize::kByte;
727 } else if (index_ >= kMinInt16 && index_ <= kMaxInt16) {
728 return OperandSize::kShort;
729 } else {
730 return OperandSize::kQuad;
731 }
732 }
733
706 bool Register::AreContiguous(Register reg1, Register reg2, Register reg3, 734 bool Register::AreContiguous(Register reg1, Register reg2, Register reg3,
707 Register reg4, Register reg5) { 735 Register reg4, Register reg5) {
708 if (reg1.index() + 1 != reg2.index()) { 736 if (reg1.index() + 1 != reg2.index()) {
709 return false; 737 return false;
710 } 738 }
711 if (reg3.is_valid() && reg2.index() + 1 != reg3.index()) { 739 if (reg3.is_valid() && reg2.index() + 1 != reg3.index()) {
712 return false; 740 return false;
713 } 741 }
714 if (reg4.is_valid() && reg3.index() + 1 != reg4.index()) { 742 if (reg4.is_valid() && reg3.index() + 1 != reg4.index()) {
715 return false; 743 return false;
(...skipping 23 matching lines...) Expand all
739 } else { 767 } else {
740 std::ostringstream s; 768 std::ostringstream s;
741 s << "r" << index(); 769 s << "r" << index();
742 return s.str(); 770 return s.str();
743 } 771 }
744 } 772 }
745 773
746 } // namespace interpreter 774 } // namespace interpreter
747 } // namespace internal 775 } // namespace internal
748 } // namespace v8 776 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | src/interpreter/interpreter-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698