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

Side by Side Diff: src/hydrogen-instructions.h

Issue 6542042: Remove const qualifier in a few places in the hydrogen IR files.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/hydrogen-instructions.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 }; 302 };
303 303
304 Representation() : kind_(kNone) { } 304 Representation() : kind_(kNone) { }
305 305
306 static Representation None() { return Representation(kNone); } 306 static Representation None() { return Representation(kNone); }
307 static Representation Tagged() { return Representation(kTagged); } 307 static Representation Tagged() { return Representation(kTagged); }
308 static Representation Integer32() { return Representation(kInteger32); } 308 static Representation Integer32() { return Representation(kInteger32); }
309 static Representation Double() { return Representation(kDouble); } 309 static Representation Double() { return Representation(kDouble); }
310 static Representation External() { return Representation(kExternal); } 310 static Representation External() { return Representation(kExternal); }
311 311
312 bool Equals(const Representation& other) const { 312 bool Equals(const Representation& other) {
313 return kind_ == other.kind_; 313 return kind_ == other.kind_;
314 } 314 }
315 315
316 Kind kind() const { return kind_; } 316 Kind kind() const { return kind_; }
317 bool IsNone() const { return kind_ == kNone; } 317 bool IsNone() const { return kind_ == kNone; }
318 bool IsTagged() const { return kind_ == kTagged; } 318 bool IsTagged() const { return kind_ == kTagged; }
319 bool IsInteger32() const { return kind_ == kInteger32; } 319 bool IsInteger32() const { return kind_ == kInteger32; }
320 bool IsDouble() const { return kind_ == kDouble; } 320 bool IsDouble() const { return kind_ == kDouble; }
321 bool IsExternal() const { return kind_ == kExternal; } 321 bool IsExternal() const { return kind_ == kExternal; }
322 bool IsSpecialization() const { 322 bool IsSpecialization() const {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 // one input. They are phi and binary add. They always return NULL and 537 // one input. They are phi and binary add. They always return NULL and
538 // expect the caller to take care of things. 538 // expect the caller to take care of things.
539 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited) { 539 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited) {
540 visited->Add(id()); 540 visited->Add(id());
541 return NULL; 541 return NULL;
542 } 542 }
543 543
544 bool IsDefinedAfter(HBasicBlock* other) const; 544 bool IsDefinedAfter(HBasicBlock* other) const;
545 545
546 // Operands. 546 // Operands.
547 virtual int OperandCount() const { return 0; } 547 virtual int OperandCount() { return 0; }
548 virtual HValue* OperandAt(int index) const { 548 virtual HValue* OperandAt(int index) {
549 UNREACHABLE(); 549 UNREACHABLE();
550 return NULL; 550 return NULL;
551 } 551 }
552 void SetOperandAt(int index, HValue* value); 552 void SetOperandAt(int index, HValue* value);
553 553
554 int LookupOperandIndex(int occurrence_index, HValue* op) const; 554 int LookupOperandIndex(int occurrence_index, HValue* op);
555 bool UsesMultipleTimes(HValue* op) const; 555 bool UsesMultipleTimes(HValue* op);
556 556
557 void ReplaceAndDelete(HValue* other); 557 void ReplaceAndDelete(HValue* other);
558 void ReplaceValue(HValue* other); 558 void ReplaceValue(HValue* other);
559 void ReplaceAtUse(HValue* use, HValue* other); 559 void ReplaceAtUse(HValue* use, HValue* other);
560 void ReplaceFirstAtUse(HValue* use, HValue* other, Representation r); 560 void ReplaceFirstAtUse(HValue* use, HValue* other, Representation r);
561 bool HasNoUses() const { return uses_.is_empty(); } 561 bool HasNoUses() const { return uses_.is_empty(); }
562 void ClearOperands(); 562 void ClearOperands();
563 void Delete(); 563 void Delete();
564 564
565 int flags() const { return flags_; } 565 int flags() const { return flags_; }
566 void SetFlag(Flag f) { flags_ |= (1 << f); } 566 void SetFlag(Flag f) { flags_ |= (1 << f); }
567 void ClearFlag(Flag f) { flags_ &= ~(1 << f); } 567 void ClearFlag(Flag f) { flags_ &= ~(1 << f); }
568 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } 568 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; }
569 569
570 void SetAllSideEffects() { flags_ |= AllSideEffects(); } 570 void SetAllSideEffects() { flags_ |= AllSideEffects(); }
571 void ClearAllSideEffects() { flags_ &= ~AllSideEffects(); } 571 void ClearAllSideEffects() { flags_ &= ~AllSideEffects(); }
572 bool HasSideEffects() const { return (flags_ & AllSideEffects()) != 0; } 572 bool HasSideEffects() const { return (flags_ & AllSideEffects()) != 0; }
573 573
574 Range* range() const { return range_; } 574 Range* range() const { return range_; }
575 bool HasRange() const { return range_ != NULL; } 575 bool HasRange() const { return range_ != NULL; }
576 void AddNewRange(Range* r); 576 void AddNewRange(Range* r);
577 void RemoveLastAddedRange(); 577 void RemoveLastAddedRange();
578 void ComputeInitialRange(); 578 void ComputeInitialRange();
579 579
580 // Representation helpers. 580 // Representation helpers.
581 virtual Representation RequiredInputRepresentation(int index) const { 581 virtual Representation RequiredInputRepresentation(int index) const {
582 return Representation::None(); 582 return Representation::None();
583 } 583 }
584 virtual Representation InferredRepresentation() const { 584 virtual Representation InferredRepresentation() {
585 return representation(); 585 return representation();
586 } 586 }
587 587
588 // This gives the instruction an opportunity to replace itself with an 588 // This gives the instruction an opportunity to replace itself with an
589 // instruction that does the same in some better way. To replace an 589 // instruction that does the same in some better way. To replace an
590 // instruction with a new one, first add the new instruction to the graph, 590 // instruction with a new one, first add the new instruction to the graph,
591 // then return it. Return NULL to have the instruction deleted. 591 // then return it. Return NULL to have the instruction deleted.
592 virtual HValue* Canonicalize() { return this; } 592 virtual HValue* Canonicalize() { return this; }
593 593
594 // Declare virtual type testers. 594 // Declare virtual type testers.
595 #define DECLARE_DO(type) virtual bool Is##type() const { return false; } 595 #define DECLARE_DO(type) virtual bool Is##type() const { return false; }
596 HYDROGEN_ALL_INSTRUCTION_LIST(DECLARE_DO) 596 HYDROGEN_ALL_INSTRUCTION_LIST(DECLARE_DO)
597 #undef DECLARE_DO 597 #undef DECLARE_DO
598 598
599 bool Equals(HValue* other) const; 599 bool Equals(HValue* other);
600 virtual intptr_t Hashcode() const; 600 virtual intptr_t Hashcode();
601 601
602 // Printing support. 602 // Printing support.
603 virtual void PrintTo(StringStream* stream) const = 0; 603 virtual void PrintTo(StringStream* stream) = 0;
604 void PrintNameTo(StringStream* stream); 604 void PrintNameTo(StringStream* stream);
605 static void PrintTypeTo(HType type, StringStream* stream); 605 static void PrintTypeTo(HType type, StringStream* stream);
606 606
607 virtual const char* Mnemonic() const = 0; 607 virtual const char* Mnemonic() const = 0;
608 virtual Opcode opcode() const = 0; 608 virtual Opcode opcode() const = 0;
609 609
610 // Updated the inferred type of this instruction and returns true if 610 // Updated the inferred type of this instruction and returns true if
611 // it has changed. 611 // it has changed.
612 bool UpdateInferredType(); 612 bool UpdateInferredType();
613 613
614 virtual HType CalculateInferredType() const; 614 virtual HType CalculateInferredType();
615 615
616 #ifdef DEBUG 616 #ifdef DEBUG
617 virtual void Verify() = 0; 617 virtual void Verify() = 0;
618 #endif 618 #endif
619 619
620 protected: 620 protected:
621 // This function must be overridden for instructions with flag kUseGVN, to 621 // This function must be overridden for instructions with flag kUseGVN, to
622 // compare the non-Operand parts of the instruction. 622 // compare the non-Operand parts of the instruction.
623 virtual bool DataEquals(HValue* other) const { 623 virtual bool DataEquals(HValue* other) {
624 UNREACHABLE(); 624 UNREACHABLE();
625 return false; 625 return false;
626 } 626 }
627 virtual void RepresentationChanged(Representation to) { } 627 virtual void RepresentationChanged(Representation to) { }
628 virtual Range* InferRange(); 628 virtual Range* InferRange();
629 virtual void DeleteFromGraph() = 0; 629 virtual void DeleteFromGraph() = 0;
630 virtual void InternalSetOperandAt(int index, HValue* value) { UNREACHABLE(); } 630 virtual void InternalSetOperandAt(int index, HValue* value) { UNREACHABLE(); }
631 void clear_block() { 631 void clear_block() {
632 ASSERT(block_ != NULL); 632 ASSERT(block_ != NULL);
633 block_ = NULL; 633 block_ = NULL;
(...skipping 28 matching lines...) Expand all
662 662
663 DISALLOW_COPY_AND_ASSIGN(HValue); 663 DISALLOW_COPY_AND_ASSIGN(HValue);
664 }; 664 };
665 665
666 666
667 class HInstruction: public HValue { 667 class HInstruction: public HValue {
668 public: 668 public:
669 HInstruction* next() const { return next_; } 669 HInstruction* next() const { return next_; }
670 HInstruction* previous() const { return previous_; } 670 HInstruction* previous() const { return previous_; }
671 671
672 void PrintTo(StringStream* stream) const; 672 virtual void PrintTo(StringStream* stream);
673 virtual void PrintDataTo(StringStream* stream) const {} 673 virtual void PrintDataTo(StringStream* stream) { }
674 674
675 bool IsLinked() const { return block() != NULL; } 675 bool IsLinked() const { return block() != NULL; }
676 void Unlink(); 676 void Unlink();
677 void InsertBefore(HInstruction* next); 677 void InsertBefore(HInstruction* next);
678 void InsertAfter(HInstruction* previous); 678 void InsertAfter(HInstruction* previous);
679 679
680 int position() const { return position_; } 680 int position() const { return position_; }
681 bool has_position() const { return position_ != RelocInfo::kNoPosition; } 681 bool has_position() const { return position_ != RelocInfo::kNoPosition; }
682 void set_position(int position) { position_ = position; } 682 void set_position(int position) { position_ = position; }
683 683
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 725
726 class HControlInstruction: public HInstruction { 726 class HControlInstruction: public HInstruction {
727 public: 727 public:
728 HControlInstruction(HBasicBlock* first, HBasicBlock* second) 728 HControlInstruction(HBasicBlock* first, HBasicBlock* second)
729 : first_successor_(first), second_successor_(second) { 729 : first_successor_(first), second_successor_(second) {
730 } 730 }
731 731
732 HBasicBlock* FirstSuccessor() const { return first_successor_; } 732 HBasicBlock* FirstSuccessor() const { return first_successor_; }
733 HBasicBlock* SecondSuccessor() const { return second_successor_; } 733 HBasicBlock* SecondSuccessor() const { return second_successor_; }
734 734
735 virtual void PrintDataTo(StringStream* stream) const; 735 virtual void PrintDataTo(StringStream* stream);
736 736
737 DECLARE_INSTRUCTION(ControlInstruction) 737 DECLARE_INSTRUCTION(ControlInstruction)
738 738
739 private: 739 private:
740 HBasicBlock* first_successor_; 740 HBasicBlock* first_successor_;
741 HBasicBlock* second_successor_; 741 HBasicBlock* second_successor_;
742 }; 742 };
743 743
744 744
745 class HDeoptimize: public HControlInstruction { 745 class HDeoptimize: public HControlInstruction {
(...skipping 28 matching lines...) Expand all
774 HBasicBlock* true_target, 774 HBasicBlock* true_target,
775 HBasicBlock* false_target) 775 HBasicBlock* false_target)
776 : HControlInstruction(true_target, false_target) { 776 : HControlInstruction(true_target, false_target) {
777 SetOperandAt(0, value); 777 SetOperandAt(0, value);
778 } 778 }
779 779
780 virtual Representation RequiredInputRepresentation(int index) const { 780 virtual Representation RequiredInputRepresentation(int index) const {
781 return Representation::Tagged(); 781 return Representation::Tagged();
782 } 782 }
783 783
784 virtual void PrintDataTo(StringStream* stream) const; 784 virtual void PrintDataTo(StringStream* stream);
785 785
786 HValue* value() const { return OperandAt(0); } 786 HValue* value() const { return OperandAt(0); }
787 virtual int OperandCount() const { return 1; } 787 virtual int OperandCount() const { return 1; }
788 virtual HValue* OperandAt(int index) const { return operands_[index]; } 788 virtual HValue* OperandAt(int index) const { return operands_[index]; }
789 789
790 DECLARE_INSTRUCTION(UnaryControlInstruction) 790 DECLARE_INSTRUCTION(UnaryControlInstruction)
791 791
792 protected: 792 protected:
793 virtual void InternalSetOperandAt(int index, HValue* value) { 793 virtual void InternalSetOperandAt(int index, HValue* value) {
794 operands_[index] = value; 794 operands_[index] = value;
(...skipping 25 matching lines...) Expand all
820 Handle<Map> map, 820 Handle<Map> map,
821 HBasicBlock* true_target, 821 HBasicBlock* true_target,
822 HBasicBlock* false_target) 822 HBasicBlock* false_target)
823 : HUnaryControlInstruction(value, true_target, false_target), 823 : HUnaryControlInstruction(value, true_target, false_target),
824 map_(map) { 824 map_(map) {
825 ASSERT(true_target != NULL); 825 ASSERT(true_target != NULL);
826 ASSERT(false_target != NULL); 826 ASSERT(false_target != NULL);
827 ASSERT(!map.is_null()); 827 ASSERT(!map.is_null());
828 } 828 }
829 829
830 virtual void PrintDataTo(StringStream* stream) const; 830 virtual void PrintDataTo(StringStream* stream);
831 831
832 Handle<Map> map() const { return map_; } 832 Handle<Map> map() const { return map_; }
833 833
834 DECLARE_CONCRETE_INSTRUCTION(CompareMap, "compare_map") 834 DECLARE_CONCRETE_INSTRUCTION(CompareMap, "compare_map")
835 835
836 private: 836 private:
837 Handle<Map> map_; 837 Handle<Map> map_;
838 }; 838 };
839 839
840 840
(...skipping 15 matching lines...) Expand all
856 }; 856 };
857 857
858 858
859 class HUnaryOperation: public HInstruction { 859 class HUnaryOperation: public HInstruction {
860 public: 860 public:
861 explicit HUnaryOperation(HValue* value) { 861 explicit HUnaryOperation(HValue* value) {
862 SetOperandAt(0, value); 862 SetOperandAt(0, value);
863 } 863 }
864 864
865 HValue* value() const { return OperandAt(0); } 865 HValue* value() const { return OperandAt(0); }
866 virtual void PrintDataTo(StringStream* stream) const; 866 virtual void PrintDataTo(StringStream* stream);
867 virtual int OperandCount() const { return 1; } 867 virtual int OperandCount() const { return 1; }
868 virtual HValue* OperandAt(int index) const { return operands_[index]; } 868 virtual HValue* OperandAt(int index) const { return operands_[index]; }
869 869
870 DECLARE_INSTRUCTION(UnaryOperation) 870 DECLARE_INSTRUCTION(UnaryOperation)
871 871
872 protected: 872 protected:
873 virtual void InternalSetOperandAt(int index, HValue* value) { 873 virtual void InternalSetOperandAt(int index, HValue* value) {
874 operands_[index] = value; 874 operands_[index] = value;
875 } 875 }
876 876
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 return from_; 918 return from_;
919 } 919 }
920 920
921 bool CanTruncateToInt32() const { 921 bool CanTruncateToInt32() const {
922 for (int i = 0; i < uses()->length(); ++i) { 922 for (int i = 0; i < uses()->length(); ++i) {
923 if (!uses()->at(i)->CheckFlag(HValue::kTruncatingToInt32)) return false; 923 if (!uses()->at(i)->CheckFlag(HValue::kTruncatingToInt32)) return false;
924 } 924 }
925 return true; 925 return true;
926 } 926 }
927 927
928 virtual void PrintDataTo(StringStream* stream) const; 928 virtual void PrintDataTo(StringStream* stream);
929 929
930 DECLARE_CONCRETE_INSTRUCTION(Change, 930 DECLARE_CONCRETE_INSTRUCTION(Change,
931 CanTruncateToInt32() ? "truncate" : "change") 931 CanTruncateToInt32() ? "truncate" : "change")
932 932
933 protected: 933 protected:
934 virtual bool DataEquals(HValue* other) const { 934 virtual bool DataEquals(HValue* other) {
935 if (!other->IsChange()) return false; 935 if (!other->IsChange()) return false;
936 HChange* change = HChange::cast(other); 936 HChange* change = HChange::cast(other);
937 return value() == change->value() 937 return value() == change->value()
938 && to().Equals(change->to()) 938 && to().Equals(change->to())
939 && CanTruncateToInt32() == change->CanTruncateToInt32(); 939 && CanTruncateToInt32() == change->CanTruncateToInt32();
940 } 940 }
941 941
942 private: 942 private:
943 Representation from_; 943 Representation from_;
944 Representation to_; 944 Representation to_;
945 }; 945 };
946 946
947 947
948 class HSimulate: public HInstruction { 948 class HSimulate: public HInstruction {
949 public: 949 public:
950 HSimulate(int ast_id, int pop_count, int environment_length) 950 HSimulate(int ast_id, int pop_count, int environment_length)
951 : ast_id_(ast_id), 951 : ast_id_(ast_id),
952 pop_count_(pop_count), 952 pop_count_(pop_count),
953 environment_length_(environment_length), 953 environment_length_(environment_length),
954 values_(2), 954 values_(2),
955 assigned_indexes_(2) {} 955 assigned_indexes_(2) {}
956 virtual ~HSimulate() {} 956 virtual ~HSimulate() {}
957 957
958 virtual void PrintDataTo(StringStream* stream) const; 958 virtual void PrintDataTo(StringStream* stream);
959 959
960 bool HasAstId() const { return ast_id_ != AstNode::kNoNumber; } 960 bool HasAstId() const { return ast_id_ != AstNode::kNoNumber; }
961 int ast_id() const { return ast_id_; } 961 int ast_id() const { return ast_id_; }
962 void set_ast_id(int id) { 962 void set_ast_id(int id) {
963 ASSERT(!HasAstId()); 963 ASSERT(!HasAstId());
964 ast_id_ = id; 964 ast_id_ = id;
965 } 965 }
966 966
967 int environment_length() const { return environment_length_; } 967 int environment_length() const { return environment_length_; }
968 int pop_count() const { return pop_count_; } 968 int pop_count() const { return pop_count_; }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack_check") 1019 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack_check")
1020 }; 1020 };
1021 1021
1022 1022
1023 class HEnterInlined: public HInstruction { 1023 class HEnterInlined: public HInstruction {
1024 public: 1024 public:
1025 HEnterInlined(Handle<JSFunction> closure, FunctionLiteral* function) 1025 HEnterInlined(Handle<JSFunction> closure, FunctionLiteral* function)
1026 : closure_(closure), function_(function) { 1026 : closure_(closure), function_(function) {
1027 } 1027 }
1028 1028
1029 virtual void PrintDataTo(StringStream* stream) const; 1029 virtual void PrintDataTo(StringStream* stream);
1030 1030
1031 Handle<JSFunction> closure() const { return closure_; } 1031 Handle<JSFunction> closure() const { return closure_; }
1032 FunctionLiteral* function() const { return function_; } 1032 FunctionLiteral* function() const { return function_; }
1033 1033
1034 DECLARE_CONCRETE_INSTRUCTION(EnterInlined, "enter_inlined") 1034 DECLARE_CONCRETE_INSTRUCTION(EnterInlined, "enter_inlined")
1035 1035
1036 private: 1036 private:
1037 Handle<JSFunction> closure_; 1037 Handle<JSFunction> closure_;
1038 FunctionLiteral* function_; 1038 FunctionLiteral* function_;
1039 }; 1039 };
(...skipping 24 matching lines...) Expand all
1064 class HContext: public HInstruction { 1064 class HContext: public HInstruction {
1065 public: 1065 public:
1066 HContext() { 1066 HContext() {
1067 set_representation(Representation::Tagged()); 1067 set_representation(Representation::Tagged());
1068 SetFlag(kUseGVN); 1068 SetFlag(kUseGVN);
1069 } 1069 }
1070 1070
1071 DECLARE_CONCRETE_INSTRUCTION(Context, "context"); 1071 DECLARE_CONCRETE_INSTRUCTION(Context, "context");
1072 1072
1073 protected: 1073 protected:
1074 virtual bool DataEquals(HValue* other) const { return true; } 1074 virtual bool DataEquals(HValue* other) { return true; }
1075 }; 1075 };
1076 1076
1077 1077
1078 class HOuterContext: public HUnaryOperation { 1078 class HOuterContext: public HUnaryOperation {
1079 public: 1079 public:
1080 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) { 1080 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) {
1081 set_representation(Representation::Tagged()); 1081 set_representation(Representation::Tagged());
1082 SetFlag(kUseGVN); 1082 SetFlag(kUseGVN);
1083 } 1083 }
1084 1084
1085 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer_context"); 1085 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer_context");
1086 1086
1087 protected: 1087 protected:
1088 virtual bool DataEquals(HValue* other) const { return true; } 1088 virtual bool DataEquals(HValue* other) { return true; }
1089 }; 1089 };
1090 1090
1091 1091
1092 class HGlobalObject: public HUnaryOperation { 1092 class HGlobalObject: public HUnaryOperation {
1093 public: 1093 public:
1094 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { 1094 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) {
1095 set_representation(Representation::Tagged()); 1095 set_representation(Representation::Tagged());
1096 SetFlag(kUseGVN); 1096 SetFlag(kUseGVN);
1097 } 1097 }
1098 1098
1099 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object") 1099 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object")
1100 1100
1101 protected: 1101 protected:
1102 virtual bool DataEquals(HValue* other) const { return true; } 1102 virtual bool DataEquals(HValue* other) { return true; }
1103 }; 1103 };
1104 1104
1105 1105
1106 class HGlobalReceiver: public HUnaryOperation { 1106 class HGlobalReceiver: public HUnaryOperation {
1107 public: 1107 public:
1108 explicit HGlobalReceiver(HValue* global_object) 1108 explicit HGlobalReceiver(HValue* global_object)
1109 : HUnaryOperation(global_object) { 1109 : HUnaryOperation(global_object) {
1110 set_representation(Representation::Tagged()); 1110 set_representation(Representation::Tagged());
1111 SetFlag(kUseGVN); 1111 SetFlag(kUseGVN);
1112 } 1112 }
1113 1113
1114 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver") 1114 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver")
1115 1115
1116 protected: 1116 protected:
1117 virtual bool DataEquals(HValue* other) const { return true; } 1117 virtual bool DataEquals(HValue* other) { return true; }
1118 }; 1118 };
1119 1119
1120 1120
1121 class HCall: public HInstruction { 1121 class HCall: public HInstruction {
1122 public: 1122 public:
1123 // The argument count includes the receiver. 1123 // The argument count includes the receiver.
1124 explicit HCall(int argument_count) : argument_count_(argument_count) { 1124 explicit HCall(int argument_count) : argument_count_(argument_count) {
1125 set_representation(Representation::Tagged()); 1125 set_representation(Representation::Tagged());
1126 SetAllSideEffects(); 1126 SetAllSideEffects();
1127 } 1127 }
1128 1128
1129 virtual HType CalculateInferredType() const { return HType::Tagged(); } 1129 virtual HType CalculateInferredType() { return HType::Tagged(); }
1130 1130
1131 virtual int argument_count() const { return argument_count_; } 1131 virtual int argument_count() const { return argument_count_; }
1132 1132
1133 virtual void PrintDataTo(StringStream* stream) const; 1133 virtual void PrintDataTo(StringStream* stream);
1134 1134
1135 DECLARE_INSTRUCTION(Call) 1135 DECLARE_INSTRUCTION(Call)
1136 1136
1137 private: 1137 private:
1138 int argument_count_; 1138 int argument_count_;
1139 }; 1139 };
1140 1140
1141 1141
1142 class HUnaryCall: public HCall { 1142 class HUnaryCall: public HCall {
1143 public: 1143 public:
1144 HUnaryCall(HValue* value, int argument_count) 1144 HUnaryCall(HValue* value, int argument_count)
1145 : HCall(argument_count), value_(NULL) { 1145 : HCall(argument_count), value_(NULL) {
1146 SetOperandAt(0, value); 1146 SetOperandAt(0, value);
1147 } 1147 }
1148 1148
1149 virtual void PrintDataTo(StringStream* stream) const; 1149 virtual void PrintDataTo(StringStream* stream);
1150 1150
1151 HValue* value() const { return value_; } 1151 HValue* value() const { return value_; }
1152 1152
1153 virtual int OperandCount() const { return 1; } 1153 virtual int OperandCount() const { return 1; }
1154 virtual HValue* OperandAt(int index) const { 1154 virtual HValue* OperandAt(int index) const {
1155 ASSERT(index == 0); 1155 ASSERT(index == 0);
1156 return value_; 1156 return value_;
1157 } 1157 }
1158 1158
1159 DECLARE_INSTRUCTION(UnaryCall) 1159 DECLARE_INSTRUCTION(UnaryCall)
(...skipping 10 matching lines...) Expand all
1170 1170
1171 1171
1172 class HBinaryCall: public HCall { 1172 class HBinaryCall: public HCall {
1173 public: 1173 public:
1174 HBinaryCall(HValue* first, HValue* second, int argument_count) 1174 HBinaryCall(HValue* first, HValue* second, int argument_count)
1175 : HCall(argument_count) { 1175 : HCall(argument_count) {
1176 SetOperandAt(0, first); 1176 SetOperandAt(0, first);
1177 SetOperandAt(1, second); 1177 SetOperandAt(1, second);
1178 } 1178 }
1179 1179
1180 virtual void PrintDataTo(StringStream* stream) const; 1180 virtual void PrintDataTo(StringStream* stream);
1181 1181
1182 HValue* first() const { return operands_[0]; } 1182 HValue* first() const { return operands_[0]; }
1183 HValue* second() const { return operands_[1]; } 1183 HValue* second() const { return operands_[1]; }
1184 1184
1185 virtual int OperandCount() const { return 2; } 1185 virtual int OperandCount() const { return 2; }
1186 virtual HValue* OperandAt(int index) const { return operands_[index]; } 1186 virtual HValue* OperandAt(int index) const { return operands_[index]; }
1187 1187
1188 DECLARE_INSTRUCTION(BinaryCall) 1188 DECLARE_INSTRUCTION(BinaryCall)
1189 1189
1190 protected: 1190 protected:
(...skipping 10 matching lines...) Expand all
1201 public: 1201 public:
1202 HCallConstantFunction(Handle<JSFunction> function, int argument_count) 1202 HCallConstantFunction(Handle<JSFunction> function, int argument_count)
1203 : HCall(argument_count), function_(function) { } 1203 : HCall(argument_count), function_(function) { }
1204 1204
1205 Handle<JSFunction> function() const { return function_; } 1205 Handle<JSFunction> function() const { return function_; }
1206 1206
1207 bool IsApplyFunction() const { 1207 bool IsApplyFunction() const {
1208 return function_->code() == Builtins::builtin(Builtins::FunctionApply); 1208 return function_->code() == Builtins::builtin(Builtins::FunctionApply);
1209 } 1209 }
1210 1210
1211 virtual void PrintDataTo(StringStream* stream) const; 1211 virtual void PrintDataTo(StringStream* stream);
1212 1212
1213 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call_constant_function") 1213 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call_constant_function")
1214 1214
1215 private: 1215 private:
1216 Handle<JSFunction> function_; 1216 Handle<JSFunction> function_;
1217 }; 1217 };
1218 1218
1219 1219
1220 class HCallKeyed: public HBinaryCall { 1220 class HCallKeyed: public HBinaryCall {
1221 public: 1221 public:
(...skipping 11 matching lines...) Expand all
1233 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call_keyed") 1233 DECLARE_CONCRETE_INSTRUCTION(CallKeyed, "call_keyed")
1234 }; 1234 };
1235 1235
1236 1236
1237 class HCallNamed: public HUnaryCall { 1237 class HCallNamed: public HUnaryCall {
1238 public: 1238 public:
1239 HCallNamed(HValue* context, Handle<String> name, int argument_count) 1239 HCallNamed(HValue* context, Handle<String> name, int argument_count)
1240 : HUnaryCall(context, argument_count), name_(name) { 1240 : HUnaryCall(context, argument_count), name_(name) {
1241 } 1241 }
1242 1242
1243 virtual void PrintDataTo(StringStream* stream) const; 1243 virtual void PrintDataTo(StringStream* stream);
1244 1244
1245 HValue* context() const { return value(); } 1245 HValue* context() const { return value(); }
1246 Handle<String> name() const { return name_; } 1246 Handle<String> name() const { return name_; }
1247 1247
1248 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call_named") 1248 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call_named")
1249 1249
1250 private: 1250 private:
1251 Handle<String> name_; 1251 Handle<String> name_;
1252 }; 1252 };
1253 1253
1254 1254
1255 class HCallFunction: public HUnaryCall { 1255 class HCallFunction: public HUnaryCall {
1256 public: 1256 public:
1257 HCallFunction(HValue* context, int argument_count) 1257 HCallFunction(HValue* context, int argument_count)
1258 : HUnaryCall(context, argument_count) { 1258 : HUnaryCall(context, argument_count) {
1259 } 1259 }
1260 1260
1261 HValue* context() const { return value(); } 1261 HValue* context() const { return value(); }
1262 1262
1263 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call_function") 1263 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call_function")
1264 }; 1264 };
1265 1265
1266 1266
1267 class HCallGlobal: public HUnaryCall { 1267 class HCallGlobal: public HUnaryCall {
1268 public: 1268 public:
1269 HCallGlobal(HValue* context, Handle<String> name, int argument_count) 1269 HCallGlobal(HValue* context, Handle<String> name, int argument_count)
1270 : HUnaryCall(context, argument_count), name_(name) { 1270 : HUnaryCall(context, argument_count), name_(name) {
1271 } 1271 }
1272 1272
1273 virtual void PrintDataTo(StringStream* stream) const; 1273 virtual void PrintDataTo(StringStream* stream);
1274 1274
1275 HValue* context() const { return value(); } 1275 HValue* context() const { return value(); }
1276 Handle<String> name() const { return name_; } 1276 Handle<String> name() const { return name_; }
1277 1277
1278 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call_global") 1278 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call_global")
1279 1279
1280 private: 1280 private:
1281 Handle<String> name_; 1281 Handle<String> name_;
1282 }; 1282 };
1283 1283
1284 1284
1285 class HCallKnownGlobal: public HCall { 1285 class HCallKnownGlobal: public HCall {
1286 public: 1286 public:
1287 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) 1287 HCallKnownGlobal(Handle<JSFunction> target, int argument_count)
1288 : HCall(argument_count), target_(target) { } 1288 : HCall(argument_count), target_(target) { }
1289 1289
1290 virtual void PrintDataTo(StringStream* stream) const; 1290 virtual void PrintDataTo(StringStream* stream);
1291 1291
1292 Handle<JSFunction> target() const { return target_; } 1292 Handle<JSFunction> target() const { return target_; }
1293 1293
1294 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call_known_global") 1294 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call_known_global")
1295 1295
1296 private: 1296 private:
1297 Handle<JSFunction> target_; 1297 Handle<JSFunction> target_;
1298 }; 1298 };
1299 1299
1300 1300
(...skipping 13 matching lines...) Expand all
1314 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call_new") 1314 DECLARE_CONCRETE_INSTRUCTION(CallNew, "call_new")
1315 }; 1315 };
1316 1316
1317 1317
1318 class HCallRuntime: public HCall { 1318 class HCallRuntime: public HCall {
1319 public: 1319 public:
1320 HCallRuntime(Handle<String> name, 1320 HCallRuntime(Handle<String> name,
1321 Runtime::Function* c_function, 1321 Runtime::Function* c_function,
1322 int argument_count) 1322 int argument_count)
1323 : HCall(argument_count), c_function_(c_function), name_(name) { } 1323 : HCall(argument_count), c_function_(c_function), name_(name) { }
1324 virtual void PrintDataTo(StringStream* stream) const; 1324 virtual void PrintDataTo(StringStream* stream);
1325 1325
1326 Runtime::Function* function() const { return c_function_; } 1326 Runtime::Function* function() const { return c_function_; }
1327 Handle<String> name() const { return name_; } 1327 Handle<String> name() const { return name_; }
1328 1328
1329 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call_runtime") 1329 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call_runtime")
1330 1330
1331 private: 1331 private:
1332 Runtime::Function* c_function_; 1332 Runtime::Function* c_function_;
1333 Handle<String> name_; 1333 Handle<String> name_;
1334 }; 1334 };
(...skipping 10 matching lines...) Expand all
1345 SetFlag(kUseGVN); 1345 SetFlag(kUseGVN);
1346 } 1346 }
1347 1347
1348 virtual Representation RequiredInputRepresentation(int index) const { 1348 virtual Representation RequiredInputRepresentation(int index) const {
1349 return Representation::Tagged(); 1349 return Representation::Tagged();
1350 } 1350 }
1351 1351
1352 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js_array_length") 1352 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength, "js_array_length")
1353 1353
1354 protected: 1354 protected:
1355 virtual bool DataEquals(HValue* other) const { return true; } 1355 virtual bool DataEquals(HValue* other) { return true; }
1356 }; 1356 };
1357 1357
1358 1358
1359 class HFixedArrayLength: public HUnaryOperation { 1359 class HFixedArrayLength: public HUnaryOperation {
1360 public: 1360 public:
1361 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) { 1361 explicit HFixedArrayLength(HValue* value) : HUnaryOperation(value) {
1362 set_representation(Representation::Tagged()); 1362 set_representation(Representation::Tagged());
1363 SetFlag(kDependsOnArrayLengths); 1363 SetFlag(kDependsOnArrayLengths);
1364 SetFlag(kUseGVN); 1364 SetFlag(kUseGVN);
1365 } 1365 }
1366 1366
1367 virtual Representation RequiredInputRepresentation(int index) const { 1367 virtual Representation RequiredInputRepresentation(int index) const {
1368 return Representation::Tagged(); 1368 return Representation::Tagged();
1369 } 1369 }
1370 1370
1371 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length") 1371 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length")
1372 1372
1373 protected: 1373 protected:
1374 virtual bool DataEquals(HValue* other) const { return true; } 1374 virtual bool DataEquals(HValue* other) { return true; }
1375 }; 1375 };
1376 1376
1377 1377
1378 class HPixelArrayLength: public HUnaryOperation { 1378 class HPixelArrayLength: public HUnaryOperation {
1379 public: 1379 public:
1380 explicit HPixelArrayLength(HValue* value) : HUnaryOperation(value) { 1380 explicit HPixelArrayLength(HValue* value) : HUnaryOperation(value) {
1381 set_representation(Representation::Integer32()); 1381 set_representation(Representation::Integer32());
1382 // The result of this instruction is idempotent as long as its inputs don't 1382 // The result of this instruction is idempotent as long as its inputs don't
1383 // change. The length of a pixel array cannot change once set, so it's not 1383 // change. The length of a pixel array cannot change once set, so it's not
1384 // necessary to introduce a kDependsOnArrayLengths or any other dependency. 1384 // necessary to introduce a kDependsOnArrayLengths or any other dependency.
1385 SetFlag(kUseGVN); 1385 SetFlag(kUseGVN);
1386 } 1386 }
1387 1387
1388 virtual Representation RequiredInputRepresentation(int index) const { 1388 virtual Representation RequiredInputRepresentation(int index) const {
1389 return Representation::Tagged(); 1389 return Representation::Tagged();
1390 } 1390 }
1391 1391
1392 DECLARE_CONCRETE_INSTRUCTION(PixelArrayLength, "pixel_array_length") 1392 DECLARE_CONCRETE_INSTRUCTION(PixelArrayLength, "pixel_array_length")
1393 1393
1394 protected: 1394 protected:
1395 virtual bool DataEquals(HValue* other) const { return true; } 1395 virtual bool DataEquals(HValue* other) { return true; }
1396 }; 1396 };
1397 1397
1398 1398
1399 class HBitNot: public HUnaryOperation { 1399 class HBitNot: public HUnaryOperation {
1400 public: 1400 public:
1401 explicit HBitNot(HValue* value) : HUnaryOperation(value) { 1401 explicit HBitNot(HValue* value) : HUnaryOperation(value) {
1402 set_representation(Representation::Integer32()); 1402 set_representation(Representation::Integer32());
1403 SetFlag(kUseGVN); 1403 SetFlag(kUseGVN);
1404 SetFlag(kTruncatingToInt32); 1404 SetFlag(kTruncatingToInt32);
1405 } 1405 }
1406 1406
1407 virtual Representation RequiredInputRepresentation(int index) const { 1407 virtual Representation RequiredInputRepresentation(int index) const {
1408 return Representation::Integer32(); 1408 return Representation::Integer32();
1409 } 1409 }
1410 virtual HType CalculateInferredType() const; 1410 virtual HType CalculateInferredType();
1411 1411
1412 DECLARE_CONCRETE_INSTRUCTION(BitNot, "bit_not") 1412 DECLARE_CONCRETE_INSTRUCTION(BitNot, "bit_not")
1413 1413
1414 protected: 1414 protected:
1415 virtual bool DataEquals(HValue* other) const { return true; } 1415 virtual bool DataEquals(HValue* other) { return true; }
1416 }; 1416 };
1417 1417
1418 1418
1419 class HUnaryMathOperation: public HUnaryOperation { 1419 class HUnaryMathOperation: public HUnaryOperation {
1420 public: 1420 public:
1421 HUnaryMathOperation(HValue* value, BuiltinFunctionId op) 1421 HUnaryMathOperation(HValue* value, BuiltinFunctionId op)
1422 : HUnaryOperation(value), op_(op) { 1422 : HUnaryOperation(value), op_(op) {
1423 switch (op) { 1423 switch (op) {
1424 case kMathFloor: 1424 case kMathFloor:
1425 case kMathRound: 1425 case kMathRound:
(...skipping 10 matching lines...) Expand all
1436 case kMathSin: 1436 case kMathSin:
1437 case kMathCos: 1437 case kMathCos:
1438 set_representation(Representation::Double()); 1438 set_representation(Representation::Double());
1439 break; 1439 break;
1440 default: 1440 default:
1441 UNREACHABLE(); 1441 UNREACHABLE();
1442 } 1442 }
1443 SetFlag(kUseGVN); 1443 SetFlag(kUseGVN);
1444 } 1444 }
1445 1445
1446 virtual void PrintDataTo(StringStream* stream) const; 1446 virtual void PrintDataTo(StringStream* stream);
1447 1447
1448 virtual HType CalculateInferredType() const; 1448 virtual HType CalculateInferredType();
1449 1449
1450 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 1450 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
1451 1451
1452 virtual Representation RequiredInputRepresentation(int index) const { 1452 virtual Representation RequiredInputRepresentation(int index) const {
1453 switch (op_) { 1453 switch (op_) {
1454 case kMathFloor: 1454 case kMathFloor:
1455 case kMathRound: 1455 case kMathRound:
1456 case kMathCeil: 1456 case kMathCeil:
1457 case kMathSqrt: 1457 case kMathSqrt:
1458 case kMathPowHalf: 1458 case kMathPowHalf:
(...skipping 19 matching lines...) Expand all
1478 } 1478 }
1479 return this; 1479 return this;
1480 } 1480 }
1481 1481
1482 BuiltinFunctionId op() const { return op_; } 1482 BuiltinFunctionId op() const { return op_; }
1483 const char* OpName() const; 1483 const char* OpName() const;
1484 1484
1485 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary_math_operation") 1485 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation, "unary_math_operation")
1486 1486
1487 protected: 1487 protected:
1488 virtual bool DataEquals(HValue* other) const { 1488 virtual bool DataEquals(HValue* other) {
1489 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); 1489 HUnaryMathOperation* b = HUnaryMathOperation::cast(other);
1490 return op_ == b->op(); 1490 return op_ == b->op();
1491 } 1491 }
1492 1492
1493 private: 1493 private:
1494 BuiltinFunctionId op_; 1494 BuiltinFunctionId op_;
1495 }; 1495 };
1496 1496
1497 1497
1498 class HLoadElements: public HUnaryOperation { 1498 class HLoadElements: public HUnaryOperation {
1499 public: 1499 public:
1500 explicit HLoadElements(HValue* value) : HUnaryOperation(value) { 1500 explicit HLoadElements(HValue* value) : HUnaryOperation(value) {
1501 set_representation(Representation::Tagged()); 1501 set_representation(Representation::Tagged());
1502 SetFlag(kUseGVN); 1502 SetFlag(kUseGVN);
1503 SetFlag(kDependsOnMaps); 1503 SetFlag(kDependsOnMaps);
1504 } 1504 }
1505 1505
1506 virtual Representation RequiredInputRepresentation(int index) const { 1506 virtual Representation RequiredInputRepresentation(int index) const {
1507 return Representation::Tagged(); 1507 return Representation::Tagged();
1508 } 1508 }
1509 1509
1510 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements") 1510 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1511 1511
1512 protected: 1512 protected:
1513 virtual bool DataEquals(HValue* other) const { return true; } 1513 virtual bool DataEquals(HValue* other) { return true; }
1514 }; 1514 };
1515 1515
1516 1516
1517 class HLoadPixelArrayExternalPointer: public HUnaryOperation { 1517 class HLoadPixelArrayExternalPointer: public HUnaryOperation {
1518 public: 1518 public:
1519 explicit HLoadPixelArrayExternalPointer(HValue* value) 1519 explicit HLoadPixelArrayExternalPointer(HValue* value)
1520 : HUnaryOperation(value) { 1520 : HUnaryOperation(value) {
1521 set_representation(Representation::External()); 1521 set_representation(Representation::External());
1522 // The result of this instruction is idempotent as long as its inputs don't 1522 // The result of this instruction is idempotent as long as its inputs don't
1523 // change. The external array of a pixel array elements object cannot 1523 // change. The external array of a pixel array elements object cannot
1524 // change once set, so it's no necessary to introduce any additional 1524 // change once set, so it's no necessary to introduce any additional
1525 // dependencies on top of the inputs. 1525 // dependencies on top of the inputs.
1526 SetFlag(kUseGVN); 1526 SetFlag(kUseGVN);
1527 } 1527 }
1528 1528
1529 virtual Representation RequiredInputRepresentation(int index) const { 1529 virtual Representation RequiredInputRepresentation(int index) const {
1530 return Representation::Tagged(); 1530 return Representation::Tagged();
1531 } 1531 }
1532 1532
1533 DECLARE_CONCRETE_INSTRUCTION(LoadPixelArrayExternalPointer, 1533 DECLARE_CONCRETE_INSTRUCTION(LoadPixelArrayExternalPointer,
1534 "load-pixel-array-external-pointer") 1534 "load-pixel-array-external-pointer")
1535 1535
1536 protected: 1536 protected:
1537 virtual bool DataEquals(HValue* other) const { return true; } 1537 virtual bool DataEquals(HValue* other) { return true; }
1538 }; 1538 };
1539 1539
1540 1540
1541 class HCheckMap: public HUnaryOperation { 1541 class HCheckMap: public HUnaryOperation {
1542 public: 1542 public:
1543 HCheckMap(HValue* value, Handle<Map> map) 1543 HCheckMap(HValue* value, Handle<Map> map)
1544 : HUnaryOperation(value), map_(map) { 1544 : HUnaryOperation(value), map_(map) {
1545 set_representation(Representation::Tagged()); 1545 set_representation(Representation::Tagged());
1546 SetFlag(kUseGVN); 1546 SetFlag(kUseGVN);
1547 SetFlag(kDependsOnMaps); 1547 SetFlag(kDependsOnMaps);
1548 } 1548 }
1549 1549
1550 virtual bool IsCheckInstruction() const { return true; } 1550 virtual bool IsCheckInstruction() const { return true; }
1551 1551
1552 virtual Representation RequiredInputRepresentation(int index) const { 1552 virtual Representation RequiredInputRepresentation(int index) const {
1553 return Representation::Tagged(); 1553 return Representation::Tagged();
1554 } 1554 }
1555 virtual void PrintDataTo(StringStream* stream) const; 1555 virtual void PrintDataTo(StringStream* stream);
1556 virtual HType CalculateInferredType() const; 1556 virtual HType CalculateInferredType();
1557 1557
1558 #ifdef DEBUG 1558 #ifdef DEBUG
1559 virtual void Verify(); 1559 virtual void Verify();
1560 #endif 1560 #endif
1561 1561
1562 Handle<Map> map() const { return map_; } 1562 Handle<Map> map() const { return map_; }
1563 1563
1564 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check_map") 1564 DECLARE_CONCRETE_INSTRUCTION(CheckMap, "check_map")
1565 1565
1566 protected: 1566 protected:
1567 virtual bool DataEquals(HValue* other) const { 1567 virtual bool DataEquals(HValue* other) {
1568 HCheckMap* b = HCheckMap::cast(other); 1568 HCheckMap* b = HCheckMap::cast(other);
1569 return map_.is_identical_to(b->map()); 1569 return map_.is_identical_to(b->map());
1570 } 1570 }
1571 1571
1572 private: 1572 private:
1573 Handle<Map> map_; 1573 Handle<Map> map_;
1574 }; 1574 };
1575 1575
1576 1576
1577 class HCheckFunction: public HUnaryOperation { 1577 class HCheckFunction: public HUnaryOperation {
1578 public: 1578 public:
1579 HCheckFunction(HValue* value, Handle<JSFunction> function) 1579 HCheckFunction(HValue* value, Handle<JSFunction> function)
1580 : HUnaryOperation(value), target_(function) { 1580 : HUnaryOperation(value), target_(function) {
1581 set_representation(Representation::Tagged()); 1581 set_representation(Representation::Tagged());
1582 SetFlag(kUseGVN); 1582 SetFlag(kUseGVN);
1583 } 1583 }
1584 1584
1585 virtual bool IsCheckInstruction() const { return true; } 1585 virtual bool IsCheckInstruction() const { return true; }
1586 1586
1587 virtual Representation RequiredInputRepresentation(int index) const { 1587 virtual Representation RequiredInputRepresentation(int index) const {
1588 return Representation::Tagged(); 1588 return Representation::Tagged();
1589 } 1589 }
1590 virtual void PrintDataTo(StringStream* stream) const; 1590 virtual void PrintDataTo(StringStream* stream);
1591 virtual HType CalculateInferredType() const; 1591 virtual HType CalculateInferredType();
1592 1592
1593 #ifdef DEBUG 1593 #ifdef DEBUG
1594 virtual void Verify(); 1594 virtual void Verify();
1595 #endif 1595 #endif
1596 1596
1597 Handle<JSFunction> target() const { return target_; } 1597 Handle<JSFunction> target() const { return target_; }
1598 1598
1599 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check_function") 1599 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check_function")
1600 1600
1601 protected: 1601 protected:
1602 virtual bool DataEquals(HValue* other) const { 1602 virtual bool DataEquals(HValue* other) {
1603 HCheckFunction* b = HCheckFunction::cast(other); 1603 HCheckFunction* b = HCheckFunction::cast(other);
1604 return target_.is_identical_to(b->target()); 1604 return target_.is_identical_to(b->target());
1605 } 1605 }
1606 1606
1607 private: 1607 private:
1608 Handle<JSFunction> target_; 1608 Handle<JSFunction> target_;
1609 }; 1609 };
1610 1610
1611 1611
1612 class HCheckInstanceType: public HUnaryOperation { 1612 class HCheckInstanceType: public HUnaryOperation {
(...skipping 27 matching lines...) Expand all
1640 1640
1641 InstanceType first() const { return first_; } 1641 InstanceType first() const { return first_; }
1642 InstanceType last() const { return last_; } 1642 InstanceType last() const { return last_; }
1643 1643
1644 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check_instance_type") 1644 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType, "check_instance_type")
1645 1645
1646 protected: 1646 protected:
1647 // TODO(ager): It could be nice to allow the ommision of instance 1647 // TODO(ager): It could be nice to allow the ommision of instance
1648 // type checks if we have already performed an instance type check 1648 // type checks if we have already performed an instance type check
1649 // with a larger range. 1649 // with a larger range.
1650 virtual bool DataEquals(HValue* other) const { 1650 virtual bool DataEquals(HValue* other) {
1651 HCheckInstanceType* b = HCheckInstanceType::cast(other); 1651 HCheckInstanceType* b = HCheckInstanceType::cast(other);
1652 return (first_ == b->first()) && (last_ == b->last()); 1652 return (first_ == b->first()) && (last_ == b->last());
1653 } 1653 }
1654 1654
1655 private: 1655 private:
1656 InstanceType first_; 1656 InstanceType first_;
1657 InstanceType last_; 1657 InstanceType last_;
1658 }; 1658 };
1659 1659
1660 1660
1661 class HCheckNonSmi: public HUnaryOperation { 1661 class HCheckNonSmi: public HUnaryOperation {
1662 public: 1662 public:
1663 explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) { 1663 explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) {
1664 set_representation(Representation::Tagged()); 1664 set_representation(Representation::Tagged());
1665 SetFlag(kUseGVN); 1665 SetFlag(kUseGVN);
1666 } 1666 }
1667 1667
1668 virtual bool IsCheckInstruction() const { return true; } 1668 virtual bool IsCheckInstruction() const { return true; }
1669 1669
1670 virtual Representation RequiredInputRepresentation(int index) const { 1670 virtual Representation RequiredInputRepresentation(int index) const {
1671 return Representation::Tagged(); 1671 return Representation::Tagged();
1672 } 1672 }
1673 1673
1674 virtual HType CalculateInferredType() const; 1674 virtual HType CalculateInferredType();
1675 1675
1676 #ifdef DEBUG 1676 #ifdef DEBUG
1677 virtual void Verify(); 1677 virtual void Verify();
1678 #endif 1678 #endif
1679 1679
1680 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi") 1680 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check_non_smi")
1681 1681
1682 protected: 1682 protected:
1683 virtual bool DataEquals(HValue* other) const { return true; } 1683 virtual bool DataEquals(HValue* other) { return true; }
1684 }; 1684 };
1685 1685
1686 1686
1687 class HCheckPrototypeMaps: public HInstruction { 1687 class HCheckPrototypeMaps: public HInstruction {
1688 public: 1688 public:
1689 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) 1689 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder)
1690 : prototype_(prototype), holder_(holder) { 1690 : prototype_(prototype), holder_(holder) {
1691 SetFlag(kUseGVN); 1691 SetFlag(kUseGVN);
1692 SetFlag(kDependsOnMaps); 1692 SetFlag(kDependsOnMaps);
1693 } 1693 }
1694 1694
1695 virtual bool IsCheckInstruction() const { return true; } 1695 virtual bool IsCheckInstruction() const { return true; }
1696 1696
1697 #ifdef DEBUG 1697 #ifdef DEBUG
1698 virtual void Verify(); 1698 virtual void Verify();
1699 #endif 1699 #endif
1700 1700
1701 Handle<JSObject> prototype() const { return prototype_; } 1701 Handle<JSObject> prototype() const { return prototype_; }
1702 Handle<JSObject> holder() const { return holder_; } 1702 Handle<JSObject> holder() const { return holder_; }
1703 1703
1704 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps") 1704 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps")
1705 1705
1706 virtual intptr_t Hashcode() const { 1706 virtual intptr_t Hashcode() {
1707 ASSERT(!Heap::IsAllocationAllowed()); 1707 ASSERT(!Heap::IsAllocationAllowed());
1708 intptr_t hash = reinterpret_cast<intptr_t>(*prototype()); 1708 intptr_t hash = reinterpret_cast<intptr_t>(*prototype());
1709 hash = 17 * hash + reinterpret_cast<intptr_t>(*holder()); 1709 hash = 17 * hash + reinterpret_cast<intptr_t>(*holder());
1710 return hash; 1710 return hash;
1711 } 1711 }
1712 1712
1713 protected: 1713 protected:
1714 virtual bool DataEquals(HValue* other) const { 1714 virtual bool DataEquals(HValue* other) {
1715 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); 1715 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other);
1716 return prototype_.is_identical_to(b->prototype()) && 1716 return prototype_.is_identical_to(b->prototype()) &&
1717 holder_.is_identical_to(b->holder()); 1717 holder_.is_identical_to(b->holder());
1718 } 1718 }
1719 1719
1720 private: 1720 private:
1721 Handle<JSObject> prototype_; 1721 Handle<JSObject> prototype_;
1722 Handle<JSObject> holder_; 1722 Handle<JSObject> holder_;
1723 }; 1723 };
1724 1724
1725 1725
1726 class HCheckSmi: public HUnaryOperation { 1726 class HCheckSmi: public HUnaryOperation {
1727 public: 1727 public:
1728 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { 1728 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) {
1729 set_representation(Representation::Tagged()); 1729 set_representation(Representation::Tagged());
1730 SetFlag(kUseGVN); 1730 SetFlag(kUseGVN);
1731 } 1731 }
1732 1732
1733 virtual bool IsCheckInstruction() const { return true; } 1733 virtual bool IsCheckInstruction() const { return true; }
1734 1734
1735 virtual Representation RequiredInputRepresentation(int index) const { 1735 virtual Representation RequiredInputRepresentation(int index) const {
1736 return Representation::Tagged(); 1736 return Representation::Tagged();
1737 } 1737 }
1738 virtual HType CalculateInferredType() const; 1738 virtual HType CalculateInferredType();
1739 1739
1740 #ifdef DEBUG 1740 #ifdef DEBUG
1741 virtual void Verify(); 1741 virtual void Verify();
1742 #endif 1742 #endif
1743 1743
1744 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check_smi") 1744 DECLARE_CONCRETE_INSTRUCTION(CheckSmi, "check_smi")
1745 1745
1746 protected: 1746 protected:
1747 virtual bool DataEquals(HValue* other) const { return true; } 1747 virtual bool DataEquals(HValue* other) { return true; }
1748 }; 1748 };
1749 1749
1750 1750
1751 class HPhi: public HValue { 1751 class HPhi: public HValue {
1752 public: 1752 public:
1753 explicit HPhi(int merged_index) 1753 explicit HPhi(int merged_index)
1754 : inputs_(2), 1754 : inputs_(2),
1755 merged_index_(merged_index), 1755 merged_index_(merged_index),
1756 phi_id_(-1) { 1756 phi_id_(-1) {
1757 for (int i = 0; i < Representation::kNumRepresentations; i++) { 1757 for (int i = 0; i < Representation::kNumRepresentations; i++) {
1758 non_phi_uses_[i] = 0; 1758 non_phi_uses_[i] = 0;
1759 indirect_uses_[i] = 0; 1759 indirect_uses_[i] = 0;
1760 } 1760 }
1761 ASSERT(merged_index >= 0); 1761 ASSERT(merged_index >= 0);
1762 set_representation(Representation::Tagged()); 1762 set_representation(Representation::Tagged());
1763 SetFlag(kFlexibleRepresentation); 1763 SetFlag(kFlexibleRepresentation);
1764 } 1764 }
1765 1765
1766 virtual Representation InferredRepresentation() const { 1766 virtual Representation InferredRepresentation() {
1767 bool double_occurred = false; 1767 bool double_occurred = false;
1768 bool int32_occurred = false; 1768 bool int32_occurred = false;
1769 for (int i = 0; i < OperandCount(); ++i) { 1769 for (int i = 0; i < OperandCount(); ++i) {
1770 HValue* value = OperandAt(i); 1770 HValue* value = OperandAt(i);
1771 if (value->representation().IsDouble()) double_occurred = true; 1771 if (value->representation().IsDouble()) double_occurred = true;
1772 if (value->representation().IsInteger32()) int32_occurred = true; 1772 if (value->representation().IsInteger32()) int32_occurred = true;
1773 if (value->representation().IsTagged()) return Representation::Tagged(); 1773 if (value->representation().IsTagged()) return Representation::Tagged();
1774 } 1774 }
1775 1775
1776 if (double_occurred) return Representation::Double(); 1776 if (double_occurred) return Representation::Double();
1777 if (int32_occurred) return Representation::Integer32(); 1777 if (int32_occurred) return Representation::Integer32();
1778 return Representation::None(); 1778 return Representation::None();
1779 } 1779 }
1780 1780
1781 virtual Range* InferRange(); 1781 virtual Range* InferRange();
1782 virtual Representation RequiredInputRepresentation(int index) const { 1782 virtual Representation RequiredInputRepresentation(int index) const {
1783 return representation(); 1783 return representation();
1784 } 1784 }
1785 virtual HType CalculateInferredType() const; 1785 virtual HType CalculateInferredType();
1786 virtual int OperandCount() const { return inputs_.length(); } 1786 virtual int OperandCount() const { return inputs_.length(); }
1787 virtual HValue* OperandAt(int index) const { return inputs_[index]; } 1787 virtual HValue* OperandAt(int index) const { return inputs_[index]; }
1788 HValue* GetRedundantReplacement() const; 1788 HValue* GetRedundantReplacement() const;
1789 void AddInput(HValue* value); 1789 void AddInput(HValue* value);
1790 1790
1791 bool IsReceiver() { return merged_index_ == 0; } 1791 bool IsReceiver() { return merged_index_ == 0; }
1792 1792
1793 int merged_index() const { return merged_index_; } 1793 int merged_index() const { return merged_index_; }
1794 1794
1795 virtual const char* Mnemonic() const { return "phi"; } 1795 virtual const char* Mnemonic() const { return "phi"; }
1796 1796
1797 virtual void PrintTo(StringStream* stream) const; 1797 virtual void PrintTo(StringStream* stream);
1798 1798
1799 #ifdef DEBUG 1799 #ifdef DEBUG
1800 virtual void Verify(); 1800 virtual void Verify();
1801 #endif 1801 #endif
1802 1802
1803 DECLARE_INSTRUCTION(Phi) 1803 DECLARE_INSTRUCTION(Phi)
1804 1804
1805 void InitRealUses(int id); 1805 void InitRealUses(int id);
1806 void AddNonPhiUsesFrom(HPhi* other); 1806 void AddNonPhiUsesFrom(HPhi* other);
1807 void AddIndirectUsesTo(int* use_count); 1807 void AddIndirectUsesTo(int* use_count);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 1855
1856 class HConstant: public HInstruction { 1856 class HConstant: public HInstruction {
1857 public: 1857 public:
1858 HConstant(Handle<Object> handle, Representation r); 1858 HConstant(Handle<Object> handle, Representation r);
1859 1859
1860 Handle<Object> handle() const { return handle_; } 1860 Handle<Object> handle() const { return handle_; }
1861 1861
1862 bool InOldSpace() const { return !Heap::InNewSpace(*handle_); } 1862 bool InOldSpace() const { return !Heap::InNewSpace(*handle_); }
1863 1863
1864 virtual bool EmitAtUses() const { return !representation().IsDouble(); } 1864 virtual bool EmitAtUses() const { return !representation().IsDouble(); }
1865 virtual void PrintDataTo(StringStream* stream) const; 1865 virtual void PrintDataTo(StringStream* stream);
1866 virtual HType CalculateInferredType() const; 1866 virtual HType CalculateInferredType();
1867 bool IsInteger() const { return handle_->IsSmi(); } 1867 bool IsInteger() const { return handle_->IsSmi(); }
1868 HConstant* CopyToRepresentation(Representation r) const; 1868 HConstant* CopyToRepresentation(Representation r) const;
1869 HConstant* CopyToTruncatedInt32() const; 1869 HConstant* CopyToTruncatedInt32() const;
1870 bool HasInteger32Value() const { return has_int32_value_; } 1870 bool HasInteger32Value() const { return has_int32_value_; }
1871 int32_t Integer32Value() const { 1871 int32_t Integer32Value() const {
1872 ASSERT(HasInteger32Value()); 1872 ASSERT(HasInteger32Value());
1873 return int32_value_; 1873 return int32_value_;
1874 } 1874 }
1875 bool HasDoubleValue() const { return has_double_value_; } 1875 bool HasDoubleValue() const { return has_double_value_; }
1876 double DoubleValue() const { 1876 double DoubleValue() const {
1877 ASSERT(HasDoubleValue()); 1877 ASSERT(HasDoubleValue());
1878 return double_value_; 1878 return double_value_;
1879 } 1879 }
1880 bool HasStringValue() const { return handle_->IsString(); } 1880 bool HasStringValue() const { return handle_->IsString(); }
1881 1881
1882 virtual intptr_t Hashcode() const { 1882 virtual intptr_t Hashcode() {
1883 ASSERT(!Heap::allow_allocation(false)); 1883 ASSERT(!Heap::allow_allocation(false));
1884 return reinterpret_cast<intptr_t>(*handle()); 1884 return reinterpret_cast<intptr_t>(*handle());
1885 } 1885 }
1886 1886
1887 #ifdef DEBUG 1887 #ifdef DEBUG
1888 virtual void Verify() { } 1888 virtual void Verify() { }
1889 #endif 1889 #endif
1890 1890
1891 DECLARE_CONCRETE_INSTRUCTION(Constant, "constant") 1891 DECLARE_CONCRETE_INSTRUCTION(Constant, "constant")
1892 1892
1893 protected: 1893 protected:
1894 virtual Range* InferRange(); 1894 virtual Range* InferRange();
1895 1895
1896 virtual bool DataEquals(HValue* other) const { 1896 virtual bool DataEquals(HValue* other) {
1897 HConstant* other_constant = HConstant::cast(other); 1897 HConstant* other_constant = HConstant::cast(other);
1898 return handle().is_identical_to(other_constant->handle()); 1898 return handle().is_identical_to(other_constant->handle());
1899 } 1899 }
1900 1900
1901 private: 1901 private:
1902 Handle<Object> handle_; 1902 Handle<Object> handle_;
1903 HType constant_type_; 1903 HType constant_type_;
1904 1904
1905 // The following two values represent the int32 and the double value of the 1905 // The following two values represent the int32 and the double value of the
1906 // given constant if there is a lossless conversion between the constant 1906 // given constant if there is a lossless conversion between the constant
(...skipping 22 matching lines...) Expand all
1929 if (IsCommutative() && left()->IsConstant()) return right(); 1929 if (IsCommutative() && left()->IsConstant()) return right();
1930 return left(); 1930 return left();
1931 } 1931 }
1932 HValue* MostConstantOperand() const { 1932 HValue* MostConstantOperand() const {
1933 if (IsCommutative() && left()->IsConstant()) return left(); 1933 if (IsCommutative() && left()->IsConstant()) return left();
1934 return right(); 1934 return right();
1935 } 1935 }
1936 1936
1937 virtual bool IsCommutative() const { return false; } 1937 virtual bool IsCommutative() const { return false; }
1938 1938
1939 virtual void PrintDataTo(StringStream* stream) const; 1939 virtual void PrintDataTo(StringStream* stream);
1940 virtual int OperandCount() const { return operands_.length(); } 1940 virtual int OperandCount() const { return operands_.length(); }
1941 virtual HValue* OperandAt(int index) const { return operands_[index]; } 1941 virtual HValue* OperandAt(int index) const { return operands_[index]; }
1942 1942
1943 DECLARE_INSTRUCTION(BinaryOperation) 1943 DECLARE_INSTRUCTION(BinaryOperation)
1944 1944
1945 protected: 1945 protected:
1946 virtual void InternalSetOperandAt(int index, HValue* value) { 1946 virtual void InternalSetOperandAt(int index, HValue* value) {
1947 operands_[index] = value; 1947 operands_[index] = value;
1948 } 1948 }
1949 1949
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 HArgumentsElements() { 1997 HArgumentsElements() {
1998 // The value produced by this instruction is a pointer into the stack 1998 // The value produced by this instruction is a pointer into the stack
1999 // that looks as if it was a smi because of alignment. 1999 // that looks as if it was a smi because of alignment.
2000 set_representation(Representation::Tagged()); 2000 set_representation(Representation::Tagged());
2001 SetFlag(kUseGVN); 2001 SetFlag(kUseGVN);
2002 } 2002 }
2003 2003
2004 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments_elements") 2004 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments_elements")
2005 2005
2006 protected: 2006 protected:
2007 virtual bool DataEquals(HValue* other) const { return true; } 2007 virtual bool DataEquals(HValue* other) { return true; }
2008 }; 2008 };
2009 2009
2010 2010
2011 class HArgumentsLength: public HUnaryOperation { 2011 class HArgumentsLength: public HUnaryOperation {
2012 public: 2012 public:
2013 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { 2013 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) {
2014 set_representation(Representation::Integer32()); 2014 set_representation(Representation::Integer32());
2015 SetFlag(kUseGVN); 2015 SetFlag(kUseGVN);
2016 } 2016 }
2017 2017
2018 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length") 2018 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length")
2019 2019
2020 protected: 2020 protected:
2021 virtual bool DataEquals(HValue* other) const { return true; } 2021 virtual bool DataEquals(HValue* other) { return true; }
2022 }; 2022 };
2023 2023
2024 2024
2025 class HAccessArgumentsAt: public HInstruction { 2025 class HAccessArgumentsAt: public HInstruction {
2026 public: 2026 public:
2027 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { 2027 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) {
2028 set_representation(Representation::Tagged()); 2028 set_representation(Representation::Tagged());
2029 SetFlag(kUseGVN); 2029 SetFlag(kUseGVN);
2030 SetOperandAt(0, arguments); 2030 SetOperandAt(0, arguments);
2031 SetOperandAt(1, length); 2031 SetOperandAt(1, length);
2032 SetOperandAt(2, index); 2032 SetOperandAt(2, index);
2033 } 2033 }
2034 2034
2035 virtual void PrintDataTo(StringStream* stream) const; 2035 virtual void PrintDataTo(StringStream* stream);
2036 2036
2037 virtual Representation RequiredInputRepresentation(int index) const { 2037 virtual Representation RequiredInputRepresentation(int index) const {
2038 // The arguments elements is considered tagged. 2038 // The arguments elements is considered tagged.
2039 return index == 0 2039 return index == 0
2040 ? Representation::Tagged() 2040 ? Representation::Tagged()
2041 : Representation::Integer32(); 2041 : Representation::Integer32();
2042 } 2042 }
2043 2043
2044 HValue* arguments() const { return operands_[0]; } 2044 HValue* arguments() const { return operands_[0]; }
2045 HValue* length() const { return operands_[1]; } 2045 HValue* length() const { return operands_[1]; }
2046 HValue* index() const { return operands_[2]; } 2046 HValue* index() const { return operands_[2]; }
2047 2047
2048 virtual int OperandCount() const { return operands_.length(); } 2048 virtual int OperandCount() const { return operands_.length(); }
2049 virtual HValue* OperandAt(int index) const { return operands_[index]; } 2049 virtual HValue* OperandAt(int index) const { return operands_[index]; }
2050 2050
2051 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access_arguments_at") 2051 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt, "access_arguments_at")
2052 2052
2053 protected: 2053 protected:
2054 virtual void InternalSetOperandAt(int index, HValue* value) { 2054 virtual void InternalSetOperandAt(int index, HValue* value) {
2055 operands_[index] = value; 2055 operands_[index] = value;
2056 } 2056 }
2057 2057
2058 virtual bool DataEquals(HValue* other) const { return true; } 2058 virtual bool DataEquals(HValue* other) { return true; }
2059 2059
2060 private: 2060 private:
2061 HOperandVector<3> operands_; 2061 HOperandVector<3> operands_;
2062 }; 2062 };
2063 2063
2064 2064
2065 class HBoundsCheck: public HBinaryOperation { 2065 class HBoundsCheck: public HBinaryOperation {
2066 public: 2066 public:
2067 HBoundsCheck(HValue* index, HValue* length) 2067 HBoundsCheck(HValue* index, HValue* length)
2068 : HBinaryOperation(index, length) { 2068 : HBinaryOperation(index, length) {
2069 SetFlag(kUseGVN); 2069 SetFlag(kUseGVN);
2070 } 2070 }
2071 2071
2072 virtual bool IsCheckInstruction() const { return true; } 2072 virtual bool IsCheckInstruction() const { return true; }
2073 2073
2074 virtual Representation RequiredInputRepresentation(int index) const { 2074 virtual Representation RequiredInputRepresentation(int index) const {
2075 return Representation::Integer32(); 2075 return Representation::Integer32();
2076 } 2076 }
2077 2077
2078 #ifdef DEBUG 2078 #ifdef DEBUG
2079 virtual void Verify(); 2079 virtual void Verify();
2080 #endif 2080 #endif
2081 2081
2082 HValue* index() const { return left(); } 2082 HValue* index() const { return left(); }
2083 HValue* length() const { return right(); } 2083 HValue* length() const { return right(); }
2084 2084
2085 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds_check") 2085 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck, "bounds_check")
2086 2086
2087 protected: 2087 protected:
2088 virtual bool DataEquals(HValue* other) const { return true; } 2088 virtual bool DataEquals(HValue* other) { return true; }
2089 }; 2089 };
2090 2090
2091 2091
2092 class HBitwiseBinaryOperation: public HBinaryOperation { 2092 class HBitwiseBinaryOperation: public HBinaryOperation {
2093 public: 2093 public:
2094 HBitwiseBinaryOperation(HValue* left, HValue* right) 2094 HBitwiseBinaryOperation(HValue* left, HValue* right)
2095 : HBinaryOperation(left, right) { 2095 : HBinaryOperation(left, right) {
2096 set_representation(Representation::Tagged()); 2096 set_representation(Representation::Tagged());
2097 SetFlag(kFlexibleRepresentation); 2097 SetFlag(kFlexibleRepresentation);
2098 SetAllSideEffects(); 2098 SetAllSideEffects();
2099 } 2099 }
2100 2100
2101 virtual Representation RequiredInputRepresentation(int index) const { 2101 virtual Representation RequiredInputRepresentation(int index) const {
2102 return representation(); 2102 return representation();
2103 } 2103 }
2104 2104
2105 virtual void RepresentationChanged(Representation to) { 2105 virtual void RepresentationChanged(Representation to) {
2106 if (!to.IsTagged()) { 2106 if (!to.IsTagged()) {
2107 ASSERT(to.IsInteger32()); 2107 ASSERT(to.IsInteger32());
2108 ClearAllSideEffects(); 2108 ClearAllSideEffects();
2109 SetFlag(kTruncatingToInt32); 2109 SetFlag(kTruncatingToInt32);
2110 SetFlag(kUseGVN); 2110 SetFlag(kUseGVN);
2111 } 2111 }
2112 } 2112 }
2113 2113
2114 HType CalculateInferredType() const; 2114 virtual HType CalculateInferredType();
2115 2115
2116 DECLARE_INSTRUCTION(BitwiseBinaryOperation) 2116 DECLARE_INSTRUCTION(BitwiseBinaryOperation)
2117 }; 2117 };
2118 2118
2119 2119
2120 class HArithmeticBinaryOperation: public HBinaryOperation { 2120 class HArithmeticBinaryOperation: public HBinaryOperation {
2121 public: 2121 public:
2122 HArithmeticBinaryOperation(HValue* left, HValue* right) 2122 HArithmeticBinaryOperation(HValue* left, HValue* right)
2123 : HBinaryOperation(left, right) { 2123 : HBinaryOperation(left, right) {
2124 set_representation(Representation::Tagged()); 2124 set_representation(Representation::Tagged());
2125 SetFlag(kFlexibleRepresentation); 2125 SetFlag(kFlexibleRepresentation);
2126 SetAllSideEffects(); 2126 SetAllSideEffects();
2127 } 2127 }
2128 2128
2129 virtual void RepresentationChanged(Representation to) { 2129 virtual void RepresentationChanged(Representation to) {
2130 if (!to.IsTagged()) { 2130 if (!to.IsTagged()) {
2131 ClearAllSideEffects(); 2131 ClearAllSideEffects();
2132 SetFlag(kUseGVN); 2132 SetFlag(kUseGVN);
2133 } 2133 }
2134 } 2134 }
2135 2135
2136 virtual HType CalculateInferredType() const; 2136 virtual HType CalculateInferredType();
2137 virtual Representation RequiredInputRepresentation(int index) const { 2137 virtual Representation RequiredInputRepresentation(int index) const {
2138 return representation(); 2138 return representation();
2139 } 2139 }
2140 virtual Representation InferredRepresentation() const { 2140 virtual Representation InferredRepresentation() {
2141 if (left()->representation().Equals(right()->representation())) { 2141 if (left()->representation().Equals(right()->representation())) {
2142 return left()->representation(); 2142 return left()->representation();
2143 } 2143 }
2144 return HValue::InferredRepresentation(); 2144 return HValue::InferredRepresentation();
2145 } 2145 }
2146 2146
2147 DECLARE_INSTRUCTION(ArithmeticBinaryOperation) 2147 DECLARE_INSTRUCTION(ArithmeticBinaryOperation)
2148 }; 2148 };
2149 2149
2150 2150
(...skipping 12 matching lines...) Expand all
2163 return !HasSideEffects() && (uses()->length() <= 1); 2163 return !HasSideEffects() && (uses()->length() <= 1);
2164 } 2164 }
2165 2165
2166 virtual Representation RequiredInputRepresentation(int index) const { 2166 virtual Representation RequiredInputRepresentation(int index) const {
2167 return input_representation_; 2167 return input_representation_;
2168 } 2168 }
2169 Representation GetInputRepresentation() const { 2169 Representation GetInputRepresentation() const {
2170 return input_representation_; 2170 return input_representation_;
2171 } 2171 }
2172 Token::Value token() const { return token_; } 2172 Token::Value token() const { return token_; }
2173 virtual void PrintDataTo(StringStream* stream) const; 2173 virtual void PrintDataTo(StringStream* stream);
2174 2174
2175 virtual HType CalculateInferredType() const; 2175 virtual HType CalculateInferredType();
2176 2176
2177 virtual intptr_t Hashcode() const { 2177 virtual intptr_t Hashcode() {
2178 return HValue::Hashcode() * 7 + token_; 2178 return HValue::Hashcode() * 7 + token_;
2179 } 2179 }
2180 2180
2181 DECLARE_CONCRETE_INSTRUCTION(Compare, "compare") 2181 DECLARE_CONCRETE_INSTRUCTION(Compare, "compare")
2182 2182
2183 protected: 2183 protected:
2184 virtual bool DataEquals(HValue* other) const { 2184 virtual bool DataEquals(HValue* other) {
2185 HCompare* comp = HCompare::cast(other); 2185 HCompare* comp = HCompare::cast(other);
2186 return token_ == comp->token(); 2186 return token_ == comp->token();
2187 } 2187 }
2188 2188
2189 private: 2189 private:
2190 Representation input_representation_; 2190 Representation input_representation_;
2191 Token::Value token_; 2191 Token::Value token_;
2192 }; 2192 };
2193 2193
2194 2194
2195 class HCompareJSObjectEq: public HBinaryOperation { 2195 class HCompareJSObjectEq: public HBinaryOperation {
2196 public: 2196 public:
2197 HCompareJSObjectEq(HValue* left, HValue* right) 2197 HCompareJSObjectEq(HValue* left, HValue* right)
2198 : HBinaryOperation(left, right) { 2198 : HBinaryOperation(left, right) {
2199 set_representation(Representation::Tagged()); 2199 set_representation(Representation::Tagged());
2200 SetFlag(kUseGVN); 2200 SetFlag(kUseGVN);
2201 } 2201 }
2202 2202
2203 virtual bool EmitAtUses() const { 2203 virtual bool EmitAtUses() const {
2204 return !HasSideEffects() && (uses()->length() <= 1); 2204 return !HasSideEffects() && (uses()->length() <= 1);
2205 } 2205 }
2206 2206
2207 virtual Representation RequiredInputRepresentation(int index) const { 2207 virtual Representation RequiredInputRepresentation(int index) const {
2208 return Representation::Tagged(); 2208 return Representation::Tagged();
2209 } 2209 }
2210 virtual HType CalculateInferredType() const; 2210 virtual HType CalculateInferredType();
2211 2211
2212 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq, "compare-js-object-eq") 2212 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq, "compare-js-object-eq")
2213 2213
2214 protected: 2214 protected:
2215 virtual bool DataEquals(HValue* other) const { return true; } 2215 virtual bool DataEquals(HValue* other) { return true; }
2216 }; 2216 };
2217 2217
2218 2218
2219 class HUnaryPredicate: public HUnaryOperation { 2219 class HUnaryPredicate: public HUnaryOperation {
2220 public: 2220 public:
2221 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { 2221 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) {
2222 set_representation(Representation::Tagged()); 2222 set_representation(Representation::Tagged());
2223 SetFlag(kUseGVN); 2223 SetFlag(kUseGVN);
2224 } 2224 }
2225 2225
2226 virtual bool EmitAtUses() const { 2226 virtual bool EmitAtUses() const {
2227 return !HasSideEffects() && (uses()->length() <= 1); 2227 return !HasSideEffects() && (uses()->length() <= 1);
2228 } 2228 }
2229 2229
2230 virtual Representation RequiredInputRepresentation(int index) const { 2230 virtual Representation RequiredInputRepresentation(int index) const {
2231 return Representation::Tagged(); 2231 return Representation::Tagged();
2232 } 2232 }
2233 virtual HType CalculateInferredType() const; 2233 virtual HType CalculateInferredType();
2234 }; 2234 };
2235 2235
2236 2236
2237 class HIsNull: public HUnaryPredicate { 2237 class HIsNull: public HUnaryPredicate {
2238 public: 2238 public:
2239 HIsNull(HValue* value, bool is_strict) 2239 HIsNull(HValue* value, bool is_strict)
2240 : HUnaryPredicate(value), is_strict_(is_strict) { } 2240 : HUnaryPredicate(value), is_strict_(is_strict) { }
2241 2241
2242 bool is_strict() const { return is_strict_; } 2242 bool is_strict() const { return is_strict_; }
2243 2243
2244 DECLARE_CONCRETE_INSTRUCTION(IsNull, "is_null") 2244 DECLARE_CONCRETE_INSTRUCTION(IsNull, "is_null")
2245 2245
2246 protected: 2246 protected:
2247 virtual bool DataEquals(HValue* other) const { 2247 virtual bool DataEquals(HValue* other) {
2248 HIsNull* b = HIsNull::cast(other); 2248 HIsNull* b = HIsNull::cast(other);
2249 return is_strict_ == b->is_strict(); 2249 return is_strict_ == b->is_strict();
2250 } 2250 }
2251 2251
2252 private: 2252 private:
2253 bool is_strict_; 2253 bool is_strict_;
2254 }; 2254 };
2255 2255
2256 2256
2257 class HIsObject: public HUnaryPredicate { 2257 class HIsObject: public HUnaryPredicate {
2258 public: 2258 public:
2259 explicit HIsObject(HValue* value) : HUnaryPredicate(value) { } 2259 explicit HIsObject(HValue* value) : HUnaryPredicate(value) { }
2260 2260
2261 DECLARE_CONCRETE_INSTRUCTION(IsObject, "is_object") 2261 DECLARE_CONCRETE_INSTRUCTION(IsObject, "is_object")
2262 2262
2263 protected: 2263 protected:
2264 virtual bool DataEquals(HValue* other) const { return true; } 2264 virtual bool DataEquals(HValue* other) { return true; }
2265 }; 2265 };
2266 2266
2267 2267
2268 class HIsSmi: public HUnaryPredicate { 2268 class HIsSmi: public HUnaryPredicate {
2269 public: 2269 public:
2270 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { } 2270 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { }
2271 2271
2272 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is_smi") 2272 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is_smi")
2273 2273
2274 protected: 2274 protected:
2275 virtual bool DataEquals(HValue* other) const { return true; } 2275 virtual bool DataEquals(HValue* other) { return true; }
2276 }; 2276 };
2277 2277
2278 2278
2279 class HIsConstructCall: public HInstruction { 2279 class HIsConstructCall: public HInstruction {
2280 public: 2280 public:
2281 HIsConstructCall() { 2281 HIsConstructCall() {
2282 set_representation(Representation::Tagged()); 2282 set_representation(Representation::Tagged());
2283 SetFlag(kUseGVN); 2283 SetFlag(kUseGVN);
2284 } 2284 }
2285 2285
2286 virtual bool EmitAtUses() const { 2286 virtual bool EmitAtUses() const {
2287 return !HasSideEffects() && (uses()->length() <= 1); 2287 return !HasSideEffects() && (uses()->length() <= 1);
2288 } 2288 }
2289 2289
2290 DECLARE_CONCRETE_INSTRUCTION(IsConstructCall, "is_construct_call") 2290 DECLARE_CONCRETE_INSTRUCTION(IsConstructCall, "is_construct_call")
2291 2291
2292 protected: 2292 protected:
2293 virtual bool DataEquals(HValue* other) const { return true; } 2293 virtual bool DataEquals(HValue* other) { return true; }
2294 }; 2294 };
2295 2295
2296 2296
2297 class HHasInstanceType: public HUnaryPredicate { 2297 class HHasInstanceType: public HUnaryPredicate {
2298 public: 2298 public:
2299 HHasInstanceType(HValue* value, InstanceType type) 2299 HHasInstanceType(HValue* value, InstanceType type)
2300 : HUnaryPredicate(value), from_(type), to_(type) { } 2300 : HUnaryPredicate(value), from_(type), to_(type) { }
2301 HHasInstanceType(HValue* value, InstanceType from, InstanceType to) 2301 HHasInstanceType(HValue* value, InstanceType from, InstanceType to)
2302 : HUnaryPredicate(value), from_(from), to_(to) { 2302 : HUnaryPredicate(value), from_(from), to_(to) {
2303 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. 2303 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend.
2304 } 2304 }
2305 2305
2306 InstanceType from() { return from_; } 2306 InstanceType from() { return from_; }
2307 InstanceType to() { return to_; } 2307 InstanceType to() { return to_; }
2308 2308
2309 virtual void PrintDataTo(StringStream* stream) const; 2309 virtual void PrintDataTo(StringStream* stream);
2310 2310
2311 DECLARE_CONCRETE_INSTRUCTION(HasInstanceType, "has_instance_type") 2311 DECLARE_CONCRETE_INSTRUCTION(HasInstanceType, "has_instance_type")
2312 2312
2313 protected: 2313 protected:
2314 virtual bool DataEquals(HValue* other) const { 2314 virtual bool DataEquals(HValue* other) {
2315 HHasInstanceType* b = HHasInstanceType::cast(other); 2315 HHasInstanceType* b = HHasInstanceType::cast(other);
2316 return (from_ == b->from()) && (to_ == b->to()); 2316 return (from_ == b->from()) && (to_ == b->to());
2317 } 2317 }
2318 2318
2319 private: 2319 private:
2320 InstanceType from_; 2320 InstanceType from_;
2321 InstanceType to_; // Inclusive range, not all combinations work. 2321 InstanceType to_; // Inclusive range, not all combinations work.
2322 }; 2322 };
2323 2323
2324 2324
2325 class HHasCachedArrayIndex: public HUnaryPredicate { 2325 class HHasCachedArrayIndex: public HUnaryPredicate {
2326 public: 2326 public:
2327 explicit HHasCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { } 2327 explicit HHasCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { }
2328 2328
2329 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex, "has_cached_array_index") 2329 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndex, "has_cached_array_index")
2330 2330
2331 protected: 2331 protected:
2332 virtual bool DataEquals(HValue* other) const { return true; } 2332 virtual bool DataEquals(HValue* other) { return true; }
2333 }; 2333 };
2334 2334
2335 2335
2336 class HGetCachedArrayIndex: public HUnaryPredicate { 2336 class HGetCachedArrayIndex: public HUnaryPredicate {
2337 public: 2337 public:
2338 explicit HGetCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { } 2338 explicit HGetCachedArrayIndex(HValue* value) : HUnaryPredicate(value) { }
2339 2339
2340 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get_cached_array_index") 2340 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex, "get_cached_array_index")
2341 2341
2342 protected: 2342 protected:
2343 virtual bool DataEquals(HValue* other) const { return true; } 2343 virtual bool DataEquals(HValue* other) { return true; }
2344 }; 2344 };
2345 2345
2346 2346
2347 class HClassOfTest: public HUnaryPredicate { 2347 class HClassOfTest: public HUnaryPredicate {
2348 public: 2348 public:
2349 HClassOfTest(HValue* value, Handle<String> class_name) 2349 HClassOfTest(HValue* value, Handle<String> class_name)
2350 : HUnaryPredicate(value), class_name_(class_name) { } 2350 : HUnaryPredicate(value), class_name_(class_name) { }
2351 2351
2352 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class_of_test") 2352 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class_of_test")
2353 2353
2354 virtual void PrintDataTo(StringStream* stream) const; 2354 virtual void PrintDataTo(StringStream* stream);
2355 2355
2356 Handle<String> class_name() const { return class_name_; } 2356 Handle<String> class_name() const { return class_name_; }
2357 2357
2358 protected: 2358 protected:
2359 virtual bool DataEquals(HValue* other) const { 2359 virtual bool DataEquals(HValue* other) {
2360 HClassOfTest* b = HClassOfTest::cast(other); 2360 HClassOfTest* b = HClassOfTest::cast(other);
2361 return class_name_.is_identical_to(b->class_name_); 2361 return class_name_.is_identical_to(b->class_name_);
2362 } 2362 }
2363 2363
2364 private: 2364 private:
2365 Handle<String> class_name_; 2365 Handle<String> class_name_;
2366 }; 2366 };
2367 2367
2368 2368
2369 class HTypeofIs: public HUnaryPredicate { 2369 class HTypeofIs: public HUnaryPredicate {
2370 public: 2370 public:
2371 HTypeofIs(HValue* value, Handle<String> type_literal) 2371 HTypeofIs(HValue* value, Handle<String> type_literal)
2372 : HUnaryPredicate(value), type_literal_(type_literal) { } 2372 : HUnaryPredicate(value), type_literal_(type_literal) { }
2373 2373
2374 Handle<String> type_literal() { return type_literal_; } 2374 Handle<String> type_literal() { return type_literal_; }
2375 virtual void PrintDataTo(StringStream* stream) const; 2375 virtual void PrintDataTo(StringStream* stream);
2376 2376
2377 DECLARE_CONCRETE_INSTRUCTION(TypeofIs, "typeof_is") 2377 DECLARE_CONCRETE_INSTRUCTION(TypeofIs, "typeof_is")
2378 2378
2379 protected: 2379 protected:
2380 virtual bool DataEquals(HValue* other) const { 2380 virtual bool DataEquals(HValue* other) {
2381 HTypeofIs* b = HTypeofIs::cast(other); 2381 HTypeofIs* b = HTypeofIs::cast(other);
2382 return type_literal_.is_identical_to(b->type_literal_); 2382 return type_literal_.is_identical_to(b->type_literal_);
2383 } 2383 }
2384 2384
2385 private: 2385 private:
2386 Handle<String> type_literal_; 2386 Handle<String> type_literal_;
2387 }; 2387 };
2388 2388
2389 2389
2390 class HInstanceOf: public HInstruction { 2390 class HInstanceOf: public HInstruction {
(...skipping 11 matching lines...) Expand all
2402 HValue* right() const { return operands_[2]; } 2402 HValue* right() const { return operands_[2]; }
2403 2403
2404 virtual bool EmitAtUses() const { 2404 virtual bool EmitAtUses() const {
2405 return !HasSideEffects() && (uses()->length() <= 1); 2405 return !HasSideEffects() && (uses()->length() <= 1);
2406 } 2406 }
2407 2407
2408 virtual Representation RequiredInputRepresentation(int index) const { 2408 virtual Representation RequiredInputRepresentation(int index) const {
2409 return Representation::Tagged(); 2409 return Representation::Tagged();
2410 } 2410 }
2411 2411
2412 virtual void PrintDataTo(StringStream* stream) const; 2412 virtual void PrintDataTo(StringStream* stream);
2413 2413
2414 virtual int OperandCount() const { return 3; } 2414 virtual int OperandCount() const { return 3; }
2415 virtual HValue* OperandAt(int index) const { return operands_[index]; } 2415 virtual HValue* OperandAt(int index) const { return operands_[index]; }
2416 2416
2417 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance_of") 2417 DECLARE_CONCRETE_INSTRUCTION(InstanceOf, "instance_of")
2418 2418
2419 protected: 2419 protected:
2420 virtual void InternalSetOperandAt(int index, HValue* value) { 2420 virtual void InternalSetOperandAt(int index, HValue* value) {
2421 operands_[index] = value; 2421 operands_[index] = value;
2422 } 2422 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 SetFlag(kUseGVN); 2456 SetFlag(kUseGVN);
2457 } 2457 }
2458 2458
2459 virtual Representation RequiredInputRepresentation(int index) const { 2459 virtual Representation RequiredInputRepresentation(int index) const {
2460 return (index == 1) ? Representation::None() : Representation::Double(); 2460 return (index == 1) ? Representation::None() : Representation::Double();
2461 } 2461 }
2462 2462
2463 DECLARE_CONCRETE_INSTRUCTION(Power, "power") 2463 DECLARE_CONCRETE_INSTRUCTION(Power, "power")
2464 2464
2465 protected: 2465 protected:
2466 virtual bool DataEquals(HValue* other) const { return true; } 2466 virtual bool DataEquals(HValue* other) { return true; }
2467 }; 2467 };
2468 2468
2469 2469
2470 class HAdd: public HArithmeticBinaryOperation { 2470 class HAdd: public HArithmeticBinaryOperation {
2471 public: 2471 public:
2472 HAdd(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2472 HAdd(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2473 SetFlag(kCanOverflow); 2473 SetFlag(kCanOverflow);
2474 } 2474 }
2475 2475
2476 // Add is only commutative if two integer values are added and not if two 2476 // Add is only commutative if two integer values are added and not if two
2477 // tagged values are added (because it might be a String concatenation). 2477 // tagged values are added (because it might be a String concatenation).
2478 virtual bool IsCommutative() const { 2478 virtual bool IsCommutative() const {
2479 return !representation().IsTagged(); 2479 return !representation().IsTagged();
2480 } 2480 }
2481 2481
2482 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2482 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2483 2483
2484 virtual HType CalculateInferredType() const; 2484 virtual HType CalculateInferredType();
2485 2485
2486 DECLARE_CONCRETE_INSTRUCTION(Add, "add") 2486 DECLARE_CONCRETE_INSTRUCTION(Add, "add")
2487 2487
2488 protected: 2488 protected:
2489 virtual bool DataEquals(HValue* other) const { return true; } 2489 virtual bool DataEquals(HValue* other) { return true; }
2490 2490
2491 virtual Range* InferRange(); 2491 virtual Range* InferRange();
2492 }; 2492 };
2493 2493
2494 2494
2495 class HSub: public HArithmeticBinaryOperation { 2495 class HSub: public HArithmeticBinaryOperation {
2496 public: 2496 public:
2497 HSub(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2497 HSub(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2498 SetFlag(kCanOverflow); 2498 SetFlag(kCanOverflow);
2499 } 2499 }
2500 2500
2501 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2501 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2502 2502
2503 DECLARE_CONCRETE_INSTRUCTION(Sub, "sub") 2503 DECLARE_CONCRETE_INSTRUCTION(Sub, "sub")
2504 2504
2505 protected: 2505 protected:
2506 virtual bool DataEquals(HValue* other) const { return true; } 2506 virtual bool DataEquals(HValue* other) { return true; }
2507 2507
2508 virtual Range* InferRange(); 2508 virtual Range* InferRange();
2509 }; 2509 };
2510 2510
2511 2511
2512 class HMul: public HArithmeticBinaryOperation { 2512 class HMul: public HArithmeticBinaryOperation {
2513 public: 2513 public:
2514 HMul(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2514 HMul(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2515 SetFlag(kCanOverflow); 2515 SetFlag(kCanOverflow);
2516 } 2516 }
2517 2517
2518 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2518 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2519 2519
2520 // Only commutative if it is certain that not two objects are multiplicated. 2520 // Only commutative if it is certain that not two objects are multiplicated.
2521 virtual bool IsCommutative() const { 2521 virtual bool IsCommutative() const {
2522 return !representation().IsTagged(); 2522 return !representation().IsTagged();
2523 } 2523 }
2524 2524
2525 DECLARE_CONCRETE_INSTRUCTION(Mul, "mul") 2525 DECLARE_CONCRETE_INSTRUCTION(Mul, "mul")
2526 2526
2527 protected: 2527 protected:
2528 virtual bool DataEquals(HValue* other) const { return true; } 2528 virtual bool DataEquals(HValue* other) { return true; }
2529 2529
2530 virtual Range* InferRange(); 2530 virtual Range* InferRange();
2531 }; 2531 };
2532 2532
2533 2533
2534 class HMod: public HArithmeticBinaryOperation { 2534 class HMod: public HArithmeticBinaryOperation {
2535 public: 2535 public:
2536 HMod(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2536 HMod(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2537 SetFlag(kCanBeDivByZero); 2537 SetFlag(kCanBeDivByZero);
2538 } 2538 }
2539 2539
2540 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2540 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2541 2541
2542 DECLARE_CONCRETE_INSTRUCTION(Mod, "mod") 2542 DECLARE_CONCRETE_INSTRUCTION(Mod, "mod")
2543 2543
2544 protected: 2544 protected:
2545 virtual bool DataEquals(HValue* other) const { return true; } 2545 virtual bool DataEquals(HValue* other) { return true; }
2546 2546
2547 virtual Range* InferRange(); 2547 virtual Range* InferRange();
2548 }; 2548 };
2549 2549
2550 2550
2551 class HDiv: public HArithmeticBinaryOperation { 2551 class HDiv: public HArithmeticBinaryOperation {
2552 public: 2552 public:
2553 HDiv(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) { 2553 HDiv(HValue* left, HValue* right) : HArithmeticBinaryOperation(left, right) {
2554 SetFlag(kCanBeDivByZero); 2554 SetFlag(kCanBeDivByZero);
2555 SetFlag(kCanOverflow); 2555 SetFlag(kCanOverflow);
2556 } 2556 }
2557 2557
2558 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); 2558 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
2559 2559
2560 DECLARE_CONCRETE_INSTRUCTION(Div, "div") 2560 DECLARE_CONCRETE_INSTRUCTION(Div, "div")
2561 2561
2562 protected: 2562 protected:
2563 virtual bool DataEquals(HValue* other) const { return true; } 2563 virtual bool DataEquals(HValue* other) { return true; }
2564 2564
2565 virtual Range* InferRange(); 2565 virtual Range* InferRange();
2566 }; 2566 };
2567 2567
2568 2568
2569 class HBitAnd: public HBitwiseBinaryOperation { 2569 class HBitAnd: public HBitwiseBinaryOperation {
2570 public: 2570 public:
2571 HBitAnd(HValue* left, HValue* right) 2571 HBitAnd(HValue* left, HValue* right)
2572 : HBitwiseBinaryOperation(left, right) { } 2572 : HBitwiseBinaryOperation(left, right) { }
2573 2573
2574 virtual bool IsCommutative() const { return true; } 2574 virtual bool IsCommutative() const { return true; }
2575 virtual HType CalculateInferredType() const; 2575 virtual HType CalculateInferredType();
2576 2576
2577 DECLARE_CONCRETE_INSTRUCTION(BitAnd, "bit_and") 2577 DECLARE_CONCRETE_INSTRUCTION(BitAnd, "bit_and")
2578 2578
2579 protected: 2579 protected:
2580 virtual bool DataEquals(HValue* other) const { return true; } 2580 virtual bool DataEquals(HValue* other) { return true; }
2581 2581
2582 virtual Range* InferRange(); 2582 virtual Range* InferRange();
2583 }; 2583 };
2584 2584
2585 2585
2586 class HBitXor: public HBitwiseBinaryOperation { 2586 class HBitXor: public HBitwiseBinaryOperation {
2587 public: 2587 public:
2588 HBitXor(HValue* left, HValue* right) 2588 HBitXor(HValue* left, HValue* right)
2589 : HBitwiseBinaryOperation(left, right) { } 2589 : HBitwiseBinaryOperation(left, right) { }
2590 2590
2591 virtual bool IsCommutative() const { return true; } 2591 virtual bool IsCommutative() const { return true; }
2592 virtual HType CalculateInferredType() const; 2592 virtual HType CalculateInferredType();
2593 2593
2594 DECLARE_CONCRETE_INSTRUCTION(BitXor, "bit_xor") 2594 DECLARE_CONCRETE_INSTRUCTION(BitXor, "bit_xor")
2595 2595
2596 protected: 2596 protected:
2597 virtual bool DataEquals(HValue* other) const { return true; } 2597 virtual bool DataEquals(HValue* other) { return true; }
2598 }; 2598 };
2599 2599
2600 2600
2601 class HBitOr: public HBitwiseBinaryOperation { 2601 class HBitOr: public HBitwiseBinaryOperation {
2602 public: 2602 public:
2603 HBitOr(HValue* left, HValue* right) 2603 HBitOr(HValue* left, HValue* right)
2604 : HBitwiseBinaryOperation(left, right) { } 2604 : HBitwiseBinaryOperation(left, right) { }
2605 2605
2606 virtual bool IsCommutative() const { return true; } 2606 virtual bool IsCommutative() const { return true; }
2607 virtual HType CalculateInferredType() const; 2607 virtual HType CalculateInferredType();
2608 2608
2609 DECLARE_CONCRETE_INSTRUCTION(BitOr, "bit_or") 2609 DECLARE_CONCRETE_INSTRUCTION(BitOr, "bit_or")
2610 2610
2611 protected: 2611 protected:
2612 virtual bool DataEquals(HValue* other) const { return true; } 2612 virtual bool DataEquals(HValue* other) { return true; }
2613 2613
2614 virtual Range* InferRange(); 2614 virtual Range* InferRange();
2615 }; 2615 };
2616 2616
2617 2617
2618 class HShl: public HBitwiseBinaryOperation { 2618 class HShl: public HBitwiseBinaryOperation {
2619 public: 2619 public:
2620 HShl(HValue* left, HValue* right) 2620 HShl(HValue* left, HValue* right)
2621 : HBitwiseBinaryOperation(left, right) { } 2621 : HBitwiseBinaryOperation(left, right) { }
2622 2622
2623 virtual Range* InferRange(); 2623 virtual Range* InferRange();
2624 virtual HType CalculateInferredType() const; 2624 virtual HType CalculateInferredType();
2625 2625
2626 DECLARE_CONCRETE_INSTRUCTION(Shl, "shl") 2626 DECLARE_CONCRETE_INSTRUCTION(Shl, "shl")
2627 2627
2628 protected: 2628 protected:
2629 virtual bool DataEquals(HValue* other) const { return true; } 2629 virtual bool DataEquals(HValue* other) { return true; }
2630 }; 2630 };
2631 2631
2632 2632
2633 class HShr: public HBitwiseBinaryOperation { 2633 class HShr: public HBitwiseBinaryOperation {
2634 public: 2634 public:
2635 HShr(HValue* left, HValue* right) 2635 HShr(HValue* left, HValue* right)
2636 : HBitwiseBinaryOperation(left, right) { } 2636 : HBitwiseBinaryOperation(left, right) { }
2637 2637
2638 virtual HType CalculateInferredType() const; 2638 virtual HType CalculateInferredType();
2639 2639
2640 DECLARE_CONCRETE_INSTRUCTION(Shr, "shr") 2640 DECLARE_CONCRETE_INSTRUCTION(Shr, "shr")
2641 2641
2642 protected: 2642 protected:
2643 virtual bool DataEquals(HValue* other) const { return true; } 2643 virtual bool DataEquals(HValue* other) { return true; }
2644 }; 2644 };
2645 2645
2646 2646
2647 class HSar: public HBitwiseBinaryOperation { 2647 class HSar: public HBitwiseBinaryOperation {
2648 public: 2648 public:
2649 HSar(HValue* left, HValue* right) 2649 HSar(HValue* left, HValue* right)
2650 : HBitwiseBinaryOperation(left, right) { } 2650 : HBitwiseBinaryOperation(left, right) { }
2651 2651
2652 virtual Range* InferRange(); 2652 virtual Range* InferRange();
2653 virtual HType CalculateInferredType() const; 2653 virtual HType CalculateInferredType();
2654 2654
2655 DECLARE_CONCRETE_INSTRUCTION(Sar, "sar") 2655 DECLARE_CONCRETE_INSTRUCTION(Sar, "sar")
2656 2656
2657 protected: 2657 protected:
2658 virtual bool DataEquals(HValue* other) const { return true; } 2658 virtual bool DataEquals(HValue* other) { return true; }
2659 }; 2659 };
2660 2660
2661 2661
2662 class HOsrEntry: public HInstruction { 2662 class HOsrEntry: public HInstruction {
2663 public: 2663 public:
2664 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) { 2664 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) {
2665 SetFlag(kChangesOsrEntries); 2665 SetFlag(kChangesOsrEntries);
2666 } 2666 }
2667 2667
2668 int ast_id() const { return ast_id_; } 2668 int ast_id() const { return ast_id_; }
2669 2669
2670 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr_entry") 2670 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr_entry")
2671 2671
2672 private: 2672 private:
2673 int ast_id_; 2673 int ast_id_;
2674 }; 2674 };
2675 2675
2676 2676
2677 class HParameter: public HInstruction { 2677 class HParameter: public HInstruction {
2678 public: 2678 public:
2679 explicit HParameter(unsigned index) : index_(index) { 2679 explicit HParameter(unsigned index) : index_(index) {
2680 set_representation(Representation::Tagged()); 2680 set_representation(Representation::Tagged());
2681 } 2681 }
2682 2682
2683 unsigned index() const { return index_; } 2683 unsigned index() const { return index_; }
2684 2684
2685 virtual void PrintDataTo(StringStream* stream) const; 2685 virtual void PrintDataTo(StringStream* stream);
2686 2686
2687 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter") 2687 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
2688 2688
2689 private: 2689 private:
2690 unsigned index_; 2690 unsigned index_;
2691 }; 2691 };
2692 2692
2693 2693
2694 class HCallStub: public HUnaryCall { 2694 class HCallStub: public HUnaryCall {
2695 public: 2695 public:
2696 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) 2696 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count)
2697 : HUnaryCall(context, argument_count), 2697 : HUnaryCall(context, argument_count),
2698 major_key_(major_key), 2698 major_key_(major_key),
2699 transcendental_type_(TranscendentalCache::kNumberOfCaches) { 2699 transcendental_type_(TranscendentalCache::kNumberOfCaches) {
2700 } 2700 }
2701 2701
2702 CodeStub::Major major_key() { return major_key_; } 2702 CodeStub::Major major_key() { return major_key_; }
2703 2703
2704 HValue* context() const { return value(); } 2704 HValue* context() const { return value(); }
2705 2705
2706 void set_transcendental_type(TranscendentalCache::Type transcendental_type) { 2706 void set_transcendental_type(TranscendentalCache::Type transcendental_type) {
2707 transcendental_type_ = transcendental_type; 2707 transcendental_type_ = transcendental_type;
2708 } 2708 }
2709 TranscendentalCache::Type transcendental_type() { 2709 TranscendentalCache::Type transcendental_type() {
2710 return transcendental_type_; 2710 return transcendental_type_;
2711 } 2711 }
2712 2712
2713 virtual void PrintDataTo(StringStream* stream) const; 2713 virtual void PrintDataTo(StringStream* stream);
2714 2714
2715 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call_stub") 2715 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call_stub")
2716 2716
2717 private: 2717 private:
2718 CodeStub::Major major_key_; 2718 CodeStub::Major major_key_;
2719 TranscendentalCache::Type transcendental_type_; 2719 TranscendentalCache::Type transcendental_type_;
2720 }; 2720 };
2721 2721
2722 2722
2723 class HUnknownOSRValue: public HInstruction { 2723 class HUnknownOSRValue: public HInstruction {
(...skipping 12 matching lines...) Expand all
2736 SetFlag(kUseGVN); 2736 SetFlag(kUseGVN);
2737 SetFlag(kDependsOnGlobalVars); 2737 SetFlag(kDependsOnGlobalVars);
2738 } 2738 }
2739 2739
2740 Handle<JSGlobalPropertyCell> cell() const { return cell_; } 2740 Handle<JSGlobalPropertyCell> cell() const { return cell_; }
2741 bool check_hole_value() const { return check_hole_value_; } 2741 bool check_hole_value() const { return check_hole_value_; }
2742 2742
2743 virtual Representation RequiredInputRepresentation(int index) const { 2743 virtual Representation RequiredInputRepresentation(int index) const {
2744 return Representation::Tagged(); 2744 return Representation::Tagged();
2745 } 2745 }
2746 virtual void PrintDataTo(StringStream* stream) const; 2746 virtual void PrintDataTo(StringStream* stream);
2747 2747
2748 virtual intptr_t Hashcode() const { 2748 virtual intptr_t Hashcode() {
2749 ASSERT(!Heap::allow_allocation(false)); 2749 ASSERT(!Heap::allow_allocation(false));
2750 return reinterpret_cast<intptr_t>(*cell_); 2750 return reinterpret_cast<intptr_t>(*cell_);
2751 } 2751 }
2752 2752
2753 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load_global") 2753 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load_global")
2754 2754
2755 protected: 2755 protected:
2756 virtual bool DataEquals(HValue* other) const { 2756 virtual bool DataEquals(HValue* other) {
2757 HLoadGlobal* b = HLoadGlobal::cast(other); 2757 HLoadGlobal* b = HLoadGlobal::cast(other);
2758 return cell_.is_identical_to(b->cell()); 2758 return cell_.is_identical_to(b->cell());
2759 } 2759 }
2760 2760
2761 private: 2761 private:
2762 Handle<JSGlobalPropertyCell> cell_; 2762 Handle<JSGlobalPropertyCell> cell_;
2763 bool check_hole_value_; 2763 bool check_hole_value_;
2764 }; 2764 };
2765 2765
2766 2766
2767 class HStoreGlobal: public HUnaryOperation { 2767 class HStoreGlobal: public HUnaryOperation {
2768 public: 2768 public:
2769 HStoreGlobal(HValue* value, 2769 HStoreGlobal(HValue* value,
2770 Handle<JSGlobalPropertyCell> cell, 2770 Handle<JSGlobalPropertyCell> cell,
2771 bool check_hole_value) 2771 bool check_hole_value)
2772 : HUnaryOperation(value), 2772 : HUnaryOperation(value),
2773 cell_(cell), 2773 cell_(cell),
2774 check_hole_value_(check_hole_value) { 2774 check_hole_value_(check_hole_value) {
2775 SetFlag(kChangesGlobalVars); 2775 SetFlag(kChangesGlobalVars);
2776 } 2776 }
2777 2777
2778 Handle<JSGlobalPropertyCell> cell() const { return cell_; } 2778 Handle<JSGlobalPropertyCell> cell() const { return cell_; }
2779 bool check_hole_value() const { return check_hole_value_; } 2779 bool check_hole_value() const { return check_hole_value_; }
2780 2780
2781 virtual Representation RequiredInputRepresentation(int index) const { 2781 virtual Representation RequiredInputRepresentation(int index) const {
2782 return Representation::Tagged(); 2782 return Representation::Tagged();
2783 } 2783 }
2784 virtual void PrintDataTo(StringStream* stream) const; 2784 virtual void PrintDataTo(StringStream* stream);
2785 2785
2786 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store_global") 2786 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store_global")
2787 2787
2788 private: 2788 private:
2789 Handle<JSGlobalPropertyCell> cell_; 2789 Handle<JSGlobalPropertyCell> cell_;
2790 bool check_hole_value_; 2790 bool check_hole_value_;
2791 }; 2791 };
2792 2792
2793 2793
2794 class HLoadContextSlot: public HUnaryOperation { 2794 class HLoadContextSlot: public HUnaryOperation {
2795 public: 2795 public:
2796 HLoadContextSlot(HValue* context , int slot_index) 2796 HLoadContextSlot(HValue* context , int slot_index)
2797 : HUnaryOperation(context), slot_index_(slot_index) { 2797 : HUnaryOperation(context), slot_index_(slot_index) {
2798 set_representation(Representation::Tagged()); 2798 set_representation(Representation::Tagged());
2799 SetFlag(kUseGVN); 2799 SetFlag(kUseGVN);
2800 SetFlag(kDependsOnContextSlots); 2800 SetFlag(kDependsOnContextSlots);
2801 } 2801 }
2802 2802
2803 int slot_index() const { return slot_index_; } 2803 int slot_index() const { return slot_index_; }
2804 2804
2805 virtual Representation RequiredInputRepresentation(int index) const { 2805 virtual Representation RequiredInputRepresentation(int index) const {
2806 return Representation::Tagged(); 2806 return Representation::Tagged();
2807 } 2807 }
2808 2808
2809 virtual void PrintDataTo(StringStream* stream) const; 2809 virtual void PrintDataTo(StringStream* stream);
2810 2810
2811 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load_context_slot") 2811 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load_context_slot")
2812 2812
2813 protected: 2813 protected:
2814 virtual bool DataEquals(HValue* other) const { 2814 virtual bool DataEquals(HValue* other) {
2815 HLoadContextSlot* b = HLoadContextSlot::cast(other); 2815 HLoadContextSlot* b = HLoadContextSlot::cast(other);
2816 return (slot_index() == b->slot_index()); 2816 return (slot_index() == b->slot_index());
2817 } 2817 }
2818 2818
2819 private: 2819 private:
2820 int slot_index_; 2820 int slot_index_;
2821 }; 2821 };
2822 2822
2823 2823
2824 static inline bool StoringValueNeedsWriteBarrier(HValue* value) { 2824 static inline bool StoringValueNeedsWriteBarrier(HValue* value) {
(...skipping 14 matching lines...) Expand all
2839 int slot_index() const { return slot_index_; } 2839 int slot_index() const { return slot_index_; }
2840 2840
2841 bool NeedsWriteBarrier() const { 2841 bool NeedsWriteBarrier() const {
2842 return StoringValueNeedsWriteBarrier(value()); 2842 return StoringValueNeedsWriteBarrier(value());
2843 } 2843 }
2844 2844
2845 virtual Representation RequiredInputRepresentation(int index) const { 2845 virtual Representation RequiredInputRepresentation(int index) const {
2846 return Representation::Tagged(); 2846 return Representation::Tagged();
2847 } 2847 }
2848 2848
2849 virtual void PrintDataTo(StringStream* stream) const; 2849 virtual void PrintDataTo(StringStream* stream);
2850 2850
2851 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store_context_slot") 2851 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store_context_slot")
2852 2852
2853 private: 2853 private:
2854 int slot_index_; 2854 int slot_index_;
2855 }; 2855 };
2856 2856
2857 2857
2858 class HLoadNamedField: public HUnaryOperation { 2858 class HLoadNamedField: public HUnaryOperation {
2859 public: 2859 public:
(...skipping 10 matching lines...) Expand all
2870 } 2870 }
2871 } 2871 }
2872 2872
2873 HValue* object() const { return OperandAt(0); } 2873 HValue* object() const { return OperandAt(0); }
2874 bool is_in_object() const { return is_in_object_; } 2874 bool is_in_object() const { return is_in_object_; }
2875 int offset() const { return offset_; } 2875 int offset() const { return offset_; }
2876 2876
2877 virtual Representation RequiredInputRepresentation(int index) const { 2877 virtual Representation RequiredInputRepresentation(int index) const {
2878 return Representation::Tagged(); 2878 return Representation::Tagged();
2879 } 2879 }
2880 virtual void PrintDataTo(StringStream* stream) const; 2880 virtual void PrintDataTo(StringStream* stream);
2881 2881
2882 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load_named_field") 2882 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField, "load_named_field")
2883 2883
2884 protected: 2884 protected:
2885 virtual bool DataEquals(HValue* other) const { 2885 virtual bool DataEquals(HValue* other) {
2886 HLoadNamedField* b = HLoadNamedField::cast(other); 2886 HLoadNamedField* b = HLoadNamedField::cast(other);
2887 return is_in_object_ == b->is_in_object_ && offset_ == b->offset_; 2887 return is_in_object_ == b->is_in_object_ && offset_ == b->offset_;
2888 } 2888 }
2889 2889
2890 private: 2890 private:
2891 bool is_in_object_; 2891 bool is_in_object_;
2892 int offset_; 2892 int offset_;
2893 }; 2893 };
2894 2894
2895 2895
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2927 2927
2928 HValue* function() const { return OperandAt(0); } 2928 HValue* function() const { return OperandAt(0); }
2929 2929
2930 virtual Representation RequiredInputRepresentation(int index) const { 2930 virtual Representation RequiredInputRepresentation(int index) const {
2931 return Representation::Tagged(); 2931 return Representation::Tagged();
2932 } 2932 }
2933 2933
2934 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load_function_prototype") 2934 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype, "load_function_prototype")
2935 2935
2936 protected: 2936 protected:
2937 virtual bool DataEquals(HValue* other) const { return true; } 2937 virtual bool DataEquals(HValue* other) { return true; }
2938 }; 2938 };
2939 2939
2940 2940
2941 class HLoadKeyed: public HBinaryOperation { 2941 class HLoadKeyed: public HBinaryOperation {
2942 public: 2942 public:
2943 HLoadKeyed(HValue* obj, HValue* key) : HBinaryOperation(obj, key) { 2943 HLoadKeyed(HValue* obj, HValue* key) : HBinaryOperation(obj, key) {
2944 set_representation(Representation::Tagged()); 2944 set_representation(Representation::Tagged());
2945 } 2945 }
2946 2946
2947 virtual void PrintDataTo(StringStream* stream) const; 2947 virtual void PrintDataTo(StringStream* stream);
2948 2948
2949 virtual Representation RequiredInputRepresentation(int index) const { 2949 virtual Representation RequiredInputRepresentation(int index) const {
2950 return Representation::Tagged(); 2950 return Representation::Tagged();
2951 } 2951 }
2952 HValue* object() const { return OperandAt(0); } 2952 HValue* object() const { return OperandAt(0); }
2953 HValue* key() const { return OperandAt(1); } 2953 HValue* key() const { return OperandAt(1); }
2954 2954
2955 DECLARE_INSTRUCTION(LoadKeyed) 2955 DECLARE_INSTRUCTION(LoadKeyed)
2956 }; 2956 };
2957 2957
2958 2958
2959 class HLoadKeyedFastElement: public HLoadKeyed { 2959 class HLoadKeyedFastElement: public HLoadKeyed {
2960 public: 2960 public:
2961 HLoadKeyedFastElement(HValue* obj, HValue* key) : HLoadKeyed(obj, key) { 2961 HLoadKeyedFastElement(HValue* obj, HValue* key) : HLoadKeyed(obj, key) {
2962 SetFlag(kDependsOnArrayElements); 2962 SetFlag(kDependsOnArrayElements);
2963 SetFlag(kUseGVN); 2963 SetFlag(kUseGVN);
2964 } 2964 }
2965 2965
2966 virtual Representation RequiredInputRepresentation(int index) const { 2966 virtual Representation RequiredInputRepresentation(int index) const {
2967 // The key is supposed to be Integer32. 2967 // The key is supposed to be Integer32.
2968 return (index == 1) ? Representation::Integer32() 2968 return (index == 1) ? Representation::Integer32()
2969 : Representation::Tagged(); 2969 : Representation::Tagged();
2970 } 2970 }
2971 2971
2972 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, 2972 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement,
2973 "load_keyed_fast_element") 2973 "load_keyed_fast_element")
2974 2974
2975 protected: 2975 protected:
2976 virtual bool DataEquals(HValue* other) const { return true; } 2976 virtual bool DataEquals(HValue* other) { return true; }
2977 }; 2977 };
2978 2978
2979 2979
2980 class HLoadPixelArrayElement: public HBinaryOperation { 2980 class HLoadPixelArrayElement: public HBinaryOperation {
2981 public: 2981 public:
2982 HLoadPixelArrayElement(HValue* external_elements, HValue* key) 2982 HLoadPixelArrayElement(HValue* external_elements, HValue* key)
2983 : HBinaryOperation(external_elements, key) { 2983 : HBinaryOperation(external_elements, key) {
2984 set_representation(Representation::Integer32()); 2984 set_representation(Representation::Integer32());
2985 SetFlag(kDependsOnPixelArrayElements); 2985 SetFlag(kDependsOnPixelArrayElements);
2986 // Native code could change the pixel array. 2986 // Native code could change the pixel array.
2987 SetFlag(kDependsOnCalls); 2987 SetFlag(kDependsOnCalls);
2988 SetFlag(kUseGVN); 2988 SetFlag(kUseGVN);
2989 } 2989 }
2990 2990
2991 virtual void PrintDataTo(StringStream* stream) const; 2991 virtual void PrintDataTo(StringStream* stream);
2992 2992
2993 virtual Representation RequiredInputRepresentation(int index) const { 2993 virtual Representation RequiredInputRepresentation(int index) const {
2994 // The key is supposed to be Integer32, but the base pointer 2994 // The key is supposed to be Integer32, but the base pointer
2995 // for the element load is a naked pointer. 2995 // for the element load is a naked pointer.
2996 return (index == 1) ? Representation::Integer32() 2996 return (index == 1) ? Representation::Integer32()
2997 : Representation::External(); 2997 : Representation::External();
2998 } 2998 }
2999 2999
3000 HValue* external_pointer() const { return OperandAt(0); } 3000 HValue* external_pointer() const { return OperandAt(0); }
3001 HValue* key() const { return OperandAt(1); } 3001 HValue* key() const { return OperandAt(1); }
3002 3002
3003 DECLARE_CONCRETE_INSTRUCTION(LoadPixelArrayElement, 3003 DECLARE_CONCRETE_INSTRUCTION(LoadPixelArrayElement,
3004 "load_pixel_array_element") 3004 "load_pixel_array_element")
3005 3005
3006 protected: 3006 protected:
3007 virtual bool DataEquals(HValue* other) const { return true; } 3007 virtual bool DataEquals(HValue* other) { return true; }
3008 }; 3008 };
3009 3009
3010 3010
3011 class HLoadKeyedGeneric: public HLoadKeyed { 3011 class HLoadKeyedGeneric: public HLoadKeyed {
3012 public: 3012 public:
3013 HLoadKeyedGeneric(HContext* context, HValue* obj, HValue* key) 3013 HLoadKeyedGeneric(HContext* context, HValue* obj, HValue* key)
3014 : HLoadKeyed(obj, key), context_(NULL) { 3014 : HLoadKeyed(obj, key), context_(NULL) {
3015 SetOperandAt(2, context); 3015 SetOperandAt(2, context);
3016 SetAllSideEffects(); 3016 SetAllSideEffects();
3017 } 3017 }
(...skipping 20 matching lines...) Expand all
3038 class HStoreNamed: public HBinaryOperation { 3038 class HStoreNamed: public HBinaryOperation {
3039 public: 3039 public:
3040 HStoreNamed(HValue* obj, Handle<String> name, HValue* val) 3040 HStoreNamed(HValue* obj, Handle<String> name, HValue* val)
3041 : HBinaryOperation(obj, val), name_(name) { 3041 : HBinaryOperation(obj, val), name_(name) {
3042 } 3042 }
3043 3043
3044 virtual Representation RequiredInputRepresentation(int index) const { 3044 virtual Representation RequiredInputRepresentation(int index) const {
3045 return Representation::Tagged(); 3045 return Representation::Tagged();
3046 } 3046 }
3047 3047
3048 virtual void PrintDataTo(StringStream* stream) const; 3048 virtual void PrintDataTo(StringStream* stream);
3049 3049
3050 HValue* object() const { return OperandAt(0); } 3050 HValue* object() const { return OperandAt(0); }
3051 Handle<String> name() const { return name_; } 3051 Handle<String> name() const { return name_; }
3052 HValue* value() const { return OperandAt(1); } 3052 HValue* value() const { return OperandAt(1); }
3053 void set_value(HValue* value) { SetOperandAt(1, value); } 3053 void set_value(HValue* value) { SetOperandAt(1, value); }
3054 3054
3055 DECLARE_INSTRUCTION(StoreNamed) 3055 DECLARE_INSTRUCTION(StoreNamed)
3056 3056
3057 private: 3057 private:
3058 Handle<String> name_; 3058 Handle<String> name_;
(...skipping 15 matching lines...) Expand all
3074 } else { 3074 } else {
3075 SetFlag(kChangesBackingStoreFields); 3075 SetFlag(kChangesBackingStoreFields);
3076 } 3076 }
3077 } 3077 }
3078 3078
3079 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store_named_field") 3079 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store_named_field")
3080 3080
3081 virtual Representation RequiredInputRepresentation(int index) const { 3081 virtual Representation RequiredInputRepresentation(int index) const {
3082 return Representation::Tagged(); 3082 return Representation::Tagged();
3083 } 3083 }
3084 virtual void PrintDataTo(StringStream* stream) const; 3084 virtual void PrintDataTo(StringStream* stream);
3085 3085
3086 bool is_in_object() const { return is_in_object_; } 3086 bool is_in_object() const { return is_in_object_; }
3087 int offset() const { return offset_; } 3087 int offset() const { return offset_; }
3088 Handle<Map> transition() const { return transition_; } 3088 Handle<Map> transition() const { return transition_; }
3089 void set_transition(Handle<Map> map) { transition_ = map; } 3089 void set_transition(Handle<Map> map) { transition_ = map; }
3090 3090
3091 bool NeedsWriteBarrier() const { 3091 bool NeedsWriteBarrier() const {
3092 return StoringValueNeedsWriteBarrier(value()); 3092 return StoringValueNeedsWriteBarrier(value());
3093 } 3093 }
3094 3094
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3131 3131
3132 3132
3133 class HStoreKeyed: public HInstruction { 3133 class HStoreKeyed: public HInstruction {
3134 public: 3134 public:
3135 HStoreKeyed(HValue* obj, HValue* key, HValue* val) { 3135 HStoreKeyed(HValue* obj, HValue* key, HValue* val) {
3136 SetOperandAt(0, obj); 3136 SetOperandAt(0, obj);
3137 SetOperandAt(1, key); 3137 SetOperandAt(1, key);
3138 SetOperandAt(2, val); 3138 SetOperandAt(2, val);
3139 } 3139 }
3140 3140
3141 virtual void PrintDataTo(StringStream* stream) const; 3141 virtual void PrintDataTo(StringStream* stream);
3142 virtual int OperandCount() const { return operands_.length(); } 3142 virtual int OperandCount() const { return operands_.length(); }
3143 virtual HValue* OperandAt(int index) const { return operands_[index]; } 3143 virtual HValue* OperandAt(int index) const { return operands_[index]; }
3144 3144
3145 virtual Representation RequiredInputRepresentation(int index) const { 3145 virtual Representation RequiredInputRepresentation(int index) const {
3146 return Representation::Tagged(); 3146 return Representation::Tagged();
3147 } 3147 }
3148 3148
3149 HValue* object() const { return OperandAt(0); } 3149 HValue* object() const { return OperandAt(0); }
3150 HValue* key() const { return OperandAt(1); } 3150 HValue* key() const { return OperandAt(1); }
3151 HValue* value() const { return OperandAt(2); } 3151 HValue* value() const { return OperandAt(2); }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3185 3185
3186 class HStorePixelArrayElement: public HInstruction { 3186 class HStorePixelArrayElement: public HInstruction {
3187 public: 3187 public:
3188 HStorePixelArrayElement(HValue* external_elements, HValue* key, HValue* val) { 3188 HStorePixelArrayElement(HValue* external_elements, HValue* key, HValue* val) {
3189 SetFlag(kChangesPixelArrayElements); 3189 SetFlag(kChangesPixelArrayElements);
3190 SetOperandAt(0, external_elements); 3190 SetOperandAt(0, external_elements);
3191 SetOperandAt(1, key); 3191 SetOperandAt(1, key);
3192 SetOperandAt(2, val); 3192 SetOperandAt(2, val);
3193 } 3193 }
3194 3194
3195 virtual void PrintDataTo(StringStream* stream) const; 3195 virtual void PrintDataTo(StringStream* stream);
3196 virtual int OperandCount() const { return operands_.length(); } 3196 virtual int OperandCount() const { return operands_.length(); }
3197 virtual HValue* OperandAt(int index) const { return operands_[index]; } 3197 virtual HValue* OperandAt(int index) const { return operands_[index]; }
3198 3198
3199 virtual Representation RequiredInputRepresentation(int index) const { 3199 virtual Representation RequiredInputRepresentation(int index) const {
3200 if (index == 0) { 3200 if (index == 0) {
3201 return Representation::External(); 3201 return Representation::External();
3202 } else { 3202 } else {
3203 return Representation::Integer32(); 3203 return Representation::Integer32();
3204 } 3204 }
3205 } 3205 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
3265 return (index == 1) ? Representation::Integer32() 3265 return (index == 1) ? Representation::Integer32()
3266 : Representation::Tagged(); 3266 : Representation::Tagged();
3267 } 3267 }
3268 3268
3269 HValue* string() const { return OperandAt(0); } 3269 HValue* string() const { return OperandAt(0); }
3270 HValue* index() const { return OperandAt(1); } 3270 HValue* index() const { return OperandAt(1); }
3271 3271
3272 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string_char_code_at") 3272 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt, "string_char_code_at")
3273 3273
3274 protected: 3274 protected:
3275 virtual bool DataEquals(HValue* other) const { return true; } 3275 virtual bool DataEquals(HValue* other) { return true; }
3276 3276
3277 virtual Range* InferRange() { 3277 virtual Range* InferRange() {
3278 return new Range(0, String::kMaxUC16CharCode); 3278 return new Range(0, String::kMaxUC16CharCode);
3279 } 3279 }
3280 }; 3280 };
3281 3281
3282 3282
3283 class HStringLength: public HUnaryOperation { 3283 class HStringLength: public HUnaryOperation {
3284 public: 3284 public:
3285 explicit HStringLength(HValue* string) : HUnaryOperation(string) { 3285 explicit HStringLength(HValue* string) : HUnaryOperation(string) {
3286 set_representation(Representation::Tagged()); 3286 set_representation(Representation::Tagged());
3287 SetFlag(kUseGVN); 3287 SetFlag(kUseGVN);
3288 } 3288 }
3289 3289
3290 virtual Representation RequiredInputRepresentation(int index) const { 3290 virtual Representation RequiredInputRepresentation(int index) const {
3291 return Representation::Tagged(); 3291 return Representation::Tagged();
3292 } 3292 }
3293 3293
3294 virtual HType CalculateInferredType() const { 3294 virtual HType CalculateInferredType() {
3295 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); 3295 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue);
3296 return HType::Smi(); 3296 return HType::Smi();
3297 } 3297 }
3298 3298
3299 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string_length") 3299 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string_length")
3300 3300
3301 protected: 3301 protected:
3302 virtual bool DataEquals(HValue* other) const { return true; } 3302 virtual bool DataEquals(HValue* other) { return true; }
3303 3303
3304 virtual Range* InferRange() { 3304 virtual Range* InferRange() {
3305 return new Range(0, String::kMaxLength); 3305 return new Range(0, String::kMaxLength);
3306 } 3306 }
3307 }; 3307 };
3308 3308
3309 3309
3310 class HMaterializedLiteral: public HInstruction { 3310 class HMaterializedLiteral: public HInstruction {
3311 public: 3311 public:
3312 HMaterializedLiteral(int index, int depth) 3312 HMaterializedLiteral(int index, int depth)
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
3464 HValue* object() const { return left(); } 3464 HValue* object() const { return left(); }
3465 HValue* key() const { return right(); } 3465 HValue* key() const { return right(); }
3466 }; 3466 };
3467 3467
3468 #undef DECLARE_INSTRUCTION 3468 #undef DECLARE_INSTRUCTION
3469 #undef DECLARE_CONCRETE_INSTRUCTION 3469 #undef DECLARE_CONCRETE_INSTRUCTION
3470 3470
3471 } } // namespace v8::internal 3471 } } // namespace v8::internal
3472 3472
3473 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 3473 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698