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

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

Issue 6538088: Fix bug with input representation of HValueOf.... (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 | test/mjsunit/compiler/regress-valueof.js » ('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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = 0;
582 return Representation::None(); 582
583 }
584 virtual Representation InferredRepresentation() { 583 virtual Representation InferredRepresentation() {
585 return representation(); 584 return representation();
586 } 585 }
587 586
588 // This gives the instruction an opportunity to replace itself with an 587 // This gives the instruction an opportunity to replace itself with an
589 // instruction that does the same in some better way. To replace an 588 // 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, 589 // instruction with a new one, first add the new instruction to the graph,
591 // then return it. Return NULL to have the instruction deleted. 590 // then return it. Return NULL to have the instruction deleted.
592 virtual HValue* Canonicalize() { return this; } 591 virtual HValue* Canonicalize() { return this; }
593 592
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 HInstruction* next_; 711 HInstruction* next_;
713 HInstruction* previous_; 712 HInstruction* previous_;
714 int position_; 713 int position_;
715 714
716 friend class HBasicBlock; 715 friend class HBasicBlock;
717 }; 716 };
718 717
719 718
720 class HBlockEntry: public HInstruction { 719 class HBlockEntry: public HInstruction {
721 public: 720 public:
721
722 virtual Representation RequiredInputRepresentation(int index) const {
723 return Representation::None();
724 }
725
722 DECLARE_CONCRETE_INSTRUCTION(BlockEntry, "block_entry") 726 DECLARE_CONCRETE_INSTRUCTION(BlockEntry, "block_entry")
723 }; 727 };
724 728
725 729
726 class HControlInstruction: public HInstruction { 730 class HControlInstruction: public HInstruction {
727 public: 731 public:
728 HControlInstruction(HBasicBlock* first, HBasicBlock* second) 732 HControlInstruction(HBasicBlock* first, HBasicBlock* second)
729 : first_successor_(first), second_successor_(second) { 733 : first_successor_(first), second_successor_(second) {
730 } 734 }
731 735
732 HBasicBlock* FirstSuccessor() const { return first_successor_; } 736 HBasicBlock* FirstSuccessor() const { return first_successor_; }
733 HBasicBlock* SecondSuccessor() const { return second_successor_; } 737 HBasicBlock* SecondSuccessor() const { return second_successor_; }
734 738
735 virtual void PrintDataTo(StringStream* stream); 739 virtual void PrintDataTo(StringStream* stream);
736 740
737 DECLARE_INSTRUCTION(ControlInstruction) 741 DECLARE_INSTRUCTION(ControlInstruction)
738 742
739 private: 743 private:
740 HBasicBlock* first_successor_; 744 HBasicBlock* first_successor_;
741 HBasicBlock* second_successor_; 745 HBasicBlock* second_successor_;
742 }; 746 };
743 747
744 748
745 class HDeoptimize: public HControlInstruction { 749 class HDeoptimize: public HControlInstruction {
746 public: 750 public:
747 HDeoptimize() : HControlInstruction(NULL, NULL) { } 751 HDeoptimize() : HControlInstruction(NULL, NULL) { }
748 752
753 virtual Representation RequiredInputRepresentation(int index) const {
754 return Representation::None();
755 }
756
749 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize") 757 DECLARE_CONCRETE_INSTRUCTION(Deoptimize, "deoptimize")
750 }; 758 };
751 759
752 760
753 class HGoto: public HControlInstruction { 761 class HGoto: public HControlInstruction {
754 public: 762 public:
755 explicit HGoto(HBasicBlock* target) 763 explicit HGoto(HBasicBlock* target)
756 : HControlInstruction(target, NULL), include_stack_check_(false) { 764 : HControlInstruction(target, NULL), include_stack_check_(false) {
757 } 765 }
758 766
759 void set_include_stack_check(bool include_stack_check) { 767 void set_include_stack_check(bool include_stack_check) {
760 include_stack_check_ = include_stack_check; 768 include_stack_check_ = include_stack_check;
761 } 769 }
762 bool include_stack_check() const { return include_stack_check_; } 770 bool include_stack_check() const { return include_stack_check_; }
763 771
772 virtual Representation RequiredInputRepresentation(int index) const {
773 return Representation::None();
774 }
775
764 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto") 776 DECLARE_CONCRETE_INSTRUCTION(Goto, "goto")
765 777
766 private: 778 private:
767 bool include_stack_check_; 779 bool include_stack_check_;
768 }; 780 };
769 781
770 782
771 class HUnaryControlInstruction: public HControlInstruction { 783 class HUnaryControlInstruction: public HControlInstruction {
772 public: 784 public:
773 explicit HUnaryControlInstruction(HValue* value, 785 explicit HUnaryControlInstruction(HValue* value,
774 HBasicBlock* true_target, 786 HBasicBlock* true_target,
775 HBasicBlock* false_target) 787 HBasicBlock* false_target)
776 : HControlInstruction(true_target, false_target) { 788 : HControlInstruction(true_target, false_target) {
777 SetOperandAt(0, value); 789 SetOperandAt(0, value);
778 } 790 }
779 791
780 virtual Representation RequiredInputRepresentation(int index) const {
781 return Representation::Tagged();
782 }
783
784 virtual void PrintDataTo(StringStream* stream); 792 virtual void PrintDataTo(StringStream* stream);
785 793
786 HValue* value() { return OperandAt(0); } 794 HValue* value() { return OperandAt(0); }
787 virtual int OperandCount() { return 1; } 795 virtual int OperandCount() { return 1; }
788 virtual HValue* OperandAt(int index) { return operands_[index]; } 796 virtual HValue* OperandAt(int index) { return operands_[index]; }
789 797
790 DECLARE_INSTRUCTION(UnaryControlInstruction) 798 DECLARE_INSTRUCTION(UnaryControlInstruction)
791 799
792 protected: 800 protected:
793 virtual void InternalSetOperandAt(int index, HValue* value) { 801 virtual void InternalSetOperandAt(int index, HValue* value) {
(...skipping 30 matching lines...) Expand all
824 map_(map) { 832 map_(map) {
825 ASSERT(true_target != NULL); 833 ASSERT(true_target != NULL);
826 ASSERT(false_target != NULL); 834 ASSERT(false_target != NULL);
827 ASSERT(!map.is_null()); 835 ASSERT(!map.is_null());
828 } 836 }
829 837
830 virtual void PrintDataTo(StringStream* stream); 838 virtual void PrintDataTo(StringStream* stream);
831 839
832 Handle<Map> map() const { return map_; } 840 Handle<Map> map() const { return map_; }
833 841
842 virtual Representation RequiredInputRepresentation(int index) const {
843 return Representation::Tagged();
844 }
845
834 DECLARE_CONCRETE_INSTRUCTION(CompareMap, "compare_map") 846 DECLARE_CONCRETE_INSTRUCTION(CompareMap, "compare_map")
835 847
836 private: 848 private:
837 Handle<Map> map_; 849 Handle<Map> map_;
838 }; 850 };
839 851
840 852
841 class HReturn: public HUnaryControlInstruction { 853 class HReturn: public HUnaryControlInstruction {
842 public: 854 public:
843 explicit HReturn(HValue* value) 855 explicit HReturn(HValue* value)
844 : HUnaryControlInstruction(value, NULL, NULL) { 856 : HUnaryControlInstruction(value, NULL, NULL) {
845 } 857 }
846 858
859 virtual Representation RequiredInputRepresentation(int index) const {
860 return Representation::Tagged();
861 }
862
847 DECLARE_CONCRETE_INSTRUCTION(Return, "return") 863 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
848 }; 864 };
849 865
850 866
851 class HAbnormalExit: public HControlInstruction { 867 class HAbnormalExit: public HControlInstruction {
852 public: 868 public:
853 HAbnormalExit() : HControlInstruction(NULL, NULL) { } 869 HAbnormalExit() : HControlInstruction(NULL, NULL) { }
854 870
871 virtual Representation RequiredInputRepresentation(int index) const {
872 return Representation::None();
873 }
874
855 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit, "abnormal_exit") 875 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit, "abnormal_exit")
856 }; 876 };
857 877
858 878
859 class HUnaryOperation: public HInstruction { 879 class HUnaryOperation: public HInstruction {
860 public: 880 public:
861 explicit HUnaryOperation(HValue* value) { 881 explicit HUnaryOperation(HValue* value) {
862 SetOperandAt(0, value); 882 SetOperandAt(0, value);
863 } 883 }
864 884
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 } 996 }
977 void AddAssignedValue(int index, HValue* value) { 997 void AddAssignedValue(int index, HValue* value) {
978 AddValue(index, value); 998 AddValue(index, value);
979 } 999 }
980 void AddPushedValue(HValue* value) { 1000 void AddPushedValue(HValue* value) {
981 AddValue(kNoIndex, value); 1001 AddValue(kNoIndex, value);
982 } 1002 }
983 virtual int OperandCount() { return values_.length(); } 1003 virtual int OperandCount() { return values_.length(); }
984 virtual HValue* OperandAt(int index) { return values_[index]; } 1004 virtual HValue* OperandAt(int index) { return values_[index]; }
985 1005
1006 virtual Representation RequiredInputRepresentation(int index) const {
1007 return Representation::None();
1008 }
1009
986 DECLARE_CONCRETE_INSTRUCTION(Simulate, "simulate") 1010 DECLARE_CONCRETE_INSTRUCTION(Simulate, "simulate")
987 1011
988 #ifdef DEBUG 1012 #ifdef DEBUG
989 virtual void Verify(); 1013 virtual void Verify();
990 #endif 1014 #endif
991 1015
992 protected: 1016 protected:
993 virtual void InternalSetOperandAt(int index, HValue* value) { 1017 virtual void InternalSetOperandAt(int index, HValue* value) {
994 values_[index] = value; 1018 values_[index] = value;
995 } 1019 }
(...skipping 13 matching lines...) Expand all
1009 int environment_length_; 1033 int environment_length_;
1010 ZoneList<HValue*> values_; 1034 ZoneList<HValue*> values_;
1011 ZoneList<int> assigned_indexes_; 1035 ZoneList<int> assigned_indexes_;
1012 }; 1036 };
1013 1037
1014 1038
1015 class HStackCheck: public HInstruction { 1039 class HStackCheck: public HInstruction {
1016 public: 1040 public:
1017 HStackCheck() { } 1041 HStackCheck() { }
1018 1042
1043 virtual Representation RequiredInputRepresentation(int index) const {
1044 return Representation::None();
1045 }
1046
1019 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack_check") 1047 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack_check")
1020 }; 1048 };
1021 1049
1022 1050
1023 class HEnterInlined: public HInstruction { 1051 class HEnterInlined: public HInstruction {
1024 public: 1052 public:
1025 HEnterInlined(Handle<JSFunction> closure, FunctionLiteral* function) 1053 HEnterInlined(Handle<JSFunction> closure, FunctionLiteral* function)
1026 : closure_(closure), function_(function) { 1054 : closure_(closure), function_(function) {
1027 } 1055 }
1028 1056
1029 virtual void PrintDataTo(StringStream* stream); 1057 virtual void PrintDataTo(StringStream* stream);
1030 1058
1031 Handle<JSFunction> closure() const { return closure_; } 1059 Handle<JSFunction> closure() const { return closure_; }
1032 FunctionLiteral* function() const { return function_; } 1060 FunctionLiteral* function() const { return function_; }
1033 1061
1062 virtual Representation RequiredInputRepresentation(int index) const {
1063 return Representation::None();
1064 }
1065
1034 DECLARE_CONCRETE_INSTRUCTION(EnterInlined, "enter_inlined") 1066 DECLARE_CONCRETE_INSTRUCTION(EnterInlined, "enter_inlined")
1035 1067
1036 private: 1068 private:
1037 Handle<JSFunction> closure_; 1069 Handle<JSFunction> closure_;
1038 FunctionLiteral* function_; 1070 FunctionLiteral* function_;
1039 }; 1071 };
1040 1072
1041 1073
1042 class HLeaveInlined: public HInstruction { 1074 class HLeaveInlined: public HInstruction {
1043 public: 1075 public:
1044 HLeaveInlined() {} 1076 HLeaveInlined() {}
1045 1077
1078 virtual Representation RequiredInputRepresentation(int index) const {
1079 return Representation::None();
1080 }
1081
1046 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined, "leave_inlined") 1082 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined, "leave_inlined")
1047 }; 1083 };
1048 1084
1049 1085
1050 class HPushArgument: public HUnaryOperation { 1086 class HPushArgument: public HUnaryOperation {
1051 public: 1087 public:
1052 explicit HPushArgument(HValue* value) : HUnaryOperation(value) { 1088 explicit HPushArgument(HValue* value) : HUnaryOperation(value) {
1053 set_representation(Representation::Tagged()); 1089 set_representation(Representation::Tagged());
1054 } 1090 }
1055 1091
1056 virtual Representation RequiredInputRepresentation(int index) const { 1092 virtual Representation RequiredInputRepresentation(int index) const {
1057 return Representation::Tagged(); 1093 return Representation::Tagged();
1058 } 1094 }
1059 1095
1060 HValue* argument() { return OperandAt(0); } 1096 HValue* argument() { return OperandAt(0); }
1061 1097
1062 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push_argument") 1098 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push_argument")
1063 }; 1099 };
1064 1100
1065 1101
1066 class HContext: public HInstruction { 1102 class HContext: public HInstruction {
1067 public: 1103 public:
1068 HContext() { 1104 HContext() {
1069 set_representation(Representation::Tagged()); 1105 set_representation(Representation::Tagged());
1070 SetFlag(kUseGVN); 1106 SetFlag(kUseGVN);
1071 } 1107 }
1072 1108
1109 virtual Representation RequiredInputRepresentation(int index) const {
1110 return Representation::None();
1111 }
1112
1073 DECLARE_CONCRETE_INSTRUCTION(Context, "context"); 1113 DECLARE_CONCRETE_INSTRUCTION(Context, "context");
1074 1114
1075 protected: 1115 protected:
1076 virtual bool DataEquals(HValue* other) { return true; } 1116 virtual bool DataEquals(HValue* other) { return true; }
1077 }; 1117 };
1078 1118
1079 1119
1080 class HOuterContext: public HUnaryOperation { 1120 class HOuterContext: public HUnaryOperation {
1081 public: 1121 public:
1082 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) { 1122 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) {
1083 set_representation(Representation::Tagged()); 1123 set_representation(Representation::Tagged());
1084 SetFlag(kUseGVN); 1124 SetFlag(kUseGVN);
1085 } 1125 }
1086 1126
1087 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer_context"); 1127 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer_context");
1088 1128
1129 virtual Representation RequiredInputRepresentation(int index) const {
1130 return Representation::Tagged();
1131 }
1132
1089 protected: 1133 protected:
1090 virtual bool DataEquals(HValue* other) { return true; } 1134 virtual bool DataEquals(HValue* other) { return true; }
1091 }; 1135 };
1092 1136
1093 1137
1094 class HGlobalObject: public HUnaryOperation { 1138 class HGlobalObject: public HUnaryOperation {
1095 public: 1139 public:
1096 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { 1140 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) {
1097 set_representation(Representation::Tagged()); 1141 set_representation(Representation::Tagged());
1098 SetFlag(kUseGVN); 1142 SetFlag(kUseGVN);
1099 } 1143 }
1100 1144
1101 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object") 1145 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object")
1102 1146
1147 virtual Representation RequiredInputRepresentation(int index) const {
1148 return Representation::Tagged();
1149 }
1150
1103 protected: 1151 protected:
1104 virtual bool DataEquals(HValue* other) { return true; } 1152 virtual bool DataEquals(HValue* other) { return true; }
1105 }; 1153 };
1106 1154
1107 1155
1108 class HGlobalReceiver: public HUnaryOperation { 1156 class HGlobalReceiver: public HUnaryOperation {
1109 public: 1157 public:
1110 explicit HGlobalReceiver(HValue* global_object) 1158 explicit HGlobalReceiver(HValue* global_object)
1111 : HUnaryOperation(global_object) { 1159 : HUnaryOperation(global_object) {
1112 set_representation(Representation::Tagged()); 1160 set_representation(Representation::Tagged());
1113 SetFlag(kUseGVN); 1161 SetFlag(kUseGVN);
1114 } 1162 }
1115 1163
1116 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver") 1164 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver")
1117 1165
1166 virtual Representation RequiredInputRepresentation(int index) const {
1167 return Representation::Tagged();
1168 }
1169
1118 protected: 1170 protected:
1119 virtual bool DataEquals(HValue* other) { return true; } 1171 virtual bool DataEquals(HValue* other) { return true; }
1120 }; 1172 };
1121 1173
1122 1174
1123 class HCall: public HInstruction { 1175 class HCall: public HInstruction {
1124 public: 1176 public:
1125 // The argument count includes the receiver. 1177 // The argument count includes the receiver.
1126 explicit HCall(int argument_count) : argument_count_(argument_count) { 1178 explicit HCall(int argument_count) : argument_count_(argument_count) {
1127 set_representation(Representation::Tagged()); 1179 set_representation(Representation::Tagged());
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 : HCall(argument_count), function_(function) { } 1257 : HCall(argument_count), function_(function) { }
1206 1258
1207 Handle<JSFunction> function() const { return function_; } 1259 Handle<JSFunction> function() const { return function_; }
1208 1260
1209 bool IsApplyFunction() const { 1261 bool IsApplyFunction() const {
1210 return function_->code() == Builtins::builtin(Builtins::FunctionApply); 1262 return function_->code() == Builtins::builtin(Builtins::FunctionApply);
1211 } 1263 }
1212 1264
1213 virtual void PrintDataTo(StringStream* stream); 1265 virtual void PrintDataTo(StringStream* stream);
1214 1266
1267 virtual Representation RequiredInputRepresentation(int index) const {
1268 return Representation::None();
1269 }
1270
1215 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call_constant_function") 1271 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call_constant_function")
1216 1272
1217 private: 1273 private:
1218 Handle<JSFunction> function_; 1274 Handle<JSFunction> function_;
1219 }; 1275 };
1220 1276
1221 1277
1222 class HCallKeyed: public HBinaryCall { 1278 class HCallKeyed: public HBinaryCall {
1223 public: 1279 public:
1224 HCallKeyed(HValue* context, HValue* key, int argument_count) 1280 HCallKeyed(HValue* context, HValue* key, int argument_count)
(...skipping 17 matching lines...) Expand all
1242 : HUnaryCall(context, argument_count), name_(name) { 1298 : HUnaryCall(context, argument_count), name_(name) {
1243 } 1299 }
1244 1300
1245 virtual void PrintDataTo(StringStream* stream); 1301 virtual void PrintDataTo(StringStream* stream);
1246 1302
1247 HValue* context() { return value(); } 1303 HValue* context() { return value(); }
1248 Handle<String> name() const { return name_; } 1304 Handle<String> name() const { return name_; }
1249 1305
1250 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call_named") 1306 DECLARE_CONCRETE_INSTRUCTION(CallNamed, "call_named")
1251 1307
1308 virtual Representation RequiredInputRepresentation(int index) const {
1309 return Representation::Tagged();
1310 }
1311
1252 private: 1312 private:
1253 Handle<String> name_; 1313 Handle<String> name_;
1254 }; 1314 };
1255 1315
1256 1316
1257 class HCallFunction: public HUnaryCall { 1317 class HCallFunction: public HUnaryCall {
1258 public: 1318 public:
1259 HCallFunction(HValue* context, int argument_count) 1319 HCallFunction(HValue* context, int argument_count)
1260 : HUnaryCall(context, argument_count) { 1320 : HUnaryCall(context, argument_count) {
1261 } 1321 }
1262 1322
1263 HValue* context() { return value(); } 1323 HValue* context() { return value(); }
1264 1324
1325 virtual Representation RequiredInputRepresentation(int index) const {
1326 return Representation::Tagged();
1327 }
1328
1265 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call_function") 1329 DECLARE_CONCRETE_INSTRUCTION(CallFunction, "call_function")
1266 }; 1330 };
1267 1331
1268 1332
1269 class HCallGlobal: public HUnaryCall { 1333 class HCallGlobal: public HUnaryCall {
1270 public: 1334 public:
1271 HCallGlobal(HValue* context, Handle<String> name, int argument_count) 1335 HCallGlobal(HValue* context, Handle<String> name, int argument_count)
1272 : HUnaryCall(context, argument_count), name_(name) { 1336 : HUnaryCall(context, argument_count), name_(name) {
1273 } 1337 }
1274 1338
1275 virtual void PrintDataTo(StringStream* stream); 1339 virtual void PrintDataTo(StringStream* stream);
1276 1340
1277 HValue* context() { return value(); } 1341 HValue* context() { return value(); }
1278 Handle<String> name() const { return name_; } 1342 Handle<String> name() const { return name_; }
1279 1343
1344 virtual Representation RequiredInputRepresentation(int index) const {
1345 return Representation::Tagged();
1346 }
1347
1280 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call_global") 1348 DECLARE_CONCRETE_INSTRUCTION(CallGlobal, "call_global")
1281 1349
1282 private: 1350 private:
1283 Handle<String> name_; 1351 Handle<String> name_;
1284 }; 1352 };
1285 1353
1286 1354
1287 class HCallKnownGlobal: public HCall { 1355 class HCallKnownGlobal: public HCall {
1288 public: 1356 public:
1289 HCallKnownGlobal(Handle<JSFunction> target, int argument_count) 1357 HCallKnownGlobal(Handle<JSFunction> target, int argument_count)
1290 : HCall(argument_count), target_(target) { } 1358 : HCall(argument_count), target_(target) { }
1291 1359
1292 virtual void PrintDataTo(StringStream* stream); 1360 virtual void PrintDataTo(StringStream* stream);
1293 1361
1294 Handle<JSFunction> target() const { return target_; } 1362 Handle<JSFunction> target() const { return target_; }
1295 1363
1364 virtual Representation RequiredInputRepresentation(int index) const {
1365 return Representation::None();
1366 }
1367
1296 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call_known_global") 1368 DECLARE_CONCRETE_INSTRUCTION(CallKnownGlobal, "call_known_global")
1297 1369
1298 private: 1370 private:
1299 Handle<JSFunction> target_; 1371 Handle<JSFunction> target_;
1300 }; 1372 };
1301 1373
1302 1374
1303 class HCallNew: public HBinaryCall { 1375 class HCallNew: public HBinaryCall {
1304 public: 1376 public:
1305 HCallNew(HValue* context, HValue* constructor, int argument_count) 1377 HCallNew(HValue* context, HValue* constructor, int argument_count)
(...skipping 15 matching lines...) Expand all
1321 public: 1393 public:
1322 HCallRuntime(Handle<String> name, 1394 HCallRuntime(Handle<String> name,
1323 Runtime::Function* c_function, 1395 Runtime::Function* c_function,
1324 int argument_count) 1396 int argument_count)
1325 : HCall(argument_count), c_function_(c_function), name_(name) { } 1397 : HCall(argument_count), c_function_(c_function), name_(name) { }
1326 virtual void PrintDataTo(StringStream* stream); 1398 virtual void PrintDataTo(StringStream* stream);
1327 1399
1328 Runtime::Function* function() const { return c_function_; } 1400 Runtime::Function* function() const { return c_function_; }
1329 Handle<String> name() const { return name_; } 1401 Handle<String> name() const { return name_; }
1330 1402
1403 virtual Representation RequiredInputRepresentation(int index) const {
1404 return Representation::None();
1405 }
1406
1331 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call_runtime") 1407 DECLARE_CONCRETE_INSTRUCTION(CallRuntime, "call_runtime")
1332 1408
1333 private: 1409 private:
1334 Runtime::Function* c_function_; 1410 Runtime::Function* c_function_;
1335 Handle<String> name_; 1411 Handle<String> name_;
1336 }; 1412 };
1337 1413
1338 1414
1339 class HJSArrayLength: public HUnaryOperation { 1415 class HJSArrayLength: public HUnaryOperation {
1340 public: 1416 public:
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 switch (op_) { 1531 switch (op_) {
1456 case kMathFloor: 1532 case kMathFloor:
1457 case kMathRound: 1533 case kMathRound:
1458 case kMathCeil: 1534 case kMathCeil:
1459 case kMathSqrt: 1535 case kMathSqrt:
1460 case kMathPowHalf: 1536 case kMathPowHalf:
1461 case kMathLog: 1537 case kMathLog:
1462 case kMathSin: 1538 case kMathSin:
1463 case kMathCos: 1539 case kMathCos:
1464 return Representation::Double(); 1540 return Representation::Double();
1465 break;
1466 case kMathAbs: 1541 case kMathAbs:
1467 return representation(); 1542 return representation();
1468 break;
1469 default: 1543 default:
1544 UNREACHABLE();
1470 return Representation::None(); 1545 return Representation::None();
1471 } 1546 }
1472 } 1547 }
1473 1548
1474 virtual HValue* Canonicalize() { 1549 virtual HValue* Canonicalize() {
1475 // If the input is integer32 then we replace the floor instruction 1550 // If the input is integer32 then we replace the floor instruction
1476 // with its inputs. This happens before the representation changes are 1551 // with its inputs. This happens before the representation changes are
1477 // introduced. 1552 // introduced.
1478 if (op() == kMathFloor) { 1553 if (op() == kMathFloor) {
1479 if (value()->representation().IsInteger32()) return value(); 1554 if (value()->representation().IsInteger32()) return value();
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 1773
1699 #ifdef DEBUG 1774 #ifdef DEBUG
1700 virtual void Verify(); 1775 virtual void Verify();
1701 #endif 1776 #endif
1702 1777
1703 Handle<JSObject> prototype() const { return prototype_; } 1778 Handle<JSObject> prototype() const { return prototype_; }
1704 Handle<JSObject> holder() const { return holder_; } 1779 Handle<JSObject> holder() const { return holder_; }
1705 1780
1706 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps") 1781 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps, "check_prototype_maps")
1707 1782
1783 virtual Representation RequiredInputRepresentation(int index) const {
1784 return Representation::None();
1785 }
1786
1708 virtual intptr_t Hashcode() { 1787 virtual intptr_t Hashcode() {
1709 ASSERT(!Heap::IsAllocationAllowed()); 1788 ASSERT(!Heap::IsAllocationAllowed());
1710 intptr_t hash = reinterpret_cast<intptr_t>(*prototype()); 1789 intptr_t hash = reinterpret_cast<intptr_t>(*prototype());
1711 hash = 17 * hash + reinterpret_cast<intptr_t>(*holder()); 1790 hash = 17 * hash + reinterpret_cast<intptr_t>(*holder());
1712 return hash; 1791 return hash;
1713 } 1792 }
1714 1793
1715 protected: 1794 protected:
1716 virtual bool DataEquals(HValue* other) { 1795 virtual bool DataEquals(HValue* other) {
1717 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); 1796 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 }; 1923 };
1845 1924
1846 1925
1847 class HArgumentsObject: public HInstruction { 1926 class HArgumentsObject: public HInstruction {
1848 public: 1927 public:
1849 HArgumentsObject() { 1928 HArgumentsObject() {
1850 set_representation(Representation::Tagged()); 1929 set_representation(Representation::Tagged());
1851 SetFlag(kIsArguments); 1930 SetFlag(kIsArguments);
1852 } 1931 }
1853 1932
1933 virtual Representation RequiredInputRepresentation(int index) const {
1934 return Representation::None();
1935 }
1936
1854 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject, "arguments-object") 1937 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject, "arguments-object")
1855 }; 1938 };
1856 1939
1857 1940
1858 class HConstant: public HInstruction { 1941 class HConstant: public HInstruction {
1859 public: 1942 public:
1860 HConstant(Handle<Object> handle, Representation r); 1943 HConstant(Handle<Object> handle, Representation r);
1861 1944
1862 Handle<Object> handle() const { return handle_; } 1945 Handle<Object> handle() const { return handle_; }
1863 1946
1864 bool InOldSpace() const { return !Heap::InNewSpace(*handle_); } 1947 bool InOldSpace() const { return !Heap::InNewSpace(*handle_); }
1865 1948
1949 virtual Representation RequiredInputRepresentation(int index) const {
1950 return Representation::None();
1951 }
1952
1866 virtual bool EmitAtUses() const { return !representation().IsDouble(); } 1953 virtual bool EmitAtUses() const { return !representation().IsDouble(); }
1867 virtual void PrintDataTo(StringStream* stream); 1954 virtual void PrintDataTo(StringStream* stream);
1868 virtual HType CalculateInferredType(); 1955 virtual HType CalculateInferredType();
1869 bool IsInteger() const { return handle_->IsSmi(); } 1956 bool IsInteger() const { return handle_->IsSmi(); }
1870 HConstant* CopyToRepresentation(Representation r) const; 1957 HConstant* CopyToRepresentation(Representation r) const;
1871 HConstant* CopyToTruncatedInt32() const; 1958 HConstant* CopyToTruncatedInt32() const;
1872 bool HasInteger32Value() const { return has_int32_value_; } 1959 bool HasInteger32Value() const { return has_int32_value_; }
1873 int32_t Integer32Value() const { 1960 int32_t Integer32Value() const {
1874 ASSERT(HasInteger32Value()); 1961 ASSERT(HasInteger32Value());
1875 return int32_value_; 1962 return int32_value_;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 public: 2085 public:
1999 HArgumentsElements() { 2086 HArgumentsElements() {
2000 // The value produced by this instruction is a pointer into the stack 2087 // The value produced by this instruction is a pointer into the stack
2001 // that looks as if it was a smi because of alignment. 2088 // that looks as if it was a smi because of alignment.
2002 set_representation(Representation::Tagged()); 2089 set_representation(Representation::Tagged());
2003 SetFlag(kUseGVN); 2090 SetFlag(kUseGVN);
2004 } 2091 }
2005 2092
2006 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments_elements") 2093 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements, "arguments_elements")
2007 2094
2095 virtual Representation RequiredInputRepresentation(int index) const {
2096 return Representation::None();
2097 }
2098
2008 protected: 2099 protected:
2009 virtual bool DataEquals(HValue* other) { return true; } 2100 virtual bool DataEquals(HValue* other) { return true; }
2010 }; 2101 };
2011 2102
2012 2103
2013 class HArgumentsLength: public HUnaryOperation { 2104 class HArgumentsLength: public HUnaryOperation {
2014 public: 2105 public:
2015 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { 2106 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) {
2016 set_representation(Representation::Integer32()); 2107 set_representation(Representation::Integer32());
2017 SetFlag(kUseGVN); 2108 SetFlag(kUseGVN);
2018 } 2109 }
2019 2110
2020 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length") 2111 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength, "arguments_length")
2021 2112
2113 virtual Representation RequiredInputRepresentation(int index) const {
2114 return Representation::Tagged();
2115 }
2116
2022 protected: 2117 protected:
2023 virtual bool DataEquals(HValue* other) { return true; } 2118 virtual bool DataEquals(HValue* other) { return true; }
2024 }; 2119 };
2025 2120
2026 2121
2027 class HAccessArgumentsAt: public HInstruction { 2122 class HAccessArgumentsAt: public HInstruction {
2028 public: 2123 public:
2029 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { 2124 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) {
2030 set_representation(Representation::Tagged()); 2125 set_representation(Representation::Tagged());
2031 SetFlag(kUseGVN); 2126 SetFlag(kUseGVN);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
2282 public: 2377 public:
2283 HIsConstructCall() { 2378 HIsConstructCall() {
2284 set_representation(Representation::Tagged()); 2379 set_representation(Representation::Tagged());
2285 SetFlag(kUseGVN); 2380 SetFlag(kUseGVN);
2286 } 2381 }
2287 2382
2288 virtual bool EmitAtUses() const { 2383 virtual bool EmitAtUses() const {
2289 return !HasSideEffects() && (uses()->length() <= 1); 2384 return !HasSideEffects() && (uses()->length() <= 1);
2290 } 2385 }
2291 2386
2387 virtual Representation RequiredInputRepresentation(int index) const {
2388 return Representation::None();
2389 }
2390
2292 DECLARE_CONCRETE_INSTRUCTION(IsConstructCall, "is_construct_call") 2391 DECLARE_CONCRETE_INSTRUCTION(IsConstructCall, "is_construct_call")
2293 2392
2294 protected: 2393 protected:
2295 virtual bool DataEquals(HValue* other) { return true; } 2394 virtual bool DataEquals(HValue* other) { return true; }
2296 }; 2395 };
2297 2396
2298 2397
2299 class HHasInstanceType: public HUnaryPredicate { 2398 class HHasInstanceType: public HUnaryPredicate {
2300 public: 2399 public:
2301 HHasInstanceType(HValue* value, InstanceType type) 2400 HHasInstanceType(HValue* value, InstanceType type)
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2662 2761
2663 2762
2664 class HOsrEntry: public HInstruction { 2763 class HOsrEntry: public HInstruction {
2665 public: 2764 public:
2666 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) { 2765 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) {
2667 SetFlag(kChangesOsrEntries); 2766 SetFlag(kChangesOsrEntries);
2668 } 2767 }
2669 2768
2670 int ast_id() const { return ast_id_; } 2769 int ast_id() const { return ast_id_; }
2671 2770
2771 virtual Representation RequiredInputRepresentation(int index) const {
2772 return Representation::None();
2773 }
2774
2672 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr_entry") 2775 DECLARE_CONCRETE_INSTRUCTION(OsrEntry, "osr_entry")
2673 2776
2674 private: 2777 private:
2675 int ast_id_; 2778 int ast_id_;
2676 }; 2779 };
2677 2780
2678 2781
2679 class HParameter: public HInstruction { 2782 class HParameter: public HInstruction {
2680 public: 2783 public:
2681 explicit HParameter(unsigned index) : index_(index) { 2784 explicit HParameter(unsigned index) : index_(index) {
2682 set_representation(Representation::Tagged()); 2785 set_representation(Representation::Tagged());
2683 } 2786 }
2684 2787
2685 unsigned index() const { return index_; } 2788 unsigned index() const { return index_; }
2686 2789
2687 virtual void PrintDataTo(StringStream* stream); 2790 virtual void PrintDataTo(StringStream* stream);
2688 2791
2792 virtual Representation RequiredInputRepresentation(int index) const {
2793 return Representation::None();
2794 }
2795
2689 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter") 2796 DECLARE_CONCRETE_INSTRUCTION(Parameter, "parameter")
2690 2797
2691 private: 2798 private:
2692 unsigned index_; 2799 unsigned index_;
2693 }; 2800 };
2694 2801
2695 2802
2696 class HCallStub: public HUnaryCall { 2803 class HCallStub: public HUnaryCall {
2697 public: 2804 public:
2698 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) 2805 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count)
2699 : HUnaryCall(context, argument_count), 2806 : HUnaryCall(context, argument_count),
2700 major_key_(major_key), 2807 major_key_(major_key),
2701 transcendental_type_(TranscendentalCache::kNumberOfCaches) { 2808 transcendental_type_(TranscendentalCache::kNumberOfCaches) {
2702 } 2809 }
2703 2810
2704 CodeStub::Major major_key() { return major_key_; } 2811 CodeStub::Major major_key() { return major_key_; }
2705 2812
2706 HValue* context() { return value(); } 2813 HValue* context() { return value(); }
2707 2814
2708 void set_transcendental_type(TranscendentalCache::Type transcendental_type) { 2815 void set_transcendental_type(TranscendentalCache::Type transcendental_type) {
2709 transcendental_type_ = transcendental_type; 2816 transcendental_type_ = transcendental_type;
2710 } 2817 }
2711 TranscendentalCache::Type transcendental_type() { 2818 TranscendentalCache::Type transcendental_type() {
2712 return transcendental_type_; 2819 return transcendental_type_;
2713 } 2820 }
2714 2821
2715 virtual void PrintDataTo(StringStream* stream); 2822 virtual void PrintDataTo(StringStream* stream);
2716 2823
2824 virtual Representation RequiredInputRepresentation(int index) const {
2825 return Representation::Tagged();
2826 }
2827
2717 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call_stub") 2828 DECLARE_CONCRETE_INSTRUCTION(CallStub, "call_stub")
2718 2829
2719 private: 2830 private:
2720 CodeStub::Major major_key_; 2831 CodeStub::Major major_key_;
2721 TranscendentalCache::Type transcendental_type_; 2832 TranscendentalCache::Type transcendental_type_;
2722 }; 2833 };
2723 2834
2724 2835
2725 class HUnknownOSRValue: public HInstruction { 2836 class HUnknownOSRValue: public HInstruction {
2726 public: 2837 public:
2727 HUnknownOSRValue() { set_representation(Representation::Tagged()); } 2838 HUnknownOSRValue() { set_representation(Representation::Tagged()); }
2728 2839
2840 virtual Representation RequiredInputRepresentation(int index) const {
2841 return Representation::None();
2842 }
2843
2729 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown_osr_value") 2844 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown_osr_value")
2730 }; 2845 };
2731 2846
2732 2847
2733 class HLoadGlobal: public HInstruction { 2848 class HLoadGlobal: public HInstruction {
2734 public: 2849 public:
2735 HLoadGlobal(Handle<JSGlobalPropertyCell> cell, bool check_hole_value) 2850 HLoadGlobal(Handle<JSGlobalPropertyCell> cell, bool check_hole_value)
2736 : cell_(cell), check_hole_value_(check_hole_value) { 2851 : cell_(cell), check_hole_value_(check_hole_value) {
2737 set_representation(Representation::Tagged()); 2852 set_representation(Representation::Tagged());
2738 SetFlag(kUseGVN); 2853 SetFlag(kUseGVN);
2739 SetFlag(kDependsOnGlobalVars); 2854 SetFlag(kDependsOnGlobalVars);
2740 } 2855 }
2741 2856
2742 Handle<JSGlobalPropertyCell> cell() const { return cell_; } 2857 Handle<JSGlobalPropertyCell> cell() const { return cell_; }
2743 bool check_hole_value() const { return check_hole_value_; } 2858 bool check_hole_value() const { return check_hole_value_; }
2744 2859
2745 virtual Representation RequiredInputRepresentation(int index) const {
2746 return Representation::Tagged();
2747 }
2748 virtual void PrintDataTo(StringStream* stream); 2860 virtual void PrintDataTo(StringStream* stream);
2749 2861
2750 virtual intptr_t Hashcode() { 2862 virtual intptr_t Hashcode() {
2751 ASSERT(!Heap::allow_allocation(false)); 2863 ASSERT(!Heap::allow_allocation(false));
2752 return reinterpret_cast<intptr_t>(*cell_); 2864 return reinterpret_cast<intptr_t>(*cell_);
2753 } 2865 }
2754 2866
2867 virtual Representation RequiredInputRepresentation(int index) const {
2868 return Representation::None();
2869 }
2870
2755 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load_global") 2871 DECLARE_CONCRETE_INSTRUCTION(LoadGlobal, "load_global")
2756 2872
2757 protected: 2873 protected:
2758 virtual bool DataEquals(HValue* other) { 2874 virtual bool DataEquals(HValue* other) {
2759 HLoadGlobal* b = HLoadGlobal::cast(other); 2875 HLoadGlobal* b = HLoadGlobal::cast(other);
2760 return cell_.is_identical_to(b->cell()); 2876 return cell_.is_identical_to(b->cell());
2761 } 2877 }
2762 2878
2763 private: 2879 private:
2764 Handle<JSGlobalPropertyCell> cell_; 2880 Handle<JSGlobalPropertyCell> cell_;
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
3335 int depth) 3451 int depth)
3336 : HMaterializedLiteral(literal_index, depth), 3452 : HMaterializedLiteral(literal_index, depth),
3337 length_(length), 3453 length_(length),
3338 constant_elements_(constant_elements) {} 3454 constant_elements_(constant_elements) {}
3339 3455
3340 Handle<FixedArray> constant_elements() const { return constant_elements_; } 3456 Handle<FixedArray> constant_elements() const { return constant_elements_; }
3341 int length() const { return length_; } 3457 int length() const { return length_; }
3342 3458
3343 bool IsCopyOnWrite() const; 3459 bool IsCopyOnWrite() const;
3344 3460
3461 virtual Representation RequiredInputRepresentation(int index) const {
3462 return Representation::None();
3463 }
3464
3345 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array_literal") 3465 DECLARE_CONCRETE_INSTRUCTION(ArrayLiteral, "array_literal")
3346 3466
3347 private: 3467 private:
3348 int length_; 3468 int length_;
3349 Handle<FixedArray> constant_elements_; 3469 Handle<FixedArray> constant_elements_;
3350 }; 3470 };
3351 3471
3352 3472
3353 class HObjectLiteral: public HMaterializedLiteral { 3473 class HObjectLiteral: public HMaterializedLiteral {
3354 public: 3474 public:
(...skipping 11 matching lines...) Expand all
3366 3486
3367 HValue* context() const { return context_; } 3487 HValue* context() const { return context_; }
3368 Handle<FixedArray> constant_properties() const { 3488 Handle<FixedArray> constant_properties() const {
3369 return constant_properties_; 3489 return constant_properties_;
3370 } 3490 }
3371 bool fast_elements() const { return fast_elements_; } 3491 bool fast_elements() const { return fast_elements_; }
3372 3492
3373 virtual int OperandCount() { return 1; } 3493 virtual int OperandCount() { return 1; }
3374 virtual HValue* OperandAt(int index) { return context_; } 3494 virtual HValue* OperandAt(int index) { return context_; }
3375 3495
3496 virtual Representation RequiredInputRepresentation(int index) const {
3497 return Representation::Tagged();
3498 }
3499
3376 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object_literal") 3500 DECLARE_CONCRETE_INSTRUCTION(ObjectLiteral, "object_literal")
3377 3501
3378 protected: 3502 protected:
3379 virtual void InternalSetOperandAt(int index, HValue* value) { 3503 virtual void InternalSetOperandAt(int index, HValue* value) {
3380 context_ = value; 3504 context_ = value;
3381 } 3505 }
3382 3506
3383 private: 3507 private:
3384 HValue* context_; 3508 HValue* context_;
3385 Handle<FixedArray> constant_properties_; 3509 Handle<FixedArray> constant_properties_;
3386 bool fast_elements_; 3510 bool fast_elements_;
3387 }; 3511 };
3388 3512
3389 3513
3390 class HRegExpLiteral: public HMaterializedLiteral { 3514 class HRegExpLiteral: public HMaterializedLiteral {
3391 public: 3515 public:
3392 HRegExpLiteral(Handle<String> pattern, 3516 HRegExpLiteral(Handle<String> pattern,
3393 Handle<String> flags, 3517 Handle<String> flags,
3394 int literal_index) 3518 int literal_index)
3395 : HMaterializedLiteral(literal_index, 0), 3519 : HMaterializedLiteral(literal_index, 0),
3396 pattern_(pattern), 3520 pattern_(pattern),
3397 flags_(flags) { } 3521 flags_(flags) { }
3398 3522
3399 Handle<String> pattern() { return pattern_; } 3523 Handle<String> pattern() { return pattern_; }
3400 Handle<String> flags() { return flags_; } 3524 Handle<String> flags() { return flags_; }
3401 3525
3526 virtual Representation RequiredInputRepresentation(int index) const {
3527 return Representation::None();
3528 }
3529
3402 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp_literal") 3530 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral, "regexp_literal")
3403 3531
3404 private: 3532 private:
3405 Handle<String> pattern_; 3533 Handle<String> pattern_;
3406 Handle<String> flags_; 3534 Handle<String> flags_;
3407 }; 3535 };
3408 3536
3409 3537
3410 class HFunctionLiteral: public HInstruction { 3538 class HFunctionLiteral: public HInstruction {
3411 public: 3539 public:
3412 HFunctionLiteral(Handle<SharedFunctionInfo> shared, bool pretenure) 3540 HFunctionLiteral(Handle<SharedFunctionInfo> shared, bool pretenure)
3413 : shared_info_(shared), pretenure_(pretenure) { 3541 : shared_info_(shared), pretenure_(pretenure) {
3414 set_representation(Representation::Tagged()); 3542 set_representation(Representation::Tagged());
3415 } 3543 }
3416 3544
3545 virtual Representation RequiredInputRepresentation(int index) const {
3546 return Representation::None();
3547 }
3548
3417 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function_literal") 3549 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral, "function_literal")
3418 3550
3419 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 3551 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
3420 bool pretenure() const { return pretenure_; } 3552 bool pretenure() const { return pretenure_; }
3421 3553
3422 private: 3554 private:
3423 Handle<SharedFunctionInfo> shared_info_; 3555 Handle<SharedFunctionInfo> shared_info_;
3424 bool pretenure_; 3556 bool pretenure_;
3425 }; 3557 };
3426 3558
(...skipping 11 matching lines...) Expand all
3438 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof") 3570 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
3439 }; 3571 };
3440 3572
3441 3573
3442 class HValueOf: public HUnaryOperation { 3574 class HValueOf: public HUnaryOperation {
3443 public: 3575 public:
3444 explicit HValueOf(HValue* value) : HUnaryOperation(value) { 3576 explicit HValueOf(HValue* value) : HUnaryOperation(value) {
3445 set_representation(Representation::Tagged()); 3577 set_representation(Representation::Tagged());
3446 } 3578 }
3447 3579
3580 virtual Representation RequiredInputRepresentation(int index) const {
3581 return Representation::Tagged();
3582 }
3583
3448 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value_of") 3584 DECLARE_CONCRETE_INSTRUCTION(ValueOf, "value_of")
3449 }; 3585 };
3450 3586
3451 3587
3452 class HDeleteProperty: public HBinaryOperation { 3588 class HDeleteProperty: public HBinaryOperation {
3453 public: 3589 public:
3454 HDeleteProperty(HValue* obj, HValue* key) 3590 HDeleteProperty(HValue* obj, HValue* key)
3455 : HBinaryOperation(obj, key) { 3591 : HBinaryOperation(obj, key) {
3456 set_representation(Representation::Tagged()); 3592 set_representation(Representation::Tagged());
3457 SetAllSideEffects(); 3593 SetAllSideEffects();
3458 } 3594 }
3459 3595
3460 virtual Representation RequiredInputRepresentation(int index) const { 3596 virtual Representation RequiredInputRepresentation(int index) const {
3461 return Representation::Tagged(); 3597 return Representation::Tagged();
3462 } 3598 }
3463 3599
3464 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete_property") 3600 DECLARE_CONCRETE_INSTRUCTION(DeleteProperty, "delete_property")
3465 3601
3466 HValue* object() { return left(); } 3602 HValue* object() { return left(); }
3467 HValue* key() { return right(); } 3603 HValue* key() { return right(); }
3468 }; 3604 };
3469 3605
3470 #undef DECLARE_INSTRUCTION 3606 #undef DECLARE_INSTRUCTION
3471 #undef DECLARE_CONCRETE_INSTRUCTION 3607 #undef DECLARE_CONCRETE_INSTRUCTION
3472 3608
3473 } } // namespace v8::internal 3609 } } // namespace v8::internal
3474 3610
3475 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 3611 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-valueof.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698