| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ | 5 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
| 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 6 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
| 7 | 7 |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 | 10 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 V(GlobalVars) \ | 183 V(GlobalVars) \ |
| 184 V(InobjectFields) \ | 184 V(InobjectFields) \ |
| 185 V(Maps) \ | 185 V(Maps) \ |
| 186 V(OsrEntries) \ | 186 V(OsrEntries) \ |
| 187 V(ExternalMemory) \ | 187 V(ExternalMemory) \ |
| 188 V(StringChars) \ | 188 V(StringChars) \ |
| 189 V(TypedArrayElements) | 189 V(TypedArrayElements) |
| 190 | 190 |
| 191 | 191 |
| 192 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ | 192 #define DECLARE_ABSTRACT_INSTRUCTION(type) \ |
| 193 bool Is##type() const FINAL { return true; } \ | 193 bool Is##type() const final { return true; } \ |
| 194 static H##type* cast(HValue* value) { \ | 194 static H##type* cast(HValue* value) { \ |
| 195 DCHECK(value->Is##type()); \ | 195 DCHECK(value->Is##type()); \ |
| 196 return reinterpret_cast<H##type*>(value); \ | 196 return reinterpret_cast<H##type*>(value); \ |
| 197 } | 197 } |
| 198 | 198 |
| 199 | 199 |
| 200 #define DECLARE_CONCRETE_INSTRUCTION(type) \ | 200 #define DECLARE_CONCRETE_INSTRUCTION(type) \ |
| 201 LInstruction* CompileToLithium(LChunkBuilder* builder) FINAL; \ | 201 LInstruction* CompileToLithium(LChunkBuilder* builder) final; \ |
| 202 static H##type* cast(HValue* value) { \ | 202 static H##type* cast(HValue* value) { \ |
| 203 DCHECK(value->Is##type()); \ | 203 DCHECK(value->Is##type()); \ |
| 204 return reinterpret_cast<H##type*>(value); \ | 204 return reinterpret_cast<H##type*>(value); \ |
| 205 } \ | 205 } \ |
| 206 Opcode opcode() const FINAL { return HValue::k##type; } | 206 Opcode opcode() const final { return HValue::k##type; } |
| 207 | 207 |
| 208 | 208 |
| 209 enum PropertyAccessType { LOAD, STORE }; | 209 enum PropertyAccessType { LOAD, STORE }; |
| 210 | 210 |
| 211 | 211 |
| 212 class Range FINAL : public ZoneObject { | 212 class Range final : public ZoneObject { |
| 213 public: | 213 public: |
| 214 Range() | 214 Range() |
| 215 : lower_(kMinInt), | 215 : lower_(kMinInt), |
| 216 upper_(kMaxInt), | 216 upper_(kMaxInt), |
| 217 next_(NULL), | 217 next_(NULL), |
| 218 can_be_minus_zero_(false) { } | 218 can_be_minus_zero_(false) { } |
| 219 | 219 |
| 220 Range(int32_t lower, int32_t upper) | 220 Range(int32_t lower, int32_t upper) |
| 221 : lower_(lower), | 221 : lower_(lower), |
| 222 upper_(upper), | 222 upper_(upper), |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 306 |
| 307 private: | 307 private: |
| 308 HUseListNode* tail_; | 308 HUseListNode* tail_; |
| 309 HValue* value_; | 309 HValue* value_; |
| 310 int index_; | 310 int index_; |
| 311 }; | 311 }; |
| 312 | 312 |
| 313 | 313 |
| 314 // We reuse use list nodes behind the scenes as uses are added and deleted. | 314 // We reuse use list nodes behind the scenes as uses are added and deleted. |
| 315 // This class is the safe way to iterate uses while deleting them. | 315 // This class is the safe way to iterate uses while deleting them. |
| 316 class HUseIterator FINAL BASE_EMBEDDED { | 316 class HUseIterator final BASE_EMBEDDED { |
| 317 public: | 317 public: |
| 318 bool Done() { return current_ == NULL; } | 318 bool Done() { return current_ == NULL; } |
| 319 void Advance(); | 319 void Advance(); |
| 320 | 320 |
| 321 HValue* value() { | 321 HValue* value() { |
| 322 DCHECK(!Done()); | 322 DCHECK(!Done()); |
| 323 return value_; | 323 return value_; |
| 324 } | 324 } |
| 325 | 325 |
| 326 int index() { | 326 int index() { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 355 }; | 355 }; |
| 356 | 356 |
| 357 | 357 |
| 358 static inline GVNFlag GVNFlagFromInt(int i) { | 358 static inline GVNFlag GVNFlagFromInt(int i) { |
| 359 DCHECK(i >= 0); | 359 DCHECK(i >= 0); |
| 360 DCHECK(i < kNumberOfFlags); | 360 DCHECK(i < kNumberOfFlags); |
| 361 return static_cast<GVNFlag>(i); | 361 return static_cast<GVNFlag>(i); |
| 362 } | 362 } |
| 363 | 363 |
| 364 | 364 |
| 365 class DecompositionResult FINAL BASE_EMBEDDED { | 365 class DecompositionResult final BASE_EMBEDDED { |
| 366 public: | 366 public: |
| 367 DecompositionResult() : base_(NULL), offset_(0), scale_(0) {} | 367 DecompositionResult() : base_(NULL), offset_(0), scale_(0) {} |
| 368 | 368 |
| 369 HValue* base() { return base_; } | 369 HValue* base() { return base_; } |
| 370 int offset() { return offset_; } | 370 int offset() { return offset_; } |
| 371 int scale() { return scale_; } | 371 int scale() { return scale_; } |
| 372 | 372 |
| 373 bool Apply(HValue* other_base, int other_offset, int other_scale = 0) { | 373 bool Apply(HValue* other_base, int other_offset, int other_scale = 0) { |
| 374 if (base_ == NULL) { | 374 if (base_ == NULL) { |
| 375 base_ = other_base; | 375 base_ = other_base; |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 | 1055 |
| 1056 intptr_t data_; | 1056 intptr_t data_; |
| 1057 }; | 1057 }; |
| 1058 | 1058 |
| 1059 | 1059 |
| 1060 class HInstruction : public HValue { | 1060 class HInstruction : public HValue { |
| 1061 public: | 1061 public: |
| 1062 HInstruction* next() const { return next_; } | 1062 HInstruction* next() const { return next_; } |
| 1063 HInstruction* previous() const { return previous_; } | 1063 HInstruction* previous() const { return previous_; } |
| 1064 | 1064 |
| 1065 std::ostream& PrintTo(std::ostream& os) const OVERRIDE; // NOLINT | 1065 std::ostream& PrintTo(std::ostream& os) const override; // NOLINT |
| 1066 virtual std::ostream& PrintDataTo(std::ostream& os) const; // NOLINT | 1066 virtual std::ostream& PrintDataTo(std::ostream& os) const; // NOLINT |
| 1067 | 1067 |
| 1068 bool IsLinked() const { return block() != NULL; } | 1068 bool IsLinked() const { return block() != NULL; } |
| 1069 void Unlink(); | 1069 void Unlink(); |
| 1070 | 1070 |
| 1071 void InsertBefore(HInstruction* next); | 1071 void InsertBefore(HInstruction* next); |
| 1072 | 1072 |
| 1073 template<class T> T* Prepend(T* instr) { | 1073 template<class T> T* Prepend(T* instr) { |
| 1074 instr->InsertBefore(this); | 1074 instr->InsertBefore(this); |
| 1075 return instr; | 1075 return instr; |
| 1076 } | 1076 } |
| 1077 | 1077 |
| 1078 void InsertAfter(HInstruction* previous); | 1078 void InsertAfter(HInstruction* previous); |
| 1079 | 1079 |
| 1080 template<class T> T* Append(T* instr) { | 1080 template<class T> T* Append(T* instr) { |
| 1081 instr->InsertAfter(this); | 1081 instr->InsertAfter(this); |
| 1082 return instr; | 1082 return instr; |
| 1083 } | 1083 } |
| 1084 | 1084 |
| 1085 // The position is a write-once variable. | 1085 // The position is a write-once variable. |
| 1086 SourcePosition position() const OVERRIDE { | 1086 SourcePosition position() const override { |
| 1087 return SourcePosition(position_.position()); | 1087 return SourcePosition(position_.position()); |
| 1088 } | 1088 } |
| 1089 bool has_position() const { | 1089 bool has_position() const { |
| 1090 return !position().IsUnknown(); | 1090 return !position().IsUnknown(); |
| 1091 } | 1091 } |
| 1092 void set_position(SourcePosition position) { | 1092 void set_position(SourcePosition position) { |
| 1093 DCHECK(!has_position()); | 1093 DCHECK(!has_position()); |
| 1094 DCHECK(!position.IsUnknown()); | 1094 DCHECK(!position.IsUnknown()); |
| 1095 position_.set_position(position); | 1095 position_.set_position(position); |
| 1096 } | 1096 } |
| 1097 | 1097 |
| 1098 SourcePosition operand_position(int index) const OVERRIDE { | 1098 SourcePosition operand_position(int index) const override { |
| 1099 const SourcePosition pos = position_.operand_position(index); | 1099 const SourcePosition pos = position_.operand_position(index); |
| 1100 return pos.IsUnknown() ? position() : pos; | 1100 return pos.IsUnknown() ? position() : pos; |
| 1101 } | 1101 } |
| 1102 void set_operand_position(Zone* zone, int index, SourcePosition pos) { | 1102 void set_operand_position(Zone* zone, int index, SourcePosition pos) { |
| 1103 DCHECK(0 <= index && index < OperandCount()); | 1103 DCHECK(0 <= index && index < OperandCount()); |
| 1104 position_.ensure_storage_for_operand_positions(zone, OperandCount()); | 1104 position_.ensure_storage_for_operand_positions(zone, OperandCount()); |
| 1105 position_.set_operand_position(index, pos); | 1105 position_.set_operand_position(index, pos); |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 bool Dominates(HInstruction* other); | 1108 bool Dominates(HInstruction* other); |
| 1109 bool CanTruncateToSmi() const { return CheckFlag(kTruncatingToSmi); } | 1109 bool CanTruncateToSmi() const { return CheckFlag(kTruncatingToSmi); } |
| 1110 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } | 1110 bool CanTruncateToInt32() const { return CheckFlag(kTruncatingToInt32); } |
| 1111 | 1111 |
| 1112 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; | 1112 virtual LInstruction* CompileToLithium(LChunkBuilder* builder) = 0; |
| 1113 | 1113 |
| 1114 #ifdef DEBUG | 1114 #ifdef DEBUG |
| 1115 void Verify() OVERRIDE; | 1115 void Verify() override; |
| 1116 #endif | 1116 #endif |
| 1117 | 1117 |
| 1118 bool CanDeoptimize(); | 1118 bool CanDeoptimize(); |
| 1119 | 1119 |
| 1120 virtual bool HasStackCheck() { return false; } | 1120 virtual bool HasStackCheck() { return false; } |
| 1121 | 1121 |
| 1122 DECLARE_ABSTRACT_INSTRUCTION(Instruction) | 1122 DECLARE_ABSTRACT_INSTRUCTION(Instruction) |
| 1123 | 1123 |
| 1124 protected: | 1124 protected: |
| 1125 explicit HInstruction(HType type = HType::Tagged()) | 1125 explicit HInstruction(HType type = HType::Tagged()) |
| 1126 : HValue(type), | 1126 : HValue(type), |
| 1127 next_(NULL), | 1127 next_(NULL), |
| 1128 previous_(NULL), | 1128 previous_(NULL), |
| 1129 position_(RelocInfo::kNoPosition) { | 1129 position_(RelocInfo::kNoPosition) { |
| 1130 SetDependsOnFlag(kOsrEntries); | 1130 SetDependsOnFlag(kOsrEntries); |
| 1131 } | 1131 } |
| 1132 | 1132 |
| 1133 void DeleteFromGraph() OVERRIDE { Unlink(); } | 1133 void DeleteFromGraph() override { Unlink(); } |
| 1134 | 1134 |
| 1135 private: | 1135 private: |
| 1136 void InitializeAsFirst(HBasicBlock* block) { | 1136 void InitializeAsFirst(HBasicBlock* block) { |
| 1137 DCHECK(!IsLinked()); | 1137 DCHECK(!IsLinked()); |
| 1138 SetBlock(block); | 1138 SetBlock(block); |
| 1139 } | 1139 } |
| 1140 | 1140 |
| 1141 HInstruction* next_; | 1141 HInstruction* next_; |
| 1142 HInstruction* previous_; | 1142 HInstruction* previous_; |
| 1143 HPositionInfo position_; | 1143 HPositionInfo position_; |
| 1144 | 1144 |
| 1145 friend class HBasicBlock; | 1145 friend class HBasicBlock; |
| 1146 }; | 1146 }; |
| 1147 | 1147 |
| 1148 | 1148 |
| 1149 template<int V> | 1149 template<int V> |
| 1150 class HTemplateInstruction : public HInstruction { | 1150 class HTemplateInstruction : public HInstruction { |
| 1151 public: | 1151 public: |
| 1152 int OperandCount() const FINAL { return V; } | 1152 int OperandCount() const final { return V; } |
| 1153 HValue* OperandAt(int i) const FINAL { return inputs_[i]; } | 1153 HValue* OperandAt(int i) const final { return inputs_[i]; } |
| 1154 | 1154 |
| 1155 protected: | 1155 protected: |
| 1156 explicit HTemplateInstruction(HType type = HType::Tagged()) | 1156 explicit HTemplateInstruction(HType type = HType::Tagged()) |
| 1157 : HInstruction(type) {} | 1157 : HInstruction(type) {} |
| 1158 | 1158 |
| 1159 void InternalSetOperandAt(int i, HValue* value) FINAL { inputs_[i] = value; } | 1159 void InternalSetOperandAt(int i, HValue* value) final { inputs_[i] = value; } |
| 1160 | 1160 |
| 1161 private: | 1161 private: |
| 1162 EmbeddedContainer<HValue*, V> inputs_; | 1162 EmbeddedContainer<HValue*, V> inputs_; |
| 1163 }; | 1163 }; |
| 1164 | 1164 |
| 1165 | 1165 |
| 1166 class HControlInstruction : public HInstruction { | 1166 class HControlInstruction : public HInstruction { |
| 1167 public: | 1167 public: |
| 1168 virtual HBasicBlock* SuccessorAt(int i) const = 0; | 1168 virtual HBasicBlock* SuccessorAt(int i) const = 0; |
| 1169 virtual int SuccessorCount() const = 0; | 1169 virtual int SuccessorCount() const = 0; |
| 1170 virtual void SetSuccessorAt(int i, HBasicBlock* block) = 0; | 1170 virtual void SetSuccessorAt(int i, HBasicBlock* block) = 0; |
| 1171 | 1171 |
| 1172 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1172 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 1173 | 1173 |
| 1174 virtual bool KnownSuccessorBlock(HBasicBlock** block) { | 1174 virtual bool KnownSuccessorBlock(HBasicBlock** block) { |
| 1175 *block = NULL; | 1175 *block = NULL; |
| 1176 return false; | 1176 return false; |
| 1177 } | 1177 } |
| 1178 | 1178 |
| 1179 HBasicBlock* FirstSuccessor() { | 1179 HBasicBlock* FirstSuccessor() { |
| 1180 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; | 1180 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; |
| 1181 } | 1181 } |
| 1182 HBasicBlock* SecondSuccessor() { | 1182 HBasicBlock* SecondSuccessor() { |
| 1183 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; | 1183 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; |
| 1184 } | 1184 } |
| 1185 | 1185 |
| 1186 void Not() { | 1186 void Not() { |
| 1187 HBasicBlock* swap = SuccessorAt(0); | 1187 HBasicBlock* swap = SuccessorAt(0); |
| 1188 SetSuccessorAt(0, SuccessorAt(1)); | 1188 SetSuccessorAt(0, SuccessorAt(1)); |
| 1189 SetSuccessorAt(1, swap); | 1189 SetSuccessorAt(1, swap); |
| 1190 } | 1190 } |
| 1191 | 1191 |
| 1192 DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction) | 1192 DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction) |
| 1193 }; | 1193 }; |
| 1194 | 1194 |
| 1195 | 1195 |
| 1196 class HSuccessorIterator FINAL BASE_EMBEDDED { | 1196 class HSuccessorIterator final BASE_EMBEDDED { |
| 1197 public: | 1197 public: |
| 1198 explicit HSuccessorIterator(const HControlInstruction* instr) | 1198 explicit HSuccessorIterator(const HControlInstruction* instr) |
| 1199 : instr_(instr), current_(0) {} | 1199 : instr_(instr), current_(0) {} |
| 1200 | 1200 |
| 1201 bool Done() { return current_ >= instr_->SuccessorCount(); } | 1201 bool Done() { return current_ >= instr_->SuccessorCount(); } |
| 1202 HBasicBlock* Current() { return instr_->SuccessorAt(current_); } | 1202 HBasicBlock* Current() { return instr_->SuccessorAt(current_); } |
| 1203 void Advance() { current_++; } | 1203 void Advance() { current_++; } |
| 1204 | 1204 |
| 1205 private: | 1205 private: |
| 1206 const HControlInstruction* instr_; | 1206 const HControlInstruction* instr_; |
| 1207 int current_; | 1207 int current_; |
| 1208 }; | 1208 }; |
| 1209 | 1209 |
| 1210 | 1210 |
| 1211 template<int S, int V> | 1211 template<int S, int V> |
| 1212 class HTemplateControlInstruction : public HControlInstruction { | 1212 class HTemplateControlInstruction : public HControlInstruction { |
| 1213 public: | 1213 public: |
| 1214 int SuccessorCount() const OVERRIDE { return S; } | 1214 int SuccessorCount() const override { return S; } |
| 1215 HBasicBlock* SuccessorAt(int i) const OVERRIDE { return successors_[i]; } | 1215 HBasicBlock* SuccessorAt(int i) const override { return successors_[i]; } |
| 1216 void SetSuccessorAt(int i, HBasicBlock* block) OVERRIDE { | 1216 void SetSuccessorAt(int i, HBasicBlock* block) override { |
| 1217 successors_[i] = block; | 1217 successors_[i] = block; |
| 1218 } | 1218 } |
| 1219 | 1219 |
| 1220 int OperandCount() const OVERRIDE { return V; } | 1220 int OperandCount() const override { return V; } |
| 1221 HValue* OperandAt(int i) const OVERRIDE { return inputs_[i]; } | 1221 HValue* OperandAt(int i) const override { return inputs_[i]; } |
| 1222 | 1222 |
| 1223 | 1223 |
| 1224 protected: | 1224 protected: |
| 1225 void InternalSetOperandAt(int i, HValue* value) OVERRIDE { | 1225 void InternalSetOperandAt(int i, HValue* value) override { |
| 1226 inputs_[i] = value; | 1226 inputs_[i] = value; |
| 1227 } | 1227 } |
| 1228 | 1228 |
| 1229 private: | 1229 private: |
| 1230 EmbeddedContainer<HBasicBlock*, S> successors_; | 1230 EmbeddedContainer<HBasicBlock*, S> successors_; |
| 1231 EmbeddedContainer<HValue*, V> inputs_; | 1231 EmbeddedContainer<HValue*, V> inputs_; |
| 1232 }; | 1232 }; |
| 1233 | 1233 |
| 1234 | 1234 |
| 1235 class HBlockEntry FINAL : public HTemplateInstruction<0> { | 1235 class HBlockEntry final : public HTemplateInstruction<0> { |
| 1236 public: | 1236 public: |
| 1237 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1237 Representation RequiredInputRepresentation(int index) override { |
| 1238 return Representation::None(); | 1238 return Representation::None(); |
| 1239 } | 1239 } |
| 1240 | 1240 |
| 1241 DECLARE_CONCRETE_INSTRUCTION(BlockEntry) | 1241 DECLARE_CONCRETE_INSTRUCTION(BlockEntry) |
| 1242 }; | 1242 }; |
| 1243 | 1243 |
| 1244 | 1244 |
| 1245 class HDummyUse FINAL : public HTemplateInstruction<1> { | 1245 class HDummyUse final : public HTemplateInstruction<1> { |
| 1246 public: | 1246 public: |
| 1247 explicit HDummyUse(HValue* value) | 1247 explicit HDummyUse(HValue* value) |
| 1248 : HTemplateInstruction<1>(HType::Smi()) { | 1248 : HTemplateInstruction<1>(HType::Smi()) { |
| 1249 SetOperandAt(0, value); | 1249 SetOperandAt(0, value); |
| 1250 // Pretend to be a Smi so that the HChange instructions inserted | 1250 // Pretend to be a Smi so that the HChange instructions inserted |
| 1251 // before any use generate as little code as possible. | 1251 // before any use generate as little code as possible. |
| 1252 set_representation(Representation::Tagged()); | 1252 set_representation(Representation::Tagged()); |
| 1253 } | 1253 } |
| 1254 | 1254 |
| 1255 HValue* value() const { return OperandAt(0); } | 1255 HValue* value() const { return OperandAt(0); } |
| 1256 | 1256 |
| 1257 bool HasEscapingOperandAt(int index) OVERRIDE { return false; } | 1257 bool HasEscapingOperandAt(int index) override { return false; } |
| 1258 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1258 Representation RequiredInputRepresentation(int index) override { |
| 1259 return Representation::None(); | 1259 return Representation::None(); |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1262 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 1263 | 1263 |
| 1264 DECLARE_CONCRETE_INSTRUCTION(DummyUse); | 1264 DECLARE_CONCRETE_INSTRUCTION(DummyUse); |
| 1265 }; | 1265 }; |
| 1266 | 1266 |
| 1267 | 1267 |
| 1268 // Inserts an int3/stop break instruction for debugging purposes. | 1268 // Inserts an int3/stop break instruction for debugging purposes. |
| 1269 class HDebugBreak FINAL : public HTemplateInstruction<0> { | 1269 class HDebugBreak final : public HTemplateInstruction<0> { |
| 1270 public: | 1270 public: |
| 1271 DECLARE_INSTRUCTION_FACTORY_P0(HDebugBreak); | 1271 DECLARE_INSTRUCTION_FACTORY_P0(HDebugBreak); |
| 1272 | 1272 |
| 1273 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1273 Representation RequiredInputRepresentation(int index) override { |
| 1274 return Representation::None(); | 1274 return Representation::None(); |
| 1275 } | 1275 } |
| 1276 | 1276 |
| 1277 DECLARE_CONCRETE_INSTRUCTION(DebugBreak) | 1277 DECLARE_CONCRETE_INSTRUCTION(DebugBreak) |
| 1278 }; | 1278 }; |
| 1279 | 1279 |
| 1280 | 1280 |
| 1281 class HGoto FINAL : public HTemplateControlInstruction<1, 0> { | 1281 class HGoto final : public HTemplateControlInstruction<1, 0> { |
| 1282 public: | 1282 public: |
| 1283 explicit HGoto(HBasicBlock* target) { | 1283 explicit HGoto(HBasicBlock* target) { |
| 1284 SetSuccessorAt(0, target); | 1284 SetSuccessorAt(0, target); |
| 1285 } | 1285 } |
| 1286 | 1286 |
| 1287 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE { | 1287 bool KnownSuccessorBlock(HBasicBlock** block) override { |
| 1288 *block = FirstSuccessor(); | 1288 *block = FirstSuccessor(); |
| 1289 return true; | 1289 return true; |
| 1290 } | 1290 } |
| 1291 | 1291 |
| 1292 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1292 Representation RequiredInputRepresentation(int index) override { |
| 1293 return Representation::None(); | 1293 return Representation::None(); |
| 1294 } | 1294 } |
| 1295 | 1295 |
| 1296 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1296 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 1297 | 1297 |
| 1298 DECLARE_CONCRETE_INSTRUCTION(Goto) | 1298 DECLARE_CONCRETE_INSTRUCTION(Goto) |
| 1299 }; | 1299 }; |
| 1300 | 1300 |
| 1301 | 1301 |
| 1302 class HDeoptimize FINAL : public HTemplateControlInstruction<1, 0> { | 1302 class HDeoptimize final : public HTemplateControlInstruction<1, 0> { |
| 1303 public: | 1303 public: |
| 1304 static HDeoptimize* New(Isolate* isolate, Zone* zone, HValue* context, | 1304 static HDeoptimize* New(Isolate* isolate, Zone* zone, HValue* context, |
| 1305 Deoptimizer::DeoptReason reason, | 1305 Deoptimizer::DeoptReason reason, |
| 1306 Deoptimizer::BailoutType type, | 1306 Deoptimizer::BailoutType type, |
| 1307 HBasicBlock* unreachable_continuation) { | 1307 HBasicBlock* unreachable_continuation) { |
| 1308 return new(zone) HDeoptimize(reason, type, unreachable_continuation); | 1308 return new(zone) HDeoptimize(reason, type, unreachable_continuation); |
| 1309 } | 1309 } |
| 1310 | 1310 |
| 1311 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE { | 1311 bool KnownSuccessorBlock(HBasicBlock** block) override { |
| 1312 *block = NULL; | 1312 *block = NULL; |
| 1313 return true; | 1313 return true; |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1316 Representation RequiredInputRepresentation(int index) override { |
| 1317 return Representation::None(); | 1317 return Representation::None(); |
| 1318 } | 1318 } |
| 1319 | 1319 |
| 1320 Deoptimizer::DeoptReason reason() const { return reason_; } | 1320 Deoptimizer::DeoptReason reason() const { return reason_; } |
| 1321 Deoptimizer::BailoutType type() { return type_; } | 1321 Deoptimizer::BailoutType type() { return type_; } |
| 1322 | 1322 |
| 1323 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) | 1323 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) |
| 1324 | 1324 |
| 1325 private: | 1325 private: |
| 1326 explicit HDeoptimize(Deoptimizer::DeoptReason reason, | 1326 explicit HDeoptimize(Deoptimizer::DeoptReason reason, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1338 class HUnaryControlInstruction : public HTemplateControlInstruction<2, 1> { | 1338 class HUnaryControlInstruction : public HTemplateControlInstruction<2, 1> { |
| 1339 public: | 1339 public: |
| 1340 HUnaryControlInstruction(HValue* value, | 1340 HUnaryControlInstruction(HValue* value, |
| 1341 HBasicBlock* true_target, | 1341 HBasicBlock* true_target, |
| 1342 HBasicBlock* false_target) { | 1342 HBasicBlock* false_target) { |
| 1343 SetOperandAt(0, value); | 1343 SetOperandAt(0, value); |
| 1344 SetSuccessorAt(0, true_target); | 1344 SetSuccessorAt(0, true_target); |
| 1345 SetSuccessorAt(1, false_target); | 1345 SetSuccessorAt(1, false_target); |
| 1346 } | 1346 } |
| 1347 | 1347 |
| 1348 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1348 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 1349 | 1349 |
| 1350 HValue* value() const { return OperandAt(0); } | 1350 HValue* value() const { return OperandAt(0); } |
| 1351 }; | 1351 }; |
| 1352 | 1352 |
| 1353 | 1353 |
| 1354 class HBranch FINAL : public HUnaryControlInstruction { | 1354 class HBranch final : public HUnaryControlInstruction { |
| 1355 public: | 1355 public: |
| 1356 DECLARE_INSTRUCTION_FACTORY_P1(HBranch, HValue*); | 1356 DECLARE_INSTRUCTION_FACTORY_P1(HBranch, HValue*); |
| 1357 DECLARE_INSTRUCTION_FACTORY_P2(HBranch, HValue*, | 1357 DECLARE_INSTRUCTION_FACTORY_P2(HBranch, HValue*, |
| 1358 ToBooleanStub::Types); | 1358 ToBooleanStub::Types); |
| 1359 DECLARE_INSTRUCTION_FACTORY_P4(HBranch, HValue*, | 1359 DECLARE_INSTRUCTION_FACTORY_P4(HBranch, HValue*, |
| 1360 ToBooleanStub::Types, | 1360 ToBooleanStub::Types, |
| 1361 HBasicBlock*, HBasicBlock*); | 1361 HBasicBlock*, HBasicBlock*); |
| 1362 | 1362 |
| 1363 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1363 Representation RequiredInputRepresentation(int index) override { |
| 1364 return Representation::None(); | 1364 return Representation::None(); |
| 1365 } | 1365 } |
| 1366 Representation observed_input_representation(int index) OVERRIDE; | 1366 Representation observed_input_representation(int index) override; |
| 1367 | 1367 |
| 1368 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 1368 bool KnownSuccessorBlock(HBasicBlock** block) override; |
| 1369 | 1369 |
| 1370 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1370 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 1371 | 1371 |
| 1372 ToBooleanStub::Types expected_input_types() const { | 1372 ToBooleanStub::Types expected_input_types() const { |
| 1373 return expected_input_types_; | 1373 return expected_input_types_; |
| 1374 } | 1374 } |
| 1375 | 1375 |
| 1376 DECLARE_CONCRETE_INSTRUCTION(Branch) | 1376 DECLARE_CONCRETE_INSTRUCTION(Branch) |
| 1377 | 1377 |
| 1378 private: | 1378 private: |
| 1379 HBranch(HValue* value, | 1379 HBranch(HValue* value, |
| 1380 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(), | 1380 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(), |
| 1381 HBasicBlock* true_target = NULL, | 1381 HBasicBlock* true_target = NULL, |
| 1382 HBasicBlock* false_target = NULL) | 1382 HBasicBlock* false_target = NULL) |
| 1383 : HUnaryControlInstruction(value, true_target, false_target), | 1383 : HUnaryControlInstruction(value, true_target, false_target), |
| 1384 expected_input_types_(expected_input_types) { | 1384 expected_input_types_(expected_input_types) { |
| 1385 SetFlag(kAllowUndefinedAsNaN); | 1385 SetFlag(kAllowUndefinedAsNaN); |
| 1386 } | 1386 } |
| 1387 | 1387 |
| 1388 ToBooleanStub::Types expected_input_types_; | 1388 ToBooleanStub::Types expected_input_types_; |
| 1389 }; | 1389 }; |
| 1390 | 1390 |
| 1391 | 1391 |
| 1392 class HCompareMap FINAL : public HUnaryControlInstruction { | 1392 class HCompareMap final : public HUnaryControlInstruction { |
| 1393 public: | 1393 public: |
| 1394 DECLARE_INSTRUCTION_FACTORY_P2(HCompareMap, HValue*, Handle<Map>); | 1394 DECLARE_INSTRUCTION_FACTORY_P2(HCompareMap, HValue*, Handle<Map>); |
| 1395 DECLARE_INSTRUCTION_FACTORY_P4(HCompareMap, HValue*, Handle<Map>, | 1395 DECLARE_INSTRUCTION_FACTORY_P4(HCompareMap, HValue*, Handle<Map>, |
| 1396 HBasicBlock*, HBasicBlock*); | 1396 HBasicBlock*, HBasicBlock*); |
| 1397 | 1397 |
| 1398 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE { | 1398 bool KnownSuccessorBlock(HBasicBlock** block) override { |
| 1399 if (known_successor_index() != kNoKnownSuccessorIndex) { | 1399 if (known_successor_index() != kNoKnownSuccessorIndex) { |
| 1400 *block = SuccessorAt(known_successor_index()); | 1400 *block = SuccessorAt(known_successor_index()); |
| 1401 return true; | 1401 return true; |
| 1402 } | 1402 } |
| 1403 *block = NULL; | 1403 *block = NULL; |
| 1404 return false; | 1404 return false; |
| 1405 } | 1405 } |
| 1406 | 1406 |
| 1407 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1407 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 1408 | 1408 |
| 1409 static const int kNoKnownSuccessorIndex = -1; | 1409 static const int kNoKnownSuccessorIndex = -1; |
| 1410 int known_successor_index() const { | 1410 int known_successor_index() const { |
| 1411 return KnownSuccessorIndexField::decode(bit_field_) - | 1411 return KnownSuccessorIndexField::decode(bit_field_) - |
| 1412 kInternalKnownSuccessorOffset; | 1412 kInternalKnownSuccessorOffset; |
| 1413 } | 1413 } |
| 1414 void set_known_successor_index(int index) { | 1414 void set_known_successor_index(int index) { |
| 1415 DCHECK(index >= 0 - kInternalKnownSuccessorOffset); | 1415 DCHECK(index >= 0 - kInternalKnownSuccessorOffset); |
| 1416 bit_field_ = KnownSuccessorIndexField::update( | 1416 bit_field_ = KnownSuccessorIndexField::update( |
| 1417 bit_field_, index + kInternalKnownSuccessorOffset); | 1417 bit_field_, index + kInternalKnownSuccessorOffset); |
| 1418 } | 1418 } |
| 1419 | 1419 |
| 1420 Unique<Map> map() const { return map_; } | 1420 Unique<Map> map() const { return map_; } |
| 1421 bool map_is_stable() const { return MapIsStableField::decode(bit_field_); } | 1421 bool map_is_stable() const { return MapIsStableField::decode(bit_field_); } |
| 1422 | 1422 |
| 1423 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1423 Representation RequiredInputRepresentation(int index) override { |
| 1424 return Representation::Tagged(); | 1424 return Representation::Tagged(); |
| 1425 } | 1425 } |
| 1426 | 1426 |
| 1427 DECLARE_CONCRETE_INSTRUCTION(CompareMap) | 1427 DECLARE_CONCRETE_INSTRUCTION(CompareMap) |
| 1428 | 1428 |
| 1429 protected: | 1429 protected: |
| 1430 int RedefinedOperandIndex() OVERRIDE { return 0; } | 1430 int RedefinedOperandIndex() override { return 0; } |
| 1431 | 1431 |
| 1432 private: | 1432 private: |
| 1433 HCompareMap(HValue* value, Handle<Map> map, HBasicBlock* true_target = NULL, | 1433 HCompareMap(HValue* value, Handle<Map> map, HBasicBlock* true_target = NULL, |
| 1434 HBasicBlock* false_target = NULL) | 1434 HBasicBlock* false_target = NULL) |
| 1435 : HUnaryControlInstruction(value, true_target, false_target), | 1435 : HUnaryControlInstruction(value, true_target, false_target), |
| 1436 bit_field_(KnownSuccessorIndexField::encode( | 1436 bit_field_(KnownSuccessorIndexField::encode( |
| 1437 kNoKnownSuccessorIndex + kInternalKnownSuccessorOffset) | | 1437 kNoKnownSuccessorIndex + kInternalKnownSuccessorOffset) | |
| 1438 MapIsStableField::encode(map->is_stable())), | 1438 MapIsStableField::encode(map->is_stable())), |
| 1439 map_(Unique<Map>::CreateImmovable(map)) { | 1439 map_(Unique<Map>::CreateImmovable(map)) { |
| 1440 set_representation(Representation::Tagged()); | 1440 set_representation(Representation::Tagged()); |
| 1441 } | 1441 } |
| 1442 | 1442 |
| 1443 // BitFields can only store unsigned values, so use an offset. | 1443 // BitFields can only store unsigned values, so use an offset. |
| 1444 // Adding kInternalKnownSuccessorOffset must yield an unsigned value. | 1444 // Adding kInternalKnownSuccessorOffset must yield an unsigned value. |
| 1445 static const int kInternalKnownSuccessorOffset = 1; | 1445 static const int kInternalKnownSuccessorOffset = 1; |
| 1446 STATIC_ASSERT(kNoKnownSuccessorIndex + kInternalKnownSuccessorOffset >= 0); | 1446 STATIC_ASSERT(kNoKnownSuccessorIndex + kInternalKnownSuccessorOffset >= 0); |
| 1447 | 1447 |
| 1448 class KnownSuccessorIndexField : public BitField<int, 0, 31> {}; | 1448 class KnownSuccessorIndexField : public BitField<int, 0, 31> {}; |
| 1449 class MapIsStableField : public BitField<bool, 31, 1> {}; | 1449 class MapIsStableField : public BitField<bool, 31, 1> {}; |
| 1450 | 1450 |
| 1451 uint32_t bit_field_; | 1451 uint32_t bit_field_; |
| 1452 Unique<Map> map_; | 1452 Unique<Map> map_; |
| 1453 }; | 1453 }; |
| 1454 | 1454 |
| 1455 | 1455 |
| 1456 class HContext FINAL : public HTemplateInstruction<0> { | 1456 class HContext final : public HTemplateInstruction<0> { |
| 1457 public: | 1457 public: |
| 1458 static HContext* New(Zone* zone) { | 1458 static HContext* New(Zone* zone) { |
| 1459 return new(zone) HContext(); | 1459 return new(zone) HContext(); |
| 1460 } | 1460 } |
| 1461 | 1461 |
| 1462 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1462 Representation RequiredInputRepresentation(int index) override { |
| 1463 return Representation::None(); | 1463 return Representation::None(); |
| 1464 } | 1464 } |
| 1465 | 1465 |
| 1466 DECLARE_CONCRETE_INSTRUCTION(Context) | 1466 DECLARE_CONCRETE_INSTRUCTION(Context) |
| 1467 | 1467 |
| 1468 protected: | 1468 protected: |
| 1469 bool DataEquals(HValue* other) OVERRIDE { return true; } | 1469 bool DataEquals(HValue* other) override { return true; } |
| 1470 | 1470 |
| 1471 private: | 1471 private: |
| 1472 HContext() { | 1472 HContext() { |
| 1473 set_representation(Representation::Tagged()); | 1473 set_representation(Representation::Tagged()); |
| 1474 SetFlag(kUseGVN); | 1474 SetFlag(kUseGVN); |
| 1475 } | 1475 } |
| 1476 | 1476 |
| 1477 bool IsDeletable() const OVERRIDE { return true; } | 1477 bool IsDeletable() const override { return true; } |
| 1478 }; | 1478 }; |
| 1479 | 1479 |
| 1480 | 1480 |
| 1481 class HReturn FINAL : public HTemplateControlInstruction<0, 3> { | 1481 class HReturn final : public HTemplateControlInstruction<0, 3> { |
| 1482 public: | 1482 public: |
| 1483 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HReturn, HValue*, HValue*); | 1483 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HReturn, HValue*, HValue*); |
| 1484 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HReturn, HValue*); | 1484 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HReturn, HValue*); |
| 1485 | 1485 |
| 1486 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1486 Representation RequiredInputRepresentation(int index) override { |
| 1487 // TODO(titzer): require an Int32 input for faster returns. | 1487 // TODO(titzer): require an Int32 input for faster returns. |
| 1488 if (index == 2) return Representation::Smi(); | 1488 if (index == 2) return Representation::Smi(); |
| 1489 return Representation::Tagged(); | 1489 return Representation::Tagged(); |
| 1490 } | 1490 } |
| 1491 | 1491 |
| 1492 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1492 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 1493 | 1493 |
| 1494 HValue* value() const { return OperandAt(0); } | 1494 HValue* value() const { return OperandAt(0); } |
| 1495 HValue* context() const { return OperandAt(1); } | 1495 HValue* context() const { return OperandAt(1); } |
| 1496 HValue* parameter_count() const { return OperandAt(2); } | 1496 HValue* parameter_count() const { return OperandAt(2); } |
| 1497 | 1497 |
| 1498 DECLARE_CONCRETE_INSTRUCTION(Return) | 1498 DECLARE_CONCRETE_INSTRUCTION(Return) |
| 1499 | 1499 |
| 1500 private: | 1500 private: |
| 1501 HReturn(HValue* context, HValue* value, HValue* parameter_count = 0) { | 1501 HReturn(HValue* context, HValue* value, HValue* parameter_count = 0) { |
| 1502 SetOperandAt(0, value); | 1502 SetOperandAt(0, value); |
| 1503 SetOperandAt(1, context); | 1503 SetOperandAt(1, context); |
| 1504 SetOperandAt(2, parameter_count); | 1504 SetOperandAt(2, parameter_count); |
| 1505 } | 1505 } |
| 1506 }; | 1506 }; |
| 1507 | 1507 |
| 1508 | 1508 |
| 1509 class HAbnormalExit FINAL : public HTemplateControlInstruction<0, 0> { | 1509 class HAbnormalExit final : public HTemplateControlInstruction<0, 0> { |
| 1510 public: | 1510 public: |
| 1511 DECLARE_INSTRUCTION_FACTORY_P0(HAbnormalExit); | 1511 DECLARE_INSTRUCTION_FACTORY_P0(HAbnormalExit); |
| 1512 | 1512 |
| 1513 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1513 Representation RequiredInputRepresentation(int index) override { |
| 1514 return Representation::None(); | 1514 return Representation::None(); |
| 1515 } | 1515 } |
| 1516 | 1516 |
| 1517 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) | 1517 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) |
| 1518 private: | 1518 private: |
| 1519 HAbnormalExit() {} | 1519 HAbnormalExit() {} |
| 1520 }; | 1520 }; |
| 1521 | 1521 |
| 1522 | 1522 |
| 1523 class HUnaryOperation : public HTemplateInstruction<1> { | 1523 class HUnaryOperation : public HTemplateInstruction<1> { |
| 1524 public: | 1524 public: |
| 1525 explicit HUnaryOperation(HValue* value, HType type = HType::Tagged()) | 1525 explicit HUnaryOperation(HValue* value, HType type = HType::Tagged()) |
| 1526 : HTemplateInstruction<1>(type) { | 1526 : HTemplateInstruction<1>(type) { |
| 1527 SetOperandAt(0, value); | 1527 SetOperandAt(0, value); |
| 1528 } | 1528 } |
| 1529 | 1529 |
| 1530 static HUnaryOperation* cast(HValue* value) { | 1530 static HUnaryOperation* cast(HValue* value) { |
| 1531 return reinterpret_cast<HUnaryOperation*>(value); | 1531 return reinterpret_cast<HUnaryOperation*>(value); |
| 1532 } | 1532 } |
| 1533 | 1533 |
| 1534 HValue* value() const { return OperandAt(0); } | 1534 HValue* value() const { return OperandAt(0); } |
| 1535 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1535 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 1536 }; | 1536 }; |
| 1537 | 1537 |
| 1538 | 1538 |
| 1539 class HUseConst FINAL : public HUnaryOperation { | 1539 class HUseConst final : public HUnaryOperation { |
| 1540 public: | 1540 public: |
| 1541 DECLARE_INSTRUCTION_FACTORY_P1(HUseConst, HValue*); | 1541 DECLARE_INSTRUCTION_FACTORY_P1(HUseConst, HValue*); |
| 1542 | 1542 |
| 1543 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1543 Representation RequiredInputRepresentation(int index) override { |
| 1544 return Representation::None(); | 1544 return Representation::None(); |
| 1545 } | 1545 } |
| 1546 | 1546 |
| 1547 DECLARE_CONCRETE_INSTRUCTION(UseConst) | 1547 DECLARE_CONCRETE_INSTRUCTION(UseConst) |
| 1548 | 1548 |
| 1549 private: | 1549 private: |
| 1550 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } | 1550 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } |
| 1551 }; | 1551 }; |
| 1552 | 1552 |
| 1553 | 1553 |
| 1554 class HForceRepresentation FINAL : public HTemplateInstruction<1> { | 1554 class HForceRepresentation final : public HTemplateInstruction<1> { |
| 1555 public: | 1555 public: |
| 1556 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 1556 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 1557 HValue* value, | 1557 HValue* value, |
| 1558 Representation required_representation); | 1558 Representation required_representation); |
| 1559 | 1559 |
| 1560 HValue* value() const { return OperandAt(0); } | 1560 HValue* value() const { return OperandAt(0); } |
| 1561 | 1561 |
| 1562 Representation observed_input_representation(int index) OVERRIDE { | 1562 Representation observed_input_representation(int index) override { |
| 1563 // We haven't actually *observed* this, but it's closer to the truth | 1563 // We haven't actually *observed* this, but it's closer to the truth |
| 1564 // than 'None'. | 1564 // than 'None'. |
| 1565 return representation(); // Same as the output representation. | 1565 return representation(); // Same as the output representation. |
| 1566 } | 1566 } |
| 1567 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1567 Representation RequiredInputRepresentation(int index) override { |
| 1568 return representation(); // Same as the output representation. | 1568 return representation(); // Same as the output representation. |
| 1569 } | 1569 } |
| 1570 | 1570 |
| 1571 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1571 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 1572 | 1572 |
| 1573 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) | 1573 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) |
| 1574 | 1574 |
| 1575 private: | 1575 private: |
| 1576 HForceRepresentation(HValue* value, Representation required_representation) { | 1576 HForceRepresentation(HValue* value, Representation required_representation) { |
| 1577 SetOperandAt(0, value); | 1577 SetOperandAt(0, value); |
| 1578 set_representation(required_representation); | 1578 set_representation(required_representation); |
| 1579 } | 1579 } |
| 1580 }; | 1580 }; |
| 1581 | 1581 |
| 1582 | 1582 |
| 1583 class HChange FINAL : public HUnaryOperation { | 1583 class HChange final : public HUnaryOperation { |
| 1584 public: | 1584 public: |
| 1585 HChange(HValue* value, | 1585 HChange(HValue* value, |
| 1586 Representation to, | 1586 Representation to, |
| 1587 bool is_truncating_to_smi, | 1587 bool is_truncating_to_smi, |
| 1588 bool is_truncating_to_int32) | 1588 bool is_truncating_to_int32) |
| 1589 : HUnaryOperation(value) { | 1589 : HUnaryOperation(value) { |
| 1590 DCHECK(!value->representation().IsNone()); | 1590 DCHECK(!value->representation().IsNone()); |
| 1591 DCHECK(!to.IsNone()); | 1591 DCHECK(!to.IsNone()); |
| 1592 DCHECK(!value->representation().Equals(to)); | 1592 DCHECK(!value->representation().Equals(to)); |
| 1593 set_representation(to); | 1593 set_representation(to); |
| 1594 SetFlag(kUseGVN); | 1594 SetFlag(kUseGVN); |
| 1595 SetFlag(kCanOverflow); | 1595 SetFlag(kCanOverflow); |
| 1596 if (is_truncating_to_smi && to.IsSmi()) { | 1596 if (is_truncating_to_smi && to.IsSmi()) { |
| 1597 SetFlag(kTruncatingToSmi); | 1597 SetFlag(kTruncatingToSmi); |
| 1598 SetFlag(kTruncatingToInt32); | 1598 SetFlag(kTruncatingToInt32); |
| 1599 } | 1599 } |
| 1600 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32); | 1600 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32); |
| 1601 if (value->representation().IsSmi() || value->type().IsSmi()) { | 1601 if (value->representation().IsSmi() || value->type().IsSmi()) { |
| 1602 set_type(HType::Smi()); | 1602 set_type(HType::Smi()); |
| 1603 } else { | 1603 } else { |
| 1604 set_type(HType::TaggedNumber()); | 1604 set_type(HType::TaggedNumber()); |
| 1605 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); | 1605 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); |
| 1606 } | 1606 } |
| 1607 } | 1607 } |
| 1608 | 1608 |
| 1609 bool can_convert_undefined_to_nan() { | 1609 bool can_convert_undefined_to_nan() { |
| 1610 return CheckUsesForFlag(kAllowUndefinedAsNaN); | 1610 return CheckUsesForFlag(kAllowUndefinedAsNaN); |
| 1611 } | 1611 } |
| 1612 | 1612 |
| 1613 HType CalculateInferredType() OVERRIDE; | 1613 HType CalculateInferredType() override; |
| 1614 HValue* Canonicalize() OVERRIDE; | 1614 HValue* Canonicalize() override; |
| 1615 | 1615 |
| 1616 Representation from() const { return value()->representation(); } | 1616 Representation from() const { return value()->representation(); } |
| 1617 Representation to() const { return representation(); } | 1617 Representation to() const { return representation(); } |
| 1618 bool deoptimize_on_minus_zero() const { | 1618 bool deoptimize_on_minus_zero() const { |
| 1619 return CheckFlag(kBailoutOnMinusZero); | 1619 return CheckFlag(kBailoutOnMinusZero); |
| 1620 } | 1620 } |
| 1621 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1621 Representation RequiredInputRepresentation(int index) override { |
| 1622 return from(); | 1622 return from(); |
| 1623 } | 1623 } |
| 1624 | 1624 |
| 1625 Range* InferRange(Zone* zone) OVERRIDE; | 1625 Range* InferRange(Zone* zone) override; |
| 1626 | 1626 |
| 1627 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1627 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 1628 | 1628 |
| 1629 DECLARE_CONCRETE_INSTRUCTION(Change) | 1629 DECLARE_CONCRETE_INSTRUCTION(Change) |
| 1630 | 1630 |
| 1631 protected: | 1631 protected: |
| 1632 bool DataEquals(HValue* other) OVERRIDE { return true; } | 1632 bool DataEquals(HValue* other) override { return true; } |
| 1633 | 1633 |
| 1634 private: | 1634 private: |
| 1635 bool IsDeletable() const OVERRIDE { | 1635 bool IsDeletable() const override { |
| 1636 return !from().IsTagged() || value()->type().IsSmi(); | 1636 return !from().IsTagged() || value()->type().IsSmi(); |
| 1637 } | 1637 } |
| 1638 }; | 1638 }; |
| 1639 | 1639 |
| 1640 | 1640 |
| 1641 class HClampToUint8 FINAL : public HUnaryOperation { | 1641 class HClampToUint8 final : public HUnaryOperation { |
| 1642 public: | 1642 public: |
| 1643 DECLARE_INSTRUCTION_FACTORY_P1(HClampToUint8, HValue*); | 1643 DECLARE_INSTRUCTION_FACTORY_P1(HClampToUint8, HValue*); |
| 1644 | 1644 |
| 1645 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1645 Representation RequiredInputRepresentation(int index) override { |
| 1646 return Representation::None(); | 1646 return Representation::None(); |
| 1647 } | 1647 } |
| 1648 | 1648 |
| 1649 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) | 1649 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) |
| 1650 | 1650 |
| 1651 protected: | 1651 protected: |
| 1652 bool DataEquals(HValue* other) OVERRIDE { return true; } | 1652 bool DataEquals(HValue* other) override { return true; } |
| 1653 | 1653 |
| 1654 private: | 1654 private: |
| 1655 explicit HClampToUint8(HValue* value) | 1655 explicit HClampToUint8(HValue* value) |
| 1656 : HUnaryOperation(value) { | 1656 : HUnaryOperation(value) { |
| 1657 set_representation(Representation::Integer32()); | 1657 set_representation(Representation::Integer32()); |
| 1658 SetFlag(kAllowUndefinedAsNaN); | 1658 SetFlag(kAllowUndefinedAsNaN); |
| 1659 SetFlag(kUseGVN); | 1659 SetFlag(kUseGVN); |
| 1660 } | 1660 } |
| 1661 | 1661 |
| 1662 bool IsDeletable() const OVERRIDE { return true; } | 1662 bool IsDeletable() const override { return true; } |
| 1663 }; | 1663 }; |
| 1664 | 1664 |
| 1665 | 1665 |
| 1666 class HDoubleBits FINAL : public HUnaryOperation { | 1666 class HDoubleBits final : public HUnaryOperation { |
| 1667 public: | 1667 public: |
| 1668 enum Bits { HIGH, LOW }; | 1668 enum Bits { HIGH, LOW }; |
| 1669 DECLARE_INSTRUCTION_FACTORY_P2(HDoubleBits, HValue*, Bits); | 1669 DECLARE_INSTRUCTION_FACTORY_P2(HDoubleBits, HValue*, Bits); |
| 1670 | 1670 |
| 1671 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1671 Representation RequiredInputRepresentation(int index) override { |
| 1672 return Representation::Double(); | 1672 return Representation::Double(); |
| 1673 } | 1673 } |
| 1674 | 1674 |
| 1675 DECLARE_CONCRETE_INSTRUCTION(DoubleBits) | 1675 DECLARE_CONCRETE_INSTRUCTION(DoubleBits) |
| 1676 | 1676 |
| 1677 Bits bits() { return bits_; } | 1677 Bits bits() { return bits_; } |
| 1678 | 1678 |
| 1679 protected: | 1679 protected: |
| 1680 bool DataEquals(HValue* other) OVERRIDE { | 1680 bool DataEquals(HValue* other) override { |
| 1681 return other->IsDoubleBits() && HDoubleBits::cast(other)->bits() == bits(); | 1681 return other->IsDoubleBits() && HDoubleBits::cast(other)->bits() == bits(); |
| 1682 } | 1682 } |
| 1683 | 1683 |
| 1684 private: | 1684 private: |
| 1685 HDoubleBits(HValue* value, Bits bits) | 1685 HDoubleBits(HValue* value, Bits bits) |
| 1686 : HUnaryOperation(value), bits_(bits) { | 1686 : HUnaryOperation(value), bits_(bits) { |
| 1687 set_representation(Representation::Integer32()); | 1687 set_representation(Representation::Integer32()); |
| 1688 SetFlag(kUseGVN); | 1688 SetFlag(kUseGVN); |
| 1689 } | 1689 } |
| 1690 | 1690 |
| 1691 bool IsDeletable() const OVERRIDE { return true; } | 1691 bool IsDeletable() const override { return true; } |
| 1692 | 1692 |
| 1693 Bits bits_; | 1693 Bits bits_; |
| 1694 }; | 1694 }; |
| 1695 | 1695 |
| 1696 | 1696 |
| 1697 class HConstructDouble FINAL : public HTemplateInstruction<2> { | 1697 class HConstructDouble final : public HTemplateInstruction<2> { |
| 1698 public: | 1698 public: |
| 1699 DECLARE_INSTRUCTION_FACTORY_P2(HConstructDouble, HValue*, HValue*); | 1699 DECLARE_INSTRUCTION_FACTORY_P2(HConstructDouble, HValue*, HValue*); |
| 1700 | 1700 |
| 1701 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1701 Representation RequiredInputRepresentation(int index) override { |
| 1702 return Representation::Integer32(); | 1702 return Representation::Integer32(); |
| 1703 } | 1703 } |
| 1704 | 1704 |
| 1705 DECLARE_CONCRETE_INSTRUCTION(ConstructDouble) | 1705 DECLARE_CONCRETE_INSTRUCTION(ConstructDouble) |
| 1706 | 1706 |
| 1707 HValue* hi() { return OperandAt(0); } | 1707 HValue* hi() { return OperandAt(0); } |
| 1708 HValue* lo() { return OperandAt(1); } | 1708 HValue* lo() { return OperandAt(1); } |
| 1709 | 1709 |
| 1710 protected: | 1710 protected: |
| 1711 bool DataEquals(HValue* other) OVERRIDE { return true; } | 1711 bool DataEquals(HValue* other) override { return true; } |
| 1712 | 1712 |
| 1713 private: | 1713 private: |
| 1714 explicit HConstructDouble(HValue* hi, HValue* lo) { | 1714 explicit HConstructDouble(HValue* hi, HValue* lo) { |
| 1715 set_representation(Representation::Double()); | 1715 set_representation(Representation::Double()); |
| 1716 SetFlag(kUseGVN); | 1716 SetFlag(kUseGVN); |
| 1717 SetOperandAt(0, hi); | 1717 SetOperandAt(0, hi); |
| 1718 SetOperandAt(1, lo); | 1718 SetOperandAt(1, lo); |
| 1719 } | 1719 } |
| 1720 | 1720 |
| 1721 bool IsDeletable() const OVERRIDE { return true; } | 1721 bool IsDeletable() const override { return true; } |
| 1722 }; | 1722 }; |
| 1723 | 1723 |
| 1724 | 1724 |
| 1725 enum RemovableSimulate { | 1725 enum RemovableSimulate { |
| 1726 REMOVABLE_SIMULATE, | 1726 REMOVABLE_SIMULATE, |
| 1727 FIXED_SIMULATE | 1727 FIXED_SIMULATE |
| 1728 }; | 1728 }; |
| 1729 | 1729 |
| 1730 | 1730 |
| 1731 class HSimulate FINAL : public HInstruction { | 1731 class HSimulate final : public HInstruction { |
| 1732 public: | 1732 public: |
| 1733 HSimulate(BailoutId ast_id, int pop_count, Zone* zone, | 1733 HSimulate(BailoutId ast_id, int pop_count, Zone* zone, |
| 1734 RemovableSimulate removable) | 1734 RemovableSimulate removable) |
| 1735 : ast_id_(ast_id), | 1735 : ast_id_(ast_id), |
| 1736 pop_count_(pop_count), | 1736 pop_count_(pop_count), |
| 1737 values_(2, zone), | 1737 values_(2, zone), |
| 1738 assigned_indexes_(2, zone), | 1738 assigned_indexes_(2, zone), |
| 1739 zone_(zone), | 1739 zone_(zone), |
| 1740 bit_field_(RemovableField::encode(removable) | | 1740 bit_field_(RemovableField::encode(removable) | |
| 1741 DoneWithReplayField::encode(false)) {} | 1741 DoneWithReplayField::encode(false)) {} |
| 1742 ~HSimulate() {} | 1742 ~HSimulate() {} |
| 1743 | 1743 |
| 1744 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1744 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 1745 | 1745 |
| 1746 bool HasAstId() const { return !ast_id_.IsNone(); } | 1746 bool HasAstId() const { return !ast_id_.IsNone(); } |
| 1747 BailoutId ast_id() const { return ast_id_; } | 1747 BailoutId ast_id() const { return ast_id_; } |
| 1748 void set_ast_id(BailoutId id) { | 1748 void set_ast_id(BailoutId id) { |
| 1749 DCHECK(!HasAstId()); | 1749 DCHECK(!HasAstId()); |
| 1750 ast_id_ = id; | 1750 ast_id_ = id; |
| 1751 } | 1751 } |
| 1752 | 1752 |
| 1753 int pop_count() const { return pop_count_; } | 1753 int pop_count() const { return pop_count_; } |
| 1754 const ZoneList<HValue*>* values() const { return &values_; } | 1754 const ZoneList<HValue*>* values() const { return &values_; } |
| 1755 int GetAssignedIndexAt(int index) const { | 1755 int GetAssignedIndexAt(int index) const { |
| 1756 DCHECK(HasAssignedIndexAt(index)); | 1756 DCHECK(HasAssignedIndexAt(index)); |
| 1757 return assigned_indexes_[index]; | 1757 return assigned_indexes_[index]; |
| 1758 } | 1758 } |
| 1759 bool HasAssignedIndexAt(int index) const { | 1759 bool HasAssignedIndexAt(int index) const { |
| 1760 return assigned_indexes_[index] != kNoIndex; | 1760 return assigned_indexes_[index] != kNoIndex; |
| 1761 } | 1761 } |
| 1762 void AddAssignedValue(int index, HValue* value) { | 1762 void AddAssignedValue(int index, HValue* value) { |
| 1763 AddValue(index, value); | 1763 AddValue(index, value); |
| 1764 } | 1764 } |
| 1765 void AddPushedValue(HValue* value) { | 1765 void AddPushedValue(HValue* value) { |
| 1766 AddValue(kNoIndex, value); | 1766 AddValue(kNoIndex, value); |
| 1767 } | 1767 } |
| 1768 int ToOperandIndex(int environment_index) { | 1768 int ToOperandIndex(int environment_index) { |
| 1769 for (int i = 0; i < assigned_indexes_.length(); ++i) { | 1769 for (int i = 0; i < assigned_indexes_.length(); ++i) { |
| 1770 if (assigned_indexes_[i] == environment_index) return i; | 1770 if (assigned_indexes_[i] == environment_index) return i; |
| 1771 } | 1771 } |
| 1772 return -1; | 1772 return -1; |
| 1773 } | 1773 } |
| 1774 int OperandCount() const OVERRIDE { return values_.length(); } | 1774 int OperandCount() const override { return values_.length(); } |
| 1775 HValue* OperandAt(int index) const OVERRIDE { return values_[index]; } | 1775 HValue* OperandAt(int index) const override { return values_[index]; } |
| 1776 | 1776 |
| 1777 bool HasEscapingOperandAt(int index) OVERRIDE { return false; } | 1777 bool HasEscapingOperandAt(int index) override { return false; } |
| 1778 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1778 Representation RequiredInputRepresentation(int index) override { |
| 1779 return Representation::None(); | 1779 return Representation::None(); |
| 1780 } | 1780 } |
| 1781 | 1781 |
| 1782 void MergeWith(ZoneList<HSimulate*>* list); | 1782 void MergeWith(ZoneList<HSimulate*>* list); |
| 1783 bool is_candidate_for_removal() { | 1783 bool is_candidate_for_removal() { |
| 1784 return RemovableField::decode(bit_field_) == REMOVABLE_SIMULATE; | 1784 return RemovableField::decode(bit_field_) == REMOVABLE_SIMULATE; |
| 1785 } | 1785 } |
| 1786 | 1786 |
| 1787 // Replay effects of this instruction on the given environment. | 1787 // Replay effects of this instruction on the given environment. |
| 1788 void ReplayEnvironment(HEnvironment* env); | 1788 void ReplayEnvironment(HEnvironment* env); |
| 1789 | 1789 |
| 1790 DECLARE_CONCRETE_INSTRUCTION(Simulate) | 1790 DECLARE_CONCRETE_INSTRUCTION(Simulate) |
| 1791 | 1791 |
| 1792 #ifdef DEBUG | 1792 #ifdef DEBUG |
| 1793 void Verify() OVERRIDE; | 1793 void Verify() override; |
| 1794 void set_closure(Handle<JSFunction> closure) { closure_ = closure; } | 1794 void set_closure(Handle<JSFunction> closure) { closure_ = closure; } |
| 1795 Handle<JSFunction> closure() const { return closure_; } | 1795 Handle<JSFunction> closure() const { return closure_; } |
| 1796 #endif | 1796 #endif |
| 1797 | 1797 |
| 1798 protected: | 1798 protected: |
| 1799 void InternalSetOperandAt(int index, HValue* value) OVERRIDE { | 1799 void InternalSetOperandAt(int index, HValue* value) override { |
| 1800 values_[index] = value; | 1800 values_[index] = value; |
| 1801 } | 1801 } |
| 1802 | 1802 |
| 1803 private: | 1803 private: |
| 1804 static const int kNoIndex = -1; | 1804 static const int kNoIndex = -1; |
| 1805 void AddValue(int index, HValue* value) { | 1805 void AddValue(int index, HValue* value) { |
| 1806 assigned_indexes_.Add(index, zone_); | 1806 assigned_indexes_.Add(index, zone_); |
| 1807 // Resize the list of pushed values. | 1807 // Resize the list of pushed values. |
| 1808 values_.Add(NULL, zone_); | 1808 values_.Add(NULL, zone_); |
| 1809 // Set the operand through the base method in HValue to make sure that the | 1809 // Set the operand through the base method in HValue to make sure that the |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1832 ZoneList<int> assigned_indexes_; | 1832 ZoneList<int> assigned_indexes_; |
| 1833 Zone* zone_; | 1833 Zone* zone_; |
| 1834 uint32_t bit_field_; | 1834 uint32_t bit_field_; |
| 1835 | 1835 |
| 1836 #ifdef DEBUG | 1836 #ifdef DEBUG |
| 1837 Handle<JSFunction> closure_; | 1837 Handle<JSFunction> closure_; |
| 1838 #endif | 1838 #endif |
| 1839 }; | 1839 }; |
| 1840 | 1840 |
| 1841 | 1841 |
| 1842 class HEnvironmentMarker FINAL : public HTemplateInstruction<1> { | 1842 class HEnvironmentMarker final : public HTemplateInstruction<1> { |
| 1843 public: | 1843 public: |
| 1844 enum Kind { BIND, LOOKUP }; | 1844 enum Kind { BIND, LOOKUP }; |
| 1845 | 1845 |
| 1846 DECLARE_INSTRUCTION_FACTORY_P2(HEnvironmentMarker, Kind, int); | 1846 DECLARE_INSTRUCTION_FACTORY_P2(HEnvironmentMarker, Kind, int); |
| 1847 | 1847 |
| 1848 Kind kind() const { return kind_; } | 1848 Kind kind() const { return kind_; } |
| 1849 int index() const { return index_; } | 1849 int index() const { return index_; } |
| 1850 HSimulate* next_simulate() { return next_simulate_; } | 1850 HSimulate* next_simulate() { return next_simulate_; } |
| 1851 void set_next_simulate(HSimulate* simulate) { | 1851 void set_next_simulate(HSimulate* simulate) { |
| 1852 next_simulate_ = simulate; | 1852 next_simulate_ = simulate; |
| 1853 } | 1853 } |
| 1854 | 1854 |
| 1855 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1855 Representation RequiredInputRepresentation(int index) override { |
| 1856 return Representation::None(); | 1856 return Representation::None(); |
| 1857 } | 1857 } |
| 1858 | 1858 |
| 1859 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1859 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 1860 | 1860 |
| 1861 #ifdef DEBUG | 1861 #ifdef DEBUG |
| 1862 void set_closure(Handle<JSFunction> closure) { | 1862 void set_closure(Handle<JSFunction> closure) { |
| 1863 DCHECK(closure_.is_null()); | 1863 DCHECK(closure_.is_null()); |
| 1864 DCHECK(!closure.is_null()); | 1864 DCHECK(!closure.is_null()); |
| 1865 closure_ = closure; | 1865 closure_ = closure; |
| 1866 } | 1866 } |
| 1867 Handle<JSFunction> closure() const { return closure_; } | 1867 Handle<JSFunction> closure() const { return closure_; } |
| 1868 #endif | 1868 #endif |
| 1869 | 1869 |
| 1870 DECLARE_CONCRETE_INSTRUCTION(EnvironmentMarker); | 1870 DECLARE_CONCRETE_INSTRUCTION(EnvironmentMarker); |
| 1871 | 1871 |
| 1872 private: | 1872 private: |
| 1873 HEnvironmentMarker(Kind kind, int index) | 1873 HEnvironmentMarker(Kind kind, int index) |
| 1874 : kind_(kind), index_(index), next_simulate_(NULL) { } | 1874 : kind_(kind), index_(index), next_simulate_(NULL) { } |
| 1875 | 1875 |
| 1876 Kind kind_; | 1876 Kind kind_; |
| 1877 int index_; | 1877 int index_; |
| 1878 HSimulate* next_simulate_; | 1878 HSimulate* next_simulate_; |
| 1879 | 1879 |
| 1880 #ifdef DEBUG | 1880 #ifdef DEBUG |
| 1881 Handle<JSFunction> closure_; | 1881 Handle<JSFunction> closure_; |
| 1882 #endif | 1882 #endif |
| 1883 }; | 1883 }; |
| 1884 | 1884 |
| 1885 | 1885 |
| 1886 class HStackCheck FINAL : public HTemplateInstruction<1> { | 1886 class HStackCheck final : public HTemplateInstruction<1> { |
| 1887 public: | 1887 public: |
| 1888 enum Type { | 1888 enum Type { |
| 1889 kFunctionEntry, | 1889 kFunctionEntry, |
| 1890 kBackwardsBranch | 1890 kBackwardsBranch |
| 1891 }; | 1891 }; |
| 1892 | 1892 |
| 1893 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HStackCheck, Type); | 1893 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HStackCheck, Type); |
| 1894 | 1894 |
| 1895 HValue* context() { return OperandAt(0); } | 1895 HValue* context() { return OperandAt(0); } |
| 1896 | 1896 |
| 1897 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1897 Representation RequiredInputRepresentation(int index) override { |
| 1898 return Representation::Tagged(); | 1898 return Representation::Tagged(); |
| 1899 } | 1899 } |
| 1900 | 1900 |
| 1901 void Eliminate() { | 1901 void Eliminate() { |
| 1902 // The stack check eliminator might try to eliminate the same stack | 1902 // The stack check eliminator might try to eliminate the same stack |
| 1903 // check instruction multiple times. | 1903 // check instruction multiple times. |
| 1904 if (IsLinked()) { | 1904 if (IsLinked()) { |
| 1905 DeleteAndReplaceWith(NULL); | 1905 DeleteAndReplaceWith(NULL); |
| 1906 } | 1906 } |
| 1907 } | 1907 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1926 CONSTRUCT_CALL_RETURN, // Either use allocated receiver or return value. | 1926 CONSTRUCT_CALL_RETURN, // Either use allocated receiver or return value. |
| 1927 GETTER_CALL_RETURN, // Returning from a getter, need to restore context. | 1927 GETTER_CALL_RETURN, // Returning from a getter, need to restore context. |
| 1928 SETTER_CALL_RETURN // Use the RHS of the assignment as the return value. | 1928 SETTER_CALL_RETURN // Use the RHS of the assignment as the return value. |
| 1929 }; | 1929 }; |
| 1930 | 1930 |
| 1931 | 1931 |
| 1932 class HArgumentsObject; | 1932 class HArgumentsObject; |
| 1933 class HConstant; | 1933 class HConstant; |
| 1934 | 1934 |
| 1935 | 1935 |
| 1936 class HEnterInlined FINAL : public HTemplateInstruction<0> { | 1936 class HEnterInlined final : public HTemplateInstruction<0> { |
| 1937 public: | 1937 public: |
| 1938 static HEnterInlined* New(Isolate* isolate, Zone* zone, HValue* context, | 1938 static HEnterInlined* New(Isolate* isolate, Zone* zone, HValue* context, |
| 1939 BailoutId return_id, Handle<JSFunction> closure, | 1939 BailoutId return_id, Handle<JSFunction> closure, |
| 1940 HConstant* closure_context, int arguments_count, | 1940 HConstant* closure_context, int arguments_count, |
| 1941 FunctionLiteral* function, | 1941 FunctionLiteral* function, |
| 1942 InliningKind inlining_kind, Variable* arguments_var, | 1942 InliningKind inlining_kind, Variable* arguments_var, |
| 1943 HArgumentsObject* arguments_object) { | 1943 HArgumentsObject* arguments_object) { |
| 1944 return new (zone) HEnterInlined(return_id, closure, closure_context, | 1944 return new (zone) HEnterInlined(return_id, closure, closure_context, |
| 1945 arguments_count, function, inlining_kind, | 1945 arguments_count, function, inlining_kind, |
| 1946 arguments_var, arguments_object, zone); | 1946 arguments_var, arguments_object, zone); |
| 1947 } | 1947 } |
| 1948 | 1948 |
| 1949 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone); | 1949 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone); |
| 1950 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; } | 1950 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; } |
| 1951 | 1951 |
| 1952 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 1952 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 1953 | 1953 |
| 1954 Handle<JSFunction> closure() const { return closure_; } | 1954 Handle<JSFunction> closure() const { return closure_; } |
| 1955 HConstant* closure_context() const { return closure_context_; } | 1955 HConstant* closure_context() const { return closure_context_; } |
| 1956 int arguments_count() const { return arguments_count_; } | 1956 int arguments_count() const { return arguments_count_; } |
| 1957 bool arguments_pushed() const { return arguments_pushed_; } | 1957 bool arguments_pushed() const { return arguments_pushed_; } |
| 1958 void set_arguments_pushed() { arguments_pushed_ = true; } | 1958 void set_arguments_pushed() { arguments_pushed_ = true; } |
| 1959 FunctionLiteral* function() const { return function_; } | 1959 FunctionLiteral* function() const { return function_; } |
| 1960 InliningKind inlining_kind() const { return inlining_kind_; } | 1960 InliningKind inlining_kind() const { return inlining_kind_; } |
| 1961 BailoutId ReturnId() const { return return_id_; } | 1961 BailoutId ReturnId() const { return return_id_; } |
| 1962 int inlining_id() const { return inlining_id_; } | 1962 int inlining_id() const { return inlining_id_; } |
| 1963 void set_inlining_id(int inlining_id) { inlining_id_ = inlining_id; } | 1963 void set_inlining_id(int inlining_id) { inlining_id_ = inlining_id; } |
| 1964 | 1964 |
| 1965 Representation RequiredInputRepresentation(int index) OVERRIDE { | 1965 Representation RequiredInputRepresentation(int index) override { |
| 1966 return Representation::None(); | 1966 return Representation::None(); |
| 1967 } | 1967 } |
| 1968 | 1968 |
| 1969 Variable* arguments_var() { return arguments_var_; } | 1969 Variable* arguments_var() { return arguments_var_; } |
| 1970 HArgumentsObject* arguments_object() { return arguments_object_; } | 1970 HArgumentsObject* arguments_object() { return arguments_object_; } |
| 1971 | 1971 |
| 1972 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) | 1972 DECLARE_CONCRETE_INSTRUCTION(EnterInlined) |
| 1973 | 1973 |
| 1974 private: | 1974 private: |
| 1975 HEnterInlined(BailoutId return_id, Handle<JSFunction> closure, | 1975 HEnterInlined(BailoutId return_id, Handle<JSFunction> closure, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1996 bool arguments_pushed_; | 1996 bool arguments_pushed_; |
| 1997 FunctionLiteral* function_; | 1997 FunctionLiteral* function_; |
| 1998 InliningKind inlining_kind_; | 1998 InliningKind inlining_kind_; |
| 1999 int inlining_id_; | 1999 int inlining_id_; |
| 2000 Variable* arguments_var_; | 2000 Variable* arguments_var_; |
| 2001 HArgumentsObject* arguments_object_; | 2001 HArgumentsObject* arguments_object_; |
| 2002 ZoneList<HBasicBlock*> return_targets_; | 2002 ZoneList<HBasicBlock*> return_targets_; |
| 2003 }; | 2003 }; |
| 2004 | 2004 |
| 2005 | 2005 |
| 2006 class HLeaveInlined FINAL : public HTemplateInstruction<0> { | 2006 class HLeaveInlined final : public HTemplateInstruction<0> { |
| 2007 public: | 2007 public: |
| 2008 HLeaveInlined(HEnterInlined* entry, | 2008 HLeaveInlined(HEnterInlined* entry, |
| 2009 int drop_count) | 2009 int drop_count) |
| 2010 : entry_(entry), | 2010 : entry_(entry), |
| 2011 drop_count_(drop_count) { } | 2011 drop_count_(drop_count) { } |
| 2012 | 2012 |
| 2013 Representation RequiredInputRepresentation(int index) OVERRIDE { | 2013 Representation RequiredInputRepresentation(int index) override { |
| 2014 return Representation::None(); | 2014 return Representation::None(); |
| 2015 } | 2015 } |
| 2016 | 2016 |
| 2017 int argument_delta() const OVERRIDE { | 2017 int argument_delta() const override { |
| 2018 return entry_->arguments_pushed() ? -drop_count_ : 0; | 2018 return entry_->arguments_pushed() ? -drop_count_ : 0; |
| 2019 } | 2019 } |
| 2020 | 2020 |
| 2021 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) | 2021 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) |
| 2022 | 2022 |
| 2023 private: | 2023 private: |
| 2024 HEnterInlined* entry_; | 2024 HEnterInlined* entry_; |
| 2025 int drop_count_; | 2025 int drop_count_; |
| 2026 }; | 2026 }; |
| 2027 | 2027 |
| 2028 | 2028 |
| 2029 class HPushArguments FINAL : public HInstruction { | 2029 class HPushArguments final : public HInstruction { |
| 2030 public: | 2030 public: |
| 2031 static HPushArguments* New(Isolate* isolate, Zone* zone, HValue* context) { | 2031 static HPushArguments* New(Isolate* isolate, Zone* zone, HValue* context) { |
| 2032 return new(zone) HPushArguments(zone); | 2032 return new(zone) HPushArguments(zone); |
| 2033 } | 2033 } |
| 2034 static HPushArguments* New(Isolate* isolate, Zone* zone, HValue* context, | 2034 static HPushArguments* New(Isolate* isolate, Zone* zone, HValue* context, |
| 2035 HValue* arg1) { | 2035 HValue* arg1) { |
| 2036 HPushArguments* instr = new(zone) HPushArguments(zone); | 2036 HPushArguments* instr = new(zone) HPushArguments(zone); |
| 2037 instr->AddInput(arg1); | 2037 instr->AddInput(arg1); |
| 2038 return instr; | 2038 return instr; |
| 2039 } | 2039 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2056 HValue* arg1, HValue* arg2, HValue* arg3, | 2056 HValue* arg1, HValue* arg2, HValue* arg3, |
| 2057 HValue* arg4) { | 2057 HValue* arg4) { |
| 2058 HPushArguments* instr = new(zone) HPushArguments(zone); | 2058 HPushArguments* instr = new(zone) HPushArguments(zone); |
| 2059 instr->AddInput(arg1); | 2059 instr->AddInput(arg1); |
| 2060 instr->AddInput(arg2); | 2060 instr->AddInput(arg2); |
| 2061 instr->AddInput(arg3); | 2061 instr->AddInput(arg3); |
| 2062 instr->AddInput(arg4); | 2062 instr->AddInput(arg4); |
| 2063 return instr; | 2063 return instr; |
| 2064 } | 2064 } |
| 2065 | 2065 |
| 2066 Representation RequiredInputRepresentation(int index) OVERRIDE { | 2066 Representation RequiredInputRepresentation(int index) override { |
| 2067 return Representation::Tagged(); | 2067 return Representation::Tagged(); |
| 2068 } | 2068 } |
| 2069 | 2069 |
| 2070 int argument_delta() const OVERRIDE { return inputs_.length(); } | 2070 int argument_delta() const override { return inputs_.length(); } |
| 2071 HValue* argument(int i) { return OperandAt(i); } | 2071 HValue* argument(int i) { return OperandAt(i); } |
| 2072 | 2072 |
| 2073 int OperandCount() const FINAL { return inputs_.length(); } | 2073 int OperandCount() const final { return inputs_.length(); } |
| 2074 HValue* OperandAt(int i) const FINAL { return inputs_[i]; } | 2074 HValue* OperandAt(int i) const final { return inputs_[i]; } |
| 2075 | 2075 |
| 2076 void AddInput(HValue* value); | 2076 void AddInput(HValue* value); |
| 2077 | 2077 |
| 2078 DECLARE_CONCRETE_INSTRUCTION(PushArguments) | 2078 DECLARE_CONCRETE_INSTRUCTION(PushArguments) |
| 2079 | 2079 |
| 2080 protected: | 2080 protected: |
| 2081 void InternalSetOperandAt(int i, HValue* value) FINAL { inputs_[i] = value; } | 2081 void InternalSetOperandAt(int i, HValue* value) final { inputs_[i] = value; } |
| 2082 | 2082 |
| 2083 private: | 2083 private: |
| 2084 explicit HPushArguments(Zone* zone) | 2084 explicit HPushArguments(Zone* zone) |
| 2085 : HInstruction(HType::Tagged()), inputs_(4, zone) { | 2085 : HInstruction(HType::Tagged()), inputs_(4, zone) { |
| 2086 set_representation(Representation::Tagged()); | 2086 set_representation(Representation::Tagged()); |
| 2087 } | 2087 } |
| 2088 | 2088 |
| 2089 ZoneList<HValue*> inputs_; | 2089 ZoneList<HValue*> inputs_; |
| 2090 }; | 2090 }; |
| 2091 | 2091 |
| 2092 | 2092 |
| 2093 class HThisFunction FINAL : public HTemplateInstruction<0> { | 2093 class HThisFunction final : public HTemplateInstruction<0> { |
| 2094 public: | 2094 public: |
| 2095 DECLARE_INSTRUCTION_FACTORY_P0(HThisFunction); | 2095 DECLARE_INSTRUCTION_FACTORY_P0(HThisFunction); |
| 2096 | 2096 |
| 2097 Representation RequiredInputRepresentation(int index) OVERRIDE { | 2097 Representation RequiredInputRepresentation(int index) override { |
| 2098 return Representation::None(); | 2098 return Representation::None(); |
| 2099 } | 2099 } |
| 2100 | 2100 |
| 2101 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) | 2101 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) |
| 2102 | 2102 |
| 2103 protected: | 2103 protected: |
| 2104 bool DataEquals(HValue* other) OVERRIDE { return true; } | 2104 bool DataEquals(HValue* other) override { return true; } |
| 2105 | 2105 |
| 2106 private: | 2106 private: |
| 2107 HThisFunction() { | 2107 HThisFunction() { |
| 2108 set_representation(Representation::Tagged()); | 2108 set_representation(Representation::Tagged()); |
| 2109 SetFlag(kUseGVN); | 2109 SetFlag(kUseGVN); |
| 2110 } | 2110 } |
| 2111 | 2111 |
| 2112 bool IsDeletable() const OVERRIDE { return true; } | 2112 bool IsDeletable() const override { return true; } |
| 2113 }; | 2113 }; |
| 2114 | 2114 |
| 2115 | 2115 |
| 2116 class HDeclareGlobals FINAL : public HUnaryOperation { | 2116 class HDeclareGlobals final : public HUnaryOperation { |
| 2117 public: | 2117 public: |
| 2118 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HDeclareGlobals, | 2118 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HDeclareGlobals, |
| 2119 Handle<FixedArray>, | 2119 Handle<FixedArray>, |
| 2120 int); | 2120 int); |
| 2121 | 2121 |
| 2122 HValue* context() { return OperandAt(0); } | 2122 HValue* context() { return OperandAt(0); } |
| 2123 Handle<FixedArray> pairs() const { return pairs_; } | 2123 Handle<FixedArray> pairs() const { return pairs_; } |
| 2124 int flags() const { return flags_; } | 2124 int flags() const { return flags_; } |
| 2125 | 2125 |
| 2126 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals) | 2126 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals) |
| 2127 | 2127 |
| 2128 Representation RequiredInputRepresentation(int index) OVERRIDE { | 2128 Representation RequiredInputRepresentation(int index) override { |
| 2129 return Representation::Tagged(); | 2129 return Representation::Tagged(); |
| 2130 } | 2130 } |
| 2131 | 2131 |
| 2132 private: | 2132 private: |
| 2133 HDeclareGlobals(HValue* context, | 2133 HDeclareGlobals(HValue* context, |
| 2134 Handle<FixedArray> pairs, | 2134 Handle<FixedArray> pairs, |
| 2135 int flags) | 2135 int flags) |
| 2136 : HUnaryOperation(context), | 2136 : HUnaryOperation(context), |
| 2137 pairs_(pairs), | 2137 pairs_(pairs), |
| 2138 flags_(flags) { | 2138 flags_(flags) { |
| 2139 set_representation(Representation::Tagged()); | 2139 set_representation(Representation::Tagged()); |
| 2140 SetAllSideEffects(); | 2140 SetAllSideEffects(); |
| 2141 } | 2141 } |
| 2142 | 2142 |
| 2143 Handle<FixedArray> pairs_; | 2143 Handle<FixedArray> pairs_; |
| 2144 int flags_; | 2144 int flags_; |
| 2145 }; | 2145 }; |
| 2146 | 2146 |
| 2147 | 2147 |
| 2148 template <int V> | 2148 template <int V> |
| 2149 class HCall : public HTemplateInstruction<V> { | 2149 class HCall : public HTemplateInstruction<V> { |
| 2150 public: | 2150 public: |
| 2151 // The argument count includes the receiver. | 2151 // The argument count includes the receiver. |
| 2152 explicit HCall<V>(int argument_count) : argument_count_(argument_count) { | 2152 explicit HCall<V>(int argument_count) : argument_count_(argument_count) { |
| 2153 this->set_representation(Representation::Tagged()); | 2153 this->set_representation(Representation::Tagged()); |
| 2154 this->SetAllSideEffects(); | 2154 this->SetAllSideEffects(); |
| 2155 } | 2155 } |
| 2156 | 2156 |
| 2157 HType CalculateInferredType() FINAL { return HType::Tagged(); } | 2157 HType CalculateInferredType() final { return HType::Tagged(); } |
| 2158 | 2158 |
| 2159 virtual int argument_count() const { | 2159 virtual int argument_count() const { |
| 2160 return argument_count_; | 2160 return argument_count_; |
| 2161 } | 2161 } |
| 2162 | 2162 |
| 2163 int argument_delta() const OVERRIDE { return -argument_count(); } | 2163 int argument_delta() const override { return -argument_count(); } |
| 2164 | 2164 |
| 2165 private: | 2165 private: |
| 2166 int argument_count_; | 2166 int argument_count_; |
| 2167 }; | 2167 }; |
| 2168 | 2168 |
| 2169 | 2169 |
| 2170 class HUnaryCall : public HCall<1> { | 2170 class HUnaryCall : public HCall<1> { |
| 2171 public: | 2171 public: |
| 2172 HUnaryCall(HValue* value, int argument_count) | 2172 HUnaryCall(HValue* value, int argument_count) |
| 2173 : HCall<1>(argument_count) { | 2173 : HCall<1>(argument_count) { |
| 2174 SetOperandAt(0, value); | 2174 SetOperandAt(0, value); |
| 2175 } | 2175 } |
| 2176 | 2176 |
| 2177 Representation RequiredInputRepresentation(int index) FINAL { | 2177 Representation RequiredInputRepresentation(int index) final { |
| 2178 return Representation::Tagged(); | 2178 return Representation::Tagged(); |
| 2179 } | 2179 } |
| 2180 | 2180 |
| 2181 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2181 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 2182 | 2182 |
| 2183 HValue* value() const { return OperandAt(0); } | 2183 HValue* value() const { return OperandAt(0); } |
| 2184 }; | 2184 }; |
| 2185 | 2185 |
| 2186 | 2186 |
| 2187 class HBinaryCall : public HCall<2> { | 2187 class HBinaryCall : public HCall<2> { |
| 2188 public: | 2188 public: |
| 2189 HBinaryCall(HValue* first, HValue* second, int argument_count) | 2189 HBinaryCall(HValue* first, HValue* second, int argument_count) |
| 2190 : HCall<2>(argument_count) { | 2190 : HCall<2>(argument_count) { |
| 2191 SetOperandAt(0, first); | 2191 SetOperandAt(0, first); |
| 2192 SetOperandAt(1, second); | 2192 SetOperandAt(1, second); |
| 2193 } | 2193 } |
| 2194 | 2194 |
| 2195 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2195 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 2196 | 2196 |
| 2197 Representation RequiredInputRepresentation(int index) FINAL { | 2197 Representation RequiredInputRepresentation(int index) final { |
| 2198 return Representation::Tagged(); | 2198 return Representation::Tagged(); |
| 2199 } | 2199 } |
| 2200 | 2200 |
| 2201 HValue* first() const { return OperandAt(0); } | 2201 HValue* first() const { return OperandAt(0); } |
| 2202 HValue* second() const { return OperandAt(1); } | 2202 HValue* second() const { return OperandAt(1); } |
| 2203 }; | 2203 }; |
| 2204 | 2204 |
| 2205 | 2205 |
| 2206 class HCallJSFunction FINAL : public HCall<1> { | 2206 class HCallJSFunction final : public HCall<1> { |
| 2207 public: | 2207 public: |
| 2208 static HCallJSFunction* New(Isolate* isolate, Zone* zone, HValue* context, | 2208 static HCallJSFunction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 2209 HValue* function, int argument_count, | 2209 HValue* function, int argument_count, |
| 2210 bool pass_argument_count); | 2210 bool pass_argument_count); |
| 2211 | 2211 |
| 2212 HValue* function() const { return OperandAt(0); } | 2212 HValue* function() const { return OperandAt(0); } |
| 2213 | 2213 |
| 2214 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2214 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 2215 | 2215 |
| 2216 Representation RequiredInputRepresentation(int index) FINAL { | 2216 Representation RequiredInputRepresentation(int index) final { |
| 2217 DCHECK(index == 0); | 2217 DCHECK(index == 0); |
| 2218 return Representation::Tagged(); | 2218 return Representation::Tagged(); |
| 2219 } | 2219 } |
| 2220 | 2220 |
| 2221 bool pass_argument_count() const { return pass_argument_count_; } | 2221 bool pass_argument_count() const { return pass_argument_count_; } |
| 2222 | 2222 |
| 2223 bool HasStackCheck() FINAL { return has_stack_check_; } | 2223 bool HasStackCheck() final { return has_stack_check_; } |
| 2224 | 2224 |
| 2225 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction) | 2225 DECLARE_CONCRETE_INSTRUCTION(CallJSFunction) |
| 2226 | 2226 |
| 2227 private: | 2227 private: |
| 2228 // The argument count includes the receiver. | 2228 // The argument count includes the receiver. |
| 2229 HCallJSFunction(HValue* function, | 2229 HCallJSFunction(HValue* function, |
| 2230 int argument_count, | 2230 int argument_count, |
| 2231 bool pass_argument_count, | 2231 bool pass_argument_count, |
| 2232 bool has_stack_check) | 2232 bool has_stack_check) |
| 2233 : HCall<1>(argument_count), | 2233 : HCall<1>(argument_count), |
| 2234 pass_argument_count_(pass_argument_count), | 2234 pass_argument_count_(pass_argument_count), |
| 2235 has_stack_check_(has_stack_check) { | 2235 has_stack_check_(has_stack_check) { |
| 2236 SetOperandAt(0, function); | 2236 SetOperandAt(0, function); |
| 2237 } | 2237 } |
| 2238 | 2238 |
| 2239 bool pass_argument_count_; | 2239 bool pass_argument_count_; |
| 2240 bool has_stack_check_; | 2240 bool has_stack_check_; |
| 2241 }; | 2241 }; |
| 2242 | 2242 |
| 2243 | 2243 |
| 2244 enum CallMode { NORMAL_CALL, TAIL_CALL }; | 2244 enum CallMode { NORMAL_CALL, TAIL_CALL }; |
| 2245 | 2245 |
| 2246 | 2246 |
| 2247 class HCallWithDescriptor FINAL : public HInstruction { | 2247 class HCallWithDescriptor final : public HInstruction { |
| 2248 public: | 2248 public: |
| 2249 static HCallWithDescriptor* New(Isolate* isolate, Zone* zone, HValue* context, | 2249 static HCallWithDescriptor* New(Isolate* isolate, Zone* zone, HValue* context, |
| 2250 HValue* target, int argument_count, | 2250 HValue* target, int argument_count, |
| 2251 CallInterfaceDescriptor descriptor, | 2251 CallInterfaceDescriptor descriptor, |
| 2252 const Vector<HValue*>& operands, | 2252 const Vector<HValue*>& operands, |
| 2253 CallMode call_mode = NORMAL_CALL) { | 2253 CallMode call_mode = NORMAL_CALL) { |
| 2254 DCHECK(operands.length() == descriptor.GetEnvironmentLength()); | 2254 DCHECK(operands.length() == descriptor.GetEnvironmentLength()); |
| 2255 HCallWithDescriptor* res = new (zone) HCallWithDescriptor( | 2255 HCallWithDescriptor* res = new (zone) HCallWithDescriptor( |
| 2256 target, argument_count, descriptor, operands, call_mode, zone); | 2256 target, argument_count, descriptor, operands, call_mode, zone); |
| 2257 return res; | 2257 return res; |
| 2258 } | 2258 } |
| 2259 | 2259 |
| 2260 int OperandCount() const FINAL { return values_.length(); } | 2260 int OperandCount() const final { return values_.length(); } |
| 2261 HValue* OperandAt(int index) const FINAL { return values_[index]; } | 2261 HValue* OperandAt(int index) const final { return values_[index]; } |
| 2262 | 2262 |
| 2263 Representation RequiredInputRepresentation(int index) FINAL { | 2263 Representation RequiredInputRepresentation(int index) final { |
| 2264 if (index == 0) { | 2264 if (index == 0) { |
| 2265 return Representation::Tagged(); | 2265 return Representation::Tagged(); |
| 2266 } else { | 2266 } else { |
| 2267 int par_index = index - 1; | 2267 int par_index = index - 1; |
| 2268 DCHECK(par_index < descriptor_.GetEnvironmentLength()); | 2268 DCHECK(par_index < descriptor_.GetEnvironmentLength()); |
| 2269 return descriptor_.GetParameterRepresentation(par_index); | 2269 return descriptor_.GetParameterRepresentation(par_index); |
| 2270 } | 2270 } |
| 2271 } | 2271 } |
| 2272 | 2272 |
| 2273 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor) | 2273 DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor) |
| 2274 | 2274 |
| 2275 HType CalculateInferredType() FINAL { return HType::Tagged(); } | 2275 HType CalculateInferredType() final { return HType::Tagged(); } |
| 2276 | 2276 |
| 2277 bool IsTailCall() const { return call_mode_ == TAIL_CALL; } | 2277 bool IsTailCall() const { return call_mode_ == TAIL_CALL; } |
| 2278 | 2278 |
| 2279 virtual int argument_count() const { | 2279 virtual int argument_count() const { |
| 2280 return argument_count_; | 2280 return argument_count_; |
| 2281 } | 2281 } |
| 2282 | 2282 |
| 2283 int argument_delta() const OVERRIDE { return -argument_count_; } | 2283 int argument_delta() const override { return -argument_count_; } |
| 2284 | 2284 |
| 2285 CallInterfaceDescriptor descriptor() const { return descriptor_; } | 2285 CallInterfaceDescriptor descriptor() const { return descriptor_; } |
| 2286 | 2286 |
| 2287 HValue* target() { | 2287 HValue* target() { |
| 2288 return OperandAt(0); | 2288 return OperandAt(0); |
| 2289 } | 2289 } |
| 2290 | 2290 |
| 2291 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2291 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 2292 | 2292 |
| 2293 private: | 2293 private: |
| 2294 // The argument count includes the receiver. | 2294 // The argument count includes the receiver. |
| 2295 HCallWithDescriptor(HValue* target, int argument_count, | 2295 HCallWithDescriptor(HValue* target, int argument_count, |
| 2296 CallInterfaceDescriptor descriptor, | 2296 CallInterfaceDescriptor descriptor, |
| 2297 const Vector<HValue*>& operands, CallMode call_mode, | 2297 const Vector<HValue*>& operands, CallMode call_mode, |
| 2298 Zone* zone) | 2298 Zone* zone) |
| 2299 : descriptor_(descriptor), | 2299 : descriptor_(descriptor), |
| 2300 values_(descriptor.GetEnvironmentLength() + 1, zone), | 2300 values_(descriptor.GetEnvironmentLength() + 1, zone), |
| 2301 argument_count_(argument_count), | 2301 argument_count_(argument_count), |
| 2302 call_mode_(call_mode) { | 2302 call_mode_(call_mode) { |
| 2303 // We can only tail call without any stack arguments. | 2303 // We can only tail call without any stack arguments. |
| 2304 DCHECK(call_mode != TAIL_CALL || argument_count == 0); | 2304 DCHECK(call_mode != TAIL_CALL || argument_count == 0); |
| 2305 AddOperand(target, zone); | 2305 AddOperand(target, zone); |
| 2306 for (int i = 0; i < operands.length(); i++) { | 2306 for (int i = 0; i < operands.length(); i++) { |
| 2307 AddOperand(operands[i], zone); | 2307 AddOperand(operands[i], zone); |
| 2308 } | 2308 } |
| 2309 this->set_representation(Representation::Tagged()); | 2309 this->set_representation(Representation::Tagged()); |
| 2310 this->SetAllSideEffects(); | 2310 this->SetAllSideEffects(); |
| 2311 } | 2311 } |
| 2312 | 2312 |
| 2313 void AddOperand(HValue* v, Zone* zone) { | 2313 void AddOperand(HValue* v, Zone* zone) { |
| 2314 values_.Add(NULL, zone); | 2314 values_.Add(NULL, zone); |
| 2315 SetOperandAt(values_.length() - 1, v); | 2315 SetOperandAt(values_.length() - 1, v); |
| 2316 } | 2316 } |
| 2317 | 2317 |
| 2318 void InternalSetOperandAt(int index, HValue* value) FINAL { | 2318 void InternalSetOperandAt(int index, HValue* value) final { |
| 2319 values_[index] = value; | 2319 values_[index] = value; |
| 2320 } | 2320 } |
| 2321 | 2321 |
| 2322 CallInterfaceDescriptor descriptor_; | 2322 CallInterfaceDescriptor descriptor_; |
| 2323 ZoneList<HValue*> values_; | 2323 ZoneList<HValue*> values_; |
| 2324 int argument_count_; | 2324 int argument_count_; |
| 2325 CallMode call_mode_; | 2325 CallMode call_mode_; |
| 2326 }; | 2326 }; |
| 2327 | 2327 |
| 2328 | 2328 |
| 2329 class HInvokeFunction FINAL : public HBinaryCall { | 2329 class HInvokeFunction final : public HBinaryCall { |
| 2330 public: | 2330 public: |
| 2331 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); | 2331 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInvokeFunction, HValue*, int); |
| 2332 | 2332 |
| 2333 HInvokeFunction(HValue* context, | 2333 HInvokeFunction(HValue* context, |
| 2334 HValue* function, | 2334 HValue* function, |
| 2335 Handle<JSFunction> known_function, | 2335 Handle<JSFunction> known_function, |
| 2336 int argument_count) | 2336 int argument_count) |
| 2337 : HBinaryCall(context, function, argument_count), | 2337 : HBinaryCall(context, function, argument_count), |
| 2338 known_function_(known_function) { | 2338 known_function_(known_function) { |
| 2339 formal_parameter_count_ = | 2339 formal_parameter_count_ = |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2351 int argument_count) { | 2351 int argument_count) { |
| 2352 return new(zone) HInvokeFunction(context, function, | 2352 return new(zone) HInvokeFunction(context, function, |
| 2353 known_function, argument_count); | 2353 known_function, argument_count); |
| 2354 } | 2354 } |
| 2355 | 2355 |
| 2356 HValue* context() { return first(); } | 2356 HValue* context() { return first(); } |
| 2357 HValue* function() { return second(); } | 2357 HValue* function() { return second(); } |
| 2358 Handle<JSFunction> known_function() { return known_function_; } | 2358 Handle<JSFunction> known_function() { return known_function_; } |
| 2359 int formal_parameter_count() const { return formal_parameter_count_; } | 2359 int formal_parameter_count() const { return formal_parameter_count_; } |
| 2360 | 2360 |
| 2361 bool HasStackCheck() FINAL { return has_stack_check_; } | 2361 bool HasStackCheck() final { return has_stack_check_; } |
| 2362 | 2362 |
| 2363 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) | 2363 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) |
| 2364 | 2364 |
| 2365 private: | 2365 private: |
| 2366 HInvokeFunction(HValue* context, HValue* function, int argument_count) | 2366 HInvokeFunction(HValue* context, HValue* function, int argument_count) |
| 2367 : HBinaryCall(context, function, argument_count), | 2367 : HBinaryCall(context, function, argument_count), |
| 2368 has_stack_check_(false) { | 2368 has_stack_check_(false) { |
| 2369 } | 2369 } |
| 2370 | 2370 |
| 2371 Handle<JSFunction> known_function_; | 2371 Handle<JSFunction> known_function_; |
| 2372 int formal_parameter_count_; | 2372 int formal_parameter_count_; |
| 2373 bool has_stack_check_; | 2373 bool has_stack_check_; |
| 2374 }; | 2374 }; |
| 2375 | 2375 |
| 2376 | 2376 |
| 2377 class HCallFunction FINAL : public HBinaryCall { | 2377 class HCallFunction final : public HBinaryCall { |
| 2378 public: | 2378 public: |
| 2379 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int); | 2379 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallFunction, HValue*, int); |
| 2380 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3( | 2380 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3( |
| 2381 HCallFunction, HValue*, int, CallFunctionFlags); | 2381 HCallFunction, HValue*, int, CallFunctionFlags); |
| 2382 | 2382 |
| 2383 HValue* context() const { return first(); } | 2383 HValue* context() const { return first(); } |
| 2384 HValue* function() const { return second(); } | 2384 HValue* function() const { return second(); } |
| 2385 CallFunctionFlags function_flags() const { return function_flags_; } | 2385 CallFunctionFlags function_flags() const { return function_flags_; } |
| 2386 | 2386 |
| 2387 FeedbackVectorICSlot slot() const { return slot_; } | 2387 FeedbackVectorICSlot slot() const { return slot_; } |
| 2388 Handle<TypeFeedbackVector> feedback_vector() const { | 2388 Handle<TypeFeedbackVector> feedback_vector() const { |
| 2389 return feedback_vector_; | 2389 return feedback_vector_; |
| 2390 } | 2390 } |
| 2391 bool HasVectorAndSlot() const { return !feedback_vector_.is_null(); } | 2391 bool HasVectorAndSlot() const { return !feedback_vector_.is_null(); } |
| 2392 void SetVectorAndSlot(Handle<TypeFeedbackVector> vector, | 2392 void SetVectorAndSlot(Handle<TypeFeedbackVector> vector, |
| 2393 FeedbackVectorICSlot slot) { | 2393 FeedbackVectorICSlot slot) { |
| 2394 feedback_vector_ = vector; | 2394 feedback_vector_ = vector; |
| 2395 slot_ = slot; | 2395 slot_ = slot; |
| 2396 } | 2396 } |
| 2397 | 2397 |
| 2398 DECLARE_CONCRETE_INSTRUCTION(CallFunction) | 2398 DECLARE_CONCRETE_INSTRUCTION(CallFunction) |
| 2399 | 2399 |
| 2400 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2400 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 2401 | 2401 |
| 2402 int argument_delta() const OVERRIDE { return -argument_count(); } | 2402 int argument_delta() const override { return -argument_count(); } |
| 2403 | 2403 |
| 2404 private: | 2404 private: |
| 2405 HCallFunction(HValue* context, HValue* function, int argument_count, | 2405 HCallFunction(HValue* context, HValue* function, int argument_count, |
| 2406 CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS) | 2406 CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS) |
| 2407 : HBinaryCall(context, function, argument_count), | 2407 : HBinaryCall(context, function, argument_count), |
| 2408 function_flags_(flags), | 2408 function_flags_(flags), |
| 2409 slot_(FeedbackVectorICSlot::Invalid()) {} | 2409 slot_(FeedbackVectorICSlot::Invalid()) {} |
| 2410 CallFunctionFlags function_flags_; | 2410 CallFunctionFlags function_flags_; |
| 2411 Handle<TypeFeedbackVector> feedback_vector_; | 2411 Handle<TypeFeedbackVector> feedback_vector_; |
| 2412 FeedbackVectorICSlot slot_; | 2412 FeedbackVectorICSlot slot_; |
| 2413 }; | 2413 }; |
| 2414 | 2414 |
| 2415 | 2415 |
| 2416 class HCallNew FINAL : public HBinaryCall { | 2416 class HCallNew final : public HBinaryCall { |
| 2417 public: | 2417 public: |
| 2418 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int); | 2418 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallNew, HValue*, int); |
| 2419 | 2419 |
| 2420 HValue* context() { return first(); } | 2420 HValue* context() { return first(); } |
| 2421 HValue* constructor() { return second(); } | 2421 HValue* constructor() { return second(); } |
| 2422 | 2422 |
| 2423 DECLARE_CONCRETE_INSTRUCTION(CallNew) | 2423 DECLARE_CONCRETE_INSTRUCTION(CallNew) |
| 2424 | 2424 |
| 2425 private: | 2425 private: |
| 2426 HCallNew(HValue* context, HValue* constructor, int argument_count) | 2426 HCallNew(HValue* context, HValue* constructor, int argument_count) |
| 2427 : HBinaryCall(context, constructor, argument_count) {} | 2427 : HBinaryCall(context, constructor, argument_count) {} |
| 2428 }; | 2428 }; |
| 2429 | 2429 |
| 2430 | 2430 |
| 2431 class HCallNewArray FINAL : public HBinaryCall { | 2431 class HCallNewArray final : public HBinaryCall { |
| 2432 public: | 2432 public: |
| 2433 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HCallNewArray, HValue*, int, | 2433 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HCallNewArray, HValue*, int, |
| 2434 ElementsKind, | 2434 ElementsKind, |
| 2435 Handle<AllocationSite>); | 2435 Handle<AllocationSite>); |
| 2436 | 2436 |
| 2437 HValue* context() { return first(); } | 2437 HValue* context() { return first(); } |
| 2438 HValue* constructor() { return second(); } | 2438 HValue* constructor() { return second(); } |
| 2439 | 2439 |
| 2440 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2440 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 2441 | 2441 |
| 2442 ElementsKind elements_kind() const { return elements_kind_; } | 2442 ElementsKind elements_kind() const { return elements_kind_; } |
| 2443 Handle<AllocationSite> site() const { return site_; } | 2443 Handle<AllocationSite> site() const { return site_; } |
| 2444 | 2444 |
| 2445 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) | 2445 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) |
| 2446 | 2446 |
| 2447 private: | 2447 private: |
| 2448 HCallNewArray(HValue* context, HValue* constructor, int argument_count, | 2448 HCallNewArray(HValue* context, HValue* constructor, int argument_count, |
| 2449 ElementsKind elements_kind, Handle<AllocationSite> site) | 2449 ElementsKind elements_kind, Handle<AllocationSite> site) |
| 2450 : HBinaryCall(context, constructor, argument_count), | 2450 : HBinaryCall(context, constructor, argument_count), |
| 2451 elements_kind_(elements_kind), | 2451 elements_kind_(elements_kind), |
| 2452 site_(site) {} | 2452 site_(site) {} |
| 2453 | 2453 |
| 2454 ElementsKind elements_kind_; | 2454 ElementsKind elements_kind_; |
| 2455 Handle<AllocationSite> site_; | 2455 Handle<AllocationSite> site_; |
| 2456 }; | 2456 }; |
| 2457 | 2457 |
| 2458 | 2458 |
| 2459 class HCallRuntime FINAL : public HCall<1> { | 2459 class HCallRuntime final : public HCall<1> { |
| 2460 public: | 2460 public: |
| 2461 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallRuntime, | 2461 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallRuntime, |
| 2462 Handle<String>, | 2462 Handle<String>, |
| 2463 const Runtime::Function*, | 2463 const Runtime::Function*, |
| 2464 int); | 2464 int); |
| 2465 | 2465 |
| 2466 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2466 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 2467 | 2467 |
| 2468 HValue* context() { return OperandAt(0); } | 2468 HValue* context() { return OperandAt(0); } |
| 2469 const Runtime::Function* function() const { return c_function_; } | 2469 const Runtime::Function* function() const { return c_function_; } |
| 2470 Handle<String> name() const { return name_; } | 2470 Handle<String> name() const { return name_; } |
| 2471 SaveFPRegsMode save_doubles() const { return save_doubles_; } | 2471 SaveFPRegsMode save_doubles() const { return save_doubles_; } |
| 2472 void set_save_doubles(SaveFPRegsMode save_doubles) { | 2472 void set_save_doubles(SaveFPRegsMode save_doubles) { |
| 2473 save_doubles_ = save_doubles; | 2473 save_doubles_ = save_doubles; |
| 2474 } | 2474 } |
| 2475 | 2475 |
| 2476 Representation RequiredInputRepresentation(int index) OVERRIDE { | 2476 Representation RequiredInputRepresentation(int index) override { |
| 2477 return Representation::Tagged(); | 2477 return Representation::Tagged(); |
| 2478 } | 2478 } |
| 2479 | 2479 |
| 2480 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) | 2480 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) |
| 2481 | 2481 |
| 2482 private: | 2482 private: |
| 2483 HCallRuntime(HValue* context, | 2483 HCallRuntime(HValue* context, |
| 2484 Handle<String> name, | 2484 Handle<String> name, |
| 2485 const Runtime::Function* c_function, | 2485 const Runtime::Function* c_function, |
| 2486 int argument_count) | 2486 int argument_count) |
| 2487 : HCall<1>(argument_count), c_function_(c_function), name_(name), | 2487 : HCall<1>(argument_count), c_function_(c_function), name_(name), |
| 2488 save_doubles_(kDontSaveFPRegs) { | 2488 save_doubles_(kDontSaveFPRegs) { |
| 2489 SetOperandAt(0, context); | 2489 SetOperandAt(0, context); |
| 2490 } | 2490 } |
| 2491 | 2491 |
| 2492 const Runtime::Function* c_function_; | 2492 const Runtime::Function* c_function_; |
| 2493 Handle<String> name_; | 2493 Handle<String> name_; |
| 2494 SaveFPRegsMode save_doubles_; | 2494 SaveFPRegsMode save_doubles_; |
| 2495 }; | 2495 }; |
| 2496 | 2496 |
| 2497 | 2497 |
| 2498 class HMapEnumLength FINAL : public HUnaryOperation { | 2498 class HMapEnumLength final : public HUnaryOperation { |
| 2499 public: | 2499 public: |
| 2500 DECLARE_INSTRUCTION_FACTORY_P1(HMapEnumLength, HValue*); | 2500 DECLARE_INSTRUCTION_FACTORY_P1(HMapEnumLength, HValue*); |
| 2501 | 2501 |
| 2502 Representation RequiredInputRepresentation(int index) OVERRIDE { | 2502 Representation RequiredInputRepresentation(int index) override { |
| 2503 return Representation::Tagged(); | 2503 return Representation::Tagged(); |
| 2504 } | 2504 } |
| 2505 | 2505 |
| 2506 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength) | 2506 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength) |
| 2507 | 2507 |
| 2508 protected: | 2508 protected: |
| 2509 bool DataEquals(HValue* other) OVERRIDE { return true; } | 2509 bool DataEquals(HValue* other) override { return true; } |
| 2510 | 2510 |
| 2511 private: | 2511 private: |
| 2512 explicit HMapEnumLength(HValue* value) | 2512 explicit HMapEnumLength(HValue* value) |
| 2513 : HUnaryOperation(value, HType::Smi()) { | 2513 : HUnaryOperation(value, HType::Smi()) { |
| 2514 set_representation(Representation::Smi()); | 2514 set_representation(Representation::Smi()); |
| 2515 SetFlag(kUseGVN); | 2515 SetFlag(kUseGVN); |
| 2516 SetDependsOnFlag(kMaps); | 2516 SetDependsOnFlag(kMaps); |
| 2517 } | 2517 } |
| 2518 | 2518 |
| 2519 bool IsDeletable() const OVERRIDE { return true; } | 2519 bool IsDeletable() const override { return true; } |
| 2520 }; | 2520 }; |
| 2521 | 2521 |
| 2522 | 2522 |
| 2523 class HUnaryMathOperation FINAL : public HTemplateInstruction<2> { | 2523 class HUnaryMathOperation final : public HTemplateInstruction<2> { |
| 2524 public: | 2524 public: |
| 2525 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 2525 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 2526 HValue* value, BuiltinFunctionId op); | 2526 HValue* value, BuiltinFunctionId op); |
| 2527 | 2527 |
| 2528 HValue* context() const { return OperandAt(0); } | 2528 HValue* context() const { return OperandAt(0); } |
| 2529 HValue* value() const { return OperandAt(1); } | 2529 HValue* value() const { return OperandAt(1); } |
| 2530 | 2530 |
| 2531 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2531 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 2532 | 2532 |
| 2533 Representation RequiredInputRepresentation(int index) OVERRIDE { | 2533 Representation RequiredInputRepresentation(int index) override { |
| 2534 if (index == 0) { | 2534 if (index == 0) { |
| 2535 return Representation::Tagged(); | 2535 return Representation::Tagged(); |
| 2536 } else { | 2536 } else { |
| 2537 switch (op_) { | 2537 switch (op_) { |
| 2538 case kMathFloor: | 2538 case kMathFloor: |
| 2539 case kMathRound: | 2539 case kMathRound: |
| 2540 case kMathFround: | 2540 case kMathFround: |
| 2541 case kMathSqrt: | 2541 case kMathSqrt: |
| 2542 case kMathPowHalf: | 2542 case kMathPowHalf: |
| 2543 case kMathLog: | 2543 case kMathLog: |
| 2544 case kMathExp: | 2544 case kMathExp: |
| 2545 return Representation::Double(); | 2545 return Representation::Double(); |
| 2546 case kMathAbs: | 2546 case kMathAbs: |
| 2547 return representation(); | 2547 return representation(); |
| 2548 case kMathClz32: | 2548 case kMathClz32: |
| 2549 return Representation::Integer32(); | 2549 return Representation::Integer32(); |
| 2550 default: | 2550 default: |
| 2551 UNREACHABLE(); | 2551 UNREACHABLE(); |
| 2552 return Representation::None(); | 2552 return Representation::None(); |
| 2553 } | 2553 } |
| 2554 } | 2554 } |
| 2555 } | 2555 } |
| 2556 | 2556 |
| 2557 Range* InferRange(Zone* zone) OVERRIDE; | 2557 Range* InferRange(Zone* zone) override; |
| 2558 | 2558 |
| 2559 HValue* Canonicalize() OVERRIDE; | 2559 HValue* Canonicalize() override; |
| 2560 Representation RepresentationFromUses() OVERRIDE; | 2560 Representation RepresentationFromUses() override; |
| 2561 Representation RepresentationFromInputs() OVERRIDE; | 2561 Representation RepresentationFromInputs() override; |
| 2562 | 2562 |
| 2563 BuiltinFunctionId op() const { return op_; } | 2563 BuiltinFunctionId op() const { return op_; } |
| 2564 const char* OpName() const; | 2564 const char* OpName() const; |
| 2565 | 2565 |
| 2566 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) | 2566 DECLARE_CONCRETE_INSTRUCTION(UnaryMathOperation) |
| 2567 | 2567 |
| 2568 protected: | 2568 protected: |
| 2569 bool DataEquals(HValue* other) OVERRIDE { | 2569 bool DataEquals(HValue* other) override { |
| 2570 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); | 2570 HUnaryMathOperation* b = HUnaryMathOperation::cast(other); |
| 2571 return op_ == b->op(); | 2571 return op_ == b->op(); |
| 2572 } | 2572 } |
| 2573 | 2573 |
| 2574 private: | 2574 private: |
| 2575 // Indicates if we support a double (and int32) output for Math.floor and | 2575 // Indicates if we support a double (and int32) output for Math.floor and |
| 2576 // Math.round. | 2576 // Math.round. |
| 2577 bool SupportsFlexibleFloorAndRound() const { | 2577 bool SupportsFlexibleFloorAndRound() const { |
| 2578 #ifdef V8_TARGET_ARCH_ARM64 | 2578 #ifdef V8_TARGET_ARCH_ARM64 |
| 2579 // TODO(rmcilroy): Re-enable this for Arm64 once http://crbug.com/476477 is | 2579 // TODO(rmcilroy): Re-enable this for Arm64 once http://crbug.com/476477 is |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2613 case kMathPowHalf: | 2613 case kMathPowHalf: |
| 2614 set_representation(Representation::Double()); | 2614 set_representation(Representation::Double()); |
| 2615 break; | 2615 break; |
| 2616 default: | 2616 default: |
| 2617 UNREACHABLE(); | 2617 UNREACHABLE(); |
| 2618 } | 2618 } |
| 2619 SetFlag(kUseGVN); | 2619 SetFlag(kUseGVN); |
| 2620 SetFlag(kAllowUndefinedAsNaN); | 2620 SetFlag(kAllowUndefinedAsNaN); |
| 2621 } | 2621 } |
| 2622 | 2622 |
| 2623 bool IsDeletable() const OVERRIDE { return true; } | 2623 bool IsDeletable() const override { return true; } |
| 2624 | 2624 |
| 2625 HValue* SimplifiedDividendForMathFloorOfDiv(HDiv* hdiv); | 2625 HValue* SimplifiedDividendForMathFloorOfDiv(HDiv* hdiv); |
| 2626 HValue* SimplifiedDivisorForMathFloorOfDiv(HDiv* hdiv); | 2626 HValue* SimplifiedDivisorForMathFloorOfDiv(HDiv* hdiv); |
| 2627 | 2627 |
| 2628 BuiltinFunctionId op_; | 2628 BuiltinFunctionId op_; |
| 2629 }; | 2629 }; |
| 2630 | 2630 |
| 2631 | 2631 |
| 2632 class HLoadRoot FINAL : public HTemplateInstruction<0> { | 2632 class HLoadRoot final : public HTemplateInstruction<0> { |
| 2633 public: | 2633 public: |
| 2634 DECLARE_INSTRUCTION_FACTORY_P1(HLoadRoot, Heap::RootListIndex); | 2634 DECLARE_INSTRUCTION_FACTORY_P1(HLoadRoot, Heap::RootListIndex); |
| 2635 DECLARE_INSTRUCTION_FACTORY_P2(HLoadRoot, Heap::RootListIndex, HType); | 2635 DECLARE_INSTRUCTION_FACTORY_P2(HLoadRoot, Heap::RootListIndex, HType); |
| 2636 | 2636 |
| 2637 Representation RequiredInputRepresentation(int index) OVERRIDE { | 2637 Representation RequiredInputRepresentation(int index) override { |
| 2638 return Representation::None(); | 2638 return Representation::None(); |
| 2639 } | 2639 } |
| 2640 | 2640 |
| 2641 Heap::RootListIndex index() const { return index_; } | 2641 Heap::RootListIndex index() const { return index_; } |
| 2642 | 2642 |
| 2643 DECLARE_CONCRETE_INSTRUCTION(LoadRoot) | 2643 DECLARE_CONCRETE_INSTRUCTION(LoadRoot) |
| 2644 | 2644 |
| 2645 protected: | 2645 protected: |
| 2646 bool DataEquals(HValue* other) OVERRIDE { | 2646 bool DataEquals(HValue* other) override { |
| 2647 HLoadRoot* b = HLoadRoot::cast(other); | 2647 HLoadRoot* b = HLoadRoot::cast(other); |
| 2648 return index_ == b->index_; | 2648 return index_ == b->index_; |
| 2649 } | 2649 } |
| 2650 | 2650 |
| 2651 private: | 2651 private: |
| 2652 explicit HLoadRoot(Heap::RootListIndex index, HType type = HType::Tagged()) | 2652 explicit HLoadRoot(Heap::RootListIndex index, HType type = HType::Tagged()) |
| 2653 : HTemplateInstruction<0>(type), index_(index) { | 2653 : HTemplateInstruction<0>(type), index_(index) { |
| 2654 SetFlag(kUseGVN); | 2654 SetFlag(kUseGVN); |
| 2655 // TODO(bmeurer): We'll need kDependsOnRoots once we add the | 2655 // TODO(bmeurer): We'll need kDependsOnRoots once we add the |
| 2656 // corresponding HStoreRoot instruction. | 2656 // corresponding HStoreRoot instruction. |
| 2657 SetDependsOnFlag(kCalls); | 2657 SetDependsOnFlag(kCalls); |
| 2658 set_representation(Representation::Tagged()); | 2658 set_representation(Representation::Tagged()); |
| 2659 } | 2659 } |
| 2660 | 2660 |
| 2661 bool IsDeletable() const OVERRIDE { return true; } | 2661 bool IsDeletable() const override { return true; } |
| 2662 | 2662 |
| 2663 const Heap::RootListIndex index_; | 2663 const Heap::RootListIndex index_; |
| 2664 }; | 2664 }; |
| 2665 | 2665 |
| 2666 | 2666 |
| 2667 class HCheckMaps FINAL : public HTemplateInstruction<2> { | 2667 class HCheckMaps final : public HTemplateInstruction<2> { |
| 2668 public: | 2668 public: |
| 2669 static HCheckMaps* New(Isolate* isolate, Zone* zone, HValue* context, | 2669 static HCheckMaps* New(Isolate* isolate, Zone* zone, HValue* context, |
| 2670 HValue* value, Handle<Map> map, | 2670 HValue* value, Handle<Map> map, |
| 2671 HValue* typecheck = NULL) { | 2671 HValue* typecheck = NULL) { |
| 2672 return new(zone) HCheckMaps(value, new(zone) UniqueSet<Map>( | 2672 return new(zone) HCheckMaps(value, new(zone) UniqueSet<Map>( |
| 2673 Unique<Map>::CreateImmovable(map), zone), typecheck); | 2673 Unique<Map>::CreateImmovable(map), zone), typecheck); |
| 2674 } | 2674 } |
| 2675 static HCheckMaps* New(Isolate* isolate, Zone* zone, HValue* context, | 2675 static HCheckMaps* New(Isolate* isolate, Zone* zone, HValue* context, |
| 2676 HValue* value, SmallMapList* map_list, | 2676 HValue* value, SmallMapList* map_list, |
| 2677 HValue* typecheck = NULL) { | 2677 HValue* typecheck = NULL) { |
| 2678 UniqueSet<Map>* maps = new(zone) UniqueSet<Map>(map_list->length(), zone); | 2678 UniqueSet<Map>* maps = new(zone) UniqueSet<Map>(map_list->length(), zone); |
| 2679 for (int i = 0; i < map_list->length(); ++i) { | 2679 for (int i = 0; i < map_list->length(); ++i) { |
| 2680 maps->Add(Unique<Map>::CreateImmovable(map_list->at(i)), zone); | 2680 maps->Add(Unique<Map>::CreateImmovable(map_list->at(i)), zone); |
| 2681 } | 2681 } |
| 2682 return new(zone) HCheckMaps(value, maps, typecheck); | 2682 return new(zone) HCheckMaps(value, maps, typecheck); |
| 2683 } | 2683 } |
| 2684 | 2684 |
| 2685 bool IsStabilityCheck() const { | 2685 bool IsStabilityCheck() const { |
| 2686 return IsStabilityCheckField::decode(bit_field_); | 2686 return IsStabilityCheckField::decode(bit_field_); |
| 2687 } | 2687 } |
| 2688 void MarkAsStabilityCheck() { | 2688 void MarkAsStabilityCheck() { |
| 2689 bit_field_ = MapsAreStableField::encode(true) | | 2689 bit_field_ = MapsAreStableField::encode(true) | |
| 2690 HasMigrationTargetField::encode(false) | | 2690 HasMigrationTargetField::encode(false) | |
| 2691 IsStabilityCheckField::encode(true); | 2691 IsStabilityCheckField::encode(true); |
| 2692 ClearChangesFlag(kNewSpacePromotion); | 2692 ClearChangesFlag(kNewSpacePromotion); |
| 2693 ClearDependsOnFlag(kElementsKind); | 2693 ClearDependsOnFlag(kElementsKind); |
| 2694 ClearDependsOnFlag(kMaps); | 2694 ClearDependsOnFlag(kMaps); |
| 2695 } | 2695 } |
| 2696 | 2696 |
| 2697 bool HasEscapingOperandAt(int index) OVERRIDE { return false; } | 2697 bool HasEscapingOperandAt(int index) override { return false; } |
| 2698 Representation RequiredInputRepresentation(int index) OVERRIDE { | 2698 Representation RequiredInputRepresentation(int index) override { |
| 2699 return Representation::Tagged(); | 2699 return Representation::Tagged(); |
| 2700 } | 2700 } |
| 2701 | 2701 |
| 2702 HType CalculateInferredType() OVERRIDE { | 2702 HType CalculateInferredType() override { |
| 2703 if (value()->type().IsHeapObject()) return value()->type(); | 2703 if (value()->type().IsHeapObject()) return value()->type(); |
| 2704 return HType::HeapObject(); | 2704 return HType::HeapObject(); |
| 2705 } | 2705 } |
| 2706 | 2706 |
| 2707 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2707 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 2708 | 2708 |
| 2709 HValue* value() const { return OperandAt(0); } | 2709 HValue* value() const { return OperandAt(0); } |
| 2710 HValue* typecheck() const { return OperandAt(1); } | 2710 HValue* typecheck() const { return OperandAt(1); } |
| 2711 | 2711 |
| 2712 const UniqueSet<Map>* maps() const { return maps_; } | 2712 const UniqueSet<Map>* maps() const { return maps_; } |
| 2713 void set_maps(const UniqueSet<Map>* maps) { maps_ = maps; } | 2713 void set_maps(const UniqueSet<Map>* maps) { maps_ = maps; } |
| 2714 | 2714 |
| 2715 bool maps_are_stable() const { | 2715 bool maps_are_stable() const { |
| 2716 return MapsAreStableField::decode(bit_field_); | 2716 return MapsAreStableField::decode(bit_field_); |
| 2717 } | 2717 } |
| 2718 | 2718 |
| 2719 bool HasMigrationTarget() const { | 2719 bool HasMigrationTarget() const { |
| 2720 return HasMigrationTargetField::decode(bit_field_); | 2720 return HasMigrationTargetField::decode(bit_field_); |
| 2721 } | 2721 } |
| 2722 | 2722 |
| 2723 HValue* Canonicalize() OVERRIDE; | 2723 HValue* Canonicalize() override; |
| 2724 | 2724 |
| 2725 static HCheckMaps* CreateAndInsertAfter(Zone* zone, | 2725 static HCheckMaps* CreateAndInsertAfter(Zone* zone, |
| 2726 HValue* value, | 2726 HValue* value, |
| 2727 Unique<Map> map, | 2727 Unique<Map> map, |
| 2728 bool map_is_stable, | 2728 bool map_is_stable, |
| 2729 HInstruction* instr) { | 2729 HInstruction* instr) { |
| 2730 return instr->Append(new(zone) HCheckMaps( | 2730 return instr->Append(new(zone) HCheckMaps( |
| 2731 value, new(zone) UniqueSet<Map>(map, zone), map_is_stable)); | 2731 value, new(zone) UniqueSet<Map>(map, zone), map_is_stable)); |
| 2732 } | 2732 } |
| 2733 | 2733 |
| 2734 static HCheckMaps* CreateAndInsertBefore(Zone* zone, | 2734 static HCheckMaps* CreateAndInsertBefore(Zone* zone, |
| 2735 HValue* value, | 2735 HValue* value, |
| 2736 const UniqueSet<Map>* maps, | 2736 const UniqueSet<Map>* maps, |
| 2737 bool maps_are_stable, | 2737 bool maps_are_stable, |
| 2738 HInstruction* instr) { | 2738 HInstruction* instr) { |
| 2739 return instr->Prepend(new(zone) HCheckMaps(value, maps, maps_are_stable)); | 2739 return instr->Prepend(new(zone) HCheckMaps(value, maps, maps_are_stable)); |
| 2740 } | 2740 } |
| 2741 | 2741 |
| 2742 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) | 2742 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) |
| 2743 | 2743 |
| 2744 protected: | 2744 protected: |
| 2745 bool DataEquals(HValue* other) OVERRIDE { | 2745 bool DataEquals(HValue* other) override { |
| 2746 return this->maps()->Equals(HCheckMaps::cast(other)->maps()); | 2746 return this->maps()->Equals(HCheckMaps::cast(other)->maps()); |
| 2747 } | 2747 } |
| 2748 | 2748 |
| 2749 int RedefinedOperandIndex() OVERRIDE { return 0; } | 2749 int RedefinedOperandIndex() override { return 0; } |
| 2750 | 2750 |
| 2751 private: | 2751 private: |
| 2752 HCheckMaps(HValue* value, const UniqueSet<Map>* maps, bool maps_are_stable) | 2752 HCheckMaps(HValue* value, const UniqueSet<Map>* maps, bool maps_are_stable) |
| 2753 : HTemplateInstruction<2>(HType::HeapObject()), | 2753 : HTemplateInstruction<2>(HType::HeapObject()), |
| 2754 maps_(maps), | 2754 maps_(maps), |
| 2755 bit_field_(HasMigrationTargetField::encode(false) | | 2755 bit_field_(HasMigrationTargetField::encode(false) | |
| 2756 IsStabilityCheckField::encode(false) | | 2756 IsStabilityCheckField::encode(false) | |
| 2757 MapsAreStableField::encode(maps_are_stable)) { | 2757 MapsAreStableField::encode(maps_are_stable)) { |
| 2758 DCHECK_NE(0, maps->size()); | 2758 DCHECK_NE(0, maps->size()); |
| 2759 SetOperandAt(0, value); | 2759 SetOperandAt(0, value); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2793 | 2793 |
| 2794 class HasMigrationTargetField : public BitField<bool, 0, 1> {}; | 2794 class HasMigrationTargetField : public BitField<bool, 0, 1> {}; |
| 2795 class IsStabilityCheckField : public BitField<bool, 1, 1> {}; | 2795 class IsStabilityCheckField : public BitField<bool, 1, 1> {}; |
| 2796 class MapsAreStableField : public BitField<bool, 2, 1> {}; | 2796 class MapsAreStableField : public BitField<bool, 2, 1> {}; |
| 2797 | 2797 |
| 2798 const UniqueSet<Map>* maps_; | 2798 const UniqueSet<Map>* maps_; |
| 2799 uint32_t bit_field_; | 2799 uint32_t bit_field_; |
| 2800 }; | 2800 }; |
| 2801 | 2801 |
| 2802 | 2802 |
| 2803 class HCheckValue FINAL : public HUnaryOperation { | 2803 class HCheckValue final : public HUnaryOperation { |
| 2804 public: | 2804 public: |
| 2805 static HCheckValue* New(Isolate* isolate, Zone* zone, HValue* context, | 2805 static HCheckValue* New(Isolate* isolate, Zone* zone, HValue* context, |
| 2806 HValue* value, Handle<JSFunction> func) { | 2806 HValue* value, Handle<JSFunction> func) { |
| 2807 bool in_new_space = isolate->heap()->InNewSpace(*func); | 2807 bool in_new_space = isolate->heap()->InNewSpace(*func); |
| 2808 // NOTE: We create an uninitialized Unique and initialize it later. | 2808 // NOTE: We create an uninitialized Unique and initialize it later. |
| 2809 // This is because a JSFunction can move due to GC during graph creation. | 2809 // This is because a JSFunction can move due to GC during graph creation. |
| 2810 // TODO(titzer): This is a migration crutch. Replace with some kind of | 2810 // TODO(titzer): This is a migration crutch. Replace with some kind of |
| 2811 // Uniqueness scope later. | 2811 // Uniqueness scope later. |
| 2812 Unique<JSFunction> target = Unique<JSFunction>::CreateUninitialized(func); | 2812 Unique<JSFunction> target = Unique<JSFunction>::CreateUninitialized(func); |
| 2813 HCheckValue* check = new(zone) HCheckValue(value, target, in_new_space); | 2813 HCheckValue* check = new(zone) HCheckValue(value, target, in_new_space); |
| 2814 return check; | 2814 return check; |
| 2815 } | 2815 } |
| 2816 static HCheckValue* New(Isolate* isolate, Zone* zone, HValue* context, | 2816 static HCheckValue* New(Isolate* isolate, Zone* zone, HValue* context, |
| 2817 HValue* value, Unique<HeapObject> target, | 2817 HValue* value, Unique<HeapObject> target, |
| 2818 bool object_in_new_space) { | 2818 bool object_in_new_space) { |
| 2819 return new(zone) HCheckValue(value, target, object_in_new_space); | 2819 return new(zone) HCheckValue(value, target, object_in_new_space); |
| 2820 } | 2820 } |
| 2821 | 2821 |
| 2822 void FinalizeUniqueness() OVERRIDE { | 2822 void FinalizeUniqueness() override { |
| 2823 object_ = Unique<HeapObject>(object_.handle()); | 2823 object_ = Unique<HeapObject>(object_.handle()); |
| 2824 } | 2824 } |
| 2825 | 2825 |
| 2826 Representation RequiredInputRepresentation(int index) OVERRIDE { | 2826 Representation RequiredInputRepresentation(int index) override { |
| 2827 return Representation::Tagged(); | 2827 return Representation::Tagged(); |
| 2828 } | 2828 } |
| 2829 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2829 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 2830 | 2830 |
| 2831 HValue* Canonicalize() OVERRIDE; | 2831 HValue* Canonicalize() override; |
| 2832 | 2832 |
| 2833 #ifdef DEBUG | 2833 #ifdef DEBUG |
| 2834 void Verify() OVERRIDE; | 2834 void Verify() override; |
| 2835 #endif | 2835 #endif |
| 2836 | 2836 |
| 2837 Unique<HeapObject> object() const { return object_; } | 2837 Unique<HeapObject> object() const { return object_; } |
| 2838 bool object_in_new_space() const { return object_in_new_space_; } | 2838 bool object_in_new_space() const { return object_in_new_space_; } |
| 2839 | 2839 |
| 2840 DECLARE_CONCRETE_INSTRUCTION(CheckValue) | 2840 DECLARE_CONCRETE_INSTRUCTION(CheckValue) |
| 2841 | 2841 |
| 2842 protected: | 2842 protected: |
| 2843 bool DataEquals(HValue* other) OVERRIDE { | 2843 bool DataEquals(HValue* other) override { |
| 2844 HCheckValue* b = HCheckValue::cast(other); | 2844 HCheckValue* b = HCheckValue::cast(other); |
| 2845 return object_ == b->object_; | 2845 return object_ == b->object_; |
| 2846 } | 2846 } |
| 2847 | 2847 |
| 2848 private: | 2848 private: |
| 2849 HCheckValue(HValue* value, Unique<HeapObject> object, | 2849 HCheckValue(HValue* value, Unique<HeapObject> object, |
| 2850 bool object_in_new_space) | 2850 bool object_in_new_space) |
| 2851 : HUnaryOperation(value, value->type()), | 2851 : HUnaryOperation(value, value->type()), |
| 2852 object_(object), | 2852 object_(object), |
| 2853 object_in_new_space_(object_in_new_space) { | 2853 object_in_new_space_(object_in_new_space) { |
| 2854 set_representation(Representation::Tagged()); | 2854 set_representation(Representation::Tagged()); |
| 2855 SetFlag(kUseGVN); | 2855 SetFlag(kUseGVN); |
| 2856 } | 2856 } |
| 2857 | 2857 |
| 2858 Unique<HeapObject> object_; | 2858 Unique<HeapObject> object_; |
| 2859 bool object_in_new_space_; | 2859 bool object_in_new_space_; |
| 2860 }; | 2860 }; |
| 2861 | 2861 |
| 2862 | 2862 |
| 2863 class HCheckInstanceType FINAL : public HUnaryOperation { | 2863 class HCheckInstanceType final : public HUnaryOperation { |
| 2864 public: | 2864 public: |
| 2865 enum Check { | 2865 enum Check { |
| 2866 IS_SPEC_OBJECT, | 2866 IS_SPEC_OBJECT, |
| 2867 IS_JS_ARRAY, | 2867 IS_JS_ARRAY, |
| 2868 IS_STRING, | 2868 IS_STRING, |
| 2869 IS_INTERNALIZED_STRING, | 2869 IS_INTERNALIZED_STRING, |
| 2870 LAST_INTERVAL_CHECK = IS_JS_ARRAY | 2870 LAST_INTERVAL_CHECK = IS_JS_ARRAY |
| 2871 }; | 2871 }; |
| 2872 | 2872 |
| 2873 DECLARE_INSTRUCTION_FACTORY_P2(HCheckInstanceType, HValue*, Check); | 2873 DECLARE_INSTRUCTION_FACTORY_P2(HCheckInstanceType, HValue*, Check); |
| 2874 | 2874 |
| 2875 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 2875 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 2876 | 2876 |
| 2877 Representation RequiredInputRepresentation(int index) OVERRIDE { | 2877 Representation RequiredInputRepresentation(int index) override { |
| 2878 return Representation::Tagged(); | 2878 return Representation::Tagged(); |
| 2879 } | 2879 } |
| 2880 | 2880 |
| 2881 HType CalculateInferredType() OVERRIDE { | 2881 HType CalculateInferredType() override { |
| 2882 switch (check_) { | 2882 switch (check_) { |
| 2883 case IS_SPEC_OBJECT: return HType::JSObject(); | 2883 case IS_SPEC_OBJECT: return HType::JSObject(); |
| 2884 case IS_JS_ARRAY: return HType::JSArray(); | 2884 case IS_JS_ARRAY: return HType::JSArray(); |
| 2885 case IS_STRING: return HType::String(); | 2885 case IS_STRING: return HType::String(); |
| 2886 case IS_INTERNALIZED_STRING: return HType::String(); | 2886 case IS_INTERNALIZED_STRING: return HType::String(); |
| 2887 } | 2887 } |
| 2888 UNREACHABLE(); | 2888 UNREACHABLE(); |
| 2889 return HType::Tagged(); | 2889 return HType::Tagged(); |
| 2890 } | 2890 } |
| 2891 | 2891 |
| 2892 HValue* Canonicalize() OVERRIDE; | 2892 HValue* Canonicalize() override; |
| 2893 | 2893 |
| 2894 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } | 2894 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } |
| 2895 void GetCheckInterval(InstanceType* first, InstanceType* last); | 2895 void GetCheckInterval(InstanceType* first, InstanceType* last); |
| 2896 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); | 2896 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); |
| 2897 | 2897 |
| 2898 Check check() const { return check_; } | 2898 Check check() const { return check_; } |
| 2899 | 2899 |
| 2900 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) | 2900 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) |
| 2901 | 2901 |
| 2902 protected: | 2902 protected: |
| 2903 // TODO(ager): It could be nice to allow the ommision of instance | 2903 // TODO(ager): It could be nice to allow the ommision of instance |
| 2904 // type checks if we have already performed an instance type check | 2904 // type checks if we have already performed an instance type check |
| 2905 // with a larger range. | 2905 // with a larger range. |
| 2906 bool DataEquals(HValue* other) OVERRIDE { | 2906 bool DataEquals(HValue* other) override { |
| 2907 HCheckInstanceType* b = HCheckInstanceType::cast(other); | 2907 HCheckInstanceType* b = HCheckInstanceType::cast(other); |
| 2908 return check_ == b->check_; | 2908 return check_ == b->check_; |
| 2909 } | 2909 } |
| 2910 | 2910 |
| 2911 int RedefinedOperandIndex() OVERRIDE { return 0; } | 2911 int RedefinedOperandIndex() override { return 0; } |
| 2912 | 2912 |
| 2913 private: | 2913 private: |
| 2914 const char* GetCheckName() const; | 2914 const char* GetCheckName() const; |
| 2915 | 2915 |
| 2916 HCheckInstanceType(HValue* value, Check check) | 2916 HCheckInstanceType(HValue* value, Check check) |
| 2917 : HUnaryOperation(value, HType::HeapObject()), check_(check) { | 2917 : HUnaryOperation(value, HType::HeapObject()), check_(check) { |
| 2918 set_representation(Representation::Tagged()); | 2918 set_representation(Representation::Tagged()); |
| 2919 SetFlag(kUseGVN); | 2919 SetFlag(kUseGVN); |
| 2920 } | 2920 } |
| 2921 | 2921 |
| 2922 const Check check_; | 2922 const Check check_; |
| 2923 }; | 2923 }; |
| 2924 | 2924 |
| 2925 | 2925 |
| 2926 class HCheckSmi FINAL : public HUnaryOperation { | 2926 class HCheckSmi final : public HUnaryOperation { |
| 2927 public: | 2927 public: |
| 2928 DECLARE_INSTRUCTION_FACTORY_P1(HCheckSmi, HValue*); | 2928 DECLARE_INSTRUCTION_FACTORY_P1(HCheckSmi, HValue*); |
| 2929 | 2929 |
| 2930 Representation RequiredInputRepresentation(int index) OVERRIDE { | 2930 Representation RequiredInputRepresentation(int index) override { |
| 2931 return Representation::Tagged(); | 2931 return Representation::Tagged(); |
| 2932 } | 2932 } |
| 2933 | 2933 |
| 2934 HValue* Canonicalize() OVERRIDE { | 2934 HValue* Canonicalize() override { |
| 2935 HType value_type = value()->type(); | 2935 HType value_type = value()->type(); |
| 2936 if (value_type.IsSmi()) { | 2936 if (value_type.IsSmi()) { |
| 2937 return NULL; | 2937 return NULL; |
| 2938 } | 2938 } |
| 2939 return this; | 2939 return this; |
| 2940 } | 2940 } |
| 2941 | 2941 |
| 2942 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) | 2942 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) |
| 2943 | 2943 |
| 2944 protected: | 2944 protected: |
| 2945 bool DataEquals(HValue* other) OVERRIDE { return true; } | 2945 bool DataEquals(HValue* other) override { return true; } |
| 2946 | 2946 |
| 2947 private: | 2947 private: |
| 2948 explicit HCheckSmi(HValue* value) : HUnaryOperation(value, HType::Smi()) { | 2948 explicit HCheckSmi(HValue* value) : HUnaryOperation(value, HType::Smi()) { |
| 2949 set_representation(Representation::Smi()); | 2949 set_representation(Representation::Smi()); |
| 2950 SetFlag(kUseGVN); | 2950 SetFlag(kUseGVN); |
| 2951 } | 2951 } |
| 2952 }; | 2952 }; |
| 2953 | 2953 |
| 2954 | 2954 |
| 2955 class HCheckHeapObject FINAL : public HUnaryOperation { | 2955 class HCheckHeapObject final : public HUnaryOperation { |
| 2956 public: | 2956 public: |
| 2957 DECLARE_INSTRUCTION_FACTORY_P1(HCheckHeapObject, HValue*); | 2957 DECLARE_INSTRUCTION_FACTORY_P1(HCheckHeapObject, HValue*); |
| 2958 | 2958 |
| 2959 bool HasEscapingOperandAt(int index) OVERRIDE { return false; } | 2959 bool HasEscapingOperandAt(int index) override { return false; } |
| 2960 Representation RequiredInputRepresentation(int index) OVERRIDE { | 2960 Representation RequiredInputRepresentation(int index) override { |
| 2961 return Representation::Tagged(); | 2961 return Representation::Tagged(); |
| 2962 } | 2962 } |
| 2963 | 2963 |
| 2964 HType CalculateInferredType() OVERRIDE { | 2964 HType CalculateInferredType() override { |
| 2965 if (value()->type().IsHeapObject()) return value()->type(); | 2965 if (value()->type().IsHeapObject()) return value()->type(); |
| 2966 return HType::HeapObject(); | 2966 return HType::HeapObject(); |
| 2967 } | 2967 } |
| 2968 | 2968 |
| 2969 #ifdef DEBUG | 2969 #ifdef DEBUG |
| 2970 void Verify() OVERRIDE; | 2970 void Verify() override; |
| 2971 #endif | 2971 #endif |
| 2972 | 2972 |
| 2973 HValue* Canonicalize() OVERRIDE { | 2973 HValue* Canonicalize() override { |
| 2974 return value()->type().IsHeapObject() ? NULL : this; | 2974 return value()->type().IsHeapObject() ? NULL : this; |
| 2975 } | 2975 } |
| 2976 | 2976 |
| 2977 DECLARE_CONCRETE_INSTRUCTION(CheckHeapObject) | 2977 DECLARE_CONCRETE_INSTRUCTION(CheckHeapObject) |
| 2978 | 2978 |
| 2979 protected: | 2979 protected: |
| 2980 bool DataEquals(HValue* other) OVERRIDE { return true; } | 2980 bool DataEquals(HValue* other) override { return true; } |
| 2981 | 2981 |
| 2982 private: | 2982 private: |
| 2983 explicit HCheckHeapObject(HValue* value) : HUnaryOperation(value) { | 2983 explicit HCheckHeapObject(HValue* value) : HUnaryOperation(value) { |
| 2984 set_representation(Representation::Tagged()); | 2984 set_representation(Representation::Tagged()); |
| 2985 SetFlag(kUseGVN); | 2985 SetFlag(kUseGVN); |
| 2986 } | 2986 } |
| 2987 }; | 2987 }; |
| 2988 | 2988 |
| 2989 | 2989 |
| 2990 class InductionVariableData; | 2990 class InductionVariableData; |
| 2991 | 2991 |
| 2992 | 2992 |
| 2993 struct InductionVariableLimitUpdate { | 2993 struct InductionVariableLimitUpdate { |
| 2994 InductionVariableData* updated_variable; | 2994 InductionVariableData* updated_variable; |
| 2995 HValue* limit; | 2995 HValue* limit; |
| 2996 bool limit_is_upper; | 2996 bool limit_is_upper; |
| 2997 bool limit_is_included; | 2997 bool limit_is_included; |
| 2998 | 2998 |
| 2999 InductionVariableLimitUpdate() | 2999 InductionVariableLimitUpdate() |
| 3000 : updated_variable(NULL), limit(NULL), | 3000 : updated_variable(NULL), limit(NULL), |
| 3001 limit_is_upper(false), limit_is_included(false) {} | 3001 limit_is_upper(false), limit_is_included(false) {} |
| 3002 }; | 3002 }; |
| 3003 | 3003 |
| 3004 | 3004 |
| 3005 class HBoundsCheck; | 3005 class HBoundsCheck; |
| 3006 class HPhi; | 3006 class HPhi; |
| 3007 class HBitwise; | 3007 class HBitwise; |
| 3008 | 3008 |
| 3009 | 3009 |
| 3010 class InductionVariableData FINAL : public ZoneObject { | 3010 class InductionVariableData final : public ZoneObject { |
| 3011 public: | 3011 public: |
| 3012 class InductionVariableCheck : public ZoneObject { | 3012 class InductionVariableCheck : public ZoneObject { |
| 3013 public: | 3013 public: |
| 3014 HBoundsCheck* check() { return check_; } | 3014 HBoundsCheck* check() { return check_; } |
| 3015 InductionVariableCheck* next() { return next_; } | 3015 InductionVariableCheck* next() { return next_; } |
| 3016 bool HasUpperLimit() { return upper_limit_ >= 0; } | 3016 bool HasUpperLimit() { return upper_limit_ >= 0; } |
| 3017 int32_t upper_limit() { | 3017 int32_t upper_limit() { |
| 3018 DCHECK(HasUpperLimit()); | 3018 DCHECK(HasUpperLimit()); |
| 3019 return upper_limit_; | 3019 return upper_limit_; |
| 3020 } | 3020 } |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3200 HBasicBlock* induction_exit_block_; | 3200 HBasicBlock* induction_exit_block_; |
| 3201 HBasicBlock* induction_exit_target_; | 3201 HBasicBlock* induction_exit_target_; |
| 3202 ChecksRelatedToLength* checks_; | 3202 ChecksRelatedToLength* checks_; |
| 3203 HValue* additional_upper_limit_; | 3203 HValue* additional_upper_limit_; |
| 3204 bool additional_upper_limit_is_included_; | 3204 bool additional_upper_limit_is_included_; |
| 3205 HValue* additional_lower_limit_; | 3205 HValue* additional_lower_limit_; |
| 3206 bool additional_lower_limit_is_included_; | 3206 bool additional_lower_limit_is_included_; |
| 3207 }; | 3207 }; |
| 3208 | 3208 |
| 3209 | 3209 |
| 3210 class HPhi FINAL : public HValue { | 3210 class HPhi final : public HValue { |
| 3211 public: | 3211 public: |
| 3212 HPhi(int merged_index, Zone* zone) | 3212 HPhi(int merged_index, Zone* zone) |
| 3213 : inputs_(2, zone), | 3213 : inputs_(2, zone), |
| 3214 merged_index_(merged_index), | 3214 merged_index_(merged_index), |
| 3215 phi_id_(-1), | 3215 phi_id_(-1), |
| 3216 induction_variable_data_(NULL) { | 3216 induction_variable_data_(NULL) { |
| 3217 for (int i = 0; i < Representation::kNumRepresentations; i++) { | 3217 for (int i = 0; i < Representation::kNumRepresentations; i++) { |
| 3218 non_phi_uses_[i] = 0; | 3218 non_phi_uses_[i] = 0; |
| 3219 indirect_uses_[i] = 0; | 3219 indirect_uses_[i] = 0; |
| 3220 } | 3220 } |
| 3221 DCHECK(merged_index >= 0 || merged_index == kInvalidMergedIndex); | 3221 DCHECK(merged_index >= 0 || merged_index == kInvalidMergedIndex); |
| 3222 SetFlag(kFlexibleRepresentation); | 3222 SetFlag(kFlexibleRepresentation); |
| 3223 SetFlag(kAllowUndefinedAsNaN); | 3223 SetFlag(kAllowUndefinedAsNaN); |
| 3224 } | 3224 } |
| 3225 | 3225 |
| 3226 Representation RepresentationFromInputs() OVERRIDE; | 3226 Representation RepresentationFromInputs() override; |
| 3227 | 3227 |
| 3228 Range* InferRange(Zone* zone) OVERRIDE; | 3228 Range* InferRange(Zone* zone) override; |
| 3229 virtual void InferRepresentation( | 3229 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
| 3230 HInferRepresentationPhase* h_infer) OVERRIDE; | 3230 Representation RequiredInputRepresentation(int index) override { |
| 3231 Representation RequiredInputRepresentation(int index) OVERRIDE { | |
| 3232 return representation(); | 3231 return representation(); |
| 3233 } | 3232 } |
| 3234 Representation KnownOptimalRepresentation() OVERRIDE { | 3233 Representation KnownOptimalRepresentation() override { |
| 3235 return representation(); | 3234 return representation(); |
| 3236 } | 3235 } |
| 3237 HType CalculateInferredType() OVERRIDE; | 3236 HType CalculateInferredType() override; |
| 3238 int OperandCount() const OVERRIDE { return inputs_.length(); } | 3237 int OperandCount() const override { return inputs_.length(); } |
| 3239 HValue* OperandAt(int index) const OVERRIDE { return inputs_[index]; } | 3238 HValue* OperandAt(int index) const override { return inputs_[index]; } |
| 3240 HValue* GetRedundantReplacement(); | 3239 HValue* GetRedundantReplacement(); |
| 3241 void AddInput(HValue* value); | 3240 void AddInput(HValue* value); |
| 3242 bool HasRealUses(); | 3241 bool HasRealUses(); |
| 3243 | 3242 |
| 3244 bool IsReceiver() const { return merged_index_ == 0; } | 3243 bool IsReceiver() const { return merged_index_ == 0; } |
| 3245 bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; } | 3244 bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; } |
| 3246 | 3245 |
| 3247 SourcePosition position() const OVERRIDE; | 3246 SourcePosition position() const override; |
| 3248 | 3247 |
| 3249 int merged_index() const { return merged_index_; } | 3248 int merged_index() const { return merged_index_; } |
| 3250 | 3249 |
| 3251 InductionVariableData* induction_variable_data() { | 3250 InductionVariableData* induction_variable_data() { |
| 3252 return induction_variable_data_; | 3251 return induction_variable_data_; |
| 3253 } | 3252 } |
| 3254 bool IsInductionVariable() { | 3253 bool IsInductionVariable() { |
| 3255 return induction_variable_data_ != NULL; | 3254 return induction_variable_data_ != NULL; |
| 3256 } | 3255 } |
| 3257 bool IsLimitedInductionVariable() { | 3256 bool IsLimitedInductionVariable() { |
| 3258 return IsInductionVariable() && | 3257 return IsInductionVariable() && |
| 3259 induction_variable_data_->limit() != NULL; | 3258 induction_variable_data_->limit() != NULL; |
| 3260 } | 3259 } |
| 3261 void DetectInductionVariable() { | 3260 void DetectInductionVariable() { |
| 3262 DCHECK(induction_variable_data_ == NULL); | 3261 DCHECK(induction_variable_data_ == NULL); |
| 3263 induction_variable_data_ = InductionVariableData::ExaminePhi(this); | 3262 induction_variable_data_ = InductionVariableData::ExaminePhi(this); |
| 3264 } | 3263 } |
| 3265 | 3264 |
| 3266 std::ostream& PrintTo(std::ostream& os) const OVERRIDE; // NOLINT | 3265 std::ostream& PrintTo(std::ostream& os) const override; // NOLINT |
| 3267 | 3266 |
| 3268 #ifdef DEBUG | 3267 #ifdef DEBUG |
| 3269 void Verify() OVERRIDE; | 3268 void Verify() override; |
| 3270 #endif | 3269 #endif |
| 3271 | 3270 |
| 3272 void InitRealUses(int id); | 3271 void InitRealUses(int id); |
| 3273 void AddNonPhiUsesFrom(HPhi* other); | 3272 void AddNonPhiUsesFrom(HPhi* other); |
| 3274 void AddIndirectUsesTo(int* use_count); | 3273 void AddIndirectUsesTo(int* use_count); |
| 3275 | 3274 |
| 3276 int tagged_non_phi_uses() const { | 3275 int tagged_non_phi_uses() const { |
| 3277 return non_phi_uses_[Representation::kTagged]; | 3276 return non_phi_uses_[Representation::kTagged]; |
| 3278 } | 3277 } |
| 3279 int smi_non_phi_uses() const { | 3278 int smi_non_phi_uses() const { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3296 } | 3295 } |
| 3297 int double_indirect_uses() const { | 3296 int double_indirect_uses() const { |
| 3298 return indirect_uses_[Representation::kDouble]; | 3297 return indirect_uses_[Representation::kDouble]; |
| 3299 } | 3298 } |
| 3300 int phi_id() { return phi_id_; } | 3299 int phi_id() { return phi_id_; } |
| 3301 | 3300 |
| 3302 static HPhi* cast(HValue* value) { | 3301 static HPhi* cast(HValue* value) { |
| 3303 DCHECK(value->IsPhi()); | 3302 DCHECK(value->IsPhi()); |
| 3304 return reinterpret_cast<HPhi*>(value); | 3303 return reinterpret_cast<HPhi*>(value); |
| 3305 } | 3304 } |
| 3306 Opcode opcode() const OVERRIDE { return HValue::kPhi; } | 3305 Opcode opcode() const override { return HValue::kPhi; } |
| 3307 | 3306 |
| 3308 void SimplifyConstantInputs(); | 3307 void SimplifyConstantInputs(); |
| 3309 | 3308 |
| 3310 // Marker value representing an invalid merge index. | 3309 // Marker value representing an invalid merge index. |
| 3311 static const int kInvalidMergedIndex = -1; | 3310 static const int kInvalidMergedIndex = -1; |
| 3312 | 3311 |
| 3313 protected: | 3312 protected: |
| 3314 void DeleteFromGraph() OVERRIDE; | 3313 void DeleteFromGraph() override; |
| 3315 void InternalSetOperandAt(int index, HValue* value) OVERRIDE { | 3314 void InternalSetOperandAt(int index, HValue* value) override { |
| 3316 inputs_[index] = value; | 3315 inputs_[index] = value; |
| 3317 } | 3316 } |
| 3318 | 3317 |
| 3319 private: | 3318 private: |
| 3320 ZoneList<HValue*> inputs_; | 3319 ZoneList<HValue*> inputs_; |
| 3321 int merged_index_; | 3320 int merged_index_; |
| 3322 | 3321 |
| 3323 int non_phi_uses_[Representation::kNumRepresentations]; | 3322 int non_phi_uses_[Representation::kNumRepresentations]; |
| 3324 int indirect_uses_[Representation::kNumRepresentations]; | 3323 int indirect_uses_[Representation::kNumRepresentations]; |
| 3325 int phi_id_; | 3324 int phi_id_; |
| 3326 InductionVariableData* induction_variable_data_; | 3325 InductionVariableData* induction_variable_data_; |
| 3327 | 3326 |
| 3328 // TODO(titzer): we can't eliminate the receiver for generating backtraces | 3327 // TODO(titzer): we can't eliminate the receiver for generating backtraces |
| 3329 bool IsDeletable() const OVERRIDE { return !IsReceiver(); } | 3328 bool IsDeletable() const override { return !IsReceiver(); } |
| 3330 }; | 3329 }; |
| 3331 | 3330 |
| 3332 | 3331 |
| 3333 // Common base class for HArgumentsObject and HCapturedObject. | 3332 // Common base class for HArgumentsObject and HCapturedObject. |
| 3334 class HDematerializedObject : public HInstruction { | 3333 class HDematerializedObject : public HInstruction { |
| 3335 public: | 3334 public: |
| 3336 HDematerializedObject(int count, Zone* zone) : values_(count, zone) {} | 3335 HDematerializedObject(int count, Zone* zone) : values_(count, zone) {} |
| 3337 | 3336 |
| 3338 int OperandCount() const FINAL { return values_.length(); } | 3337 int OperandCount() const final { return values_.length(); } |
| 3339 HValue* OperandAt(int index) const FINAL { return values_[index]; } | 3338 HValue* OperandAt(int index) const final { return values_[index]; } |
| 3340 | 3339 |
| 3341 bool HasEscapingOperandAt(int index) FINAL { return false; } | 3340 bool HasEscapingOperandAt(int index) final { return false; } |
| 3342 Representation RequiredInputRepresentation(int index) FINAL { | 3341 Representation RequiredInputRepresentation(int index) final { |
| 3343 return Representation::None(); | 3342 return Representation::None(); |
| 3344 } | 3343 } |
| 3345 | 3344 |
| 3346 protected: | 3345 protected: |
| 3347 void InternalSetOperandAt(int index, HValue* value) FINAL { | 3346 void InternalSetOperandAt(int index, HValue* value) final { |
| 3348 values_[index] = value; | 3347 values_[index] = value; |
| 3349 } | 3348 } |
| 3350 | 3349 |
| 3351 // List of values tracked by this marker. | 3350 // List of values tracked by this marker. |
| 3352 ZoneList<HValue*> values_; | 3351 ZoneList<HValue*> values_; |
| 3353 }; | 3352 }; |
| 3354 | 3353 |
| 3355 | 3354 |
| 3356 class HArgumentsObject FINAL : public HDematerializedObject { | 3355 class HArgumentsObject final : public HDematerializedObject { |
| 3357 public: | 3356 public: |
| 3358 static HArgumentsObject* New(Isolate* isolate, Zone* zone, HValue* context, | 3357 static HArgumentsObject* New(Isolate* isolate, Zone* zone, HValue* context, |
| 3359 int count) { | 3358 int count) { |
| 3360 return new(zone) HArgumentsObject(count, zone); | 3359 return new(zone) HArgumentsObject(count, zone); |
| 3361 } | 3360 } |
| 3362 | 3361 |
| 3363 // The values contain a list of all elements in the arguments object | 3362 // The values contain a list of all elements in the arguments object |
| 3364 // including the receiver object, which is skipped when materializing. | 3363 // including the receiver object, which is skipped when materializing. |
| 3365 const ZoneList<HValue*>* arguments_values() const { return &values_; } | 3364 const ZoneList<HValue*>* arguments_values() const { return &values_; } |
| 3366 int arguments_count() const { return values_.length(); } | 3365 int arguments_count() const { return values_.length(); } |
| 3367 | 3366 |
| 3368 void AddArgument(HValue* argument, Zone* zone) { | 3367 void AddArgument(HValue* argument, Zone* zone) { |
| 3369 values_.Add(NULL, zone); // Resize list. | 3368 values_.Add(NULL, zone); // Resize list. |
| 3370 SetOperandAt(values_.length() - 1, argument); | 3369 SetOperandAt(values_.length() - 1, argument); |
| 3371 } | 3370 } |
| 3372 | 3371 |
| 3373 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) | 3372 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) |
| 3374 | 3373 |
| 3375 private: | 3374 private: |
| 3376 HArgumentsObject(int count, Zone* zone) | 3375 HArgumentsObject(int count, Zone* zone) |
| 3377 : HDematerializedObject(count, zone) { | 3376 : HDematerializedObject(count, zone) { |
| 3378 set_representation(Representation::Tagged()); | 3377 set_representation(Representation::Tagged()); |
| 3379 SetFlag(kIsArguments); | 3378 SetFlag(kIsArguments); |
| 3380 } | 3379 } |
| 3381 }; | 3380 }; |
| 3382 | 3381 |
| 3383 | 3382 |
| 3384 class HCapturedObject FINAL : public HDematerializedObject { | 3383 class HCapturedObject final : public HDematerializedObject { |
| 3385 public: | 3384 public: |
| 3386 HCapturedObject(int length, int id, Zone* zone) | 3385 HCapturedObject(int length, int id, Zone* zone) |
| 3387 : HDematerializedObject(length, zone), capture_id_(id) { | 3386 : HDematerializedObject(length, zone), capture_id_(id) { |
| 3388 set_representation(Representation::Tagged()); | 3387 set_representation(Representation::Tagged()); |
| 3389 values_.AddBlock(NULL, length, zone); // Resize list. | 3388 values_.AddBlock(NULL, length, zone); // Resize list. |
| 3390 } | 3389 } |
| 3391 | 3390 |
| 3392 // The values contain a list of all in-object properties inside the | 3391 // The values contain a list of all in-object properties inside the |
| 3393 // captured object and is index by field index. Properties in the | 3392 // captured object and is index by field index. Properties in the |
| 3394 // properties or elements backing store are not tracked here. | 3393 // properties or elements backing store are not tracked here. |
| 3395 const ZoneList<HValue*>* values() const { return &values_; } | 3394 const ZoneList<HValue*>* values() const { return &values_; } |
| 3396 int length() const { return values_.length(); } | 3395 int length() const { return values_.length(); } |
| 3397 int capture_id() const { return capture_id_; } | 3396 int capture_id() const { return capture_id_; } |
| 3398 | 3397 |
| 3399 // Shortcut for the map value of this captured object. | 3398 // Shortcut for the map value of this captured object. |
| 3400 HValue* map_value() const { return values()->first(); } | 3399 HValue* map_value() const { return values()->first(); } |
| 3401 | 3400 |
| 3402 void ReuseSideEffectsFromStore(HInstruction* store) { | 3401 void ReuseSideEffectsFromStore(HInstruction* store) { |
| 3403 DCHECK(store->HasObservableSideEffects()); | 3402 DCHECK(store->HasObservableSideEffects()); |
| 3404 DCHECK(store->IsStoreNamedField()); | 3403 DCHECK(store->IsStoreNamedField()); |
| 3405 changes_flags_.Add(store->ChangesFlags()); | 3404 changes_flags_.Add(store->ChangesFlags()); |
| 3406 } | 3405 } |
| 3407 | 3406 |
| 3408 // Replay effects of this instruction on the given environment. | 3407 // Replay effects of this instruction on the given environment. |
| 3409 void ReplayEnvironment(HEnvironment* env); | 3408 void ReplayEnvironment(HEnvironment* env); |
| 3410 | 3409 |
| 3411 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 3410 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 3412 | 3411 |
| 3413 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) | 3412 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) |
| 3414 | 3413 |
| 3415 private: | 3414 private: |
| 3416 int capture_id_; | 3415 int capture_id_; |
| 3417 | 3416 |
| 3418 // Note that we cannot DCE captured objects as they are used to replay | 3417 // Note that we cannot DCE captured objects as they are used to replay |
| 3419 // the environment. This method is here as an explicit reminder. | 3418 // the environment. This method is here as an explicit reminder. |
| 3420 // TODO(mstarzinger): Turn HSimulates into full snapshots maybe? | 3419 // TODO(mstarzinger): Turn HSimulates into full snapshots maybe? |
| 3421 bool IsDeletable() const FINAL { return false; } | 3420 bool IsDeletable() const final { return false; } |
| 3422 }; | 3421 }; |
| 3423 | 3422 |
| 3424 | 3423 |
| 3425 class HConstant FINAL : public HTemplateInstruction<0> { | 3424 class HConstant final : public HTemplateInstruction<0> { |
| 3426 public: | 3425 public: |
| 3427 enum Special { kHoleNaN }; | 3426 enum Special { kHoleNaN }; |
| 3428 | 3427 |
| 3429 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Special); | 3428 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Special); |
| 3430 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); | 3429 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); |
| 3431 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); | 3430 DECLARE_INSTRUCTION_FACTORY_P2(HConstant, int32_t, Representation); |
| 3432 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); | 3431 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); |
| 3433 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); | 3432 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); |
| 3434 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); | 3433 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); |
| 3435 | 3434 |
| 3436 static HConstant* CreateAndInsertAfter(Isolate* isolate, Zone* zone, | 3435 static HConstant* CreateAndInsertAfter(Isolate* isolate, Zone* zone, |
| 3437 HValue* context, int32_t value, | 3436 HValue* context, int32_t value, |
| 3438 Representation representation, | 3437 Representation representation, |
| 3439 HInstruction* instruction) { | 3438 HInstruction* instruction) { |
| 3440 return instruction->Append( | 3439 return instruction->Append( |
| 3441 HConstant::New(isolate, zone, context, value, representation)); | 3440 HConstant::New(isolate, zone, context, value, representation)); |
| 3442 } | 3441 } |
| 3443 | 3442 |
| 3444 Handle<Map> GetMonomorphicJSObjectMap() OVERRIDE { | 3443 Handle<Map> GetMonomorphicJSObjectMap() override { |
| 3445 Handle<Object> object = object_.handle(); | 3444 Handle<Object> object = object_.handle(); |
| 3446 if (!object.is_null() && object->IsHeapObject()) { | 3445 if (!object.is_null() && object->IsHeapObject()) { |
| 3447 return v8::internal::handle(HeapObject::cast(*object)->map()); | 3446 return v8::internal::handle(HeapObject::cast(*object)->map()); |
| 3448 } | 3447 } |
| 3449 return Handle<Map>(); | 3448 return Handle<Map>(); |
| 3450 } | 3449 } |
| 3451 | 3450 |
| 3452 static HConstant* CreateAndInsertBefore(Isolate* isolate, Zone* zone, | 3451 static HConstant* CreateAndInsertBefore(Isolate* isolate, Zone* zone, |
| 3453 HValue* context, int32_t value, | 3452 HValue* context, int32_t value, |
| 3454 Representation representation, | 3453 Representation representation, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3499 return IsNotInNewSpaceField::decode(bit_field_); | 3498 return IsNotInNewSpaceField::decode(bit_field_); |
| 3500 } | 3499 } |
| 3501 | 3500 |
| 3502 bool ImmortalImmovable() const; | 3501 bool ImmortalImmovable() const; |
| 3503 | 3502 |
| 3504 bool IsCell() const { | 3503 bool IsCell() const { |
| 3505 InstanceType instance_type = GetInstanceType(); | 3504 InstanceType instance_type = GetInstanceType(); |
| 3506 return instance_type == CELL_TYPE; | 3505 return instance_type == CELL_TYPE; |
| 3507 } | 3506 } |
| 3508 | 3507 |
| 3509 Representation RequiredInputRepresentation(int index) OVERRIDE { | 3508 Representation RequiredInputRepresentation(int index) override { |
| 3510 return Representation::None(); | 3509 return Representation::None(); |
| 3511 } | 3510 } |
| 3512 | 3511 |
| 3513 Representation KnownOptimalRepresentation() OVERRIDE { | 3512 Representation KnownOptimalRepresentation() override { |
| 3514 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi(); | 3513 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi(); |
| 3515 if (HasInteger32Value()) return Representation::Integer32(); | 3514 if (HasInteger32Value()) return Representation::Integer32(); |
| 3516 if (HasNumberValue()) return Representation::Double(); | 3515 if (HasNumberValue()) return Representation::Double(); |
| 3517 if (HasExternalReferenceValue()) return Representation::External(); | 3516 if (HasExternalReferenceValue()) return Representation::External(); |
| 3518 return Representation::Tagged(); | 3517 return Representation::Tagged(); |
| 3519 } | 3518 } |
| 3520 | 3519 |
| 3521 bool EmitAtUses() OVERRIDE; | 3520 bool EmitAtUses() override; |
| 3522 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 3521 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 3523 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; | 3522 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; |
| 3524 Maybe<HConstant*> CopyToTruncatedInt32(Zone* zone); | 3523 Maybe<HConstant*> CopyToTruncatedInt32(Zone* zone); |
| 3525 Maybe<HConstant*> CopyToTruncatedNumber(Isolate* isolate, Zone* zone); | 3524 Maybe<HConstant*> CopyToTruncatedNumber(Isolate* isolate, Zone* zone); |
| 3526 bool HasInteger32Value() const { | 3525 bool HasInteger32Value() const { |
| 3527 return HasInt32ValueField::decode(bit_field_); | 3526 return HasInt32ValueField::decode(bit_field_); |
| 3528 } | 3527 } |
| 3529 int32_t Integer32Value() const { | 3528 int32_t Integer32Value() const { |
| 3530 DCHECK(HasInteger32Value()); | 3529 DCHECK(HasInteger32Value()); |
| 3531 return int32_value_; | 3530 return int32_value_; |
| 3532 } | 3531 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3598 DCHECK(HasMapValue() || !HasStableMapValueField::decode(bit_field_)); | 3597 DCHECK(HasMapValue() || !HasStableMapValueField::decode(bit_field_)); |
| 3599 return HasStableMapValueField::decode(bit_field_); | 3598 return HasStableMapValueField::decode(bit_field_); |
| 3600 } | 3599 } |
| 3601 | 3600 |
| 3602 bool HasObjectMap() const { return !object_map_.IsNull(); } | 3601 bool HasObjectMap() const { return !object_map_.IsNull(); } |
| 3603 Unique<Map> ObjectMap() const { | 3602 Unique<Map> ObjectMap() const { |
| 3604 DCHECK(HasObjectMap()); | 3603 DCHECK(HasObjectMap()); |
| 3605 return object_map_; | 3604 return object_map_; |
| 3606 } | 3605 } |
| 3607 | 3606 |
| 3608 intptr_t Hashcode() OVERRIDE { | 3607 intptr_t Hashcode() override { |
| 3609 if (HasInteger32Value()) { | 3608 if (HasInteger32Value()) { |
| 3610 return static_cast<intptr_t>(int32_value_); | 3609 return static_cast<intptr_t>(int32_value_); |
| 3611 } else if (HasDoubleValue()) { | 3610 } else if (HasDoubleValue()) { |
| 3612 uint64_t bits = DoubleValueAsBits(); | 3611 uint64_t bits = DoubleValueAsBits(); |
| 3613 if (sizeof(bits) > sizeof(intptr_t)) { | 3612 if (sizeof(bits) > sizeof(intptr_t)) { |
| 3614 bits ^= (bits >> 32); | 3613 bits ^= (bits >> 32); |
| 3615 } | 3614 } |
| 3616 return static_cast<intptr_t>(bits); | 3615 return static_cast<intptr_t>(bits); |
| 3617 } else if (HasExternalReferenceValue()) { | 3616 } else if (HasExternalReferenceValue()) { |
| 3618 return reinterpret_cast<intptr_t>(external_reference_value_.address()); | 3617 return reinterpret_cast<intptr_t>(external_reference_value_.address()); |
| 3619 } else { | 3618 } else { |
| 3620 DCHECK(!object_.handle().is_null()); | 3619 DCHECK(!object_.handle().is_null()); |
| 3621 return object_.Hashcode(); | 3620 return object_.Hashcode(); |
| 3622 } | 3621 } |
| 3623 } | 3622 } |
| 3624 | 3623 |
| 3625 void FinalizeUniqueness() OVERRIDE { | 3624 void FinalizeUniqueness() override { |
| 3626 if (!HasDoubleValue() && !HasExternalReferenceValue()) { | 3625 if (!HasDoubleValue() && !HasExternalReferenceValue()) { |
| 3627 DCHECK(!object_.handle().is_null()); | 3626 DCHECK(!object_.handle().is_null()); |
| 3628 object_ = Unique<Object>(object_.handle()); | 3627 object_ = Unique<Object>(object_.handle()); |
| 3629 } | 3628 } |
| 3630 } | 3629 } |
| 3631 | 3630 |
| 3632 Unique<Object> GetUnique() const { | 3631 Unique<Object> GetUnique() const { |
| 3633 return object_; | 3632 return object_; |
| 3634 } | 3633 } |
| 3635 | 3634 |
| 3636 bool EqualsUnique(Unique<Object> other) const { | 3635 bool EqualsUnique(Unique<Object> other) const { |
| 3637 return object_.IsInitialized() && object_ == other; | 3636 return object_.IsInitialized() && object_ == other; |
| 3638 } | 3637 } |
| 3639 | 3638 |
| 3640 bool DataEquals(HValue* other) OVERRIDE { | 3639 bool DataEquals(HValue* other) override { |
| 3641 HConstant* other_constant = HConstant::cast(other); | 3640 HConstant* other_constant = HConstant::cast(other); |
| 3642 if (HasInteger32Value()) { | 3641 if (HasInteger32Value()) { |
| 3643 return other_constant->HasInteger32Value() && | 3642 return other_constant->HasInteger32Value() && |
| 3644 int32_value_ == other_constant->int32_value_; | 3643 int32_value_ == other_constant->int32_value_; |
| 3645 } else if (HasDoubleValue()) { | 3644 } else if (HasDoubleValue()) { |
| 3646 return other_constant->HasDoubleValue() && | 3645 return other_constant->HasDoubleValue() && |
| 3647 std::memcmp(&double_value_, &other_constant->double_value_, | 3646 std::memcmp(&double_value_, &other_constant->double_value_, |
| 3648 sizeof(double_value_)) == 0; | 3647 sizeof(double_value_)) == 0; |
| 3649 } else if (HasExternalReferenceValue()) { | 3648 } else if (HasExternalReferenceValue()) { |
| 3650 return other_constant->HasExternalReferenceValue() && | 3649 return other_constant->HasExternalReferenceValue() && |
| 3651 external_reference_value_ == | 3650 external_reference_value_ == |
| 3652 other_constant->external_reference_value_; | 3651 other_constant->external_reference_value_; |
| 3653 } else { | 3652 } else { |
| 3654 if (other_constant->HasInteger32Value() || | 3653 if (other_constant->HasInteger32Value() || |
| 3655 other_constant->HasDoubleValue() || | 3654 other_constant->HasDoubleValue() || |
| 3656 other_constant->HasExternalReferenceValue()) { | 3655 other_constant->HasExternalReferenceValue()) { |
| 3657 return false; | 3656 return false; |
| 3658 } | 3657 } |
| 3659 DCHECK(!object_.handle().is_null()); | 3658 DCHECK(!object_.handle().is_null()); |
| 3660 return other_constant->object_ == object_; | 3659 return other_constant->object_ == object_; |
| 3661 } | 3660 } |
| 3662 } | 3661 } |
| 3663 | 3662 |
| 3664 #ifdef DEBUG | 3663 #ifdef DEBUG |
| 3665 void Verify() OVERRIDE {} | 3664 void Verify() override {} |
| 3666 #endif | 3665 #endif |
| 3667 | 3666 |
| 3668 DECLARE_CONCRETE_INSTRUCTION(Constant) | 3667 DECLARE_CONCRETE_INSTRUCTION(Constant) |
| 3669 | 3668 |
| 3670 protected: | 3669 protected: |
| 3671 Range* InferRange(Zone* zone) OVERRIDE; | 3670 Range* InferRange(Zone* zone) override; |
| 3672 | 3671 |
| 3673 private: | 3672 private: |
| 3674 friend class HGraph; | 3673 friend class HGraph; |
| 3675 explicit HConstant(Special special); | 3674 explicit HConstant(Special special); |
| 3676 explicit HConstant(Handle<Object> handle, | 3675 explicit HConstant(Handle<Object> handle, |
| 3677 Representation r = Representation::None()); | 3676 Representation r = Representation::None()); |
| 3678 HConstant(int32_t value, | 3677 HConstant(int32_t value, |
| 3679 Representation r = Representation::None(), | 3678 Representation r = Representation::None(), |
| 3680 bool is_not_in_new_space = true, | 3679 bool is_not_in_new_space = true, |
| 3681 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); | 3680 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); |
| 3682 HConstant(double value, | 3681 HConstant(double value, |
| 3683 Representation r = Representation::None(), | 3682 Representation r = Representation::None(), |
| 3684 bool is_not_in_new_space = true, | 3683 bool is_not_in_new_space = true, |
| 3685 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); | 3684 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); |
| 3686 HConstant(Unique<Object> object, | 3685 HConstant(Unique<Object> object, |
| 3687 Unique<Map> object_map, | 3686 Unique<Map> object_map, |
| 3688 bool has_stable_map_value, | 3687 bool has_stable_map_value, |
| 3689 Representation r, | 3688 Representation r, |
| 3690 HType type, | 3689 HType type, |
| 3691 bool is_not_in_new_space, | 3690 bool is_not_in_new_space, |
| 3692 bool boolean_value, | 3691 bool boolean_value, |
| 3693 bool is_undetectable, | 3692 bool is_undetectable, |
| 3694 InstanceType instance_type); | 3693 InstanceType instance_type); |
| 3695 | 3694 |
| 3696 explicit HConstant(ExternalReference reference); | 3695 explicit HConstant(ExternalReference reference); |
| 3697 | 3696 |
| 3698 void Initialize(Representation r); | 3697 void Initialize(Representation r); |
| 3699 | 3698 |
| 3700 bool IsDeletable() const OVERRIDE { return true; } | 3699 bool IsDeletable() const override { return true; } |
| 3701 | 3700 |
| 3702 // If object_ is a map, this indicates whether the map is stable. | 3701 // If object_ is a map, this indicates whether the map is stable. |
| 3703 class HasStableMapValueField : public BitField<bool, 0, 1> {}; | 3702 class HasStableMapValueField : public BitField<bool, 0, 1> {}; |
| 3704 | 3703 |
| 3705 // We store the HConstant in the most specific form safely possible. | 3704 // We store the HConstant in the most specific form safely possible. |
| 3706 // These flags tell us if the respective member fields hold valid, safe | 3705 // These flags tell us if the respective member fields hold valid, safe |
| 3707 // representations of the constant. More specific flags imply more general | 3706 // representations of the constant. More specific flags imply more general |
| 3708 // flags, but not the converse (i.e. smi => int32 => double). | 3707 // flags, but not the converse (i.e. smi => int32 => double). |
| 3709 class HasSmiValueField : public BitField<bool, 1, 1> {}; | 3708 class HasSmiValueField : public BitField<bool, 1, 1> {}; |
| 3710 class HasInt32ValueField : public BitField<bool, 2, 1> {}; | 3709 class HasInt32ValueField : public BitField<bool, 2, 1> {}; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3778 | 3777 |
| 3779 void set_observed_input_representation(int index, Representation rep) { | 3778 void set_observed_input_representation(int index, Representation rep) { |
| 3780 DCHECK(index >= 1 && index <= 2); | 3779 DCHECK(index >= 1 && index <= 2); |
| 3781 observed_input_representation_[index - 1] = rep; | 3780 observed_input_representation_[index - 1] = rep; |
| 3782 } | 3781 } |
| 3783 | 3782 |
| 3784 virtual void initialize_output_representation(Representation observed) { | 3783 virtual void initialize_output_representation(Representation observed) { |
| 3785 observed_output_representation_ = observed; | 3784 observed_output_representation_ = observed; |
| 3786 } | 3785 } |
| 3787 | 3786 |
| 3788 Representation observed_input_representation(int index) OVERRIDE { | 3787 Representation observed_input_representation(int index) override { |
| 3789 if (index == 0) return Representation::Tagged(); | 3788 if (index == 0) return Representation::Tagged(); |
| 3790 return observed_input_representation_[index - 1]; | 3789 return observed_input_representation_[index - 1]; |
| 3791 } | 3790 } |
| 3792 | 3791 |
| 3793 virtual void UpdateRepresentation(Representation new_rep, | 3792 virtual void UpdateRepresentation(Representation new_rep, |
| 3794 HInferRepresentationPhase* h_infer, | 3793 HInferRepresentationPhase* h_infer, |
| 3795 const char* reason) OVERRIDE { | 3794 const char* reason) override { |
| 3796 Representation rep = !FLAG_smi_binop && new_rep.IsSmi() | 3795 Representation rep = !FLAG_smi_binop && new_rep.IsSmi() |
| 3797 ? Representation::Integer32() : new_rep; | 3796 ? Representation::Integer32() : new_rep; |
| 3798 HValue::UpdateRepresentation(rep, h_infer, reason); | 3797 HValue::UpdateRepresentation(rep, h_infer, reason); |
| 3799 } | 3798 } |
| 3800 | 3799 |
| 3801 virtual void InferRepresentation( | 3800 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
| 3802 HInferRepresentationPhase* h_infer) OVERRIDE; | 3801 Representation RepresentationFromInputs() override; |
| 3803 Representation RepresentationFromInputs() OVERRIDE; | |
| 3804 Representation RepresentationFromOutput(); | 3802 Representation RepresentationFromOutput(); |
| 3805 void AssumeRepresentation(Representation r) OVERRIDE; | 3803 void AssumeRepresentation(Representation r) override; |
| 3806 | 3804 |
| 3807 virtual bool IsCommutative() const { return false; } | 3805 virtual bool IsCommutative() const { return false; } |
| 3808 | 3806 |
| 3809 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 3807 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 3810 | 3808 |
| 3811 Representation RequiredInputRepresentation(int index) OVERRIDE { | 3809 Representation RequiredInputRepresentation(int index) override { |
| 3812 if (index == 0) return Representation::Tagged(); | 3810 if (index == 0) return Representation::Tagged(); |
| 3813 return representation(); | 3811 return representation(); |
| 3814 } | 3812 } |
| 3815 | 3813 |
| 3816 void SetOperandPositions(Zone* zone, SourcePosition left_pos, | 3814 void SetOperandPositions(Zone* zone, SourcePosition left_pos, |
| 3817 SourcePosition right_pos) { | 3815 SourcePosition right_pos) { |
| 3818 set_operand_position(zone, 1, left_pos); | 3816 set_operand_position(zone, 1, left_pos); |
| 3819 set_operand_position(zone, 2, right_pos); | 3817 set_operand_position(zone, 2, right_pos); |
| 3820 } | 3818 } |
| 3821 | 3819 |
| 3822 bool RightIsPowerOf2() { | 3820 bool RightIsPowerOf2() { |
| 3823 if (!right()->IsInteger32Constant()) return false; | 3821 if (!right()->IsInteger32Constant()) return false; |
| 3824 int32_t value = right()->GetInteger32Constant(); | 3822 int32_t value = right()->GetInteger32Constant(); |
| 3825 if (value < 0) { | 3823 if (value < 0) { |
| 3826 return base::bits::IsPowerOfTwo32(static_cast<uint32_t>(-value)); | 3824 return base::bits::IsPowerOfTwo32(static_cast<uint32_t>(-value)); |
| 3827 } | 3825 } |
| 3828 return base::bits::IsPowerOfTwo32(static_cast<uint32_t>(value)); | 3826 return base::bits::IsPowerOfTwo32(static_cast<uint32_t>(value)); |
| 3829 } | 3827 } |
| 3830 | 3828 |
| 3831 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) | 3829 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) |
| 3832 | 3830 |
| 3833 private: | 3831 private: |
| 3834 bool IgnoreObservedOutputRepresentation(Representation current_rep); | 3832 bool IgnoreObservedOutputRepresentation(Representation current_rep); |
| 3835 | 3833 |
| 3836 Representation observed_input_representation_[2]; | 3834 Representation observed_input_representation_[2]; |
| 3837 Representation observed_output_representation_; | 3835 Representation observed_output_representation_; |
| 3838 }; | 3836 }; |
| 3839 | 3837 |
| 3840 | 3838 |
| 3841 class HWrapReceiver FINAL : public HTemplateInstruction<2> { | 3839 class HWrapReceiver final : public HTemplateInstruction<2> { |
| 3842 public: | 3840 public: |
| 3843 DECLARE_INSTRUCTION_FACTORY_P2(HWrapReceiver, HValue*, HValue*); | 3841 DECLARE_INSTRUCTION_FACTORY_P2(HWrapReceiver, HValue*, HValue*); |
| 3844 | 3842 |
| 3845 bool DataEquals(HValue* other) OVERRIDE { return true; } | 3843 bool DataEquals(HValue* other) override { return true; } |
| 3846 | 3844 |
| 3847 Representation RequiredInputRepresentation(int index) OVERRIDE { | 3845 Representation RequiredInputRepresentation(int index) override { |
| 3848 return Representation::Tagged(); | 3846 return Representation::Tagged(); |
| 3849 } | 3847 } |
| 3850 | 3848 |
| 3851 HValue* receiver() const { return OperandAt(0); } | 3849 HValue* receiver() const { return OperandAt(0); } |
| 3852 HValue* function() const { return OperandAt(1); } | 3850 HValue* function() const { return OperandAt(1); } |
| 3853 | 3851 |
| 3854 HValue* Canonicalize() OVERRIDE; | 3852 HValue* Canonicalize() override; |
| 3855 | 3853 |
| 3856 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 3854 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 3857 bool known_function() const { return known_function_; } | 3855 bool known_function() const { return known_function_; } |
| 3858 | 3856 |
| 3859 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver) | 3857 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver) |
| 3860 | 3858 |
| 3861 private: | 3859 private: |
| 3862 HWrapReceiver(HValue* receiver, HValue* function) { | 3860 HWrapReceiver(HValue* receiver, HValue* function) { |
| 3863 known_function_ = function->IsConstant() && | 3861 known_function_ = function->IsConstant() && |
| 3864 HConstant::cast(function)->handle(function->isolate())->IsJSFunction(); | 3862 HConstant::cast(function)->handle(function->isolate())->IsJSFunction(); |
| 3865 set_representation(Representation::Tagged()); | 3863 set_representation(Representation::Tagged()); |
| 3866 SetOperandAt(0, receiver); | 3864 SetOperandAt(0, receiver); |
| 3867 SetOperandAt(1, function); | 3865 SetOperandAt(1, function); |
| 3868 SetFlag(kUseGVN); | 3866 SetFlag(kUseGVN); |
| 3869 } | 3867 } |
| 3870 | 3868 |
| 3871 bool known_function_; | 3869 bool known_function_; |
| 3872 }; | 3870 }; |
| 3873 | 3871 |
| 3874 | 3872 |
| 3875 class HApplyArguments FINAL : public HTemplateInstruction<4> { | 3873 class HApplyArguments final : public HTemplateInstruction<4> { |
| 3876 public: | 3874 public: |
| 3877 DECLARE_INSTRUCTION_FACTORY_P4(HApplyArguments, HValue*, HValue*, HValue*, | 3875 DECLARE_INSTRUCTION_FACTORY_P4(HApplyArguments, HValue*, HValue*, HValue*, |
| 3878 HValue*); | 3876 HValue*); |
| 3879 | 3877 |
| 3880 Representation RequiredInputRepresentation(int index) OVERRIDE { | 3878 Representation RequiredInputRepresentation(int index) override { |
| 3881 // The length is untagged, all other inputs are tagged. | 3879 // The length is untagged, all other inputs are tagged. |
| 3882 return (index == 2) | 3880 return (index == 2) |
| 3883 ? Representation::Integer32() | 3881 ? Representation::Integer32() |
| 3884 : Representation::Tagged(); | 3882 : Representation::Tagged(); |
| 3885 } | 3883 } |
| 3886 | 3884 |
| 3887 HValue* function() { return OperandAt(0); } | 3885 HValue* function() { return OperandAt(0); } |
| 3888 HValue* receiver() { return OperandAt(1); } | 3886 HValue* receiver() { return OperandAt(1); } |
| 3889 HValue* length() { return OperandAt(2); } | 3887 HValue* length() { return OperandAt(2); } |
| 3890 HValue* elements() { return OperandAt(3); } | 3888 HValue* elements() { return OperandAt(3); } |
| 3891 | 3889 |
| 3892 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments) | 3890 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments) |
| 3893 | 3891 |
| 3894 private: | 3892 private: |
| 3895 HApplyArguments(HValue* function, | 3893 HApplyArguments(HValue* function, |
| 3896 HValue* receiver, | 3894 HValue* receiver, |
| 3897 HValue* length, | 3895 HValue* length, |
| 3898 HValue* elements) { | 3896 HValue* elements) { |
| 3899 set_representation(Representation::Tagged()); | 3897 set_representation(Representation::Tagged()); |
| 3900 SetOperandAt(0, function); | 3898 SetOperandAt(0, function); |
| 3901 SetOperandAt(1, receiver); | 3899 SetOperandAt(1, receiver); |
| 3902 SetOperandAt(2, length); | 3900 SetOperandAt(2, length); |
| 3903 SetOperandAt(3, elements); | 3901 SetOperandAt(3, elements); |
| 3904 SetAllSideEffects(); | 3902 SetAllSideEffects(); |
| 3905 } | 3903 } |
| 3906 }; | 3904 }; |
| 3907 | 3905 |
| 3908 | 3906 |
| 3909 class HArgumentsElements FINAL : public HTemplateInstruction<0> { | 3907 class HArgumentsElements final : public HTemplateInstruction<0> { |
| 3910 public: | 3908 public: |
| 3911 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsElements, bool); | 3909 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsElements, bool); |
| 3912 | 3910 |
| 3913 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) | 3911 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) |
| 3914 | 3912 |
| 3915 Representation RequiredInputRepresentation(int index) OVERRIDE { | 3913 Representation RequiredInputRepresentation(int index) override { |
| 3916 return Representation::None(); | 3914 return Representation::None(); |
| 3917 } | 3915 } |
| 3918 | 3916 |
| 3919 bool from_inlined() const { return from_inlined_; } | 3917 bool from_inlined() const { return from_inlined_; } |
| 3920 | 3918 |
| 3921 protected: | 3919 protected: |
| 3922 bool DataEquals(HValue* other) OVERRIDE { return true; } | 3920 bool DataEquals(HValue* other) override { return true; } |
| 3923 | 3921 |
| 3924 private: | 3922 private: |
| 3925 explicit HArgumentsElements(bool from_inlined) : from_inlined_(from_inlined) { | 3923 explicit HArgumentsElements(bool from_inlined) : from_inlined_(from_inlined) { |
| 3926 // The value produced by this instruction is a pointer into the stack | 3924 // The value produced by this instruction is a pointer into the stack |
| 3927 // that looks as if it was a smi because of alignment. | 3925 // that looks as if it was a smi because of alignment. |
| 3928 set_representation(Representation::Tagged()); | 3926 set_representation(Representation::Tagged()); |
| 3929 SetFlag(kUseGVN); | 3927 SetFlag(kUseGVN); |
| 3930 } | 3928 } |
| 3931 | 3929 |
| 3932 bool IsDeletable() const OVERRIDE { return true; } | 3930 bool IsDeletable() const override { return true; } |
| 3933 | 3931 |
| 3934 bool from_inlined_; | 3932 bool from_inlined_; |
| 3935 }; | 3933 }; |
| 3936 | 3934 |
| 3937 | 3935 |
| 3938 class HArgumentsLength FINAL : public HUnaryOperation { | 3936 class HArgumentsLength final : public HUnaryOperation { |
| 3939 public: | 3937 public: |
| 3940 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsLength, HValue*); | 3938 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsLength, HValue*); |
| 3941 | 3939 |
| 3942 Representation RequiredInputRepresentation(int index) OVERRIDE { | 3940 Representation RequiredInputRepresentation(int index) override { |
| 3943 return Representation::Tagged(); | 3941 return Representation::Tagged(); |
| 3944 } | 3942 } |
| 3945 | 3943 |
| 3946 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) | 3944 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) |
| 3947 | 3945 |
| 3948 protected: | 3946 protected: |
| 3949 bool DataEquals(HValue* other) OVERRIDE { return true; } | 3947 bool DataEquals(HValue* other) override { return true; } |
| 3950 | 3948 |
| 3951 private: | 3949 private: |
| 3952 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { | 3950 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { |
| 3953 set_representation(Representation::Integer32()); | 3951 set_representation(Representation::Integer32()); |
| 3954 SetFlag(kUseGVN); | 3952 SetFlag(kUseGVN); |
| 3955 } | 3953 } |
| 3956 | 3954 |
| 3957 bool IsDeletable() const OVERRIDE { return true; } | 3955 bool IsDeletable() const override { return true; } |
| 3958 }; | 3956 }; |
| 3959 | 3957 |
| 3960 | 3958 |
| 3961 class HAccessArgumentsAt FINAL : public HTemplateInstruction<3> { | 3959 class HAccessArgumentsAt final : public HTemplateInstruction<3> { |
| 3962 public: | 3960 public: |
| 3963 DECLARE_INSTRUCTION_FACTORY_P3(HAccessArgumentsAt, HValue*, HValue*, HValue*); | 3961 DECLARE_INSTRUCTION_FACTORY_P3(HAccessArgumentsAt, HValue*, HValue*, HValue*); |
| 3964 | 3962 |
| 3965 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 3963 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 3966 | 3964 |
| 3967 Representation RequiredInputRepresentation(int index) OVERRIDE { | 3965 Representation RequiredInputRepresentation(int index) override { |
| 3968 // The arguments elements is considered tagged. | 3966 // The arguments elements is considered tagged. |
| 3969 return index == 0 | 3967 return index == 0 |
| 3970 ? Representation::Tagged() | 3968 ? Representation::Tagged() |
| 3971 : Representation::Integer32(); | 3969 : Representation::Integer32(); |
| 3972 } | 3970 } |
| 3973 | 3971 |
| 3974 HValue* arguments() const { return OperandAt(0); } | 3972 HValue* arguments() const { return OperandAt(0); } |
| 3975 HValue* length() const { return OperandAt(1); } | 3973 HValue* length() const { return OperandAt(1); } |
| 3976 HValue* index() const { return OperandAt(2); } | 3974 HValue* index() const { return OperandAt(2); } |
| 3977 | 3975 |
| 3978 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) | 3976 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) |
| 3979 | 3977 |
| 3980 private: | 3978 private: |
| 3981 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { | 3979 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { |
| 3982 set_representation(Representation::Tagged()); | 3980 set_representation(Representation::Tagged()); |
| 3983 SetFlag(kUseGVN); | 3981 SetFlag(kUseGVN); |
| 3984 SetOperandAt(0, arguments); | 3982 SetOperandAt(0, arguments); |
| 3985 SetOperandAt(1, length); | 3983 SetOperandAt(1, length); |
| 3986 SetOperandAt(2, index); | 3984 SetOperandAt(2, index); |
| 3987 } | 3985 } |
| 3988 | 3986 |
| 3989 bool DataEquals(HValue* other) OVERRIDE { return true; } | 3987 bool DataEquals(HValue* other) override { return true; } |
| 3990 }; | 3988 }; |
| 3991 | 3989 |
| 3992 | 3990 |
| 3993 class HBoundsCheckBaseIndexInformation; | 3991 class HBoundsCheckBaseIndexInformation; |
| 3994 | 3992 |
| 3995 | 3993 |
| 3996 class HBoundsCheck FINAL : public HTemplateInstruction<2> { | 3994 class HBoundsCheck final : public HTemplateInstruction<2> { |
| 3997 public: | 3995 public: |
| 3998 DECLARE_INSTRUCTION_FACTORY_P2(HBoundsCheck, HValue*, HValue*); | 3996 DECLARE_INSTRUCTION_FACTORY_P2(HBoundsCheck, HValue*, HValue*); |
| 3999 | 3997 |
| 4000 bool skip_check() const { return skip_check_; } | 3998 bool skip_check() const { return skip_check_; } |
| 4001 void set_skip_check() { skip_check_ = true; } | 3999 void set_skip_check() { skip_check_ = true; } |
| 4002 | 4000 |
| 4003 HValue* base() const { return base_; } | 4001 HValue* base() const { return base_; } |
| 4004 int offset() const { return offset_; } | 4002 int offset() const { return offset_; } |
| 4005 int scale() const { return scale_; } | 4003 int scale() const { return scale_; } |
| 4006 | 4004 |
| 4007 void ApplyIndexChange(); | 4005 void ApplyIndexChange(); |
| 4008 bool DetectCompoundIndex() { | 4006 bool DetectCompoundIndex() { |
| 4009 DCHECK(base() == NULL); | 4007 DCHECK(base() == NULL); |
| 4010 | 4008 |
| 4011 DecompositionResult decomposition; | 4009 DecompositionResult decomposition; |
| 4012 if (index()->TryDecompose(&decomposition)) { | 4010 if (index()->TryDecompose(&decomposition)) { |
| 4013 base_ = decomposition.base(); | 4011 base_ = decomposition.base(); |
| 4014 offset_ = decomposition.offset(); | 4012 offset_ = decomposition.offset(); |
| 4015 scale_ = decomposition.scale(); | 4013 scale_ = decomposition.scale(); |
| 4016 return true; | 4014 return true; |
| 4017 } else { | 4015 } else { |
| 4018 base_ = index(); | 4016 base_ = index(); |
| 4019 offset_ = 0; | 4017 offset_ = 0; |
| 4020 scale_ = 0; | 4018 scale_ = 0; |
| 4021 return false; | 4019 return false; |
| 4022 } | 4020 } |
| 4023 } | 4021 } |
| 4024 | 4022 |
| 4025 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4023 Representation RequiredInputRepresentation(int index) override { |
| 4026 return representation(); | 4024 return representation(); |
| 4027 } | 4025 } |
| 4028 | 4026 |
| 4029 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4027 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 4030 virtual void InferRepresentation( | 4028 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
| 4031 HInferRepresentationPhase* h_infer) OVERRIDE; | |
| 4032 | 4029 |
| 4033 HValue* index() const { return OperandAt(0); } | 4030 HValue* index() const { return OperandAt(0); } |
| 4034 HValue* length() const { return OperandAt(1); } | 4031 HValue* length() const { return OperandAt(1); } |
| 4035 bool allow_equality() const { return allow_equality_; } | 4032 bool allow_equality() const { return allow_equality_; } |
| 4036 void set_allow_equality(bool v) { allow_equality_ = v; } | 4033 void set_allow_equality(bool v) { allow_equality_ = v; } |
| 4037 | 4034 |
| 4038 int RedefinedOperandIndex() OVERRIDE { return 0; } | 4035 int RedefinedOperandIndex() override { return 0; } |
| 4039 bool IsPurelyInformativeDefinition() OVERRIDE { return skip_check(); } | 4036 bool IsPurelyInformativeDefinition() override { return skip_check(); } |
| 4040 | 4037 |
| 4041 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) | 4038 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) |
| 4042 | 4039 |
| 4043 protected: | 4040 protected: |
| 4044 friend class HBoundsCheckBaseIndexInformation; | 4041 friend class HBoundsCheckBaseIndexInformation; |
| 4045 | 4042 |
| 4046 Range* InferRange(Zone* zone) OVERRIDE; | 4043 Range* InferRange(Zone* zone) override; |
| 4047 | 4044 |
| 4048 bool DataEquals(HValue* other) OVERRIDE { return true; } | 4045 bool DataEquals(HValue* other) override { return true; } |
| 4049 bool skip_check_; | 4046 bool skip_check_; |
| 4050 HValue* base_; | 4047 HValue* base_; |
| 4051 int offset_; | 4048 int offset_; |
| 4052 int scale_; | 4049 int scale_; |
| 4053 bool allow_equality_; | 4050 bool allow_equality_; |
| 4054 | 4051 |
| 4055 private: | 4052 private: |
| 4056 // Normally HBoundsCheck should be created using the | 4053 // Normally HBoundsCheck should be created using the |
| 4057 // HGraphBuilder::AddBoundsCheck() helper. | 4054 // HGraphBuilder::AddBoundsCheck() helper. |
| 4058 // However when building stubs, where we know that the arguments are Int32, | 4055 // However when building stubs, where we know that the arguments are Int32, |
| 4059 // it makes sense to invoke this constructor directly. | 4056 // it makes sense to invoke this constructor directly. |
| 4060 HBoundsCheck(HValue* index, HValue* length) | 4057 HBoundsCheck(HValue* index, HValue* length) |
| 4061 : skip_check_(false), | 4058 : skip_check_(false), |
| 4062 base_(NULL), offset_(0), scale_(0), | 4059 base_(NULL), offset_(0), scale_(0), |
| 4063 allow_equality_(false) { | 4060 allow_equality_(false) { |
| 4064 SetOperandAt(0, index); | 4061 SetOperandAt(0, index); |
| 4065 SetOperandAt(1, length); | 4062 SetOperandAt(1, length); |
| 4066 SetFlag(kFlexibleRepresentation); | 4063 SetFlag(kFlexibleRepresentation); |
| 4067 SetFlag(kUseGVN); | 4064 SetFlag(kUseGVN); |
| 4068 } | 4065 } |
| 4069 | 4066 |
| 4070 bool IsDeletable() const OVERRIDE { return skip_check() && !FLAG_debug_code; } | 4067 bool IsDeletable() const override { return skip_check() && !FLAG_debug_code; } |
| 4071 }; | 4068 }; |
| 4072 | 4069 |
| 4073 | 4070 |
| 4074 class HBoundsCheckBaseIndexInformation FINAL | 4071 class HBoundsCheckBaseIndexInformation final : public HTemplateInstruction<2> { |
| 4075 : public HTemplateInstruction<2> { | |
| 4076 public: | 4072 public: |
| 4077 explicit HBoundsCheckBaseIndexInformation(HBoundsCheck* check) { | 4073 explicit HBoundsCheckBaseIndexInformation(HBoundsCheck* check) { |
| 4078 DecompositionResult decomposition; | 4074 DecompositionResult decomposition; |
| 4079 if (check->index()->TryDecompose(&decomposition)) { | 4075 if (check->index()->TryDecompose(&decomposition)) { |
| 4080 SetOperandAt(0, decomposition.base()); | 4076 SetOperandAt(0, decomposition.base()); |
| 4081 SetOperandAt(1, check); | 4077 SetOperandAt(1, check); |
| 4082 } else { | 4078 } else { |
| 4083 UNREACHABLE(); | 4079 UNREACHABLE(); |
| 4084 } | 4080 } |
| 4085 } | 4081 } |
| 4086 | 4082 |
| 4087 HValue* base_index() const { return OperandAt(0); } | 4083 HValue* base_index() const { return OperandAt(0); } |
| 4088 HBoundsCheck* bounds_check() { return HBoundsCheck::cast(OperandAt(1)); } | 4084 HBoundsCheck* bounds_check() { return HBoundsCheck::cast(OperandAt(1)); } |
| 4089 | 4085 |
| 4090 DECLARE_CONCRETE_INSTRUCTION(BoundsCheckBaseIndexInformation) | 4086 DECLARE_CONCRETE_INSTRUCTION(BoundsCheckBaseIndexInformation) |
| 4091 | 4087 |
| 4092 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4088 Representation RequiredInputRepresentation(int index) override { |
| 4093 return representation(); | 4089 return representation(); |
| 4094 } | 4090 } |
| 4095 | 4091 |
| 4096 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4092 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 4097 | 4093 |
| 4098 int RedefinedOperandIndex() OVERRIDE { return 0; } | 4094 int RedefinedOperandIndex() override { return 0; } |
| 4099 bool IsPurelyInformativeDefinition() OVERRIDE { return true; } | 4095 bool IsPurelyInformativeDefinition() override { return true; } |
| 4100 }; | 4096 }; |
| 4101 | 4097 |
| 4102 | 4098 |
| 4103 class HBitwiseBinaryOperation : public HBinaryOperation { | 4099 class HBitwiseBinaryOperation : public HBinaryOperation { |
| 4104 public: | 4100 public: |
| 4105 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, | 4101 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, |
| 4106 HType type = HType::TaggedNumber()) | 4102 HType type = HType::TaggedNumber()) |
| 4107 : HBinaryOperation(context, left, right, type) { | 4103 : HBinaryOperation(context, left, right, type) { |
| 4108 SetFlag(kFlexibleRepresentation); | 4104 SetFlag(kFlexibleRepresentation); |
| 4109 SetFlag(kTruncatingToInt32); | 4105 SetFlag(kTruncatingToInt32); |
| 4110 SetFlag(kAllowUndefinedAsNaN); | 4106 SetFlag(kAllowUndefinedAsNaN); |
| 4111 SetAllSideEffects(); | 4107 SetAllSideEffects(); |
| 4112 } | 4108 } |
| 4113 | 4109 |
| 4114 void RepresentationChanged(Representation to) OVERRIDE { | 4110 void RepresentationChanged(Representation to) override { |
| 4115 if (to.IsTagged() && | 4111 if (to.IsTagged() && |
| 4116 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { | 4112 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { |
| 4117 SetAllSideEffects(); | 4113 SetAllSideEffects(); |
| 4118 ClearFlag(kUseGVN); | 4114 ClearFlag(kUseGVN); |
| 4119 } else { | 4115 } else { |
| 4120 ClearAllSideEffects(); | 4116 ClearAllSideEffects(); |
| 4121 SetFlag(kUseGVN); | 4117 SetFlag(kUseGVN); |
| 4122 } | 4118 } |
| 4123 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); | 4119 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); |
| 4124 } | 4120 } |
| 4125 | 4121 |
| 4126 virtual void UpdateRepresentation(Representation new_rep, | 4122 virtual void UpdateRepresentation(Representation new_rep, |
| 4127 HInferRepresentationPhase* h_infer, | 4123 HInferRepresentationPhase* h_infer, |
| 4128 const char* reason) OVERRIDE { | 4124 const char* reason) override { |
| 4129 // We only generate either int32 or generic tagged bitwise operations. | 4125 // We only generate either int32 or generic tagged bitwise operations. |
| 4130 if (new_rep.IsDouble()) new_rep = Representation::Integer32(); | 4126 if (new_rep.IsDouble()) new_rep = Representation::Integer32(); |
| 4131 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4127 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 4132 } | 4128 } |
| 4133 | 4129 |
| 4134 Representation observed_input_representation(int index) OVERRIDE { | 4130 Representation observed_input_representation(int index) override { |
| 4135 Representation r = HBinaryOperation::observed_input_representation(index); | 4131 Representation r = HBinaryOperation::observed_input_representation(index); |
| 4136 if (r.IsDouble()) return Representation::Integer32(); | 4132 if (r.IsDouble()) return Representation::Integer32(); |
| 4137 return r; | 4133 return r; |
| 4138 } | 4134 } |
| 4139 | 4135 |
| 4140 virtual void initialize_output_representation( | 4136 virtual void initialize_output_representation( |
| 4141 Representation observed) OVERRIDE { | 4137 Representation observed) override { |
| 4142 if (observed.IsDouble()) observed = Representation::Integer32(); | 4138 if (observed.IsDouble()) observed = Representation::Integer32(); |
| 4143 HBinaryOperation::initialize_output_representation(observed); | 4139 HBinaryOperation::initialize_output_representation(observed); |
| 4144 } | 4140 } |
| 4145 | 4141 |
| 4146 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) | 4142 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) |
| 4147 | 4143 |
| 4148 private: | 4144 private: |
| 4149 bool IsDeletable() const OVERRIDE { return true; } | 4145 bool IsDeletable() const override { return true; } |
| 4150 }; | 4146 }; |
| 4151 | 4147 |
| 4152 | 4148 |
| 4153 class HMathFloorOfDiv FINAL : public HBinaryOperation { | 4149 class HMathFloorOfDiv final : public HBinaryOperation { |
| 4154 public: | 4150 public: |
| 4155 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HMathFloorOfDiv, | 4151 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HMathFloorOfDiv, |
| 4156 HValue*, | 4152 HValue*, |
| 4157 HValue*); | 4153 HValue*); |
| 4158 | 4154 |
| 4159 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) | 4155 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) |
| 4160 | 4156 |
| 4161 protected: | 4157 protected: |
| 4162 bool DataEquals(HValue* other) OVERRIDE { return true; } | 4158 bool DataEquals(HValue* other) override { return true; } |
| 4163 | 4159 |
| 4164 private: | 4160 private: |
| 4165 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) | 4161 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) |
| 4166 : HBinaryOperation(context, left, right) { | 4162 : HBinaryOperation(context, left, right) { |
| 4167 set_representation(Representation::Integer32()); | 4163 set_representation(Representation::Integer32()); |
| 4168 SetFlag(kUseGVN); | 4164 SetFlag(kUseGVN); |
| 4169 SetFlag(kCanOverflow); | 4165 SetFlag(kCanOverflow); |
| 4170 SetFlag(kCanBeDivByZero); | 4166 SetFlag(kCanBeDivByZero); |
| 4171 SetFlag(kLeftCanBeMinInt); | 4167 SetFlag(kLeftCanBeMinInt); |
| 4172 SetFlag(kLeftCanBeNegative); | 4168 SetFlag(kLeftCanBeNegative); |
| 4173 SetFlag(kLeftCanBePositive); | 4169 SetFlag(kLeftCanBePositive); |
| 4174 SetFlag(kAllowUndefinedAsNaN); | 4170 SetFlag(kAllowUndefinedAsNaN); |
| 4175 } | 4171 } |
| 4176 | 4172 |
| 4177 Range* InferRange(Zone* zone) OVERRIDE; | 4173 Range* InferRange(Zone* zone) override; |
| 4178 | 4174 |
| 4179 bool IsDeletable() const OVERRIDE { return true; } | 4175 bool IsDeletable() const override { return true; } |
| 4180 }; | 4176 }; |
| 4181 | 4177 |
| 4182 | 4178 |
| 4183 class HArithmeticBinaryOperation : public HBinaryOperation { | 4179 class HArithmeticBinaryOperation : public HBinaryOperation { |
| 4184 public: | 4180 public: |
| 4185 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) | 4181 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) |
| 4186 : HBinaryOperation(context, left, right, HType::TaggedNumber()) { | 4182 : HBinaryOperation(context, left, right, HType::TaggedNumber()) { |
| 4187 SetAllSideEffects(); | 4183 SetAllSideEffects(); |
| 4188 SetFlag(kFlexibleRepresentation); | 4184 SetFlag(kFlexibleRepresentation); |
| 4189 SetFlag(kAllowUndefinedAsNaN); | 4185 SetFlag(kAllowUndefinedAsNaN); |
| 4190 } | 4186 } |
| 4191 | 4187 |
| 4192 void RepresentationChanged(Representation to) OVERRIDE { | 4188 void RepresentationChanged(Representation to) override { |
| 4193 if (to.IsTagged() && | 4189 if (to.IsTagged() && |
| 4194 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { | 4190 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { |
| 4195 SetAllSideEffects(); | 4191 SetAllSideEffects(); |
| 4196 ClearFlag(kUseGVN); | 4192 ClearFlag(kUseGVN); |
| 4197 } else { | 4193 } else { |
| 4198 ClearAllSideEffects(); | 4194 ClearAllSideEffects(); |
| 4199 SetFlag(kUseGVN); | 4195 SetFlag(kUseGVN); |
| 4200 } | 4196 } |
| 4201 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); | 4197 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); |
| 4202 } | 4198 } |
| 4203 | 4199 |
| 4204 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) | 4200 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) |
| 4205 | 4201 |
| 4206 private: | 4202 private: |
| 4207 bool IsDeletable() const OVERRIDE { return true; } | 4203 bool IsDeletable() const override { return true; } |
| 4208 }; | 4204 }; |
| 4209 | 4205 |
| 4210 | 4206 |
| 4211 class HCompareGeneric FINAL : public HBinaryOperation { | 4207 class HCompareGeneric final : public HBinaryOperation { |
| 4212 public: | 4208 public: |
| 4213 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGeneric, HValue*, | 4209 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGeneric, HValue*, |
| 4214 HValue*, Token::Value); | 4210 HValue*, Token::Value); |
| 4215 | 4211 |
| 4216 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4212 Representation RequiredInputRepresentation(int index) override { |
| 4217 return index == 0 | 4213 return index == 0 |
| 4218 ? Representation::Tagged() | 4214 ? Representation::Tagged() |
| 4219 : representation(); | 4215 : representation(); |
| 4220 } | 4216 } |
| 4221 | 4217 |
| 4222 Token::Value token() const { return token_; } | 4218 Token::Value token() const { return token_; } |
| 4223 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4219 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 4224 | 4220 |
| 4225 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) | 4221 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) |
| 4226 | 4222 |
| 4227 private: | 4223 private: |
| 4228 HCompareGeneric(HValue* context, | 4224 HCompareGeneric(HValue* context, |
| 4229 HValue* left, | 4225 HValue* left, |
| 4230 HValue* right, | 4226 HValue* right, |
| 4231 Token::Value token) | 4227 Token::Value token) |
| 4232 : HBinaryOperation(context, left, right, HType::Boolean()), | 4228 : HBinaryOperation(context, left, right, HType::Boolean()), |
| 4233 token_(token) { | 4229 token_(token) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 4251 HValue* left() const { return OperandAt(0); } | 4247 HValue* left() const { return OperandAt(0); } |
| 4252 HValue* right() const { return OperandAt(1); } | 4248 HValue* right() const { return OperandAt(1); } |
| 4253 Token::Value token() const { return token_; } | 4249 Token::Value token() const { return token_; } |
| 4254 | 4250 |
| 4255 void set_observed_input_representation(Representation left, | 4251 void set_observed_input_representation(Representation left, |
| 4256 Representation right) { | 4252 Representation right) { |
| 4257 observed_input_representation_[0] = left; | 4253 observed_input_representation_[0] = left; |
| 4258 observed_input_representation_[1] = right; | 4254 observed_input_representation_[1] = right; |
| 4259 } | 4255 } |
| 4260 | 4256 |
| 4261 virtual void InferRepresentation( | 4257 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
| 4262 HInferRepresentationPhase* h_infer) OVERRIDE; | |
| 4263 | 4258 |
| 4264 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4259 Representation RequiredInputRepresentation(int index) override { |
| 4265 return representation(); | 4260 return representation(); |
| 4266 } | 4261 } |
| 4267 Representation observed_input_representation(int index) OVERRIDE { | 4262 Representation observed_input_representation(int index) override { |
| 4268 return observed_input_representation_[index]; | 4263 return observed_input_representation_[index]; |
| 4269 } | 4264 } |
| 4270 | 4265 |
| 4271 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4266 bool KnownSuccessorBlock(HBasicBlock** block) override; |
| 4272 | 4267 |
| 4273 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4268 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 4274 | 4269 |
| 4275 void SetOperandPositions(Zone* zone, SourcePosition left_pos, | 4270 void SetOperandPositions(Zone* zone, SourcePosition left_pos, |
| 4276 SourcePosition right_pos) { | 4271 SourcePosition right_pos) { |
| 4277 set_operand_position(zone, 0, left_pos); | 4272 set_operand_position(zone, 0, left_pos); |
| 4278 set_operand_position(zone, 1, right_pos); | 4273 set_operand_position(zone, 1, right_pos); |
| 4279 } | 4274 } |
| 4280 | 4275 |
| 4281 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch) | 4276 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch) |
| 4282 | 4277 |
| 4283 private: | 4278 private: |
| 4284 HCompareNumericAndBranch(HValue* left, | 4279 HCompareNumericAndBranch(HValue* left, |
| 4285 HValue* right, | 4280 HValue* right, |
| 4286 Token::Value token, | 4281 Token::Value token, |
| 4287 HBasicBlock* true_target = NULL, | 4282 HBasicBlock* true_target = NULL, |
| 4288 HBasicBlock* false_target = NULL) | 4283 HBasicBlock* false_target = NULL) |
| 4289 : token_(token) { | 4284 : token_(token) { |
| 4290 SetFlag(kFlexibleRepresentation); | 4285 SetFlag(kFlexibleRepresentation); |
| 4291 DCHECK(Token::IsCompareOp(token)); | 4286 DCHECK(Token::IsCompareOp(token)); |
| 4292 SetOperandAt(0, left); | 4287 SetOperandAt(0, left); |
| 4293 SetOperandAt(1, right); | 4288 SetOperandAt(1, right); |
| 4294 SetSuccessorAt(0, true_target); | 4289 SetSuccessorAt(0, true_target); |
| 4295 SetSuccessorAt(1, false_target); | 4290 SetSuccessorAt(1, false_target); |
| 4296 } | 4291 } |
| 4297 | 4292 |
| 4298 Representation observed_input_representation_[2]; | 4293 Representation observed_input_representation_[2]; |
| 4299 Token::Value token_; | 4294 Token::Value token_; |
| 4300 }; | 4295 }; |
| 4301 | 4296 |
| 4302 | 4297 |
| 4303 class HCompareHoleAndBranch FINAL : public HUnaryControlInstruction { | 4298 class HCompareHoleAndBranch final : public HUnaryControlInstruction { |
| 4304 public: | 4299 public: |
| 4305 DECLARE_INSTRUCTION_FACTORY_P1(HCompareHoleAndBranch, HValue*); | 4300 DECLARE_INSTRUCTION_FACTORY_P1(HCompareHoleAndBranch, HValue*); |
| 4306 DECLARE_INSTRUCTION_FACTORY_P3(HCompareHoleAndBranch, HValue*, | 4301 DECLARE_INSTRUCTION_FACTORY_P3(HCompareHoleAndBranch, HValue*, |
| 4307 HBasicBlock*, HBasicBlock*); | 4302 HBasicBlock*, HBasicBlock*); |
| 4308 | 4303 |
| 4309 virtual void InferRepresentation( | 4304 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
| 4310 HInferRepresentationPhase* h_infer) OVERRIDE; | |
| 4311 | 4305 |
| 4312 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4306 Representation RequiredInputRepresentation(int index) override { |
| 4313 return representation(); | 4307 return representation(); |
| 4314 } | 4308 } |
| 4315 | 4309 |
| 4316 DECLARE_CONCRETE_INSTRUCTION(CompareHoleAndBranch) | 4310 DECLARE_CONCRETE_INSTRUCTION(CompareHoleAndBranch) |
| 4317 | 4311 |
| 4318 private: | 4312 private: |
| 4319 HCompareHoleAndBranch(HValue* value, | 4313 HCompareHoleAndBranch(HValue* value, |
| 4320 HBasicBlock* true_target = NULL, | 4314 HBasicBlock* true_target = NULL, |
| 4321 HBasicBlock* false_target = NULL) | 4315 HBasicBlock* false_target = NULL) |
| 4322 : HUnaryControlInstruction(value, true_target, false_target) { | 4316 : HUnaryControlInstruction(value, true_target, false_target) { |
| 4323 SetFlag(kFlexibleRepresentation); | 4317 SetFlag(kFlexibleRepresentation); |
| 4324 SetFlag(kAllowUndefinedAsNaN); | 4318 SetFlag(kAllowUndefinedAsNaN); |
| 4325 } | 4319 } |
| 4326 }; | 4320 }; |
| 4327 | 4321 |
| 4328 | 4322 |
| 4329 class HCompareMinusZeroAndBranch FINAL : public HUnaryControlInstruction { | 4323 class HCompareMinusZeroAndBranch final : public HUnaryControlInstruction { |
| 4330 public: | 4324 public: |
| 4331 DECLARE_INSTRUCTION_FACTORY_P1(HCompareMinusZeroAndBranch, HValue*); | 4325 DECLARE_INSTRUCTION_FACTORY_P1(HCompareMinusZeroAndBranch, HValue*); |
| 4332 | 4326 |
| 4333 virtual void InferRepresentation( | 4327 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
| 4334 HInferRepresentationPhase* h_infer) OVERRIDE; | |
| 4335 | 4328 |
| 4336 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4329 Representation RequiredInputRepresentation(int index) override { |
| 4337 return representation(); | 4330 return representation(); |
| 4338 } | 4331 } |
| 4339 | 4332 |
| 4340 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4333 bool KnownSuccessorBlock(HBasicBlock** block) override; |
| 4341 | 4334 |
| 4342 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch) | 4335 DECLARE_CONCRETE_INSTRUCTION(CompareMinusZeroAndBranch) |
| 4343 | 4336 |
| 4344 private: | 4337 private: |
| 4345 explicit HCompareMinusZeroAndBranch(HValue* value) | 4338 explicit HCompareMinusZeroAndBranch(HValue* value) |
| 4346 : HUnaryControlInstruction(value, NULL, NULL) { | 4339 : HUnaryControlInstruction(value, NULL, NULL) { |
| 4347 } | 4340 } |
| 4348 }; | 4341 }; |
| 4349 | 4342 |
| 4350 | 4343 |
| 4351 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> { | 4344 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> { |
| 4352 public: | 4345 public: |
| 4353 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*); | 4346 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*); |
| 4354 DECLARE_INSTRUCTION_FACTORY_P4(HCompareObjectEqAndBranch, HValue*, HValue*, | 4347 DECLARE_INSTRUCTION_FACTORY_P4(HCompareObjectEqAndBranch, HValue*, HValue*, |
| 4355 HBasicBlock*, HBasicBlock*); | 4348 HBasicBlock*, HBasicBlock*); |
| 4356 | 4349 |
| 4357 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4350 bool KnownSuccessorBlock(HBasicBlock** block) override; |
| 4358 | 4351 |
| 4359 static const int kNoKnownSuccessorIndex = -1; | 4352 static const int kNoKnownSuccessorIndex = -1; |
| 4360 int known_successor_index() const { return known_successor_index_; } | 4353 int known_successor_index() const { return known_successor_index_; } |
| 4361 void set_known_successor_index(int known_successor_index) { | 4354 void set_known_successor_index(int known_successor_index) { |
| 4362 known_successor_index_ = known_successor_index; | 4355 known_successor_index_ = known_successor_index; |
| 4363 } | 4356 } |
| 4364 | 4357 |
| 4365 HValue* left() const { return OperandAt(0); } | 4358 HValue* left() const { return OperandAt(0); } |
| 4366 HValue* right() const { return OperandAt(1); } | 4359 HValue* right() const { return OperandAt(1); } |
| 4367 | 4360 |
| 4368 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4361 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 4369 | 4362 |
| 4370 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4363 Representation RequiredInputRepresentation(int index) override { |
| 4371 return Representation::Tagged(); | 4364 return Representation::Tagged(); |
| 4372 } | 4365 } |
| 4373 | 4366 |
| 4374 Representation observed_input_representation(int index) OVERRIDE { | 4367 Representation observed_input_representation(int index) override { |
| 4375 return Representation::Tagged(); | 4368 return Representation::Tagged(); |
| 4376 } | 4369 } |
| 4377 | 4370 |
| 4378 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) | 4371 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) |
| 4379 | 4372 |
| 4380 private: | 4373 private: |
| 4381 HCompareObjectEqAndBranch(HValue* left, | 4374 HCompareObjectEqAndBranch(HValue* left, |
| 4382 HValue* right, | 4375 HValue* right, |
| 4383 HBasicBlock* true_target = NULL, | 4376 HBasicBlock* true_target = NULL, |
| 4384 HBasicBlock* false_target = NULL) | 4377 HBasicBlock* false_target = NULL) |
| 4385 : known_successor_index_(kNoKnownSuccessorIndex) { | 4378 : known_successor_index_(kNoKnownSuccessorIndex) { |
| 4386 SetOperandAt(0, left); | 4379 SetOperandAt(0, left); |
| 4387 SetOperandAt(1, right); | 4380 SetOperandAt(1, right); |
| 4388 SetSuccessorAt(0, true_target); | 4381 SetSuccessorAt(0, true_target); |
| 4389 SetSuccessorAt(1, false_target); | 4382 SetSuccessorAt(1, false_target); |
| 4390 } | 4383 } |
| 4391 | 4384 |
| 4392 int known_successor_index_; | 4385 int known_successor_index_; |
| 4393 }; | 4386 }; |
| 4394 | 4387 |
| 4395 | 4388 |
| 4396 class HIsObjectAndBranch FINAL : public HUnaryControlInstruction { | 4389 class HIsObjectAndBranch final : public HUnaryControlInstruction { |
| 4397 public: | 4390 public: |
| 4398 DECLARE_INSTRUCTION_FACTORY_P1(HIsObjectAndBranch, HValue*); | 4391 DECLARE_INSTRUCTION_FACTORY_P1(HIsObjectAndBranch, HValue*); |
| 4399 DECLARE_INSTRUCTION_FACTORY_P3(HIsObjectAndBranch, HValue*, | 4392 DECLARE_INSTRUCTION_FACTORY_P3(HIsObjectAndBranch, HValue*, |
| 4400 HBasicBlock*, HBasicBlock*); | 4393 HBasicBlock*, HBasicBlock*); |
| 4401 | 4394 |
| 4402 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4395 Representation RequiredInputRepresentation(int index) override { |
| 4403 return Representation::Tagged(); | 4396 return Representation::Tagged(); |
| 4404 } | 4397 } |
| 4405 | 4398 |
| 4406 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4399 bool KnownSuccessorBlock(HBasicBlock** block) override; |
| 4407 | 4400 |
| 4408 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) | 4401 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) |
| 4409 | 4402 |
| 4410 private: | 4403 private: |
| 4411 HIsObjectAndBranch(HValue* value, | 4404 HIsObjectAndBranch(HValue* value, |
| 4412 HBasicBlock* true_target = NULL, | 4405 HBasicBlock* true_target = NULL, |
| 4413 HBasicBlock* false_target = NULL) | 4406 HBasicBlock* false_target = NULL) |
| 4414 : HUnaryControlInstruction(value, true_target, false_target) {} | 4407 : HUnaryControlInstruction(value, true_target, false_target) {} |
| 4415 }; | 4408 }; |
| 4416 | 4409 |
| 4417 | 4410 |
| 4418 class HIsStringAndBranch FINAL : public HUnaryControlInstruction { | 4411 class HIsStringAndBranch final : public HUnaryControlInstruction { |
| 4419 public: | 4412 public: |
| 4420 DECLARE_INSTRUCTION_FACTORY_P1(HIsStringAndBranch, HValue*); | 4413 DECLARE_INSTRUCTION_FACTORY_P1(HIsStringAndBranch, HValue*); |
| 4421 DECLARE_INSTRUCTION_FACTORY_P3(HIsStringAndBranch, HValue*, | 4414 DECLARE_INSTRUCTION_FACTORY_P3(HIsStringAndBranch, HValue*, |
| 4422 HBasicBlock*, HBasicBlock*); | 4415 HBasicBlock*, HBasicBlock*); |
| 4423 | 4416 |
| 4424 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4417 Representation RequiredInputRepresentation(int index) override { |
| 4425 return Representation::Tagged(); | 4418 return Representation::Tagged(); |
| 4426 } | 4419 } |
| 4427 | 4420 |
| 4428 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4421 bool KnownSuccessorBlock(HBasicBlock** block) override; |
| 4429 | 4422 |
| 4430 static const int kNoKnownSuccessorIndex = -1; | 4423 static const int kNoKnownSuccessorIndex = -1; |
| 4431 int known_successor_index() const { return known_successor_index_; } | 4424 int known_successor_index() const { return known_successor_index_; } |
| 4432 void set_known_successor_index(int known_successor_index) { | 4425 void set_known_successor_index(int known_successor_index) { |
| 4433 known_successor_index_ = known_successor_index; | 4426 known_successor_index_ = known_successor_index; |
| 4434 } | 4427 } |
| 4435 | 4428 |
| 4436 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch) | 4429 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch) |
| 4437 | 4430 |
| 4438 protected: | 4431 protected: |
| 4439 int RedefinedOperandIndex() OVERRIDE { return 0; } | 4432 int RedefinedOperandIndex() override { return 0; } |
| 4440 | 4433 |
| 4441 private: | 4434 private: |
| 4442 HIsStringAndBranch(HValue* value, HBasicBlock* true_target = NULL, | 4435 HIsStringAndBranch(HValue* value, HBasicBlock* true_target = NULL, |
| 4443 HBasicBlock* false_target = NULL) | 4436 HBasicBlock* false_target = NULL) |
| 4444 : HUnaryControlInstruction(value, true_target, false_target), | 4437 : HUnaryControlInstruction(value, true_target, false_target), |
| 4445 known_successor_index_(kNoKnownSuccessorIndex) { | 4438 known_successor_index_(kNoKnownSuccessorIndex) { |
| 4446 set_representation(Representation::Tagged()); | 4439 set_representation(Representation::Tagged()); |
| 4447 } | 4440 } |
| 4448 | 4441 |
| 4449 int known_successor_index_; | 4442 int known_successor_index_; |
| 4450 }; | 4443 }; |
| 4451 | 4444 |
| 4452 | 4445 |
| 4453 class HIsSmiAndBranch FINAL : public HUnaryControlInstruction { | 4446 class HIsSmiAndBranch final : public HUnaryControlInstruction { |
| 4454 public: | 4447 public: |
| 4455 DECLARE_INSTRUCTION_FACTORY_P1(HIsSmiAndBranch, HValue*); | 4448 DECLARE_INSTRUCTION_FACTORY_P1(HIsSmiAndBranch, HValue*); |
| 4456 DECLARE_INSTRUCTION_FACTORY_P3(HIsSmiAndBranch, HValue*, | 4449 DECLARE_INSTRUCTION_FACTORY_P3(HIsSmiAndBranch, HValue*, |
| 4457 HBasicBlock*, HBasicBlock*); | 4450 HBasicBlock*, HBasicBlock*); |
| 4458 | 4451 |
| 4459 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) | 4452 DECLARE_CONCRETE_INSTRUCTION(IsSmiAndBranch) |
| 4460 | 4453 |
| 4461 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4454 Representation RequiredInputRepresentation(int index) override { |
| 4462 return Representation::Tagged(); | 4455 return Representation::Tagged(); |
| 4463 } | 4456 } |
| 4464 | 4457 |
| 4465 protected: | 4458 protected: |
| 4466 bool DataEquals(HValue* other) OVERRIDE { return true; } | 4459 bool DataEquals(HValue* other) override { return true; } |
| 4467 int RedefinedOperandIndex() OVERRIDE { return 0; } | 4460 int RedefinedOperandIndex() override { return 0; } |
| 4468 | 4461 |
| 4469 private: | 4462 private: |
| 4470 HIsSmiAndBranch(HValue* value, | 4463 HIsSmiAndBranch(HValue* value, |
| 4471 HBasicBlock* true_target = NULL, | 4464 HBasicBlock* true_target = NULL, |
| 4472 HBasicBlock* false_target = NULL) | 4465 HBasicBlock* false_target = NULL) |
| 4473 : HUnaryControlInstruction(value, true_target, false_target) { | 4466 : HUnaryControlInstruction(value, true_target, false_target) { |
| 4474 set_representation(Representation::Tagged()); | 4467 set_representation(Representation::Tagged()); |
| 4475 } | 4468 } |
| 4476 }; | 4469 }; |
| 4477 | 4470 |
| 4478 | 4471 |
| 4479 class HIsUndetectableAndBranch FINAL : public HUnaryControlInstruction { | 4472 class HIsUndetectableAndBranch final : public HUnaryControlInstruction { |
| 4480 public: | 4473 public: |
| 4481 DECLARE_INSTRUCTION_FACTORY_P1(HIsUndetectableAndBranch, HValue*); | 4474 DECLARE_INSTRUCTION_FACTORY_P1(HIsUndetectableAndBranch, HValue*); |
| 4482 DECLARE_INSTRUCTION_FACTORY_P3(HIsUndetectableAndBranch, HValue*, | 4475 DECLARE_INSTRUCTION_FACTORY_P3(HIsUndetectableAndBranch, HValue*, |
| 4483 HBasicBlock*, HBasicBlock*); | 4476 HBasicBlock*, HBasicBlock*); |
| 4484 | 4477 |
| 4485 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4478 Representation RequiredInputRepresentation(int index) override { |
| 4486 return Representation::Tagged(); | 4479 return Representation::Tagged(); |
| 4487 } | 4480 } |
| 4488 | 4481 |
| 4489 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4482 bool KnownSuccessorBlock(HBasicBlock** block) override; |
| 4490 | 4483 |
| 4491 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) | 4484 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) |
| 4492 | 4485 |
| 4493 private: | 4486 private: |
| 4494 HIsUndetectableAndBranch(HValue* value, | 4487 HIsUndetectableAndBranch(HValue* value, |
| 4495 HBasicBlock* true_target = NULL, | 4488 HBasicBlock* true_target = NULL, |
| 4496 HBasicBlock* false_target = NULL) | 4489 HBasicBlock* false_target = NULL) |
| 4497 : HUnaryControlInstruction(value, true_target, false_target) {} | 4490 : HUnaryControlInstruction(value, true_target, false_target) {} |
| 4498 }; | 4491 }; |
| 4499 | 4492 |
| 4500 | 4493 |
| 4501 class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> { | 4494 class HStringCompareAndBranch : public HTemplateControlInstruction<2, 3> { |
| 4502 public: | 4495 public: |
| 4503 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HStringCompareAndBranch, | 4496 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HStringCompareAndBranch, |
| 4504 HValue*, | 4497 HValue*, |
| 4505 HValue*, | 4498 HValue*, |
| 4506 Token::Value); | 4499 Token::Value); |
| 4507 | 4500 |
| 4508 HValue* context() { return OperandAt(0); } | 4501 HValue* context() { return OperandAt(0); } |
| 4509 HValue* left() { return OperandAt(1); } | 4502 HValue* left() { return OperandAt(1); } |
| 4510 HValue* right() { return OperandAt(2); } | 4503 HValue* right() { return OperandAt(2); } |
| 4511 Token::Value token() const { return token_; } | 4504 Token::Value token() const { return token_; } |
| 4512 | 4505 |
| 4513 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4506 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 4514 | 4507 |
| 4515 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4508 Representation RequiredInputRepresentation(int index) override { |
| 4516 return Representation::Tagged(); | 4509 return Representation::Tagged(); |
| 4517 } | 4510 } |
| 4518 | 4511 |
| 4519 Representation GetInputRepresentation() const { | 4512 Representation GetInputRepresentation() const { |
| 4520 return Representation::Tagged(); | 4513 return Representation::Tagged(); |
| 4521 } | 4514 } |
| 4522 | 4515 |
| 4523 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch) | 4516 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch) |
| 4524 | 4517 |
| 4525 private: | 4518 private: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4537 } | 4530 } |
| 4538 | 4531 |
| 4539 Token::Value token_; | 4532 Token::Value token_; |
| 4540 }; | 4533 }; |
| 4541 | 4534 |
| 4542 | 4535 |
| 4543 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> { | 4536 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> { |
| 4544 public: | 4537 public: |
| 4545 DECLARE_INSTRUCTION_FACTORY_P0(HIsConstructCallAndBranch); | 4538 DECLARE_INSTRUCTION_FACTORY_P0(HIsConstructCallAndBranch); |
| 4546 | 4539 |
| 4547 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4540 Representation RequiredInputRepresentation(int index) override { |
| 4548 return Representation::None(); | 4541 return Representation::None(); |
| 4549 } | 4542 } |
| 4550 | 4543 |
| 4551 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) | 4544 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch) |
| 4552 private: | 4545 private: |
| 4553 HIsConstructCallAndBranch() {} | 4546 HIsConstructCallAndBranch() {} |
| 4554 }; | 4547 }; |
| 4555 | 4548 |
| 4556 | 4549 |
| 4557 class HHasInstanceTypeAndBranch FINAL : public HUnaryControlInstruction { | 4550 class HHasInstanceTypeAndBranch final : public HUnaryControlInstruction { |
| 4558 public: | 4551 public: |
| 4559 DECLARE_INSTRUCTION_FACTORY_P2( | 4552 DECLARE_INSTRUCTION_FACTORY_P2( |
| 4560 HHasInstanceTypeAndBranch, HValue*, InstanceType); | 4553 HHasInstanceTypeAndBranch, HValue*, InstanceType); |
| 4561 DECLARE_INSTRUCTION_FACTORY_P3( | 4554 DECLARE_INSTRUCTION_FACTORY_P3( |
| 4562 HHasInstanceTypeAndBranch, HValue*, InstanceType, InstanceType); | 4555 HHasInstanceTypeAndBranch, HValue*, InstanceType, InstanceType); |
| 4563 | 4556 |
| 4564 InstanceType from() { return from_; } | 4557 InstanceType from() { return from_; } |
| 4565 InstanceType to() { return to_; } | 4558 InstanceType to() { return to_; } |
| 4566 | 4559 |
| 4567 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4560 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 4568 | 4561 |
| 4569 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4562 Representation RequiredInputRepresentation(int index) override { |
| 4570 return Representation::Tagged(); | 4563 return Representation::Tagged(); |
| 4571 } | 4564 } |
| 4572 | 4565 |
| 4573 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4566 bool KnownSuccessorBlock(HBasicBlock** block) override; |
| 4574 | 4567 |
| 4575 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) | 4568 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) |
| 4576 | 4569 |
| 4577 private: | 4570 private: |
| 4578 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) | 4571 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) |
| 4579 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } | 4572 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } |
| 4580 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) | 4573 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) |
| 4581 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { | 4574 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { |
| 4582 DCHECK(to == LAST_TYPE); // Others not implemented yet in backend. | 4575 DCHECK(to == LAST_TYPE); // Others not implemented yet in backend. |
| 4583 } | 4576 } |
| 4584 | 4577 |
| 4585 InstanceType from_; | 4578 InstanceType from_; |
| 4586 InstanceType to_; // Inclusive range, not all combinations work. | 4579 InstanceType to_; // Inclusive range, not all combinations work. |
| 4587 }; | 4580 }; |
| 4588 | 4581 |
| 4589 | 4582 |
| 4590 class HHasCachedArrayIndexAndBranch FINAL : public HUnaryControlInstruction { | 4583 class HHasCachedArrayIndexAndBranch final : public HUnaryControlInstruction { |
| 4591 public: | 4584 public: |
| 4592 DECLARE_INSTRUCTION_FACTORY_P1(HHasCachedArrayIndexAndBranch, HValue*); | 4585 DECLARE_INSTRUCTION_FACTORY_P1(HHasCachedArrayIndexAndBranch, HValue*); |
| 4593 | 4586 |
| 4594 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4587 Representation RequiredInputRepresentation(int index) override { |
| 4595 return Representation::Tagged(); | 4588 return Representation::Tagged(); |
| 4596 } | 4589 } |
| 4597 | 4590 |
| 4598 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch) | 4591 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch) |
| 4599 private: | 4592 private: |
| 4600 explicit HHasCachedArrayIndexAndBranch(HValue* value) | 4593 explicit HHasCachedArrayIndexAndBranch(HValue* value) |
| 4601 : HUnaryControlInstruction(value, NULL, NULL) { } | 4594 : HUnaryControlInstruction(value, NULL, NULL) { } |
| 4602 }; | 4595 }; |
| 4603 | 4596 |
| 4604 | 4597 |
| 4605 class HGetCachedArrayIndex FINAL : public HUnaryOperation { | 4598 class HGetCachedArrayIndex final : public HUnaryOperation { |
| 4606 public: | 4599 public: |
| 4607 DECLARE_INSTRUCTION_FACTORY_P1(HGetCachedArrayIndex, HValue*); | 4600 DECLARE_INSTRUCTION_FACTORY_P1(HGetCachedArrayIndex, HValue*); |
| 4608 | 4601 |
| 4609 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4602 Representation RequiredInputRepresentation(int index) override { |
| 4610 return Representation::Tagged(); | 4603 return Representation::Tagged(); |
| 4611 } | 4604 } |
| 4612 | 4605 |
| 4613 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) | 4606 DECLARE_CONCRETE_INSTRUCTION(GetCachedArrayIndex) |
| 4614 | 4607 |
| 4615 protected: | 4608 protected: |
| 4616 bool DataEquals(HValue* other) OVERRIDE { return true; } | 4609 bool DataEquals(HValue* other) override { return true; } |
| 4617 | 4610 |
| 4618 private: | 4611 private: |
| 4619 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) { | 4612 explicit HGetCachedArrayIndex(HValue* value) : HUnaryOperation(value) { |
| 4620 set_representation(Representation::Tagged()); | 4613 set_representation(Representation::Tagged()); |
| 4621 SetFlag(kUseGVN); | 4614 SetFlag(kUseGVN); |
| 4622 } | 4615 } |
| 4623 | 4616 |
| 4624 bool IsDeletable() const OVERRIDE { return true; } | 4617 bool IsDeletable() const override { return true; } |
| 4625 }; | 4618 }; |
| 4626 | 4619 |
| 4627 | 4620 |
| 4628 class HClassOfTestAndBranch FINAL : public HUnaryControlInstruction { | 4621 class HClassOfTestAndBranch final : public HUnaryControlInstruction { |
| 4629 public: | 4622 public: |
| 4630 DECLARE_INSTRUCTION_FACTORY_P2(HClassOfTestAndBranch, HValue*, | 4623 DECLARE_INSTRUCTION_FACTORY_P2(HClassOfTestAndBranch, HValue*, |
| 4631 Handle<String>); | 4624 Handle<String>); |
| 4632 | 4625 |
| 4633 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) | 4626 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) |
| 4634 | 4627 |
| 4635 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4628 Representation RequiredInputRepresentation(int index) override { |
| 4636 return Representation::Tagged(); | 4629 return Representation::Tagged(); |
| 4637 } | 4630 } |
| 4638 | 4631 |
| 4639 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4632 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 4640 | 4633 |
| 4641 Handle<String> class_name() const { return class_name_; } | 4634 Handle<String> class_name() const { return class_name_; } |
| 4642 | 4635 |
| 4643 private: | 4636 private: |
| 4644 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) | 4637 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) |
| 4645 : HUnaryControlInstruction(value, NULL, NULL), | 4638 : HUnaryControlInstruction(value, NULL, NULL), |
| 4646 class_name_(class_name) { } | 4639 class_name_(class_name) { } |
| 4647 | 4640 |
| 4648 Handle<String> class_name_; | 4641 Handle<String> class_name_; |
| 4649 }; | 4642 }; |
| 4650 | 4643 |
| 4651 | 4644 |
| 4652 class HTypeofIsAndBranch FINAL : public HUnaryControlInstruction { | 4645 class HTypeofIsAndBranch final : public HUnaryControlInstruction { |
| 4653 public: | 4646 public: |
| 4654 DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>); | 4647 DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>); |
| 4655 | 4648 |
| 4656 Handle<String> type_literal() const { return type_literal_.handle(); } | 4649 Handle<String> type_literal() const { return type_literal_.handle(); } |
| 4657 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4650 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 4658 | 4651 |
| 4659 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) | 4652 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) |
| 4660 | 4653 |
| 4661 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4654 Representation RequiredInputRepresentation(int index) override { |
| 4662 return Representation::None(); | 4655 return Representation::None(); |
| 4663 } | 4656 } |
| 4664 | 4657 |
| 4665 bool KnownSuccessorBlock(HBasicBlock** block) OVERRIDE; | 4658 bool KnownSuccessorBlock(HBasicBlock** block) override; |
| 4666 | 4659 |
| 4667 void FinalizeUniqueness() OVERRIDE { | 4660 void FinalizeUniqueness() override { |
| 4668 type_literal_ = Unique<String>(type_literal_.handle()); | 4661 type_literal_ = Unique<String>(type_literal_.handle()); |
| 4669 } | 4662 } |
| 4670 | 4663 |
| 4671 private: | 4664 private: |
| 4672 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) | 4665 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) |
| 4673 : HUnaryControlInstruction(value, NULL, NULL), | 4666 : HUnaryControlInstruction(value, NULL, NULL), |
| 4674 type_literal_(Unique<String>::CreateUninitialized(type_literal)) { } | 4667 type_literal_(Unique<String>::CreateUninitialized(type_literal)) { } |
| 4675 | 4668 |
| 4676 Unique<String> type_literal_; | 4669 Unique<String> type_literal_; |
| 4677 }; | 4670 }; |
| 4678 | 4671 |
| 4679 | 4672 |
| 4680 class HInstanceOf FINAL : public HBinaryOperation { | 4673 class HInstanceOf final : public HBinaryOperation { |
| 4681 public: | 4674 public: |
| 4682 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOf, HValue*, HValue*); | 4675 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOf, HValue*, HValue*); |
| 4683 | 4676 |
| 4684 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4677 Representation RequiredInputRepresentation(int index) override { |
| 4685 return Representation::Tagged(); | 4678 return Representation::Tagged(); |
| 4686 } | 4679 } |
| 4687 | 4680 |
| 4688 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 4681 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 4689 | 4682 |
| 4690 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) | 4683 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) |
| 4691 | 4684 |
| 4692 private: | 4685 private: |
| 4693 HInstanceOf(HValue* context, HValue* left, HValue* right) | 4686 HInstanceOf(HValue* context, HValue* left, HValue* right) |
| 4694 : HBinaryOperation(context, left, right, HType::Boolean()) { | 4687 : HBinaryOperation(context, left, right, HType::Boolean()) { |
| 4695 set_representation(Representation::Tagged()); | 4688 set_representation(Representation::Tagged()); |
| 4696 SetAllSideEffects(); | 4689 SetAllSideEffects(); |
| 4697 } | 4690 } |
| 4698 }; | 4691 }; |
| 4699 | 4692 |
| 4700 | 4693 |
| 4701 class HInstanceOfKnownGlobal FINAL : public HTemplateInstruction<2> { | 4694 class HInstanceOfKnownGlobal final : public HTemplateInstruction<2> { |
| 4702 public: | 4695 public: |
| 4703 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal, | 4696 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOfKnownGlobal, |
| 4704 HValue*, | 4697 HValue*, |
| 4705 Handle<JSFunction>); | 4698 Handle<JSFunction>); |
| 4706 | 4699 |
| 4707 HValue* context() { return OperandAt(0); } | 4700 HValue* context() { return OperandAt(0); } |
| 4708 HValue* left() { return OperandAt(1); } | 4701 HValue* left() { return OperandAt(1); } |
| 4709 Handle<JSFunction> function() { return function_; } | 4702 Handle<JSFunction> function() { return function_; } |
| 4710 | 4703 |
| 4711 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4704 Representation RequiredInputRepresentation(int index) override { |
| 4712 return Representation::Tagged(); | 4705 return Representation::Tagged(); |
| 4713 } | 4706 } |
| 4714 | 4707 |
| 4715 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) | 4708 DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal) |
| 4716 | 4709 |
| 4717 private: | 4710 private: |
| 4718 HInstanceOfKnownGlobal(HValue* context, | 4711 HInstanceOfKnownGlobal(HValue* context, |
| 4719 HValue* left, | 4712 HValue* left, |
| 4720 Handle<JSFunction> right) | 4713 Handle<JSFunction> right) |
| 4721 : HTemplateInstruction<2>(HType::Boolean()), function_(right) { | 4714 : HTemplateInstruction<2>(HType::Boolean()), function_(right) { |
| 4722 SetOperandAt(0, context); | 4715 SetOperandAt(0, context); |
| 4723 SetOperandAt(1, left); | 4716 SetOperandAt(1, left); |
| 4724 set_representation(Representation::Tagged()); | 4717 set_representation(Representation::Tagged()); |
| 4725 SetAllSideEffects(); | 4718 SetAllSideEffects(); |
| 4726 } | 4719 } |
| 4727 | 4720 |
| 4728 Handle<JSFunction> function_; | 4721 Handle<JSFunction> function_; |
| 4729 }; | 4722 }; |
| 4730 | 4723 |
| 4731 | 4724 |
| 4732 class HPower FINAL : public HTemplateInstruction<2> { | 4725 class HPower final : public HTemplateInstruction<2> { |
| 4733 public: | 4726 public: |
| 4734 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4727 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 4735 HValue* left, HValue* right); | 4728 HValue* left, HValue* right); |
| 4736 | 4729 |
| 4737 HValue* left() { return OperandAt(0); } | 4730 HValue* left() { return OperandAt(0); } |
| 4738 HValue* right() const { return OperandAt(1); } | 4731 HValue* right() const { return OperandAt(1); } |
| 4739 | 4732 |
| 4740 Representation RequiredInputRepresentation(int index) OVERRIDE { | 4733 Representation RequiredInputRepresentation(int index) override { |
| 4741 return index == 0 | 4734 return index == 0 |
| 4742 ? Representation::Double() | 4735 ? Representation::Double() |
| 4743 : Representation::None(); | 4736 : Representation::None(); |
| 4744 } | 4737 } |
| 4745 Representation observed_input_representation(int index) OVERRIDE { | 4738 Representation observed_input_representation(int index) override { |
| 4746 return RequiredInputRepresentation(index); | 4739 return RequiredInputRepresentation(index); |
| 4747 } | 4740 } |
| 4748 | 4741 |
| 4749 DECLARE_CONCRETE_INSTRUCTION(Power) | 4742 DECLARE_CONCRETE_INSTRUCTION(Power) |
| 4750 | 4743 |
| 4751 protected: | 4744 protected: |
| 4752 bool DataEquals(HValue* other) OVERRIDE { return true; } | 4745 bool DataEquals(HValue* other) override { return true; } |
| 4753 | 4746 |
| 4754 private: | 4747 private: |
| 4755 HPower(HValue* left, HValue* right) { | 4748 HPower(HValue* left, HValue* right) { |
| 4756 SetOperandAt(0, left); | 4749 SetOperandAt(0, left); |
| 4757 SetOperandAt(1, right); | 4750 SetOperandAt(1, right); |
| 4758 set_representation(Representation::Double()); | 4751 set_representation(Representation::Double()); |
| 4759 SetFlag(kUseGVN); | 4752 SetFlag(kUseGVN); |
| 4760 SetChangesFlag(kNewSpacePromotion); | 4753 SetChangesFlag(kNewSpacePromotion); |
| 4761 } | 4754 } |
| 4762 | 4755 |
| 4763 bool IsDeletable() const OVERRIDE { | 4756 bool IsDeletable() const override { |
| 4764 return !right()->representation().IsTagged(); | 4757 return !right()->representation().IsTagged(); |
| 4765 } | 4758 } |
| 4766 }; | 4759 }; |
| 4767 | 4760 |
| 4768 | 4761 |
| 4769 class HAdd FINAL : public HArithmeticBinaryOperation { | 4762 class HAdd final : public HArithmeticBinaryOperation { |
| 4770 public: | 4763 public: |
| 4771 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4764 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 4772 HValue* left, HValue* right); | 4765 HValue* left, HValue* right); |
| 4773 | 4766 |
| 4774 // Add is only commutative if two integer values are added and not if two | 4767 // Add is only commutative if two integer values are added and not if two |
| 4775 // tagged values are added (because it might be a String concatenation). | 4768 // tagged values are added (because it might be a String concatenation). |
| 4776 // We also do not commute (pointer + offset). | 4769 // We also do not commute (pointer + offset). |
| 4777 bool IsCommutative() const OVERRIDE { | 4770 bool IsCommutative() const override { |
| 4778 return !representation().IsTagged() && !representation().IsExternal(); | 4771 return !representation().IsTagged() && !representation().IsExternal(); |
| 4779 } | 4772 } |
| 4780 | 4773 |
| 4781 HValue* Canonicalize() OVERRIDE; | 4774 HValue* Canonicalize() override; |
| 4782 | 4775 |
| 4783 bool TryDecompose(DecompositionResult* decomposition) OVERRIDE { | 4776 bool TryDecompose(DecompositionResult* decomposition) override { |
| 4784 if (left()->IsInteger32Constant()) { | 4777 if (left()->IsInteger32Constant()) { |
| 4785 decomposition->Apply(right(), left()->GetInteger32Constant()); | 4778 decomposition->Apply(right(), left()->GetInteger32Constant()); |
| 4786 return true; | 4779 return true; |
| 4787 } else if (right()->IsInteger32Constant()) { | 4780 } else if (right()->IsInteger32Constant()) { |
| 4788 decomposition->Apply(left(), right()->GetInteger32Constant()); | 4781 decomposition->Apply(left(), right()->GetInteger32Constant()); |
| 4789 return true; | 4782 return true; |
| 4790 } else { | 4783 } else { |
| 4791 return false; | 4784 return false; |
| 4792 } | 4785 } |
| 4793 } | 4786 } |
| 4794 | 4787 |
| 4795 void RepresentationChanged(Representation to) OVERRIDE { | 4788 void RepresentationChanged(Representation to) override { |
| 4796 if (to.IsTagged() && | 4789 if (to.IsTagged() && |
| 4797 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || | 4790 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || |
| 4798 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { | 4791 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { |
| 4799 SetAllSideEffects(); | 4792 SetAllSideEffects(); |
| 4800 ClearFlag(kUseGVN); | 4793 ClearFlag(kUseGVN); |
| 4801 } else { | 4794 } else { |
| 4802 ClearAllSideEffects(); | 4795 ClearAllSideEffects(); |
| 4803 SetFlag(kUseGVN); | 4796 SetFlag(kUseGVN); |
| 4804 } | 4797 } |
| 4805 if (to.IsTagged()) { | 4798 if (to.IsTagged()) { |
| 4806 SetChangesFlag(kNewSpacePromotion); | 4799 SetChangesFlag(kNewSpacePromotion); |
| 4807 ClearFlag(kAllowUndefinedAsNaN); | 4800 ClearFlag(kAllowUndefinedAsNaN); |
| 4808 } | 4801 } |
| 4809 } | 4802 } |
| 4810 | 4803 |
| 4811 Representation RepresentationFromInputs() OVERRIDE; | 4804 Representation RepresentationFromInputs() override; |
| 4812 | 4805 |
| 4813 Representation RequiredInputRepresentation(int index) OVERRIDE; | 4806 Representation RequiredInputRepresentation(int index) override; |
| 4814 | 4807 |
| 4815 DECLARE_CONCRETE_INSTRUCTION(Add) | 4808 DECLARE_CONCRETE_INSTRUCTION(Add) |
| 4816 | 4809 |
| 4817 protected: | 4810 protected: |
| 4818 bool DataEquals(HValue* other) OVERRIDE { return true; } | 4811 bool DataEquals(HValue* other) override { return true; } |
| 4819 | 4812 |
| 4820 Range* InferRange(Zone* zone) OVERRIDE; | 4813 Range* InferRange(Zone* zone) override; |
| 4821 | 4814 |
| 4822 private: | 4815 private: |
| 4823 HAdd(HValue* context, HValue* left, HValue* right) | 4816 HAdd(HValue* context, HValue* left, HValue* right) |
| 4824 : HArithmeticBinaryOperation(context, left, right) { | 4817 : HArithmeticBinaryOperation(context, left, right) { |
| 4825 SetFlag(kCanOverflow); | 4818 SetFlag(kCanOverflow); |
| 4826 } | 4819 } |
| 4827 }; | 4820 }; |
| 4828 | 4821 |
| 4829 | 4822 |
| 4830 class HSub FINAL : public HArithmeticBinaryOperation { | 4823 class HSub final : public HArithmeticBinaryOperation { |
| 4831 public: | 4824 public: |
| 4832 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4825 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 4833 HValue* left, HValue* right); | 4826 HValue* left, HValue* right); |
| 4834 | 4827 |
| 4835 HValue* Canonicalize() OVERRIDE; | 4828 HValue* Canonicalize() override; |
| 4836 | 4829 |
| 4837 bool TryDecompose(DecompositionResult* decomposition) OVERRIDE { | 4830 bool TryDecompose(DecompositionResult* decomposition) override { |
| 4838 if (right()->IsInteger32Constant()) { | 4831 if (right()->IsInteger32Constant()) { |
| 4839 decomposition->Apply(left(), -right()->GetInteger32Constant()); | 4832 decomposition->Apply(left(), -right()->GetInteger32Constant()); |
| 4840 return true; | 4833 return true; |
| 4841 } else { | 4834 } else { |
| 4842 return false; | 4835 return false; |
| 4843 } | 4836 } |
| 4844 } | 4837 } |
| 4845 | 4838 |
| 4846 DECLARE_CONCRETE_INSTRUCTION(Sub) | 4839 DECLARE_CONCRETE_INSTRUCTION(Sub) |
| 4847 | 4840 |
| 4848 protected: | 4841 protected: |
| 4849 bool DataEquals(HValue* other) OVERRIDE { return true; } | 4842 bool DataEquals(HValue* other) override { return true; } |
| 4850 | 4843 |
| 4851 Range* InferRange(Zone* zone) OVERRIDE; | 4844 Range* InferRange(Zone* zone) override; |
| 4852 | 4845 |
| 4853 private: | 4846 private: |
| 4854 HSub(HValue* context, HValue* left, HValue* right) | 4847 HSub(HValue* context, HValue* left, HValue* right) |
| 4855 : HArithmeticBinaryOperation(context, left, right) { | 4848 : HArithmeticBinaryOperation(context, left, right) { |
| 4856 SetFlag(kCanOverflow); | 4849 SetFlag(kCanOverflow); |
| 4857 } | 4850 } |
| 4858 }; | 4851 }; |
| 4859 | 4852 |
| 4860 | 4853 |
| 4861 class HMul FINAL : public HArithmeticBinaryOperation { | 4854 class HMul final : public HArithmeticBinaryOperation { |
| 4862 public: | 4855 public: |
| 4863 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4856 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 4864 HValue* left, HValue* right); | 4857 HValue* left, HValue* right); |
| 4865 | 4858 |
| 4866 static HInstruction* NewImul(Isolate* isolate, Zone* zone, HValue* context, | 4859 static HInstruction* NewImul(Isolate* isolate, Zone* zone, HValue* context, |
| 4867 HValue* left, HValue* right) { | 4860 HValue* left, HValue* right) { |
| 4868 HInstruction* instr = HMul::New(isolate, zone, context, left, right); | 4861 HInstruction* instr = HMul::New(isolate, zone, context, left, right); |
| 4869 if (!instr->IsMul()) return instr; | 4862 if (!instr->IsMul()) return instr; |
| 4870 HMul* mul = HMul::cast(instr); | 4863 HMul* mul = HMul::cast(instr); |
| 4871 // TODO(mstarzinger): Prevent bailout on minus zero for imul. | 4864 // TODO(mstarzinger): Prevent bailout on minus zero for imul. |
| 4872 mul->AssumeRepresentation(Representation::Integer32()); | 4865 mul->AssumeRepresentation(Representation::Integer32()); |
| 4873 mul->ClearFlag(HValue::kCanOverflow); | 4866 mul->ClearFlag(HValue::kCanOverflow); |
| 4874 return mul; | 4867 return mul; |
| 4875 } | 4868 } |
| 4876 | 4869 |
| 4877 HValue* Canonicalize() OVERRIDE; | 4870 HValue* Canonicalize() override; |
| 4878 | 4871 |
| 4879 // Only commutative if it is certain that not two objects are multiplicated. | 4872 // Only commutative if it is certain that not two objects are multiplicated. |
| 4880 bool IsCommutative() const OVERRIDE { return !representation().IsTagged(); } | 4873 bool IsCommutative() const override { return !representation().IsTagged(); } |
| 4881 | 4874 |
| 4882 virtual void UpdateRepresentation(Representation new_rep, | 4875 virtual void UpdateRepresentation(Representation new_rep, |
| 4883 HInferRepresentationPhase* h_infer, | 4876 HInferRepresentationPhase* h_infer, |
| 4884 const char* reason) OVERRIDE { | 4877 const char* reason) override { |
| 4885 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4878 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 4886 } | 4879 } |
| 4887 | 4880 |
| 4888 bool MulMinusOne(); | 4881 bool MulMinusOne(); |
| 4889 | 4882 |
| 4890 DECLARE_CONCRETE_INSTRUCTION(Mul) | 4883 DECLARE_CONCRETE_INSTRUCTION(Mul) |
| 4891 | 4884 |
| 4892 protected: | 4885 protected: |
| 4893 bool DataEquals(HValue* other) OVERRIDE { return true; } | 4886 bool DataEquals(HValue* other) override { return true; } |
| 4894 | 4887 |
| 4895 Range* InferRange(Zone* zone) OVERRIDE; | 4888 Range* InferRange(Zone* zone) override; |
| 4896 | 4889 |
| 4897 private: | 4890 private: |
| 4898 HMul(HValue* context, HValue* left, HValue* right) | 4891 HMul(HValue* context, HValue* left, HValue* right) |
| 4899 : HArithmeticBinaryOperation(context, left, right) { | 4892 : HArithmeticBinaryOperation(context, left, right) { |
| 4900 SetFlag(kCanOverflow); | 4893 SetFlag(kCanOverflow); |
| 4901 } | 4894 } |
| 4902 }; | 4895 }; |
| 4903 | 4896 |
| 4904 | 4897 |
| 4905 class HMod FINAL : public HArithmeticBinaryOperation { | 4898 class HMod final : public HArithmeticBinaryOperation { |
| 4906 public: | 4899 public: |
| 4907 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4900 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 4908 HValue* left, HValue* right); | 4901 HValue* left, HValue* right); |
| 4909 | 4902 |
| 4910 HValue* Canonicalize() OVERRIDE; | 4903 HValue* Canonicalize() override; |
| 4911 | 4904 |
| 4912 virtual void UpdateRepresentation(Representation new_rep, | 4905 virtual void UpdateRepresentation(Representation new_rep, |
| 4913 HInferRepresentationPhase* h_infer, | 4906 HInferRepresentationPhase* h_infer, |
| 4914 const char* reason) OVERRIDE { | 4907 const char* reason) override { |
| 4915 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4908 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
| 4916 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4909 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 4917 } | 4910 } |
| 4918 | 4911 |
| 4919 DECLARE_CONCRETE_INSTRUCTION(Mod) | 4912 DECLARE_CONCRETE_INSTRUCTION(Mod) |
| 4920 | 4913 |
| 4921 protected: | 4914 protected: |
| 4922 bool DataEquals(HValue* other) OVERRIDE { return true; } | 4915 bool DataEquals(HValue* other) override { return true; } |
| 4923 | 4916 |
| 4924 Range* InferRange(Zone* zone) OVERRIDE; | 4917 Range* InferRange(Zone* zone) override; |
| 4925 | 4918 |
| 4926 private: | 4919 private: |
| 4927 HMod(HValue* context, | 4920 HMod(HValue* context, |
| 4928 HValue* left, | 4921 HValue* left, |
| 4929 HValue* right) : HArithmeticBinaryOperation(context, left, right) { | 4922 HValue* right) : HArithmeticBinaryOperation(context, left, right) { |
| 4930 SetFlag(kCanBeDivByZero); | 4923 SetFlag(kCanBeDivByZero); |
| 4931 SetFlag(kCanOverflow); | 4924 SetFlag(kCanOverflow); |
| 4932 SetFlag(kLeftCanBeNegative); | 4925 SetFlag(kLeftCanBeNegative); |
| 4933 } | 4926 } |
| 4934 }; | 4927 }; |
| 4935 | 4928 |
| 4936 | 4929 |
| 4937 class HDiv FINAL : public HArithmeticBinaryOperation { | 4930 class HDiv final : public HArithmeticBinaryOperation { |
| 4938 public: | 4931 public: |
| 4939 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4932 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 4940 HValue* left, HValue* right); | 4933 HValue* left, HValue* right); |
| 4941 | 4934 |
| 4942 HValue* Canonicalize() OVERRIDE; | 4935 HValue* Canonicalize() override; |
| 4943 | 4936 |
| 4944 virtual void UpdateRepresentation(Representation new_rep, | 4937 virtual void UpdateRepresentation(Representation new_rep, |
| 4945 HInferRepresentationPhase* h_infer, | 4938 HInferRepresentationPhase* h_infer, |
| 4946 const char* reason) OVERRIDE { | 4939 const char* reason) override { |
| 4947 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 4940 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
| 4948 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 4941 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 4949 } | 4942 } |
| 4950 | 4943 |
| 4951 DECLARE_CONCRETE_INSTRUCTION(Div) | 4944 DECLARE_CONCRETE_INSTRUCTION(Div) |
| 4952 | 4945 |
| 4953 protected: | 4946 protected: |
| 4954 bool DataEquals(HValue* other) OVERRIDE { return true; } | 4947 bool DataEquals(HValue* other) override { return true; } |
| 4955 | 4948 |
| 4956 Range* InferRange(Zone* zone) OVERRIDE; | 4949 Range* InferRange(Zone* zone) override; |
| 4957 | 4950 |
| 4958 private: | 4951 private: |
| 4959 HDiv(HValue* context, HValue* left, HValue* right) | 4952 HDiv(HValue* context, HValue* left, HValue* right) |
| 4960 : HArithmeticBinaryOperation(context, left, right) { | 4953 : HArithmeticBinaryOperation(context, left, right) { |
| 4961 SetFlag(kCanBeDivByZero); | 4954 SetFlag(kCanBeDivByZero); |
| 4962 SetFlag(kCanOverflow); | 4955 SetFlag(kCanOverflow); |
| 4963 } | 4956 } |
| 4964 }; | 4957 }; |
| 4965 | 4958 |
| 4966 | 4959 |
| 4967 class HMathMinMax FINAL : public HArithmeticBinaryOperation { | 4960 class HMathMinMax final : public HArithmeticBinaryOperation { |
| 4968 public: | 4961 public: |
| 4969 enum Operation { kMathMin, kMathMax }; | 4962 enum Operation { kMathMin, kMathMax }; |
| 4970 | 4963 |
| 4971 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 4964 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 4972 HValue* left, HValue* right, Operation op); | 4965 HValue* left, HValue* right, Operation op); |
| 4973 | 4966 |
| 4974 Representation observed_input_representation(int index) OVERRIDE { | 4967 Representation observed_input_representation(int index) override { |
| 4975 return RequiredInputRepresentation(index); | 4968 return RequiredInputRepresentation(index); |
| 4976 } | 4969 } |
| 4977 | 4970 |
| 4978 virtual void InferRepresentation( | 4971 virtual void InferRepresentation(HInferRepresentationPhase* h_infer) override; |
| 4979 HInferRepresentationPhase* h_infer) OVERRIDE; | |
| 4980 | 4972 |
| 4981 Representation RepresentationFromInputs() OVERRIDE { | 4973 Representation RepresentationFromInputs() override { |
| 4982 Representation left_rep = left()->representation(); | 4974 Representation left_rep = left()->representation(); |
| 4983 Representation right_rep = right()->representation(); | 4975 Representation right_rep = right()->representation(); |
| 4984 Representation result = Representation::Smi(); | 4976 Representation result = Representation::Smi(); |
| 4985 result = result.generalize(left_rep); | 4977 result = result.generalize(left_rep); |
| 4986 result = result.generalize(right_rep); | 4978 result = result.generalize(right_rep); |
| 4987 if (result.IsTagged()) return Representation::Double(); | 4979 if (result.IsTagged()) return Representation::Double(); |
| 4988 return result; | 4980 return result; |
| 4989 } | 4981 } |
| 4990 | 4982 |
| 4991 bool IsCommutative() const OVERRIDE { return true; } | 4983 bool IsCommutative() const override { return true; } |
| 4992 | 4984 |
| 4993 Operation operation() { return operation_; } | 4985 Operation operation() { return operation_; } |
| 4994 | 4986 |
| 4995 DECLARE_CONCRETE_INSTRUCTION(MathMinMax) | 4987 DECLARE_CONCRETE_INSTRUCTION(MathMinMax) |
| 4996 | 4988 |
| 4997 protected: | 4989 protected: |
| 4998 bool DataEquals(HValue* other) OVERRIDE { | 4990 bool DataEquals(HValue* other) override { |
| 4999 return other->IsMathMinMax() && | 4991 return other->IsMathMinMax() && |
| 5000 HMathMinMax::cast(other)->operation_ == operation_; | 4992 HMathMinMax::cast(other)->operation_ == operation_; |
| 5001 } | 4993 } |
| 5002 | 4994 |
| 5003 Range* InferRange(Zone* zone) OVERRIDE; | 4995 Range* InferRange(Zone* zone) override; |
| 5004 | 4996 |
| 5005 private: | 4997 private: |
| 5006 HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op) | 4998 HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op) |
| 5007 : HArithmeticBinaryOperation(context, left, right), | 4999 : HArithmeticBinaryOperation(context, left, right), |
| 5008 operation_(op) { } | 5000 operation_(op) { } |
| 5009 | 5001 |
| 5010 Operation operation_; | 5002 Operation operation_; |
| 5011 }; | 5003 }; |
| 5012 | 5004 |
| 5013 | 5005 |
| 5014 class HBitwise FINAL : public HBitwiseBinaryOperation { | 5006 class HBitwise final : public HBitwiseBinaryOperation { |
| 5015 public: | 5007 public: |
| 5016 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5008 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 5017 Token::Value op, HValue* left, HValue* right); | 5009 Token::Value op, HValue* left, HValue* right); |
| 5018 | 5010 |
| 5019 Token::Value op() const { return op_; } | 5011 Token::Value op() const { return op_; } |
| 5020 | 5012 |
| 5021 bool IsCommutative() const OVERRIDE { return true; } | 5013 bool IsCommutative() const override { return true; } |
| 5022 | 5014 |
| 5023 HValue* Canonicalize() OVERRIDE; | 5015 HValue* Canonicalize() override; |
| 5024 | 5016 |
| 5025 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5017 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 5026 | 5018 |
| 5027 DECLARE_CONCRETE_INSTRUCTION(Bitwise) | 5019 DECLARE_CONCRETE_INSTRUCTION(Bitwise) |
| 5028 | 5020 |
| 5029 protected: | 5021 protected: |
| 5030 bool DataEquals(HValue* other) OVERRIDE { | 5022 bool DataEquals(HValue* other) override { |
| 5031 return op() == HBitwise::cast(other)->op(); | 5023 return op() == HBitwise::cast(other)->op(); |
| 5032 } | 5024 } |
| 5033 | 5025 |
| 5034 Range* InferRange(Zone* zone) OVERRIDE; | 5026 Range* InferRange(Zone* zone) override; |
| 5035 | 5027 |
| 5036 private: | 5028 private: |
| 5037 HBitwise(HValue* context, | 5029 HBitwise(HValue* context, |
| 5038 Token::Value op, | 5030 Token::Value op, |
| 5039 HValue* left, | 5031 HValue* left, |
| 5040 HValue* right) | 5032 HValue* right) |
| 5041 : HBitwiseBinaryOperation(context, left, right), | 5033 : HBitwiseBinaryOperation(context, left, right), |
| 5042 op_(op) { | 5034 op_(op) { |
| 5043 DCHECK(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); | 5035 DCHECK(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); |
| 5044 // BIT_AND with a smi-range positive value will always unset the | 5036 // BIT_AND with a smi-range positive value will always unset the |
| (...skipping 18 matching lines...) Expand all Loading... |
| 5063 HConstant::cast(right)->Integer32Value() < 0))) { | 5055 HConstant::cast(right)->Integer32Value() < 0))) { |
| 5064 SetFlag(kTruncatingToSmi); | 5056 SetFlag(kTruncatingToSmi); |
| 5065 SetFlag(kTruncatingToInt32); | 5057 SetFlag(kTruncatingToInt32); |
| 5066 } | 5058 } |
| 5067 } | 5059 } |
| 5068 | 5060 |
| 5069 Token::Value op_; | 5061 Token::Value op_; |
| 5070 }; | 5062 }; |
| 5071 | 5063 |
| 5072 | 5064 |
| 5073 class HShl FINAL : public HBitwiseBinaryOperation { | 5065 class HShl final : public HBitwiseBinaryOperation { |
| 5074 public: | 5066 public: |
| 5075 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5067 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 5076 HValue* left, HValue* right); | 5068 HValue* left, HValue* right); |
| 5077 | 5069 |
| 5078 Range* InferRange(Zone* zone) OVERRIDE; | 5070 Range* InferRange(Zone* zone) override; |
| 5079 | 5071 |
| 5080 virtual void UpdateRepresentation(Representation new_rep, | 5072 virtual void UpdateRepresentation(Representation new_rep, |
| 5081 HInferRepresentationPhase* h_infer, | 5073 HInferRepresentationPhase* h_infer, |
| 5082 const char* reason) OVERRIDE { | 5074 const char* reason) override { |
| 5083 if (new_rep.IsSmi() && | 5075 if (new_rep.IsSmi() && |
| 5084 !(right()->IsInteger32Constant() && | 5076 !(right()->IsInteger32Constant() && |
| 5085 right()->GetInteger32Constant() >= 0)) { | 5077 right()->GetInteger32Constant() >= 0)) { |
| 5086 new_rep = Representation::Integer32(); | 5078 new_rep = Representation::Integer32(); |
| 5087 } | 5079 } |
| 5088 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5080 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 5089 } | 5081 } |
| 5090 | 5082 |
| 5091 DECLARE_CONCRETE_INSTRUCTION(Shl) | 5083 DECLARE_CONCRETE_INSTRUCTION(Shl) |
| 5092 | 5084 |
| 5093 protected: | 5085 protected: |
| 5094 bool DataEquals(HValue* other) OVERRIDE { return true; } | 5086 bool DataEquals(HValue* other) override { return true; } |
| 5095 | 5087 |
| 5096 private: | 5088 private: |
| 5097 HShl(HValue* context, HValue* left, HValue* right) | 5089 HShl(HValue* context, HValue* left, HValue* right) |
| 5098 : HBitwiseBinaryOperation(context, left, right) { } | 5090 : HBitwiseBinaryOperation(context, left, right) { } |
| 5099 }; | 5091 }; |
| 5100 | 5092 |
| 5101 | 5093 |
| 5102 class HShr FINAL : public HBitwiseBinaryOperation { | 5094 class HShr final : public HBitwiseBinaryOperation { |
| 5103 public: | 5095 public: |
| 5104 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5096 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 5105 HValue* left, HValue* right); | 5097 HValue* left, HValue* right); |
| 5106 | 5098 |
| 5107 bool TryDecompose(DecompositionResult* decomposition) OVERRIDE { | 5099 bool TryDecompose(DecompositionResult* decomposition) override { |
| 5108 if (right()->IsInteger32Constant()) { | 5100 if (right()->IsInteger32Constant()) { |
| 5109 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { | 5101 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { |
| 5110 // This is intended to look for HAdd and HSub, to handle compounds | 5102 // This is intended to look for HAdd and HSub, to handle compounds |
| 5111 // like ((base + offset) >> scale) with one single decomposition. | 5103 // like ((base + offset) >> scale) with one single decomposition. |
| 5112 left()->TryDecompose(decomposition); | 5104 left()->TryDecompose(decomposition); |
| 5113 return true; | 5105 return true; |
| 5114 } | 5106 } |
| 5115 } | 5107 } |
| 5116 return false; | 5108 return false; |
| 5117 } | 5109 } |
| 5118 | 5110 |
| 5119 Range* InferRange(Zone* zone) OVERRIDE; | 5111 Range* InferRange(Zone* zone) override; |
| 5120 | 5112 |
| 5121 virtual void UpdateRepresentation(Representation new_rep, | 5113 virtual void UpdateRepresentation(Representation new_rep, |
| 5122 HInferRepresentationPhase* h_infer, | 5114 HInferRepresentationPhase* h_infer, |
| 5123 const char* reason) OVERRIDE { | 5115 const char* reason) override { |
| 5124 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5116 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
| 5125 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5117 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 5126 } | 5118 } |
| 5127 | 5119 |
| 5128 DECLARE_CONCRETE_INSTRUCTION(Shr) | 5120 DECLARE_CONCRETE_INSTRUCTION(Shr) |
| 5129 | 5121 |
| 5130 protected: | 5122 protected: |
| 5131 bool DataEquals(HValue* other) OVERRIDE { return true; } | 5123 bool DataEquals(HValue* other) override { return true; } |
| 5132 | 5124 |
| 5133 private: | 5125 private: |
| 5134 HShr(HValue* context, HValue* left, HValue* right) | 5126 HShr(HValue* context, HValue* left, HValue* right) |
| 5135 : HBitwiseBinaryOperation(context, left, right) { } | 5127 : HBitwiseBinaryOperation(context, left, right) { } |
| 5136 }; | 5128 }; |
| 5137 | 5129 |
| 5138 | 5130 |
| 5139 class HSar FINAL : public HBitwiseBinaryOperation { | 5131 class HSar final : public HBitwiseBinaryOperation { |
| 5140 public: | 5132 public: |
| 5141 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5133 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 5142 HValue* left, HValue* right); | 5134 HValue* left, HValue* right); |
| 5143 | 5135 |
| 5144 bool TryDecompose(DecompositionResult* decomposition) OVERRIDE { | 5136 bool TryDecompose(DecompositionResult* decomposition) override { |
| 5145 if (right()->IsInteger32Constant()) { | 5137 if (right()->IsInteger32Constant()) { |
| 5146 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { | 5138 if (decomposition->Apply(left(), 0, right()->GetInteger32Constant())) { |
| 5147 // This is intended to look for HAdd and HSub, to handle compounds | 5139 // This is intended to look for HAdd and HSub, to handle compounds |
| 5148 // like ((base + offset) >> scale) with one single decomposition. | 5140 // like ((base + offset) >> scale) with one single decomposition. |
| 5149 left()->TryDecompose(decomposition); | 5141 left()->TryDecompose(decomposition); |
| 5150 return true; | 5142 return true; |
| 5151 } | 5143 } |
| 5152 } | 5144 } |
| 5153 return false; | 5145 return false; |
| 5154 } | 5146 } |
| 5155 | 5147 |
| 5156 Range* InferRange(Zone* zone) OVERRIDE; | 5148 Range* InferRange(Zone* zone) override; |
| 5157 | 5149 |
| 5158 virtual void UpdateRepresentation(Representation new_rep, | 5150 virtual void UpdateRepresentation(Representation new_rep, |
| 5159 HInferRepresentationPhase* h_infer, | 5151 HInferRepresentationPhase* h_infer, |
| 5160 const char* reason) OVERRIDE { | 5152 const char* reason) override { |
| 5161 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5153 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
| 5162 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5154 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 5163 } | 5155 } |
| 5164 | 5156 |
| 5165 DECLARE_CONCRETE_INSTRUCTION(Sar) | 5157 DECLARE_CONCRETE_INSTRUCTION(Sar) |
| 5166 | 5158 |
| 5167 protected: | 5159 protected: |
| 5168 bool DataEquals(HValue* other) OVERRIDE { return true; } | 5160 bool DataEquals(HValue* other) override { return true; } |
| 5169 | 5161 |
| 5170 private: | 5162 private: |
| 5171 HSar(HValue* context, HValue* left, HValue* right) | 5163 HSar(HValue* context, HValue* left, HValue* right) |
| 5172 : HBitwiseBinaryOperation(context, left, right) { } | 5164 : HBitwiseBinaryOperation(context, left, right) { } |
| 5173 }; | 5165 }; |
| 5174 | 5166 |
| 5175 | 5167 |
| 5176 class HRor FINAL : public HBitwiseBinaryOperation { | 5168 class HRor final : public HBitwiseBinaryOperation { |
| 5177 public: | 5169 public: |
| 5178 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 5170 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 5179 HValue* left, HValue* right) { | 5171 HValue* left, HValue* right) { |
| 5180 return new(zone) HRor(context, left, right); | 5172 return new(zone) HRor(context, left, right); |
| 5181 } | 5173 } |
| 5182 | 5174 |
| 5183 virtual void UpdateRepresentation(Representation new_rep, | 5175 virtual void UpdateRepresentation(Representation new_rep, |
| 5184 HInferRepresentationPhase* h_infer, | 5176 HInferRepresentationPhase* h_infer, |
| 5185 const char* reason) OVERRIDE { | 5177 const char* reason) override { |
| 5186 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); | 5178 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); |
| 5187 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); | 5179 HBitwiseBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); |
| 5188 } | 5180 } |
| 5189 | 5181 |
| 5190 DECLARE_CONCRETE_INSTRUCTION(Ror) | 5182 DECLARE_CONCRETE_INSTRUCTION(Ror) |
| 5191 | 5183 |
| 5192 protected: | 5184 protected: |
| 5193 bool DataEquals(HValue* other) OVERRIDE { return true; } | 5185 bool DataEquals(HValue* other) override { return true; } |
| 5194 | 5186 |
| 5195 private: | 5187 private: |
| 5196 HRor(HValue* context, HValue* left, HValue* right) | 5188 HRor(HValue* context, HValue* left, HValue* right) |
| 5197 : HBitwiseBinaryOperation(context, left, right) { | 5189 : HBitwiseBinaryOperation(context, left, right) { |
| 5198 ChangeRepresentation(Representation::Integer32()); | 5190 ChangeRepresentation(Representation::Integer32()); |
| 5199 } | 5191 } |
| 5200 }; | 5192 }; |
| 5201 | 5193 |
| 5202 | 5194 |
| 5203 class HOsrEntry FINAL : public HTemplateInstruction<0> { | 5195 class HOsrEntry final : public HTemplateInstruction<0> { |
| 5204 public: | 5196 public: |
| 5205 DECLARE_INSTRUCTION_FACTORY_P1(HOsrEntry, BailoutId); | 5197 DECLARE_INSTRUCTION_FACTORY_P1(HOsrEntry, BailoutId); |
| 5206 | 5198 |
| 5207 BailoutId ast_id() const { return ast_id_; } | 5199 BailoutId ast_id() const { return ast_id_; } |
| 5208 | 5200 |
| 5209 Representation RequiredInputRepresentation(int index) OVERRIDE { | 5201 Representation RequiredInputRepresentation(int index) override { |
| 5210 return Representation::None(); | 5202 return Representation::None(); |
| 5211 } | 5203 } |
| 5212 | 5204 |
| 5213 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) | 5205 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) |
| 5214 | 5206 |
| 5215 private: | 5207 private: |
| 5216 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) { | 5208 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) { |
| 5217 SetChangesFlag(kOsrEntries); | 5209 SetChangesFlag(kOsrEntries); |
| 5218 SetChangesFlag(kNewSpacePromotion); | 5210 SetChangesFlag(kNewSpacePromotion); |
| 5219 } | 5211 } |
| 5220 | 5212 |
| 5221 BailoutId ast_id_; | 5213 BailoutId ast_id_; |
| 5222 }; | 5214 }; |
| 5223 | 5215 |
| 5224 | 5216 |
| 5225 class HParameter FINAL : public HTemplateInstruction<0> { | 5217 class HParameter final : public HTemplateInstruction<0> { |
| 5226 public: | 5218 public: |
| 5227 enum ParameterKind { | 5219 enum ParameterKind { |
| 5228 STACK_PARAMETER, | 5220 STACK_PARAMETER, |
| 5229 REGISTER_PARAMETER | 5221 REGISTER_PARAMETER |
| 5230 }; | 5222 }; |
| 5231 | 5223 |
| 5232 DECLARE_INSTRUCTION_FACTORY_P1(HParameter, unsigned); | 5224 DECLARE_INSTRUCTION_FACTORY_P1(HParameter, unsigned); |
| 5233 DECLARE_INSTRUCTION_FACTORY_P2(HParameter, unsigned, ParameterKind); | 5225 DECLARE_INSTRUCTION_FACTORY_P2(HParameter, unsigned, ParameterKind); |
| 5234 DECLARE_INSTRUCTION_FACTORY_P3(HParameter, unsigned, ParameterKind, | 5226 DECLARE_INSTRUCTION_FACTORY_P3(HParameter, unsigned, ParameterKind, |
| 5235 Representation); | 5227 Representation); |
| 5236 | 5228 |
| 5237 unsigned index() const { return index_; } | 5229 unsigned index() const { return index_; } |
| 5238 ParameterKind kind() const { return kind_; } | 5230 ParameterKind kind() const { return kind_; } |
| 5239 | 5231 |
| 5240 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5232 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 5241 | 5233 |
| 5242 Representation RequiredInputRepresentation(int index) OVERRIDE { | 5234 Representation RequiredInputRepresentation(int index) override { |
| 5243 return Representation::None(); | 5235 return Representation::None(); |
| 5244 } | 5236 } |
| 5245 | 5237 |
| 5246 Representation KnownOptimalRepresentation() OVERRIDE { | 5238 Representation KnownOptimalRepresentation() override { |
| 5247 // If a parameter is an input to a phi, that phi should not | 5239 // If a parameter is an input to a phi, that phi should not |
| 5248 // choose any more optimistic representation than Tagged. | 5240 // choose any more optimistic representation than Tagged. |
| 5249 return Representation::Tagged(); | 5241 return Representation::Tagged(); |
| 5250 } | 5242 } |
| 5251 | 5243 |
| 5252 DECLARE_CONCRETE_INSTRUCTION(Parameter) | 5244 DECLARE_CONCRETE_INSTRUCTION(Parameter) |
| 5253 | 5245 |
| 5254 private: | 5246 private: |
| 5255 explicit HParameter(unsigned index, | 5247 explicit HParameter(unsigned index, |
| 5256 ParameterKind kind = STACK_PARAMETER) | 5248 ParameterKind kind = STACK_PARAMETER) |
| 5257 : index_(index), | 5249 : index_(index), |
| 5258 kind_(kind) { | 5250 kind_(kind) { |
| 5259 set_representation(Representation::Tagged()); | 5251 set_representation(Representation::Tagged()); |
| 5260 } | 5252 } |
| 5261 | 5253 |
| 5262 explicit HParameter(unsigned index, | 5254 explicit HParameter(unsigned index, |
| 5263 ParameterKind kind, | 5255 ParameterKind kind, |
| 5264 Representation r) | 5256 Representation r) |
| 5265 : index_(index), | 5257 : index_(index), |
| 5266 kind_(kind) { | 5258 kind_(kind) { |
| 5267 set_representation(r); | 5259 set_representation(r); |
| 5268 } | 5260 } |
| 5269 | 5261 |
| 5270 unsigned index_; | 5262 unsigned index_; |
| 5271 ParameterKind kind_; | 5263 ParameterKind kind_; |
| 5272 }; | 5264 }; |
| 5273 | 5265 |
| 5274 | 5266 |
| 5275 class HCallStub FINAL : public HUnaryCall { | 5267 class HCallStub final : public HUnaryCall { |
| 5276 public: | 5268 public: |
| 5277 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallStub, CodeStub::Major, int); | 5269 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallStub, CodeStub::Major, int); |
| 5278 CodeStub::Major major_key() { return major_key_; } | 5270 CodeStub::Major major_key() { return major_key_; } |
| 5279 | 5271 |
| 5280 HValue* context() { return value(); } | 5272 HValue* context() { return value(); } |
| 5281 | 5273 |
| 5282 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5274 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 5283 | 5275 |
| 5284 DECLARE_CONCRETE_INSTRUCTION(CallStub) | 5276 DECLARE_CONCRETE_INSTRUCTION(CallStub) |
| 5285 | 5277 |
| 5286 private: | 5278 private: |
| 5287 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) | 5279 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) |
| 5288 : HUnaryCall(context, argument_count), | 5280 : HUnaryCall(context, argument_count), |
| 5289 major_key_(major_key) { | 5281 major_key_(major_key) { |
| 5290 } | 5282 } |
| 5291 | 5283 |
| 5292 CodeStub::Major major_key_; | 5284 CodeStub::Major major_key_; |
| 5293 }; | 5285 }; |
| 5294 | 5286 |
| 5295 | 5287 |
| 5296 class HTailCallThroughMegamorphicCache FINAL : public HInstruction { | 5288 class HTailCallThroughMegamorphicCache final : public HInstruction { |
| 5297 public: | 5289 public: |
| 5298 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HTailCallThroughMegamorphicCache, | 5290 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HTailCallThroughMegamorphicCache, |
| 5299 HValue*, HValue*); | 5291 HValue*, HValue*); |
| 5300 | 5292 |
| 5301 Representation RequiredInputRepresentation(int index) OVERRIDE { | 5293 Representation RequiredInputRepresentation(int index) override { |
| 5302 return Representation::Tagged(); | 5294 return Representation::Tagged(); |
| 5303 } | 5295 } |
| 5304 | 5296 |
| 5305 virtual int OperandCount() const FINAL OVERRIDE { return 3; } | 5297 virtual int OperandCount() const final override { return 3; } |
| 5306 virtual HValue* OperandAt(int i) const FINAL OVERRIDE { return inputs_[i]; } | 5298 virtual HValue* OperandAt(int i) const final override { return inputs_[i]; } |
| 5307 | 5299 |
| 5308 HValue* context() const { return OperandAt(0); } | 5300 HValue* context() const { return OperandAt(0); } |
| 5309 HValue* receiver() const { return OperandAt(1); } | 5301 HValue* receiver() const { return OperandAt(1); } |
| 5310 HValue* name() const { return OperandAt(2); } | 5302 HValue* name() const { return OperandAt(2); } |
| 5311 Code::Flags flags() const; | 5303 Code::Flags flags() const; |
| 5312 | 5304 |
| 5313 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5305 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 5314 | 5306 |
| 5315 DECLARE_CONCRETE_INSTRUCTION(TailCallThroughMegamorphicCache) | 5307 DECLARE_CONCRETE_INSTRUCTION(TailCallThroughMegamorphicCache) |
| 5316 | 5308 |
| 5317 protected: | 5309 protected: |
| 5318 virtual void InternalSetOperandAt(int i, HValue* value) FINAL OVERRIDE { | 5310 virtual void InternalSetOperandAt(int i, HValue* value) final override { |
| 5319 inputs_[i] = value; | 5311 inputs_[i] = value; |
| 5320 } | 5312 } |
| 5321 | 5313 |
| 5322 private: | 5314 private: |
| 5323 HTailCallThroughMegamorphicCache(HValue* context, HValue* receiver, | 5315 HTailCallThroughMegamorphicCache(HValue* context, HValue* receiver, |
| 5324 HValue* name) { | 5316 HValue* name) { |
| 5325 SetOperandAt(0, context); | 5317 SetOperandAt(0, context); |
| 5326 SetOperandAt(1, receiver); | 5318 SetOperandAt(1, receiver); |
| 5327 SetOperandAt(2, name); | 5319 SetOperandAt(2, name); |
| 5328 } | 5320 } |
| 5329 | 5321 |
| 5330 EmbeddedContainer<HValue*, 3> inputs_; | 5322 EmbeddedContainer<HValue*, 3> inputs_; |
| 5331 }; | 5323 }; |
| 5332 | 5324 |
| 5333 | 5325 |
| 5334 class HUnknownOSRValue FINAL : public HTemplateInstruction<0> { | 5326 class HUnknownOSRValue final : public HTemplateInstruction<0> { |
| 5335 public: | 5327 public: |
| 5336 DECLARE_INSTRUCTION_FACTORY_P2(HUnknownOSRValue, HEnvironment*, int); | 5328 DECLARE_INSTRUCTION_FACTORY_P2(HUnknownOSRValue, HEnvironment*, int); |
| 5337 | 5329 |
| 5338 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5330 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 5339 | 5331 |
| 5340 Representation RequiredInputRepresentation(int index) OVERRIDE { | 5332 Representation RequiredInputRepresentation(int index) override { |
| 5341 return Representation::None(); | 5333 return Representation::None(); |
| 5342 } | 5334 } |
| 5343 | 5335 |
| 5344 void set_incoming_value(HPhi* value) { incoming_value_ = value; } | 5336 void set_incoming_value(HPhi* value) { incoming_value_ = value; } |
| 5345 HPhi* incoming_value() { return incoming_value_; } | 5337 HPhi* incoming_value() { return incoming_value_; } |
| 5346 HEnvironment *environment() { return environment_; } | 5338 HEnvironment *environment() { return environment_; } |
| 5347 int index() { return index_; } | 5339 int index() { return index_; } |
| 5348 | 5340 |
| 5349 Representation KnownOptimalRepresentation() OVERRIDE { | 5341 Representation KnownOptimalRepresentation() override { |
| 5350 if (incoming_value_ == NULL) return Representation::None(); | 5342 if (incoming_value_ == NULL) return Representation::None(); |
| 5351 return incoming_value_->KnownOptimalRepresentation(); | 5343 return incoming_value_->KnownOptimalRepresentation(); |
| 5352 } | 5344 } |
| 5353 | 5345 |
| 5354 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) | 5346 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) |
| 5355 | 5347 |
| 5356 private: | 5348 private: |
| 5357 HUnknownOSRValue(HEnvironment* environment, int index) | 5349 HUnknownOSRValue(HEnvironment* environment, int index) |
| 5358 : environment_(environment), | 5350 : environment_(environment), |
| 5359 index_(index), | 5351 index_(index), |
| 5360 incoming_value_(NULL) { | 5352 incoming_value_(NULL) { |
| 5361 set_representation(Representation::Tagged()); | 5353 set_representation(Representation::Tagged()); |
| 5362 } | 5354 } |
| 5363 | 5355 |
| 5364 HEnvironment* environment_; | 5356 HEnvironment* environment_; |
| 5365 int index_; | 5357 int index_; |
| 5366 HPhi* incoming_value_; | 5358 HPhi* incoming_value_; |
| 5367 }; | 5359 }; |
| 5368 | 5360 |
| 5369 | 5361 |
| 5370 class HLoadGlobalGeneric FINAL : public HTemplateInstruction<2> { | 5362 class HLoadGlobalGeneric final : public HTemplateInstruction<2> { |
| 5371 public: | 5363 public: |
| 5372 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*, | 5364 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*, |
| 5373 Handle<String>, bool); | 5365 Handle<String>, bool); |
| 5374 | 5366 |
| 5375 HValue* context() { return OperandAt(0); } | 5367 HValue* context() { return OperandAt(0); } |
| 5376 HValue* global_object() { return OperandAt(1); } | 5368 HValue* global_object() { return OperandAt(1); } |
| 5377 Handle<String> name() const { return name_; } | 5369 Handle<String> name() const { return name_; } |
| 5378 bool for_typeof() const { return for_typeof_; } | 5370 bool for_typeof() const { return for_typeof_; } |
| 5379 FeedbackVectorICSlot slot() const { return slot_; } | 5371 FeedbackVectorICSlot slot() const { return slot_; } |
| 5380 Handle<TypeFeedbackVector> feedback_vector() const { | 5372 Handle<TypeFeedbackVector> feedback_vector() const { |
| 5381 return feedback_vector_; | 5373 return feedback_vector_; |
| 5382 } | 5374 } |
| 5383 bool HasVectorAndSlot() const { return FLAG_vector_ics; } | 5375 bool HasVectorAndSlot() const { return FLAG_vector_ics; } |
| 5384 void SetVectorAndSlot(Handle<TypeFeedbackVector> vector, | 5376 void SetVectorAndSlot(Handle<TypeFeedbackVector> vector, |
| 5385 FeedbackVectorICSlot slot) { | 5377 FeedbackVectorICSlot slot) { |
| 5386 DCHECK(FLAG_vector_ics); | 5378 DCHECK(FLAG_vector_ics); |
| 5387 feedback_vector_ = vector; | 5379 feedback_vector_ = vector; |
| 5388 slot_ = slot; | 5380 slot_ = slot; |
| 5389 } | 5381 } |
| 5390 | 5382 |
| 5391 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5383 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 5392 | 5384 |
| 5393 Representation RequiredInputRepresentation(int index) OVERRIDE { | 5385 Representation RequiredInputRepresentation(int index) override { |
| 5394 return Representation::Tagged(); | 5386 return Representation::Tagged(); |
| 5395 } | 5387 } |
| 5396 | 5388 |
| 5397 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) | 5389 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) |
| 5398 | 5390 |
| 5399 private: | 5391 private: |
| 5400 HLoadGlobalGeneric(HValue* context, HValue* global_object, | 5392 HLoadGlobalGeneric(HValue* context, HValue* global_object, |
| 5401 Handle<String> name, bool for_typeof) | 5393 Handle<String> name, bool for_typeof) |
| 5402 : name_(name), | 5394 : name_(name), |
| 5403 for_typeof_(for_typeof), | 5395 for_typeof_(for_typeof), |
| 5404 slot_(FeedbackVectorICSlot::Invalid()) { | 5396 slot_(FeedbackVectorICSlot::Invalid()) { |
| 5405 SetOperandAt(0, context); | 5397 SetOperandAt(0, context); |
| 5406 SetOperandAt(1, global_object); | 5398 SetOperandAt(1, global_object); |
| 5407 set_representation(Representation::Tagged()); | 5399 set_representation(Representation::Tagged()); |
| 5408 SetAllSideEffects(); | 5400 SetAllSideEffects(); |
| 5409 } | 5401 } |
| 5410 | 5402 |
| 5411 Handle<String> name_; | 5403 Handle<String> name_; |
| 5412 bool for_typeof_; | 5404 bool for_typeof_; |
| 5413 Handle<TypeFeedbackVector> feedback_vector_; | 5405 Handle<TypeFeedbackVector> feedback_vector_; |
| 5414 FeedbackVectorICSlot slot_; | 5406 FeedbackVectorICSlot slot_; |
| 5415 }; | 5407 }; |
| 5416 | 5408 |
| 5417 | 5409 |
| 5418 class HAllocate FINAL : public HTemplateInstruction<2> { | 5410 class HAllocate final : public HTemplateInstruction<2> { |
| 5419 public: | 5411 public: |
| 5420 static bool CompatibleInstanceTypes(InstanceType type1, | 5412 static bool CompatibleInstanceTypes(InstanceType type1, |
| 5421 InstanceType type2) { | 5413 InstanceType type2) { |
| 5422 return ComputeFlags(TENURED, type1) == ComputeFlags(TENURED, type2) && | 5414 return ComputeFlags(TENURED, type1) == ComputeFlags(TENURED, type2) && |
| 5423 ComputeFlags(NOT_TENURED, type1) == ComputeFlags(NOT_TENURED, type2); | 5415 ComputeFlags(NOT_TENURED, type1) == ComputeFlags(NOT_TENURED, type2); |
| 5424 } | 5416 } |
| 5425 | 5417 |
| 5426 static HAllocate* New( | 5418 static HAllocate* New( |
| 5427 Isolate* isolate, Zone* zone, HValue* context, HValue* size, HType type, | 5419 Isolate* isolate, Zone* zone, HValue* context, HValue* size, HType type, |
| 5428 PretenureFlag pretenure_flag, InstanceType instance_type, | 5420 PretenureFlag pretenure_flag, InstanceType instance_type, |
| 5429 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()) { | 5421 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()) { |
| 5430 return new(zone) HAllocate(context, size, type, pretenure_flag, | 5422 return new(zone) HAllocate(context, size, type, pretenure_flag, |
| 5431 instance_type, allocation_site); | 5423 instance_type, allocation_site); |
| 5432 } | 5424 } |
| 5433 | 5425 |
| 5434 // Maximum instance size for which allocations will be inlined. | 5426 // Maximum instance size for which allocations will be inlined. |
| 5435 static const int kMaxInlineSize = 64 * kPointerSize; | 5427 static const int kMaxInlineSize = 64 * kPointerSize; |
| 5436 | 5428 |
| 5437 HValue* context() const { return OperandAt(0); } | 5429 HValue* context() const { return OperandAt(0); } |
| 5438 HValue* size() const { return OperandAt(1); } | 5430 HValue* size() const { return OperandAt(1); } |
| 5439 | 5431 |
| 5440 bool has_size_upper_bound() { return size_upper_bound_ != NULL; } | 5432 bool has_size_upper_bound() { return size_upper_bound_ != NULL; } |
| 5441 HConstant* size_upper_bound() { return size_upper_bound_; } | 5433 HConstant* size_upper_bound() { return size_upper_bound_; } |
| 5442 void set_size_upper_bound(HConstant* value) { | 5434 void set_size_upper_bound(HConstant* value) { |
| 5443 DCHECK(size_upper_bound_ == NULL); | 5435 DCHECK(size_upper_bound_ == NULL); |
| 5444 size_upper_bound_ = value; | 5436 size_upper_bound_ = value; |
| 5445 } | 5437 } |
| 5446 | 5438 |
| 5447 Representation RequiredInputRepresentation(int index) OVERRIDE { | 5439 Representation RequiredInputRepresentation(int index) override { |
| 5448 if (index == 0) { | 5440 if (index == 0) { |
| 5449 return Representation::Tagged(); | 5441 return Representation::Tagged(); |
| 5450 } else { | 5442 } else { |
| 5451 return Representation::Integer32(); | 5443 return Representation::Integer32(); |
| 5452 } | 5444 } |
| 5453 } | 5445 } |
| 5454 | 5446 |
| 5455 Handle<Map> GetMonomorphicJSObjectMap() OVERRIDE { | 5447 Handle<Map> GetMonomorphicJSObjectMap() override { |
| 5456 return known_initial_map_; | 5448 return known_initial_map_; |
| 5457 } | 5449 } |
| 5458 | 5450 |
| 5459 void set_known_initial_map(Handle<Map> known_initial_map) { | 5451 void set_known_initial_map(Handle<Map> known_initial_map) { |
| 5460 known_initial_map_ = known_initial_map; | 5452 known_initial_map_ = known_initial_map; |
| 5461 } | 5453 } |
| 5462 | 5454 |
| 5463 bool IsNewSpaceAllocation() const { | 5455 bool IsNewSpaceAllocation() const { |
| 5464 return (flags_ & ALLOCATE_IN_NEW_SPACE) != 0; | 5456 return (flags_ & ALLOCATE_IN_NEW_SPACE) != 0; |
| 5465 } | 5457 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 5482 | 5474 |
| 5483 bool MustClearNextMapWord() const { | 5475 bool MustClearNextMapWord() const { |
| 5484 return (flags_ & CLEAR_NEXT_MAP_WORD) != 0; | 5476 return (flags_ & CLEAR_NEXT_MAP_WORD) != 0; |
| 5485 } | 5477 } |
| 5486 | 5478 |
| 5487 void MakeDoubleAligned() { | 5479 void MakeDoubleAligned() { |
| 5488 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); | 5480 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); |
| 5489 } | 5481 } |
| 5490 | 5482 |
| 5491 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 5483 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
| 5492 HValue* dominator) OVERRIDE; | 5484 HValue* dominator) override; |
| 5493 | 5485 |
| 5494 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5486 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 5495 | 5487 |
| 5496 DECLARE_CONCRETE_INSTRUCTION(Allocate) | 5488 DECLARE_CONCRETE_INSTRUCTION(Allocate) |
| 5497 | 5489 |
| 5498 private: | 5490 private: |
| 5499 enum Flags { | 5491 enum Flags { |
| 5500 ALLOCATE_IN_NEW_SPACE = 1 << 0, | 5492 ALLOCATE_IN_NEW_SPACE = 1 << 0, |
| 5501 ALLOCATE_IN_OLD_SPACE = 1 << 2, | 5493 ALLOCATE_IN_OLD_SPACE = 1 << 2, |
| 5502 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, | 5494 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, |
| 5503 PREFILL_WITH_FILLER = 1 << 4, | 5495 PREFILL_WITH_FILLER = 1 << 4, |
| 5504 CLEAR_NEXT_MAP_WORD = 1 << 5 | 5496 CLEAR_NEXT_MAP_WORD = 1 << 5 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5583 void ClearNextMapWord(int offset); | 5575 void ClearNextMapWord(int offset); |
| 5584 | 5576 |
| 5585 Flags flags_; | 5577 Flags flags_; |
| 5586 Handle<Map> known_initial_map_; | 5578 Handle<Map> known_initial_map_; |
| 5587 HAllocate* dominating_allocate_; | 5579 HAllocate* dominating_allocate_; |
| 5588 HStoreNamedField* filler_free_space_size_; | 5580 HStoreNamedField* filler_free_space_size_; |
| 5589 HConstant* size_upper_bound_; | 5581 HConstant* size_upper_bound_; |
| 5590 }; | 5582 }; |
| 5591 | 5583 |
| 5592 | 5584 |
| 5593 class HStoreCodeEntry FINAL: public HTemplateInstruction<2> { | 5585 class HStoreCodeEntry final : public HTemplateInstruction<2> { |
| 5594 public: | 5586 public: |
| 5595 static HStoreCodeEntry* New(Isolate* isolate, Zone* zone, HValue* context, | 5587 static HStoreCodeEntry* New(Isolate* isolate, Zone* zone, HValue* context, |
| 5596 HValue* function, HValue* code) { | 5588 HValue* function, HValue* code) { |
| 5597 return new(zone) HStoreCodeEntry(function, code); | 5589 return new(zone) HStoreCodeEntry(function, code); |
| 5598 } | 5590 } |
| 5599 | 5591 |
| 5600 Representation RequiredInputRepresentation(int index) OVERRIDE { | 5592 Representation RequiredInputRepresentation(int index) override { |
| 5601 return Representation::Tagged(); | 5593 return Representation::Tagged(); |
| 5602 } | 5594 } |
| 5603 | 5595 |
| 5604 HValue* function() { return OperandAt(0); } | 5596 HValue* function() { return OperandAt(0); } |
| 5605 HValue* code_object() { return OperandAt(1); } | 5597 HValue* code_object() { return OperandAt(1); } |
| 5606 | 5598 |
| 5607 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry) | 5599 DECLARE_CONCRETE_INSTRUCTION(StoreCodeEntry) |
| 5608 | 5600 |
| 5609 private: | 5601 private: |
| 5610 HStoreCodeEntry(HValue* function, HValue* code) { | 5602 HStoreCodeEntry(HValue* function, HValue* code) { |
| 5611 SetOperandAt(0, function); | 5603 SetOperandAt(0, function); |
| 5612 SetOperandAt(1, code); | 5604 SetOperandAt(1, code); |
| 5613 } | 5605 } |
| 5614 }; | 5606 }; |
| 5615 | 5607 |
| 5616 | 5608 |
| 5617 class HInnerAllocatedObject FINAL : public HTemplateInstruction<2> { | 5609 class HInnerAllocatedObject final : public HTemplateInstruction<2> { |
| 5618 public: | 5610 public: |
| 5619 static HInnerAllocatedObject* New(Isolate* isolate, Zone* zone, | 5611 static HInnerAllocatedObject* New(Isolate* isolate, Zone* zone, |
| 5620 HValue* context, HValue* value, | 5612 HValue* context, HValue* value, |
| 5621 HValue* offset, HType type) { | 5613 HValue* offset, HType type) { |
| 5622 return new(zone) HInnerAllocatedObject(value, offset, type); | 5614 return new(zone) HInnerAllocatedObject(value, offset, type); |
| 5623 } | 5615 } |
| 5624 | 5616 |
| 5625 HValue* base_object() const { return OperandAt(0); } | 5617 HValue* base_object() const { return OperandAt(0); } |
| 5626 HValue* offset() const { return OperandAt(1); } | 5618 HValue* offset() const { return OperandAt(1); } |
| 5627 | 5619 |
| 5628 Representation RequiredInputRepresentation(int index) OVERRIDE { | 5620 Representation RequiredInputRepresentation(int index) override { |
| 5629 return index == 0 ? Representation::Tagged() : Representation::Integer32(); | 5621 return index == 0 ? Representation::Tagged() : Representation::Integer32(); |
| 5630 } | 5622 } |
| 5631 | 5623 |
| 5632 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5624 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 5633 | 5625 |
| 5634 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject) | 5626 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject) |
| 5635 | 5627 |
| 5636 private: | 5628 private: |
| 5637 HInnerAllocatedObject(HValue* value, | 5629 HInnerAllocatedObject(HValue* value, |
| 5638 HValue* offset, | 5630 HValue* offset, |
| 5639 HType type) : HTemplateInstruction<2>(type) { | 5631 HType type) : HTemplateInstruction<2>(type) { |
| 5640 DCHECK(value->IsAllocate()); | 5632 DCHECK(value->IsAllocate()); |
| 5641 DCHECK(type.IsHeapObject()); | 5633 DCHECK(type.IsHeapObject()); |
| 5642 SetOperandAt(0, value); | 5634 SetOperandAt(0, value); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5699 } | 5691 } |
| 5700 if (object == dominator && | 5692 if (object == dominator && |
| 5701 object->IsAllocate() && | 5693 object->IsAllocate() && |
| 5702 HAllocate::cast(object)->IsNewSpaceAllocation()) { | 5694 HAllocate::cast(object)->IsNewSpaceAllocation()) { |
| 5703 return kPointersToHereAreAlwaysInteresting; | 5695 return kPointersToHereAreAlwaysInteresting; |
| 5704 } | 5696 } |
| 5705 return kPointersToHereMaybeInteresting; | 5697 return kPointersToHereMaybeInteresting; |
| 5706 } | 5698 } |
| 5707 | 5699 |
| 5708 | 5700 |
| 5709 class HLoadContextSlot FINAL : public HUnaryOperation { | 5701 class HLoadContextSlot final : public HUnaryOperation { |
| 5710 public: | 5702 public: |
| 5711 enum Mode { | 5703 enum Mode { |
| 5712 // Perform a normal load of the context slot without checking its value. | 5704 // Perform a normal load of the context slot without checking its value. |
| 5713 kNoCheck, | 5705 kNoCheck, |
| 5714 // Load and check the value of the context slot. Deoptimize if it's the | 5706 // Load and check the value of the context slot. Deoptimize if it's the |
| 5715 // hole value. This is used for checking for loading of uninitialized | 5707 // hole value. This is used for checking for loading of uninitialized |
| 5716 // harmony bindings where we deoptimize into full-codegen generated code | 5708 // harmony bindings where we deoptimize into full-codegen generated code |
| 5717 // which will subsequently throw a reference error. | 5709 // which will subsequently throw a reference error. |
| 5718 kCheckDeoptimize, | 5710 kCheckDeoptimize, |
| 5719 // Load and check the value of the context slot. Return undefined if it's | 5711 // Load and check the value of the context slot. Return undefined if it's |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5732 Mode mode() const { return mode_; } | 5724 Mode mode() const { return mode_; } |
| 5733 | 5725 |
| 5734 bool DeoptimizesOnHole() { | 5726 bool DeoptimizesOnHole() { |
| 5735 return mode_ == kCheckDeoptimize; | 5727 return mode_ == kCheckDeoptimize; |
| 5736 } | 5728 } |
| 5737 | 5729 |
| 5738 bool RequiresHoleCheck() const { | 5730 bool RequiresHoleCheck() const { |
| 5739 return mode_ != kNoCheck; | 5731 return mode_ != kNoCheck; |
| 5740 } | 5732 } |
| 5741 | 5733 |
| 5742 Representation RequiredInputRepresentation(int index) OVERRIDE { | 5734 Representation RequiredInputRepresentation(int index) override { |
| 5743 return Representation::Tagged(); | 5735 return Representation::Tagged(); |
| 5744 } | 5736 } |
| 5745 | 5737 |
| 5746 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5738 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 5747 | 5739 |
| 5748 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) | 5740 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) |
| 5749 | 5741 |
| 5750 protected: | 5742 protected: |
| 5751 bool DataEquals(HValue* other) OVERRIDE { | 5743 bool DataEquals(HValue* other) override { |
| 5752 HLoadContextSlot* b = HLoadContextSlot::cast(other); | 5744 HLoadContextSlot* b = HLoadContextSlot::cast(other); |
| 5753 return (slot_index() == b->slot_index()); | 5745 return (slot_index() == b->slot_index()); |
| 5754 } | 5746 } |
| 5755 | 5747 |
| 5756 private: | 5748 private: |
| 5757 bool IsDeletable() const OVERRIDE { return !RequiresHoleCheck(); } | 5749 bool IsDeletable() const override { return !RequiresHoleCheck(); } |
| 5758 | 5750 |
| 5759 int slot_index_; | 5751 int slot_index_; |
| 5760 Mode mode_; | 5752 Mode mode_; |
| 5761 }; | 5753 }; |
| 5762 | 5754 |
| 5763 | 5755 |
| 5764 class HStoreContextSlot FINAL : public HTemplateInstruction<2> { | 5756 class HStoreContextSlot final : public HTemplateInstruction<2> { |
| 5765 public: | 5757 public: |
| 5766 enum Mode { | 5758 enum Mode { |
| 5767 // Perform a normal store to the context slot without checking its previous | 5759 // Perform a normal store to the context slot without checking its previous |
| 5768 // value. | 5760 // value. |
| 5769 kNoCheck, | 5761 kNoCheck, |
| 5770 // Check the previous value of the context slot and deoptimize if it's the | 5762 // Check the previous value of the context slot and deoptimize if it's the |
| 5771 // hole value. This is used for checking for assignments to uninitialized | 5763 // hole value. This is used for checking for assignments to uninitialized |
| 5772 // harmony bindings where we deoptimize into full-codegen generated code | 5764 // harmony bindings where we deoptimize into full-codegen generated code |
| 5773 // which will subsequently throw a reference error. | 5765 // which will subsequently throw a reference error. |
| 5774 kCheckDeoptimize, | 5766 kCheckDeoptimize, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 5789 } | 5781 } |
| 5790 | 5782 |
| 5791 bool DeoptimizesOnHole() { | 5783 bool DeoptimizesOnHole() { |
| 5792 return mode_ == kCheckDeoptimize; | 5784 return mode_ == kCheckDeoptimize; |
| 5793 } | 5785 } |
| 5794 | 5786 |
| 5795 bool RequiresHoleCheck() { | 5787 bool RequiresHoleCheck() { |
| 5796 return mode_ != kNoCheck; | 5788 return mode_ != kNoCheck; |
| 5797 } | 5789 } |
| 5798 | 5790 |
| 5799 Representation RequiredInputRepresentation(int index) OVERRIDE { | 5791 Representation RequiredInputRepresentation(int index) override { |
| 5800 return Representation::Tagged(); | 5792 return Representation::Tagged(); |
| 5801 } | 5793 } |
| 5802 | 5794 |
| 5803 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 5795 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 5804 | 5796 |
| 5805 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) | 5797 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) |
| 5806 | 5798 |
| 5807 private: | 5799 private: |
| 5808 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value) | 5800 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value) |
| 5809 : slot_index_(slot_index), mode_(mode) { | 5801 : slot_index_(slot_index), mode_(mode) { |
| 5810 SetOperandAt(0, context); | 5802 SetOperandAt(0, context); |
| 5811 SetOperandAt(1, value); | 5803 SetOperandAt(1, value); |
| 5812 SetChangesFlag(kContextSlots); | 5804 SetChangesFlag(kContextSlots); |
| 5813 } | 5805 } |
| 5814 | 5806 |
| 5815 int slot_index_; | 5807 int slot_index_; |
| 5816 Mode mode_; | 5808 Mode mode_; |
| 5817 }; | 5809 }; |
| 5818 | 5810 |
| 5819 | 5811 |
| 5820 // Represents an access to a portion of an object, such as the map pointer, | 5812 // Represents an access to a portion of an object, such as the map pointer, |
| 5821 // array elements pointer, etc, but not accesses to array elements themselves. | 5813 // array elements pointer, etc, but not accesses to array elements themselves. |
| 5822 class HObjectAccess FINAL { | 5814 class HObjectAccess final { |
| 5823 public: | 5815 public: |
| 5824 inline bool IsInobject() const { | 5816 inline bool IsInobject() const { |
| 5825 return portion() != kBackingStore && portion() != kExternalMemory; | 5817 return portion() != kBackingStore && portion() != kExternalMemory; |
| 5826 } | 5818 } |
| 5827 | 5819 |
| 5828 inline bool IsExternalMemory() const { | 5820 inline bool IsExternalMemory() const { |
| 5829 return portion() == kExternalMemory; | 5821 return portion() == kExternalMemory; |
| 5830 } | 5822 } |
| 5831 | 5823 |
| 5832 inline bool IsStringLength() const { | 5824 inline bool IsStringLength() const { |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6244 | 6236 |
| 6245 inline Portion portion() const { | 6237 inline Portion portion() const { |
| 6246 return PortionField::decode(value_); | 6238 return PortionField::decode(value_); |
| 6247 } | 6239 } |
| 6248 }; | 6240 }; |
| 6249 | 6241 |
| 6250 | 6242 |
| 6251 std::ostream& operator<<(std::ostream& os, const HObjectAccess& access); | 6243 std::ostream& operator<<(std::ostream& os, const HObjectAccess& access); |
| 6252 | 6244 |
| 6253 | 6245 |
| 6254 class HLoadNamedField FINAL : public HTemplateInstruction<2> { | 6246 class HLoadNamedField final : public HTemplateInstruction<2> { |
| 6255 public: | 6247 public: |
| 6256 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, | 6248 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, |
| 6257 HValue*, HObjectAccess); | 6249 HValue*, HObjectAccess); |
| 6258 DECLARE_INSTRUCTION_FACTORY_P5(HLoadNamedField, HValue*, HValue*, | 6250 DECLARE_INSTRUCTION_FACTORY_P5(HLoadNamedField, HValue*, HValue*, |
| 6259 HObjectAccess, const UniqueSet<Map>*, HType); | 6251 HObjectAccess, const UniqueSet<Map>*, HType); |
| 6260 | 6252 |
| 6261 HValue* object() const { return OperandAt(0); } | 6253 HValue* object() const { return OperandAt(0); } |
| 6262 HValue* dependency() const { | 6254 HValue* dependency() const { |
| 6263 DCHECK(HasDependency()); | 6255 DCHECK(HasDependency()); |
| 6264 return OperandAt(1); | 6256 return OperandAt(1); |
| 6265 } | 6257 } |
| 6266 bool HasDependency() const { return OperandAt(0) != OperandAt(1); } | 6258 bool HasDependency() const { return OperandAt(0) != OperandAt(1); } |
| 6267 HObjectAccess access() const { return access_; } | 6259 HObjectAccess access() const { return access_; } |
| 6268 Representation field_representation() const { | 6260 Representation field_representation() const { |
| 6269 return access_.representation(); | 6261 return access_.representation(); |
| 6270 } | 6262 } |
| 6271 | 6263 |
| 6272 const UniqueSet<Map>* maps() const { return maps_; } | 6264 const UniqueSet<Map>* maps() const { return maps_; } |
| 6273 | 6265 |
| 6274 bool HasEscapingOperandAt(int index) OVERRIDE { return false; } | 6266 bool HasEscapingOperandAt(int index) override { return false; } |
| 6275 bool HasOutOfBoundsAccess(int size) OVERRIDE { | 6267 bool HasOutOfBoundsAccess(int size) override { |
| 6276 return !access().IsInobject() || access().offset() >= size; | 6268 return !access().IsInobject() || access().offset() >= size; |
| 6277 } | 6269 } |
| 6278 Representation RequiredInputRepresentation(int index) OVERRIDE { | 6270 Representation RequiredInputRepresentation(int index) override { |
| 6279 if (index == 0) { | 6271 if (index == 0) { |
| 6280 // object must be external in case of external memory access | 6272 // object must be external in case of external memory access |
| 6281 return access().IsExternalMemory() ? Representation::External() | 6273 return access().IsExternalMemory() ? Representation::External() |
| 6282 : Representation::Tagged(); | 6274 : Representation::Tagged(); |
| 6283 } | 6275 } |
| 6284 DCHECK(index == 1); | 6276 DCHECK(index == 1); |
| 6285 return Representation::None(); | 6277 return Representation::None(); |
| 6286 } | 6278 } |
| 6287 Range* InferRange(Zone* zone) OVERRIDE; | 6279 Range* InferRange(Zone* zone) override; |
| 6288 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 6280 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 6289 | 6281 |
| 6290 bool CanBeReplacedWith(HValue* other) const { | 6282 bool CanBeReplacedWith(HValue* other) const { |
| 6291 if (!CheckFlag(HValue::kCantBeReplaced)) return false; | 6283 if (!CheckFlag(HValue::kCantBeReplaced)) return false; |
| 6292 if (!type().Equals(other->type())) return false; | 6284 if (!type().Equals(other->type())) return false; |
| 6293 if (!representation().Equals(other->representation())) return false; | 6285 if (!representation().Equals(other->representation())) return false; |
| 6294 if (!other->IsLoadNamedField()) return true; | 6286 if (!other->IsLoadNamedField()) return true; |
| 6295 HLoadNamedField* that = HLoadNamedField::cast(other); | 6287 HLoadNamedField* that = HLoadNamedField::cast(other); |
| 6296 if (this->maps_ == that->maps_) return true; | 6288 if (this->maps_ == that->maps_) return true; |
| 6297 if (this->maps_ == NULL || that->maps_ == NULL) return false; | 6289 if (this->maps_ == NULL || that->maps_ == NULL) return false; |
| 6298 return this->maps_->IsSubset(that->maps_); | 6290 return this->maps_->IsSubset(that->maps_); |
| 6299 } | 6291 } |
| 6300 | 6292 |
| 6301 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) | 6293 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) |
| 6302 | 6294 |
| 6303 protected: | 6295 protected: |
| 6304 bool DataEquals(HValue* other) OVERRIDE { | 6296 bool DataEquals(HValue* other) override { |
| 6305 HLoadNamedField* that = HLoadNamedField::cast(other); | 6297 HLoadNamedField* that = HLoadNamedField::cast(other); |
| 6306 if (!this->access_.Equals(that->access_)) return false; | 6298 if (!this->access_.Equals(that->access_)) return false; |
| 6307 if (this->maps_ == that->maps_) return true; | 6299 if (this->maps_ == that->maps_) return true; |
| 6308 return (this->maps_ != NULL && | 6300 return (this->maps_ != NULL && |
| 6309 that->maps_ != NULL && | 6301 that->maps_ != NULL && |
| 6310 this->maps_->Equals(that->maps_)); | 6302 this->maps_->Equals(that->maps_)); |
| 6311 } | 6303 } |
| 6312 | 6304 |
| 6313 private: | 6305 private: |
| 6314 HLoadNamedField(HValue* object, | 6306 HLoadNamedField(HValue* object, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6358 SetOperandAt(0, object); | 6350 SetOperandAt(0, object); |
| 6359 SetOperandAt(1, dependency ? dependency : object); | 6351 SetOperandAt(1, dependency ? dependency : object); |
| 6360 | 6352 |
| 6361 DCHECK(access.representation().IsHeapObject()); | 6353 DCHECK(access.representation().IsHeapObject()); |
| 6362 DCHECK(type.IsHeapObject()); | 6354 DCHECK(type.IsHeapObject()); |
| 6363 set_representation(Representation::Tagged()); | 6355 set_representation(Representation::Tagged()); |
| 6364 | 6356 |
| 6365 access.SetGVNFlags(this, LOAD); | 6357 access.SetGVNFlags(this, LOAD); |
| 6366 } | 6358 } |
| 6367 | 6359 |
| 6368 bool IsDeletable() const OVERRIDE { return true; } | 6360 bool IsDeletable() const override { return true; } |
| 6369 | 6361 |
| 6370 HObjectAccess access_; | 6362 HObjectAccess access_; |
| 6371 const UniqueSet<Map>* maps_; | 6363 const UniqueSet<Map>* maps_; |
| 6372 }; | 6364 }; |
| 6373 | 6365 |
| 6374 | 6366 |
| 6375 class HLoadNamedGeneric FINAL : public HTemplateInstruction<2> { | 6367 class HLoadNamedGeneric final : public HTemplateInstruction<2> { |
| 6376 public: | 6368 public: |
| 6377 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadNamedGeneric, HValue*, | 6369 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadNamedGeneric, HValue*, |
| 6378 Handle<Object>, InlineCacheState); | 6370 Handle<Object>, InlineCacheState); |
| 6379 | 6371 |
| 6380 HValue* context() const { return OperandAt(0); } | 6372 HValue* context() const { return OperandAt(0); } |
| 6381 HValue* object() const { return OperandAt(1); } | 6373 HValue* object() const { return OperandAt(1); } |
| 6382 Handle<Object> name() const { return name_; } | 6374 Handle<Object> name() const { return name_; } |
| 6383 | 6375 |
| 6384 InlineCacheState initialization_state() const { | 6376 InlineCacheState initialization_state() const { |
| 6385 return initialization_state_; | 6377 return initialization_state_; |
| 6386 } | 6378 } |
| 6387 FeedbackVectorICSlot slot() const { return slot_; } | 6379 FeedbackVectorICSlot slot() const { return slot_; } |
| 6388 Handle<TypeFeedbackVector> feedback_vector() const { | 6380 Handle<TypeFeedbackVector> feedback_vector() const { |
| 6389 return feedback_vector_; | 6381 return feedback_vector_; |
| 6390 } | 6382 } |
| 6391 bool HasVectorAndSlot() const { return FLAG_vector_ics; } | 6383 bool HasVectorAndSlot() const { return FLAG_vector_ics; } |
| 6392 void SetVectorAndSlot(Handle<TypeFeedbackVector> vector, | 6384 void SetVectorAndSlot(Handle<TypeFeedbackVector> vector, |
| 6393 FeedbackVectorICSlot slot) { | 6385 FeedbackVectorICSlot slot) { |
| 6394 DCHECK(FLAG_vector_ics); | 6386 DCHECK(FLAG_vector_ics); |
| 6395 feedback_vector_ = vector; | 6387 feedback_vector_ = vector; |
| 6396 slot_ = slot; | 6388 slot_ = slot; |
| 6397 } | 6389 } |
| 6398 | 6390 |
| 6399 Representation RequiredInputRepresentation(int index) OVERRIDE { | 6391 Representation RequiredInputRepresentation(int index) override { |
| 6400 return Representation::Tagged(); | 6392 return Representation::Tagged(); |
| 6401 } | 6393 } |
| 6402 | 6394 |
| 6403 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 6395 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 6404 | 6396 |
| 6405 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) | 6397 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) |
| 6406 | 6398 |
| 6407 private: | 6399 private: |
| 6408 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name, | 6400 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name, |
| 6409 InlineCacheState initialization_state) | 6401 InlineCacheState initialization_state) |
| 6410 : name_(name), | 6402 : name_(name), |
| 6411 slot_(FeedbackVectorICSlot::Invalid()), | 6403 slot_(FeedbackVectorICSlot::Invalid()), |
| 6412 initialization_state_(initialization_state) { | 6404 initialization_state_(initialization_state) { |
| 6413 SetOperandAt(0, context); | 6405 SetOperandAt(0, context); |
| 6414 SetOperandAt(1, object); | 6406 SetOperandAt(1, object); |
| 6415 set_representation(Representation::Tagged()); | 6407 set_representation(Representation::Tagged()); |
| 6416 SetAllSideEffects(); | 6408 SetAllSideEffects(); |
| 6417 } | 6409 } |
| 6418 | 6410 |
| 6419 Handle<Object> name_; | 6411 Handle<Object> name_; |
| 6420 Handle<TypeFeedbackVector> feedback_vector_; | 6412 Handle<TypeFeedbackVector> feedback_vector_; |
| 6421 FeedbackVectorICSlot slot_; | 6413 FeedbackVectorICSlot slot_; |
| 6422 InlineCacheState initialization_state_; | 6414 InlineCacheState initialization_state_; |
| 6423 }; | 6415 }; |
| 6424 | 6416 |
| 6425 | 6417 |
| 6426 class HLoadFunctionPrototype FINAL : public HUnaryOperation { | 6418 class HLoadFunctionPrototype final : public HUnaryOperation { |
| 6427 public: | 6419 public: |
| 6428 DECLARE_INSTRUCTION_FACTORY_P1(HLoadFunctionPrototype, HValue*); | 6420 DECLARE_INSTRUCTION_FACTORY_P1(HLoadFunctionPrototype, HValue*); |
| 6429 | 6421 |
| 6430 HValue* function() { return OperandAt(0); } | 6422 HValue* function() { return OperandAt(0); } |
| 6431 | 6423 |
| 6432 Representation RequiredInputRepresentation(int index) OVERRIDE { | 6424 Representation RequiredInputRepresentation(int index) override { |
| 6433 return Representation::Tagged(); | 6425 return Representation::Tagged(); |
| 6434 } | 6426 } |
| 6435 | 6427 |
| 6436 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) | 6428 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) |
| 6437 | 6429 |
| 6438 protected: | 6430 protected: |
| 6439 bool DataEquals(HValue* other) OVERRIDE { return true; } | 6431 bool DataEquals(HValue* other) override { return true; } |
| 6440 | 6432 |
| 6441 private: | 6433 private: |
| 6442 explicit HLoadFunctionPrototype(HValue* function) | 6434 explicit HLoadFunctionPrototype(HValue* function) |
| 6443 : HUnaryOperation(function) { | 6435 : HUnaryOperation(function) { |
| 6444 set_representation(Representation::Tagged()); | 6436 set_representation(Representation::Tagged()); |
| 6445 SetFlag(kUseGVN); | 6437 SetFlag(kUseGVN); |
| 6446 SetDependsOnFlag(kCalls); | 6438 SetDependsOnFlag(kCalls); |
| 6447 } | 6439 } |
| 6448 }; | 6440 }; |
| 6449 | 6441 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 6466 | 6458 |
| 6467 | 6459 |
| 6468 static const int kDefaultKeyedHeaderOffsetSentinel = -1; | 6460 static const int kDefaultKeyedHeaderOffsetSentinel = -1; |
| 6469 | 6461 |
| 6470 enum LoadKeyedHoleMode { | 6462 enum LoadKeyedHoleMode { |
| 6471 NEVER_RETURN_HOLE, | 6463 NEVER_RETURN_HOLE, |
| 6472 ALLOW_RETURN_HOLE | 6464 ALLOW_RETURN_HOLE |
| 6473 }; | 6465 }; |
| 6474 | 6466 |
| 6475 | 6467 |
| 6476 class HLoadKeyed FINAL | 6468 class HLoadKeyed final : public HTemplateInstruction<3>, |
| 6477 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 6469 public ArrayInstructionInterface { |
| 6478 public: | 6470 public: |
| 6479 DECLARE_INSTRUCTION_FACTORY_P4(HLoadKeyed, HValue*, HValue*, HValue*, | 6471 DECLARE_INSTRUCTION_FACTORY_P4(HLoadKeyed, HValue*, HValue*, HValue*, |
| 6480 ElementsKind); | 6472 ElementsKind); |
| 6481 DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*, | 6473 DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*, |
| 6482 ElementsKind, LoadKeyedHoleMode); | 6474 ElementsKind, LoadKeyedHoleMode); |
| 6483 DECLARE_INSTRUCTION_FACTORY_P6(HLoadKeyed, HValue*, HValue*, HValue*, | 6475 DECLARE_INSTRUCTION_FACTORY_P6(HLoadKeyed, HValue*, HValue*, HValue*, |
| 6484 ElementsKind, LoadKeyedHoleMode, int); | 6476 ElementsKind, LoadKeyedHoleMode, int); |
| 6485 | 6477 |
| 6486 bool is_external() const { | 6478 bool is_external() const { |
| 6487 return IsExternalArrayElementsKind(elements_kind()); | 6479 return IsExternalArrayElementsKind(elements_kind()); |
| 6488 } | 6480 } |
| 6489 bool is_fixed_typed_array() const { | 6481 bool is_fixed_typed_array() const { |
| 6490 return IsFixedTypedArrayElementsKind(elements_kind()); | 6482 return IsFixedTypedArrayElementsKind(elements_kind()); |
| 6491 } | 6483 } |
| 6492 bool is_typed_elements() const { | 6484 bool is_typed_elements() const { |
| 6493 return is_external() || is_fixed_typed_array(); | 6485 return is_external() || is_fixed_typed_array(); |
| 6494 } | 6486 } |
| 6495 HValue* elements() const { return OperandAt(0); } | 6487 HValue* elements() const { return OperandAt(0); } |
| 6496 HValue* key() const { return OperandAt(1); } | 6488 HValue* key() const { return OperandAt(1); } |
| 6497 HValue* dependency() const { | 6489 HValue* dependency() const { |
| 6498 DCHECK(HasDependency()); | 6490 DCHECK(HasDependency()); |
| 6499 return OperandAt(2); | 6491 return OperandAt(2); |
| 6500 } | 6492 } |
| 6501 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } | 6493 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } |
| 6502 uint32_t base_offset() const { return BaseOffsetField::decode(bit_field_); } | 6494 uint32_t base_offset() const { return BaseOffsetField::decode(bit_field_); } |
| 6503 bool TryIncreaseBaseOffset(uint32_t increase_by_value) OVERRIDE; | 6495 bool TryIncreaseBaseOffset(uint32_t increase_by_value) override; |
| 6504 HValue* GetKey() OVERRIDE { return key(); } | 6496 HValue* GetKey() override { return key(); } |
| 6505 void SetKey(HValue* key) OVERRIDE { SetOperandAt(1, key); } | 6497 void SetKey(HValue* key) override { SetOperandAt(1, key); } |
| 6506 bool IsDehoisted() const OVERRIDE { | 6498 bool IsDehoisted() const override { |
| 6507 return IsDehoistedField::decode(bit_field_); | 6499 return IsDehoistedField::decode(bit_field_); |
| 6508 } | 6500 } |
| 6509 void SetDehoisted(bool is_dehoisted) OVERRIDE { | 6501 void SetDehoisted(bool is_dehoisted) override { |
| 6510 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); | 6502 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); |
| 6511 } | 6503 } |
| 6512 ElementsKind elements_kind() const OVERRIDE { | 6504 ElementsKind elements_kind() const override { |
| 6513 return ElementsKindField::decode(bit_field_); | 6505 return ElementsKindField::decode(bit_field_); |
| 6514 } | 6506 } |
| 6515 LoadKeyedHoleMode hole_mode() const { | 6507 LoadKeyedHoleMode hole_mode() const { |
| 6516 return HoleModeField::decode(bit_field_); | 6508 return HoleModeField::decode(bit_field_); |
| 6517 } | 6509 } |
| 6518 | 6510 |
| 6519 Representation RequiredInputRepresentation(int index) OVERRIDE { | 6511 Representation RequiredInputRepresentation(int index) override { |
| 6520 // kind_fast: tagged[int32] (none) | 6512 // kind_fast: tagged[int32] (none) |
| 6521 // kind_double: tagged[int32] (none) | 6513 // kind_double: tagged[int32] (none) |
| 6522 // kind_fixed_typed_array: tagged[int32] (none) | 6514 // kind_fixed_typed_array: tagged[int32] (none) |
| 6523 // kind_external: external[int32] (none) | 6515 // kind_external: external[int32] (none) |
| 6524 if (index == 0) { | 6516 if (index == 0) { |
| 6525 return is_external() ? Representation::External() | 6517 return is_external() ? Representation::External() |
| 6526 : Representation::Tagged(); | 6518 : Representation::Tagged(); |
| 6527 } | 6519 } |
| 6528 if (index == 1) { | 6520 if (index == 1) { |
| 6529 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 6521 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
| 6530 OperandAt(1)->representation()); | 6522 OperandAt(1)->representation()); |
| 6531 } | 6523 } |
| 6532 return Representation::None(); | 6524 return Representation::None(); |
| 6533 } | 6525 } |
| 6534 | 6526 |
| 6535 Representation observed_input_representation(int index) OVERRIDE { | 6527 Representation observed_input_representation(int index) override { |
| 6536 return RequiredInputRepresentation(index); | 6528 return RequiredInputRepresentation(index); |
| 6537 } | 6529 } |
| 6538 | 6530 |
| 6539 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 6531 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 6540 | 6532 |
| 6541 bool UsesMustHandleHole() const; | 6533 bool UsesMustHandleHole() const; |
| 6542 bool AllUsesCanTreatHoleAsNaN() const; | 6534 bool AllUsesCanTreatHoleAsNaN() const; |
| 6543 bool RequiresHoleCheck() const; | 6535 bool RequiresHoleCheck() const; |
| 6544 | 6536 |
| 6545 Range* InferRange(Zone* zone) OVERRIDE; | 6537 Range* InferRange(Zone* zone) override; |
| 6546 | 6538 |
| 6547 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed) | 6539 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed) |
| 6548 | 6540 |
| 6549 protected: | 6541 protected: |
| 6550 bool DataEquals(HValue* other) OVERRIDE { | 6542 bool DataEquals(HValue* other) override { |
| 6551 if (!other->IsLoadKeyed()) return false; | 6543 if (!other->IsLoadKeyed()) return false; |
| 6552 HLoadKeyed* other_load = HLoadKeyed::cast(other); | 6544 HLoadKeyed* other_load = HLoadKeyed::cast(other); |
| 6553 | 6545 |
| 6554 if (base_offset() != other_load->base_offset()) return false; | 6546 if (base_offset() != other_load->base_offset()) return false; |
| 6555 return elements_kind() == other_load->elements_kind(); | 6547 return elements_kind() == other_load->elements_kind(); |
| 6556 } | 6548 } |
| 6557 | 6549 |
| 6558 private: | 6550 private: |
| 6559 HLoadKeyed(HValue* obj, | 6551 HLoadKeyed(HValue* obj, |
| 6560 HValue* key, | 6552 HValue* key, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6616 } else { | 6608 } else { |
| 6617 UNREACHABLE(); | 6609 UNREACHABLE(); |
| 6618 } | 6610 } |
| 6619 // Native code could change the specialized array. | 6611 // Native code could change the specialized array. |
| 6620 SetDependsOnFlag(kCalls); | 6612 SetDependsOnFlag(kCalls); |
| 6621 } | 6613 } |
| 6622 | 6614 |
| 6623 SetFlag(kUseGVN); | 6615 SetFlag(kUseGVN); |
| 6624 } | 6616 } |
| 6625 | 6617 |
| 6626 bool IsDeletable() const OVERRIDE { return !RequiresHoleCheck(); } | 6618 bool IsDeletable() const override { return !RequiresHoleCheck(); } |
| 6627 | 6619 |
| 6628 // Establish some checks around our packed fields | 6620 // Establish some checks around our packed fields |
| 6629 enum LoadKeyedBits { | 6621 enum LoadKeyedBits { |
| 6630 kBitsForElementsKind = 5, | 6622 kBitsForElementsKind = 5, |
| 6631 kBitsForHoleMode = 1, | 6623 kBitsForHoleMode = 1, |
| 6632 kBitsForBaseOffset = 25, | 6624 kBitsForBaseOffset = 25, |
| 6633 kBitsForIsDehoisted = 1, | 6625 kBitsForIsDehoisted = 1, |
| 6634 | 6626 |
| 6635 kStartElementsKind = 0, | 6627 kStartElementsKind = 0, |
| 6636 kStartHoleMode = kStartElementsKind + kBitsForElementsKind, | 6628 kStartHoleMode = kStartElementsKind + kBitsForElementsKind, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 6650 class BaseOffsetField: | 6642 class BaseOffsetField: |
| 6651 public BitField<uint32_t, kStartBaseOffset, kBitsForBaseOffset> | 6643 public BitField<uint32_t, kStartBaseOffset, kBitsForBaseOffset> |
| 6652 {}; // NOLINT | 6644 {}; // NOLINT |
| 6653 class IsDehoistedField: | 6645 class IsDehoistedField: |
| 6654 public BitField<bool, kStartIsDehoisted, kBitsForIsDehoisted> | 6646 public BitField<bool, kStartIsDehoisted, kBitsForIsDehoisted> |
| 6655 {}; // NOLINT | 6647 {}; // NOLINT |
| 6656 uint32_t bit_field_; | 6648 uint32_t bit_field_; |
| 6657 }; | 6649 }; |
| 6658 | 6650 |
| 6659 | 6651 |
| 6660 class HLoadKeyedGeneric FINAL : public HTemplateInstruction<3> { | 6652 class HLoadKeyedGeneric final : public HTemplateInstruction<3> { |
| 6661 public: | 6653 public: |
| 6662 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadKeyedGeneric, HValue*, | 6654 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadKeyedGeneric, HValue*, |
| 6663 HValue*, InlineCacheState); | 6655 HValue*, InlineCacheState); |
| 6664 HValue* object() const { return OperandAt(0); } | 6656 HValue* object() const { return OperandAt(0); } |
| 6665 HValue* key() const { return OperandAt(1); } | 6657 HValue* key() const { return OperandAt(1); } |
| 6666 HValue* context() const { return OperandAt(2); } | 6658 HValue* context() const { return OperandAt(2); } |
| 6667 InlineCacheState initialization_state() const { | 6659 InlineCacheState initialization_state() const { |
| 6668 return initialization_state_; | 6660 return initialization_state_; |
| 6669 } | 6661 } |
| 6670 FeedbackVectorICSlot slot() const { return slot_; } | 6662 FeedbackVectorICSlot slot() const { return slot_; } |
| 6671 Handle<TypeFeedbackVector> feedback_vector() const { | 6663 Handle<TypeFeedbackVector> feedback_vector() const { |
| 6672 return feedback_vector_; | 6664 return feedback_vector_; |
| 6673 } | 6665 } |
| 6674 bool HasVectorAndSlot() const { | 6666 bool HasVectorAndSlot() const { |
| 6675 DCHECK(!FLAG_vector_ics || initialization_state_ == MEGAMORPHIC || | 6667 DCHECK(!FLAG_vector_ics || initialization_state_ == MEGAMORPHIC || |
| 6676 !feedback_vector_.is_null()); | 6668 !feedback_vector_.is_null()); |
| 6677 return !feedback_vector_.is_null(); | 6669 return !feedback_vector_.is_null(); |
| 6678 } | 6670 } |
| 6679 void SetVectorAndSlot(Handle<TypeFeedbackVector> vector, | 6671 void SetVectorAndSlot(Handle<TypeFeedbackVector> vector, |
| 6680 FeedbackVectorICSlot slot) { | 6672 FeedbackVectorICSlot slot) { |
| 6681 DCHECK(FLAG_vector_ics); | 6673 DCHECK(FLAG_vector_ics); |
| 6682 feedback_vector_ = vector; | 6674 feedback_vector_ = vector; |
| 6683 slot_ = slot; | 6675 slot_ = slot; |
| 6684 } | 6676 } |
| 6685 | 6677 |
| 6686 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 6678 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 6687 | 6679 |
| 6688 Representation RequiredInputRepresentation(int index) OVERRIDE { | 6680 Representation RequiredInputRepresentation(int index) override { |
| 6689 // tagged[tagged] | 6681 // tagged[tagged] |
| 6690 return Representation::Tagged(); | 6682 return Representation::Tagged(); |
| 6691 } | 6683 } |
| 6692 | 6684 |
| 6693 HValue* Canonicalize() OVERRIDE; | 6685 HValue* Canonicalize() override; |
| 6694 | 6686 |
| 6695 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) | 6687 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) |
| 6696 | 6688 |
| 6697 private: | 6689 private: |
| 6698 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key, | 6690 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key, |
| 6699 InlineCacheState initialization_state) | 6691 InlineCacheState initialization_state) |
| 6700 : slot_(FeedbackVectorICSlot::Invalid()), | 6692 : slot_(FeedbackVectorICSlot::Invalid()), |
| 6701 initialization_state_(initialization_state) { | 6693 initialization_state_(initialization_state) { |
| 6702 set_representation(Representation::Tagged()); | 6694 set_representation(Representation::Tagged()); |
| 6703 SetOperandAt(0, obj); | 6695 SetOperandAt(0, obj); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 6716 // initialized or not. | 6708 // initialized or not. |
| 6717 enum StoreFieldOrKeyedMode { | 6709 enum StoreFieldOrKeyedMode { |
| 6718 // The entry could be either previously initialized or not. | 6710 // The entry could be either previously initialized or not. |
| 6719 INITIALIZING_STORE, | 6711 INITIALIZING_STORE, |
| 6720 // At the time of this store it is guaranteed that the entry is already | 6712 // At the time of this store it is guaranteed that the entry is already |
| 6721 // initialized. | 6713 // initialized. |
| 6722 STORE_TO_INITIALIZED_ENTRY | 6714 STORE_TO_INITIALIZED_ENTRY |
| 6723 }; | 6715 }; |
| 6724 | 6716 |
| 6725 | 6717 |
| 6726 class HStoreNamedField FINAL : public HTemplateInstruction<3> { | 6718 class HStoreNamedField final : public HTemplateInstruction<3> { |
| 6727 public: | 6719 public: |
| 6728 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, | 6720 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, |
| 6729 HObjectAccess, HValue*); | 6721 HObjectAccess, HValue*); |
| 6730 DECLARE_INSTRUCTION_FACTORY_P4(HStoreNamedField, HValue*, | 6722 DECLARE_INSTRUCTION_FACTORY_P4(HStoreNamedField, HValue*, |
| 6731 HObjectAccess, HValue*, StoreFieldOrKeyedMode); | 6723 HObjectAccess, HValue*, StoreFieldOrKeyedMode); |
| 6732 | 6724 |
| 6733 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 6725 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
| 6734 | 6726 |
| 6735 bool HasEscapingOperandAt(int index) OVERRIDE { return index == 1; } | 6727 bool HasEscapingOperandAt(int index) override { return index == 1; } |
| 6736 bool HasOutOfBoundsAccess(int size) OVERRIDE { | 6728 bool HasOutOfBoundsAccess(int size) override { |
| 6737 return !access().IsInobject() || access().offset() >= size; | 6729 return !access().IsInobject() || access().offset() >= size; |
| 6738 } | 6730 } |
| 6739 Representation RequiredInputRepresentation(int index) OVERRIDE { | 6731 Representation RequiredInputRepresentation(int index) override { |
| 6740 if (index == 0 && access().IsExternalMemory()) { | 6732 if (index == 0 && access().IsExternalMemory()) { |
| 6741 // object must be external in case of external memory access | 6733 // object must be external in case of external memory access |
| 6742 return Representation::External(); | 6734 return Representation::External(); |
| 6743 } else if (index == 1) { | 6735 } else if (index == 1) { |
| 6744 if (field_representation().IsInteger8() || | 6736 if (field_representation().IsInteger8() || |
| 6745 field_representation().IsUInteger8() || | 6737 field_representation().IsUInteger8() || |
| 6746 field_representation().IsInteger16() || | 6738 field_representation().IsInteger16() || |
| 6747 field_representation().IsUInteger16() || | 6739 field_representation().IsUInteger16() || |
| 6748 field_representation().IsInteger32()) { | 6740 field_representation().IsInteger32()) { |
| 6749 return Representation::Integer32(); | 6741 return Representation::Integer32(); |
| 6750 } else if (field_representation().IsDouble()) { | 6742 } else if (field_representation().IsDouble()) { |
| 6751 return field_representation(); | 6743 return field_representation(); |
| 6752 } else if (field_representation().IsSmi()) { | 6744 } else if (field_representation().IsSmi()) { |
| 6753 if (SmiValuesAre32Bits() && | 6745 if (SmiValuesAre32Bits() && |
| 6754 store_mode() == STORE_TO_INITIALIZED_ENTRY) { | 6746 store_mode() == STORE_TO_INITIALIZED_ENTRY) { |
| 6755 return Representation::Integer32(); | 6747 return Representation::Integer32(); |
| 6756 } | 6748 } |
| 6757 return field_representation(); | 6749 return field_representation(); |
| 6758 } else if (field_representation().IsExternal()) { | 6750 } else if (field_representation().IsExternal()) { |
| 6759 return Representation::External(); | 6751 return Representation::External(); |
| 6760 } | 6752 } |
| 6761 } | 6753 } |
| 6762 return Representation::Tagged(); | 6754 return Representation::Tagged(); |
| 6763 } | 6755 } |
| 6764 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 6756 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
| 6765 HValue* dominator) OVERRIDE { | 6757 HValue* dominator) override { |
| 6766 DCHECK(side_effect == kNewSpacePromotion); | 6758 DCHECK(side_effect == kNewSpacePromotion); |
| 6767 if (!FLAG_use_write_barrier_elimination) return false; | 6759 if (!FLAG_use_write_barrier_elimination) return false; |
| 6768 dominator_ = dominator; | 6760 dominator_ = dominator; |
| 6769 return false; | 6761 return false; |
| 6770 } | 6762 } |
| 6771 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 6763 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 6772 | 6764 |
| 6773 HValue* object() const { return OperandAt(0); } | 6765 HValue* object() const { return OperandAt(0); } |
| 6774 HValue* value() const { return OperandAt(1); } | 6766 HValue* value() const { return OperandAt(1); } |
| 6775 HValue* transition() const { return OperandAt(2); } | 6767 HValue* transition() const { return OperandAt(2); } |
| 6776 | 6768 |
| 6777 HObjectAccess access() const { return access_; } | 6769 HObjectAccess access() const { return access_; } |
| 6778 HValue* dominator() const { return dominator_; } | 6770 HValue* dominator() const { return dominator_; } |
| 6779 bool has_transition() const { return HasTransitionField::decode(bit_field_); } | 6771 bool has_transition() const { return HasTransitionField::decode(bit_field_); } |
| 6780 StoreFieldOrKeyedMode store_mode() const { | 6772 StoreFieldOrKeyedMode store_mode() const { |
| 6781 return StoreModeField::decode(bit_field_); | 6773 return StoreModeField::decode(bit_field_); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6864 | 6856 |
| 6865 class HasTransitionField : public BitField<bool, 0, 1> {}; | 6857 class HasTransitionField : public BitField<bool, 0, 1> {}; |
| 6866 class StoreModeField : public BitField<StoreFieldOrKeyedMode, 1, 1> {}; | 6858 class StoreModeField : public BitField<StoreFieldOrKeyedMode, 1, 1> {}; |
| 6867 | 6859 |
| 6868 HObjectAccess access_; | 6860 HObjectAccess access_; |
| 6869 HValue* dominator_; | 6861 HValue* dominator_; |
| 6870 uint32_t bit_field_; | 6862 uint32_t bit_field_; |
| 6871 }; | 6863 }; |
| 6872 | 6864 |
| 6873 | 6865 |
| 6874 class HStoreNamedGeneric FINAL : public HTemplateInstruction<3> { | 6866 class HStoreNamedGeneric final : public HTemplateInstruction<3> { |
| 6875 public: | 6867 public: |
| 6876 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(HStoreNamedGeneric, HValue*, | 6868 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(HStoreNamedGeneric, HValue*, |
| 6877 Handle<String>, HValue*, | 6869 Handle<String>, HValue*, |
| 6878 LanguageMode, InlineCacheState); | 6870 LanguageMode, InlineCacheState); |
| 6879 HValue* object() const { return OperandAt(0); } | 6871 HValue* object() const { return OperandAt(0); } |
| 6880 HValue* value() const { return OperandAt(1); } | 6872 HValue* value() const { return OperandAt(1); } |
| 6881 HValue* context() const { return OperandAt(2); } | 6873 HValue* context() const { return OperandAt(2); } |
| 6882 Handle<String> name() const { return name_; } | 6874 Handle<String> name() const { return name_; } |
| 6883 LanguageMode language_mode() const { return language_mode_; } | 6875 LanguageMode language_mode() const { return language_mode_; } |
| 6884 InlineCacheState initialization_state() const { | 6876 InlineCacheState initialization_state() const { |
| 6885 return initialization_state_; | 6877 return initialization_state_; |
| 6886 } | 6878 } |
| 6887 | 6879 |
| 6888 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 6880 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 6889 | 6881 |
| 6890 Representation RequiredInputRepresentation(int index) OVERRIDE { | 6882 Representation RequiredInputRepresentation(int index) override { |
| 6891 return Representation::Tagged(); | 6883 return Representation::Tagged(); |
| 6892 } | 6884 } |
| 6893 | 6885 |
| 6894 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) | 6886 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) |
| 6895 | 6887 |
| 6896 private: | 6888 private: |
| 6897 HStoreNamedGeneric(HValue* context, HValue* object, Handle<String> name, | 6889 HStoreNamedGeneric(HValue* context, HValue* object, Handle<String> name, |
| 6898 HValue* value, LanguageMode language_mode, | 6890 HValue* value, LanguageMode language_mode, |
| 6899 InlineCacheState initialization_state) | 6891 InlineCacheState initialization_state) |
| 6900 : name_(name), | 6892 : name_(name), |
| 6901 language_mode_(language_mode), | 6893 language_mode_(language_mode), |
| 6902 initialization_state_(initialization_state) { | 6894 initialization_state_(initialization_state) { |
| 6903 SetOperandAt(0, object); | 6895 SetOperandAt(0, object); |
| 6904 SetOperandAt(1, value); | 6896 SetOperandAt(1, value); |
| 6905 SetOperandAt(2, context); | 6897 SetOperandAt(2, context); |
| 6906 SetAllSideEffects(); | 6898 SetAllSideEffects(); |
| 6907 } | 6899 } |
| 6908 | 6900 |
| 6909 Handle<String> name_; | 6901 Handle<String> name_; |
| 6910 LanguageMode language_mode_; | 6902 LanguageMode language_mode_; |
| 6911 InlineCacheState initialization_state_; | 6903 InlineCacheState initialization_state_; |
| 6912 }; | 6904 }; |
| 6913 | 6905 |
| 6914 | 6906 |
| 6915 class HStoreKeyed FINAL | 6907 class HStoreKeyed final : public HTemplateInstruction<3>, |
| 6916 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 6908 public ArrayInstructionInterface { |
| 6917 public: | 6909 public: |
| 6918 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, | 6910 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, |
| 6919 ElementsKind); | 6911 ElementsKind); |
| 6920 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, | 6912 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, |
| 6921 ElementsKind, StoreFieldOrKeyedMode); | 6913 ElementsKind, StoreFieldOrKeyedMode); |
| 6922 DECLARE_INSTRUCTION_FACTORY_P6(HStoreKeyed, HValue*, HValue*, HValue*, | 6914 DECLARE_INSTRUCTION_FACTORY_P6(HStoreKeyed, HValue*, HValue*, HValue*, |
| 6923 ElementsKind, StoreFieldOrKeyedMode, int); | 6915 ElementsKind, StoreFieldOrKeyedMode, int); |
| 6924 | 6916 |
| 6925 Representation RequiredInputRepresentation(int index) OVERRIDE { | 6917 Representation RequiredInputRepresentation(int index) override { |
| 6926 // kind_fast: tagged[int32] = tagged | 6918 // kind_fast: tagged[int32] = tagged |
| 6927 // kind_double: tagged[int32] = double | 6919 // kind_double: tagged[int32] = double |
| 6928 // kind_smi : tagged[int32] = smi | 6920 // kind_smi : tagged[int32] = smi |
| 6929 // kind_fixed_typed_array: tagged[int32] = (double | int32) | 6921 // kind_fixed_typed_array: tagged[int32] = (double | int32) |
| 6930 // kind_external: external[int32] = (double | int32) | 6922 // kind_external: external[int32] = (double | int32) |
| 6931 if (index == 0) { | 6923 if (index == 0) { |
| 6932 return is_external() ? Representation::External() | 6924 return is_external() ? Representation::External() |
| 6933 : Representation::Tagged(); | 6925 : Representation::Tagged(); |
| 6934 } else if (index == 1) { | 6926 } else if (index == 1) { |
| 6935 return ArrayInstructionInterface::KeyedAccessIndexRequirement( | 6927 return ArrayInstructionInterface::KeyedAccessIndexRequirement( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 6966 } | 6958 } |
| 6967 | 6959 |
| 6968 bool is_fixed_typed_array() const { | 6960 bool is_fixed_typed_array() const { |
| 6969 return IsFixedTypedArrayElementsKind(elements_kind()); | 6961 return IsFixedTypedArrayElementsKind(elements_kind()); |
| 6970 } | 6962 } |
| 6971 | 6963 |
| 6972 bool is_typed_elements() const { | 6964 bool is_typed_elements() const { |
| 6973 return is_external() || is_fixed_typed_array(); | 6965 return is_external() || is_fixed_typed_array(); |
| 6974 } | 6966 } |
| 6975 | 6967 |
| 6976 Representation observed_input_representation(int index) OVERRIDE { | 6968 Representation observed_input_representation(int index) override { |
| 6977 if (index < 2) return RequiredInputRepresentation(index); | 6969 if (index < 2) return RequiredInputRepresentation(index); |
| 6978 if (IsUninitialized()) { | 6970 if (IsUninitialized()) { |
| 6979 return Representation::None(); | 6971 return Representation::None(); |
| 6980 } | 6972 } |
| 6981 Representation r = | 6973 Representation r = |
| 6982 RequiredValueRepresentation(elements_kind(), store_mode()); | 6974 RequiredValueRepresentation(elements_kind(), store_mode()); |
| 6983 // For fast object elements kinds, don't assume anything. | 6975 // For fast object elements kinds, don't assume anything. |
| 6984 if (r.IsTagged()) return Representation::None(); | 6976 if (r.IsTagged()) return Representation::None(); |
| 6985 return r; | 6977 return r; |
| 6986 } | 6978 } |
| 6987 | 6979 |
| 6988 HValue* elements() const { return OperandAt(0); } | 6980 HValue* elements() const { return OperandAt(0); } |
| 6989 HValue* key() const { return OperandAt(1); } | 6981 HValue* key() const { return OperandAt(1); } |
| 6990 HValue* value() const { return OperandAt(2); } | 6982 HValue* value() const { return OperandAt(2); } |
| 6991 bool value_is_smi() const { return IsFastSmiElementsKind(elements_kind()); } | 6983 bool value_is_smi() const { return IsFastSmiElementsKind(elements_kind()); } |
| 6992 StoreFieldOrKeyedMode store_mode() const { | 6984 StoreFieldOrKeyedMode store_mode() const { |
| 6993 return StoreModeField::decode(bit_field_); | 6985 return StoreModeField::decode(bit_field_); |
| 6994 } | 6986 } |
| 6995 ElementsKind elements_kind() const OVERRIDE { | 6987 ElementsKind elements_kind() const override { |
| 6996 return ElementsKindField::decode(bit_field_); | 6988 return ElementsKindField::decode(bit_field_); |
| 6997 } | 6989 } |
| 6998 uint32_t base_offset() const { return base_offset_; } | 6990 uint32_t base_offset() const { return base_offset_; } |
| 6999 bool TryIncreaseBaseOffset(uint32_t increase_by_value) OVERRIDE; | 6991 bool TryIncreaseBaseOffset(uint32_t increase_by_value) override; |
| 7000 HValue* GetKey() OVERRIDE { return key(); } | 6992 HValue* GetKey() override { return key(); } |
| 7001 void SetKey(HValue* key) OVERRIDE { SetOperandAt(1, key); } | 6993 void SetKey(HValue* key) override { SetOperandAt(1, key); } |
| 7002 bool IsDehoisted() const OVERRIDE { | 6994 bool IsDehoisted() const override { |
| 7003 return IsDehoistedField::decode(bit_field_); | 6995 return IsDehoistedField::decode(bit_field_); |
| 7004 } | 6996 } |
| 7005 void SetDehoisted(bool is_dehoisted) OVERRIDE { | 6997 void SetDehoisted(bool is_dehoisted) override { |
| 7006 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); | 6998 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); |
| 7007 } | 6999 } |
| 7008 bool IsUninitialized() { return IsUninitializedField::decode(bit_field_); } | 7000 bool IsUninitialized() { return IsUninitializedField::decode(bit_field_); } |
| 7009 void SetUninitialized(bool is_uninitialized) { | 7001 void SetUninitialized(bool is_uninitialized) { |
| 7010 bit_field_ = IsUninitializedField::update(bit_field_, is_uninitialized); | 7002 bit_field_ = IsUninitializedField::update(bit_field_, is_uninitialized); |
| 7011 } | 7003 } |
| 7012 | 7004 |
| 7013 bool IsConstantHoleStore() { | 7005 bool IsConstantHoleStore() { |
| 7014 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); | 7006 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); |
| 7015 } | 7007 } |
| 7016 | 7008 |
| 7017 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 7009 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
| 7018 HValue* dominator) OVERRIDE { | 7010 HValue* dominator) override { |
| 7019 DCHECK(side_effect == kNewSpacePromotion); | 7011 DCHECK(side_effect == kNewSpacePromotion); |
| 7020 dominator_ = dominator; | 7012 dominator_ = dominator; |
| 7021 return false; | 7013 return false; |
| 7022 } | 7014 } |
| 7023 | 7015 |
| 7024 HValue* dominator() const { return dominator_; } | 7016 HValue* dominator() const { return dominator_; } |
| 7025 | 7017 |
| 7026 bool NeedsWriteBarrier() { | 7018 bool NeedsWriteBarrier() { |
| 7027 if (value_is_smi()) { | 7019 if (value_is_smi()) { |
| 7028 return false; | 7020 return false; |
| 7029 } else { | 7021 } else { |
| 7030 return StoringValueNeedsWriteBarrier(value()) && | 7022 return StoringValueNeedsWriteBarrier(value()) && |
| 7031 ReceiverObjectNeedsWriteBarrier(elements(), value(), dominator()); | 7023 ReceiverObjectNeedsWriteBarrier(elements(), value(), dominator()); |
| 7032 } | 7024 } |
| 7033 } | 7025 } |
| 7034 | 7026 |
| 7035 PointersToHereCheck PointersToHereCheckForValue() const { | 7027 PointersToHereCheck PointersToHereCheckForValue() const { |
| 7036 return PointersToHereCheckForObject(value(), dominator()); | 7028 return PointersToHereCheckForObject(value(), dominator()); |
| 7037 } | 7029 } |
| 7038 | 7030 |
| 7039 bool NeedsCanonicalization(); | 7031 bool NeedsCanonicalization(); |
| 7040 | 7032 |
| 7041 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7033 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 7042 | 7034 |
| 7043 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) | 7035 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) |
| 7044 | 7036 |
| 7045 private: | 7037 private: |
| 7046 HStoreKeyed(HValue* obj, HValue* key, HValue* val, ElementsKind elements_kind, | 7038 HStoreKeyed(HValue* obj, HValue* key, HValue* val, ElementsKind elements_kind, |
| 7047 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE, | 7039 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE, |
| 7048 int offset = kDefaultKeyedHeaderOffsetSentinel) | 7040 int offset = kDefaultKeyedHeaderOffsetSentinel) |
| 7049 : base_offset_(offset == kDefaultKeyedHeaderOffsetSentinel | 7041 : base_offset_(offset == kDefaultKeyedHeaderOffsetSentinel |
| 7050 ? GetDefaultHeaderSizeForElementsKind(elements_kind) | 7042 ? GetDefaultHeaderSizeForElementsKind(elements_kind) |
| 7051 : offset), | 7043 : offset), |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7089 class IsUninitializedField : public BitField<bool, 1, 1> {}; | 7081 class IsUninitializedField : public BitField<bool, 1, 1> {}; |
| 7090 class StoreModeField : public BitField<StoreFieldOrKeyedMode, 2, 1> {}; | 7082 class StoreModeField : public BitField<StoreFieldOrKeyedMode, 2, 1> {}; |
| 7091 class ElementsKindField : public BitField<ElementsKind, 3, 5> {}; | 7083 class ElementsKindField : public BitField<ElementsKind, 3, 5> {}; |
| 7092 | 7084 |
| 7093 uint32_t base_offset_; | 7085 uint32_t base_offset_; |
| 7094 uint32_t bit_field_; | 7086 uint32_t bit_field_; |
| 7095 HValue* dominator_; | 7087 HValue* dominator_; |
| 7096 }; | 7088 }; |
| 7097 | 7089 |
| 7098 | 7090 |
| 7099 class HStoreKeyedGeneric FINAL : public HTemplateInstruction<4> { | 7091 class HStoreKeyedGeneric final : public HTemplateInstruction<4> { |
| 7100 public: | 7092 public: |
| 7101 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(HStoreKeyedGeneric, HValue*, | 7093 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(HStoreKeyedGeneric, HValue*, |
| 7102 HValue*, HValue*, LanguageMode, | 7094 HValue*, HValue*, LanguageMode, |
| 7103 InlineCacheState); | 7095 InlineCacheState); |
| 7104 | 7096 |
| 7105 HValue* object() const { return OperandAt(0); } | 7097 HValue* object() const { return OperandAt(0); } |
| 7106 HValue* key() const { return OperandAt(1); } | 7098 HValue* key() const { return OperandAt(1); } |
| 7107 HValue* value() const { return OperandAt(2); } | 7099 HValue* value() const { return OperandAt(2); } |
| 7108 HValue* context() const { return OperandAt(3); } | 7100 HValue* context() const { return OperandAt(3); } |
| 7109 LanguageMode language_mode() const { return language_mode_; } | 7101 LanguageMode language_mode() const { return language_mode_; } |
| 7110 InlineCacheState initialization_state() const { | 7102 InlineCacheState initialization_state() const { |
| 7111 return initialization_state_; | 7103 return initialization_state_; |
| 7112 } | 7104 } |
| 7113 | 7105 |
| 7114 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7106 Representation RequiredInputRepresentation(int index) override { |
| 7115 // tagged[tagged] = tagged | 7107 // tagged[tagged] = tagged |
| 7116 return Representation::Tagged(); | 7108 return Representation::Tagged(); |
| 7117 } | 7109 } |
| 7118 | 7110 |
| 7119 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7111 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 7120 | 7112 |
| 7121 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) | 7113 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) |
| 7122 | 7114 |
| 7123 private: | 7115 private: |
| 7124 HStoreKeyedGeneric(HValue* context, HValue* object, HValue* key, | 7116 HStoreKeyedGeneric(HValue* context, HValue* object, HValue* key, |
| 7125 HValue* value, LanguageMode language_mode, | 7117 HValue* value, LanguageMode language_mode, |
| 7126 InlineCacheState initialization_state) | 7118 InlineCacheState initialization_state) |
| 7127 : language_mode_(language_mode), | 7119 : language_mode_(language_mode), |
| 7128 initialization_state_(initialization_state) { | 7120 initialization_state_(initialization_state) { |
| 7129 SetOperandAt(0, object); | 7121 SetOperandAt(0, object); |
| 7130 SetOperandAt(1, key); | 7122 SetOperandAt(1, key); |
| 7131 SetOperandAt(2, value); | 7123 SetOperandAt(2, value); |
| 7132 SetOperandAt(3, context); | 7124 SetOperandAt(3, context); |
| 7133 SetAllSideEffects(); | 7125 SetAllSideEffects(); |
| 7134 } | 7126 } |
| 7135 | 7127 |
| 7136 LanguageMode language_mode_; | 7128 LanguageMode language_mode_; |
| 7137 InlineCacheState initialization_state_; | 7129 InlineCacheState initialization_state_; |
| 7138 }; | 7130 }; |
| 7139 | 7131 |
| 7140 | 7132 |
| 7141 class HTransitionElementsKind FINAL : public HTemplateInstruction<2> { | 7133 class HTransitionElementsKind final : public HTemplateInstruction<2> { |
| 7142 public: | 7134 public: |
| 7143 inline static HTransitionElementsKind* New(Isolate* isolate, Zone* zone, | 7135 inline static HTransitionElementsKind* New(Isolate* isolate, Zone* zone, |
| 7144 HValue* context, HValue* object, | 7136 HValue* context, HValue* object, |
| 7145 Handle<Map> original_map, | 7137 Handle<Map> original_map, |
| 7146 Handle<Map> transitioned_map) { | 7138 Handle<Map> transitioned_map) { |
| 7147 return new(zone) HTransitionElementsKind(context, object, | 7139 return new(zone) HTransitionElementsKind(context, object, |
| 7148 original_map, transitioned_map); | 7140 original_map, transitioned_map); |
| 7149 } | 7141 } |
| 7150 | 7142 |
| 7151 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7143 Representation RequiredInputRepresentation(int index) override { |
| 7152 return Representation::Tagged(); | 7144 return Representation::Tagged(); |
| 7153 } | 7145 } |
| 7154 | 7146 |
| 7155 HValue* object() const { return OperandAt(0); } | 7147 HValue* object() const { return OperandAt(0); } |
| 7156 HValue* context() const { return OperandAt(1); } | 7148 HValue* context() const { return OperandAt(1); } |
| 7157 Unique<Map> original_map() const { return original_map_; } | 7149 Unique<Map> original_map() const { return original_map_; } |
| 7158 Unique<Map> transitioned_map() const { return transitioned_map_; } | 7150 Unique<Map> transitioned_map() const { return transitioned_map_; } |
| 7159 ElementsKind from_kind() const { | 7151 ElementsKind from_kind() const { |
| 7160 return FromElementsKindField::decode(bit_field_); | 7152 return FromElementsKindField::decode(bit_field_); |
| 7161 } | 7153 } |
| 7162 ElementsKind to_kind() const { | 7154 ElementsKind to_kind() const { |
| 7163 return ToElementsKindField::decode(bit_field_); | 7155 return ToElementsKindField::decode(bit_field_); |
| 7164 } | 7156 } |
| 7165 bool map_is_stable() const { return MapIsStableField::decode(bit_field_); } | 7157 bool map_is_stable() const { return MapIsStableField::decode(bit_field_); } |
| 7166 | 7158 |
| 7167 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7159 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 7168 | 7160 |
| 7169 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) | 7161 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) |
| 7170 | 7162 |
| 7171 protected: | 7163 protected: |
| 7172 bool DataEquals(HValue* other) OVERRIDE { | 7164 bool DataEquals(HValue* other) override { |
| 7173 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); | 7165 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); |
| 7174 return original_map_ == instr->original_map_ && | 7166 return original_map_ == instr->original_map_ && |
| 7175 transitioned_map_ == instr->transitioned_map_; | 7167 transitioned_map_ == instr->transitioned_map_; |
| 7176 } | 7168 } |
| 7177 | 7169 |
| 7178 int RedefinedOperandIndex() OVERRIDE { return 0; } | 7170 int RedefinedOperandIndex() override { return 0; } |
| 7179 | 7171 |
| 7180 private: | 7172 private: |
| 7181 HTransitionElementsKind(HValue* context, HValue* object, | 7173 HTransitionElementsKind(HValue* context, HValue* object, |
| 7182 Handle<Map> original_map, | 7174 Handle<Map> original_map, |
| 7183 Handle<Map> transitioned_map) | 7175 Handle<Map> transitioned_map) |
| 7184 : original_map_(Unique<Map>(original_map)), | 7176 : original_map_(Unique<Map>(original_map)), |
| 7185 transitioned_map_(Unique<Map>(transitioned_map)), | 7177 transitioned_map_(Unique<Map>(transitioned_map)), |
| 7186 bit_field_( | 7178 bit_field_( |
| 7187 FromElementsKindField::encode(original_map->elements_kind()) | | 7179 FromElementsKindField::encode(original_map->elements_kind()) | |
| 7188 ToElementsKindField::encode(transitioned_map->elements_kind()) | | 7180 ToElementsKindField::encode(transitioned_map->elements_kind()) | |
| (...skipping 12 matching lines...) Expand all Loading... |
| 7201 class FromElementsKindField : public BitField<ElementsKind, 0, 5> {}; | 7193 class FromElementsKindField : public BitField<ElementsKind, 0, 5> {}; |
| 7202 class ToElementsKindField : public BitField<ElementsKind, 5, 5> {}; | 7194 class ToElementsKindField : public BitField<ElementsKind, 5, 5> {}; |
| 7203 class MapIsStableField : public BitField<bool, 10, 1> {}; | 7195 class MapIsStableField : public BitField<bool, 10, 1> {}; |
| 7204 | 7196 |
| 7205 Unique<Map> original_map_; | 7197 Unique<Map> original_map_; |
| 7206 Unique<Map> transitioned_map_; | 7198 Unique<Map> transitioned_map_; |
| 7207 uint32_t bit_field_; | 7199 uint32_t bit_field_; |
| 7208 }; | 7200 }; |
| 7209 | 7201 |
| 7210 | 7202 |
| 7211 class HStringAdd FINAL : public HBinaryOperation { | 7203 class HStringAdd final : public HBinaryOperation { |
| 7212 public: | 7204 public: |
| 7213 static HInstruction* New( | 7205 static HInstruction* New( |
| 7214 Isolate* isolate, Zone* zone, HValue* context, HValue* left, | 7206 Isolate* isolate, Zone* zone, HValue* context, HValue* left, |
| 7215 HValue* right, PretenureFlag pretenure_flag = NOT_TENURED, | 7207 HValue* right, PretenureFlag pretenure_flag = NOT_TENURED, |
| 7216 StringAddFlags flags = STRING_ADD_CHECK_BOTH, | 7208 StringAddFlags flags = STRING_ADD_CHECK_BOTH, |
| 7217 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); | 7209 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); |
| 7218 | 7210 |
| 7219 StringAddFlags flags() const { return flags_; } | 7211 StringAddFlags flags() const { return flags_; } |
| 7220 PretenureFlag pretenure_flag() const { return pretenure_flag_; } | 7212 PretenureFlag pretenure_flag() const { return pretenure_flag_; } |
| 7221 | 7213 |
| 7222 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7214 Representation RequiredInputRepresentation(int index) override { |
| 7223 return Representation::Tagged(); | 7215 return Representation::Tagged(); |
| 7224 } | 7216 } |
| 7225 | 7217 |
| 7226 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7218 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 7227 | 7219 |
| 7228 DECLARE_CONCRETE_INSTRUCTION(StringAdd) | 7220 DECLARE_CONCRETE_INSTRUCTION(StringAdd) |
| 7229 | 7221 |
| 7230 protected: | 7222 protected: |
| 7231 bool DataEquals(HValue* other) OVERRIDE { | 7223 bool DataEquals(HValue* other) override { |
| 7232 return flags_ == HStringAdd::cast(other)->flags_ && | 7224 return flags_ == HStringAdd::cast(other)->flags_ && |
| 7233 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_; | 7225 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_; |
| 7234 } | 7226 } |
| 7235 | 7227 |
| 7236 private: | 7228 private: |
| 7237 HStringAdd(HValue* context, | 7229 HStringAdd(HValue* context, |
| 7238 HValue* left, | 7230 HValue* left, |
| 7239 HValue* right, | 7231 HValue* right, |
| 7240 PretenureFlag pretenure_flag, | 7232 PretenureFlag pretenure_flag, |
| 7241 StringAddFlags flags, | 7233 StringAddFlags flags, |
| 7242 Handle<AllocationSite> allocation_site) | 7234 Handle<AllocationSite> allocation_site) |
| 7243 : HBinaryOperation(context, left, right, HType::String()), | 7235 : HBinaryOperation(context, left, right, HType::String()), |
| 7244 flags_(flags), pretenure_flag_(pretenure_flag) { | 7236 flags_(flags), pretenure_flag_(pretenure_flag) { |
| 7245 set_representation(Representation::Tagged()); | 7237 set_representation(Representation::Tagged()); |
| 7246 SetFlag(kUseGVN); | 7238 SetFlag(kUseGVN); |
| 7247 SetDependsOnFlag(kMaps); | 7239 SetDependsOnFlag(kMaps); |
| 7248 SetChangesFlag(kNewSpacePromotion); | 7240 SetChangesFlag(kNewSpacePromotion); |
| 7249 if (FLAG_trace_pretenuring) { | 7241 if (FLAG_trace_pretenuring) { |
| 7250 PrintF("HStringAdd with AllocationSite %p %s\n", | 7242 PrintF("HStringAdd with AllocationSite %p %s\n", |
| 7251 allocation_site.is_null() | 7243 allocation_site.is_null() |
| 7252 ? static_cast<void*>(NULL) | 7244 ? static_cast<void*>(NULL) |
| 7253 : static_cast<void*>(*allocation_site), | 7245 : static_cast<void*>(*allocation_site), |
| 7254 pretenure_flag == TENURED ? "tenured" : "not tenured"); | 7246 pretenure_flag == TENURED ? "tenured" : "not tenured"); |
| 7255 } | 7247 } |
| 7256 } | 7248 } |
| 7257 | 7249 |
| 7258 // No side-effects except possible allocation: | 7250 // No side-effects except possible allocation: |
| 7259 bool IsDeletable() const OVERRIDE { return true; } | 7251 bool IsDeletable() const override { return true; } |
| 7260 | 7252 |
| 7261 const StringAddFlags flags_; | 7253 const StringAddFlags flags_; |
| 7262 const PretenureFlag pretenure_flag_; | 7254 const PretenureFlag pretenure_flag_; |
| 7263 }; | 7255 }; |
| 7264 | 7256 |
| 7265 | 7257 |
| 7266 class HStringCharCodeAt FINAL : public HTemplateInstruction<3> { | 7258 class HStringCharCodeAt final : public HTemplateInstruction<3> { |
| 7267 public: | 7259 public: |
| 7268 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt, | 7260 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HStringCharCodeAt, |
| 7269 HValue*, | 7261 HValue*, |
| 7270 HValue*); | 7262 HValue*); |
| 7271 | 7263 |
| 7272 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7264 Representation RequiredInputRepresentation(int index) override { |
| 7273 // The index is supposed to be Integer32. | 7265 // The index is supposed to be Integer32. |
| 7274 return index == 2 | 7266 return index == 2 |
| 7275 ? Representation::Integer32() | 7267 ? Representation::Integer32() |
| 7276 : Representation::Tagged(); | 7268 : Representation::Tagged(); |
| 7277 } | 7269 } |
| 7278 | 7270 |
| 7279 HValue* context() const { return OperandAt(0); } | 7271 HValue* context() const { return OperandAt(0); } |
| 7280 HValue* string() const { return OperandAt(1); } | 7272 HValue* string() const { return OperandAt(1); } |
| 7281 HValue* index() const { return OperandAt(2); } | 7273 HValue* index() const { return OperandAt(2); } |
| 7282 | 7274 |
| 7283 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) | 7275 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) |
| 7284 | 7276 |
| 7285 protected: | 7277 protected: |
| 7286 bool DataEquals(HValue* other) OVERRIDE { return true; } | 7278 bool DataEquals(HValue* other) override { return true; } |
| 7287 | 7279 |
| 7288 Range* InferRange(Zone* zone) OVERRIDE { | 7280 Range* InferRange(Zone* zone) override { |
| 7289 return new(zone) Range(0, String::kMaxUtf16CodeUnit); | 7281 return new(zone) Range(0, String::kMaxUtf16CodeUnit); |
| 7290 } | 7282 } |
| 7291 | 7283 |
| 7292 private: | 7284 private: |
| 7293 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { | 7285 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { |
| 7294 SetOperandAt(0, context); | 7286 SetOperandAt(0, context); |
| 7295 SetOperandAt(1, string); | 7287 SetOperandAt(1, string); |
| 7296 SetOperandAt(2, index); | 7288 SetOperandAt(2, index); |
| 7297 set_representation(Representation::Integer32()); | 7289 set_representation(Representation::Integer32()); |
| 7298 SetFlag(kUseGVN); | 7290 SetFlag(kUseGVN); |
| 7299 SetDependsOnFlag(kMaps); | 7291 SetDependsOnFlag(kMaps); |
| 7300 SetDependsOnFlag(kStringChars); | 7292 SetDependsOnFlag(kStringChars); |
| 7301 SetChangesFlag(kNewSpacePromotion); | 7293 SetChangesFlag(kNewSpacePromotion); |
| 7302 } | 7294 } |
| 7303 | 7295 |
| 7304 // No side effects: runtime function assumes string + number inputs. | 7296 // No side effects: runtime function assumes string + number inputs. |
| 7305 bool IsDeletable() const OVERRIDE { return true; } | 7297 bool IsDeletable() const override { return true; } |
| 7306 }; | 7298 }; |
| 7307 | 7299 |
| 7308 | 7300 |
| 7309 class HStringCharFromCode FINAL : public HTemplateInstruction<2> { | 7301 class HStringCharFromCode final : public HTemplateInstruction<2> { |
| 7310 public: | 7302 public: |
| 7311 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 7303 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 7312 HValue* char_code); | 7304 HValue* char_code); |
| 7313 | 7305 |
| 7314 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7306 Representation RequiredInputRepresentation(int index) override { |
| 7315 return index == 0 | 7307 return index == 0 |
| 7316 ? Representation::Tagged() | 7308 ? Representation::Tagged() |
| 7317 : Representation::Integer32(); | 7309 : Representation::Integer32(); |
| 7318 } | 7310 } |
| 7319 | 7311 |
| 7320 HValue* context() const { return OperandAt(0); } | 7312 HValue* context() const { return OperandAt(0); } |
| 7321 HValue* value() const { return OperandAt(1); } | 7313 HValue* value() const { return OperandAt(1); } |
| 7322 | 7314 |
| 7323 bool DataEquals(HValue* other) OVERRIDE { return true; } | 7315 bool DataEquals(HValue* other) override { return true; } |
| 7324 | 7316 |
| 7325 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) | 7317 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) |
| 7326 | 7318 |
| 7327 private: | 7319 private: |
| 7328 HStringCharFromCode(HValue* context, HValue* char_code) | 7320 HStringCharFromCode(HValue* context, HValue* char_code) |
| 7329 : HTemplateInstruction<2>(HType::String()) { | 7321 : HTemplateInstruction<2>(HType::String()) { |
| 7330 SetOperandAt(0, context); | 7322 SetOperandAt(0, context); |
| 7331 SetOperandAt(1, char_code); | 7323 SetOperandAt(1, char_code); |
| 7332 set_representation(Representation::Tagged()); | 7324 set_representation(Representation::Tagged()); |
| 7333 SetFlag(kUseGVN); | 7325 SetFlag(kUseGVN); |
| 7334 SetChangesFlag(kNewSpacePromotion); | 7326 SetChangesFlag(kNewSpacePromotion); |
| 7335 } | 7327 } |
| 7336 | 7328 |
| 7337 bool IsDeletable() const OVERRIDE { | 7329 bool IsDeletable() const override { |
| 7338 return !value()->ToNumberCanBeObserved(); | 7330 return !value()->ToNumberCanBeObserved(); |
| 7339 } | 7331 } |
| 7340 }; | 7332 }; |
| 7341 | 7333 |
| 7342 | 7334 |
| 7343 template <int V> | 7335 template <int V> |
| 7344 class HMaterializedLiteral : public HTemplateInstruction<V> { | 7336 class HMaterializedLiteral : public HTemplateInstruction<V> { |
| 7345 public: | 7337 public: |
| 7346 HMaterializedLiteral<V>(int index, int depth, AllocationSiteMode mode) | 7338 HMaterializedLiteral<V>(int index, int depth, AllocationSiteMode mode) |
| 7347 : literal_index_(index), depth_(depth), allocation_site_mode_(mode) { | 7339 : literal_index_(index), depth_(depth), allocation_site_mode_(mode) { |
| 7348 this->set_representation(Representation::Tagged()); | 7340 this->set_representation(Representation::Tagged()); |
| 7349 } | 7341 } |
| 7350 | 7342 |
| 7351 HMaterializedLiteral<V>(int index, int depth) | 7343 HMaterializedLiteral<V>(int index, int depth) |
| 7352 : literal_index_(index), depth_(depth), | 7344 : literal_index_(index), depth_(depth), |
| 7353 allocation_site_mode_(DONT_TRACK_ALLOCATION_SITE) { | 7345 allocation_site_mode_(DONT_TRACK_ALLOCATION_SITE) { |
| 7354 this->set_representation(Representation::Tagged()); | 7346 this->set_representation(Representation::Tagged()); |
| 7355 } | 7347 } |
| 7356 | 7348 |
| 7357 int literal_index() const { return literal_index_; } | 7349 int literal_index() const { return literal_index_; } |
| 7358 int depth() const { return depth_; } | 7350 int depth() const { return depth_; } |
| 7359 AllocationSiteMode allocation_site_mode() const { | 7351 AllocationSiteMode allocation_site_mode() const { |
| 7360 return allocation_site_mode_; | 7352 return allocation_site_mode_; |
| 7361 } | 7353 } |
| 7362 | 7354 |
| 7363 private: | 7355 private: |
| 7364 bool IsDeletable() const FINAL { return true; } | 7356 bool IsDeletable() const final { return true; } |
| 7365 | 7357 |
| 7366 int literal_index_; | 7358 int literal_index_; |
| 7367 int depth_; | 7359 int depth_; |
| 7368 AllocationSiteMode allocation_site_mode_; | 7360 AllocationSiteMode allocation_site_mode_; |
| 7369 }; | 7361 }; |
| 7370 | 7362 |
| 7371 | 7363 |
| 7372 class HRegExpLiteral FINAL : public HMaterializedLiteral<1> { | 7364 class HRegExpLiteral final : public HMaterializedLiteral<1> { |
| 7373 public: | 7365 public: |
| 7374 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HRegExpLiteral, | 7366 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HRegExpLiteral, |
| 7375 Handle<FixedArray>, | 7367 Handle<FixedArray>, |
| 7376 Handle<String>, | 7368 Handle<String>, |
| 7377 Handle<String>, | 7369 Handle<String>, |
| 7378 int); | 7370 int); |
| 7379 | 7371 |
| 7380 HValue* context() { return OperandAt(0); } | 7372 HValue* context() { return OperandAt(0); } |
| 7381 Handle<FixedArray> literals() { return literals_; } | 7373 Handle<FixedArray> literals() { return literals_; } |
| 7382 Handle<String> pattern() { return pattern_; } | 7374 Handle<String> pattern() { return pattern_; } |
| 7383 Handle<String> flags() { return flags_; } | 7375 Handle<String> flags() { return flags_; } |
| 7384 | 7376 |
| 7385 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7377 Representation RequiredInputRepresentation(int index) override { |
| 7386 return Representation::Tagged(); | 7378 return Representation::Tagged(); |
| 7387 } | 7379 } |
| 7388 | 7380 |
| 7389 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) | 7381 DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral) |
| 7390 | 7382 |
| 7391 private: | 7383 private: |
| 7392 HRegExpLiteral(HValue* context, | 7384 HRegExpLiteral(HValue* context, |
| 7393 Handle<FixedArray> literals, | 7385 Handle<FixedArray> literals, |
| 7394 Handle<String> pattern, | 7386 Handle<String> pattern, |
| 7395 Handle<String> flags, | 7387 Handle<String> flags, |
| 7396 int literal_index) | 7388 int literal_index) |
| 7397 : HMaterializedLiteral<1>(literal_index, 0), | 7389 : HMaterializedLiteral<1>(literal_index, 0), |
| 7398 literals_(literals), | 7390 literals_(literals), |
| 7399 pattern_(pattern), | 7391 pattern_(pattern), |
| 7400 flags_(flags) { | 7392 flags_(flags) { |
| 7401 SetOperandAt(0, context); | 7393 SetOperandAt(0, context); |
| 7402 SetAllSideEffects(); | 7394 SetAllSideEffects(); |
| 7403 set_type(HType::JSObject()); | 7395 set_type(HType::JSObject()); |
| 7404 } | 7396 } |
| 7405 | 7397 |
| 7406 Handle<FixedArray> literals_; | 7398 Handle<FixedArray> literals_; |
| 7407 Handle<String> pattern_; | 7399 Handle<String> pattern_; |
| 7408 Handle<String> flags_; | 7400 Handle<String> flags_; |
| 7409 }; | 7401 }; |
| 7410 | 7402 |
| 7411 | 7403 |
| 7412 class HFunctionLiteral FINAL : public HTemplateInstruction<1> { | 7404 class HFunctionLiteral final : public HTemplateInstruction<1> { |
| 7413 public: | 7405 public: |
| 7414 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HFunctionLiteral, | 7406 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HFunctionLiteral, |
| 7415 Handle<SharedFunctionInfo>, | 7407 Handle<SharedFunctionInfo>, |
| 7416 bool); | 7408 bool); |
| 7417 HValue* context() { return OperandAt(0); } | 7409 HValue* context() { return OperandAt(0); } |
| 7418 | 7410 |
| 7419 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7411 Representation RequiredInputRepresentation(int index) override { |
| 7420 return Representation::Tagged(); | 7412 return Representation::Tagged(); |
| 7421 } | 7413 } |
| 7422 | 7414 |
| 7423 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) | 7415 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) |
| 7424 | 7416 |
| 7425 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } | 7417 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
| 7426 bool pretenure() const { return PretenureField::decode(bit_field_); } | 7418 bool pretenure() const { return PretenureField::decode(bit_field_); } |
| 7427 bool has_no_literals() const { | 7419 bool has_no_literals() const { |
| 7428 return HasNoLiteralsField::decode(bit_field_); | 7420 return HasNoLiteralsField::decode(bit_field_); |
| 7429 } | 7421 } |
| 7430 FunctionKind kind() const { return FunctionKindField::decode(bit_field_); } | 7422 FunctionKind kind() const { return FunctionKindField::decode(bit_field_); } |
| 7431 LanguageMode language_mode() const { | 7423 LanguageMode language_mode() const { |
| 7432 return LanguageModeField::decode(bit_field_); | 7424 return LanguageModeField::decode(bit_field_); |
| 7433 } | 7425 } |
| 7434 | 7426 |
| 7435 private: | 7427 private: |
| 7436 HFunctionLiteral(HValue* context, Handle<SharedFunctionInfo> shared, | 7428 HFunctionLiteral(HValue* context, Handle<SharedFunctionInfo> shared, |
| 7437 bool pretenure) | 7429 bool pretenure) |
| 7438 : HTemplateInstruction<1>(HType::JSObject()), | 7430 : HTemplateInstruction<1>(HType::JSObject()), |
| 7439 shared_info_(shared), | 7431 shared_info_(shared), |
| 7440 bit_field_(FunctionKindField::encode(shared->kind()) | | 7432 bit_field_(FunctionKindField::encode(shared->kind()) | |
| 7441 PretenureField::encode(pretenure) | | 7433 PretenureField::encode(pretenure) | |
| 7442 HasNoLiteralsField::encode(shared->num_literals() == 0) | | 7434 HasNoLiteralsField::encode(shared->num_literals() == 0) | |
| 7443 LanguageModeField::encode(shared->language_mode())) { | 7435 LanguageModeField::encode(shared->language_mode())) { |
| 7444 SetOperandAt(0, context); | 7436 SetOperandAt(0, context); |
| 7445 set_representation(Representation::Tagged()); | 7437 set_representation(Representation::Tagged()); |
| 7446 SetChangesFlag(kNewSpacePromotion); | 7438 SetChangesFlag(kNewSpacePromotion); |
| 7447 } | 7439 } |
| 7448 | 7440 |
| 7449 bool IsDeletable() const OVERRIDE { return true; } | 7441 bool IsDeletable() const override { return true; } |
| 7450 | 7442 |
| 7451 class FunctionKindField : public BitField<FunctionKind, 0, 8> {}; | 7443 class FunctionKindField : public BitField<FunctionKind, 0, 8> {}; |
| 7452 class PretenureField : public BitField<bool, 8, 1> {}; | 7444 class PretenureField : public BitField<bool, 8, 1> {}; |
| 7453 class HasNoLiteralsField : public BitField<bool, 9, 1> {}; | 7445 class HasNoLiteralsField : public BitField<bool, 9, 1> {}; |
| 7454 STATIC_ASSERT(LANGUAGE_END == 3); | 7446 STATIC_ASSERT(LANGUAGE_END == 3); |
| 7455 class LanguageModeField : public BitField<LanguageMode, 10, 2> {}; | 7447 class LanguageModeField : public BitField<LanguageMode, 10, 2> {}; |
| 7456 | 7448 |
| 7457 Handle<SharedFunctionInfo> shared_info_; | 7449 Handle<SharedFunctionInfo> shared_info_; |
| 7458 uint32_t bit_field_; | 7450 uint32_t bit_field_; |
| 7459 }; | 7451 }; |
| 7460 | 7452 |
| 7461 | 7453 |
| 7462 class HTypeof FINAL : public HTemplateInstruction<2> { | 7454 class HTypeof final : public HTemplateInstruction<2> { |
| 7463 public: | 7455 public: |
| 7464 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HTypeof, HValue*); | 7456 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HTypeof, HValue*); |
| 7465 | 7457 |
| 7466 HValue* context() const { return OperandAt(0); } | 7458 HValue* context() const { return OperandAt(0); } |
| 7467 HValue* value() const { return OperandAt(1); } | 7459 HValue* value() const { return OperandAt(1); } |
| 7468 | 7460 |
| 7469 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7461 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 7470 | 7462 |
| 7471 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7463 Representation RequiredInputRepresentation(int index) override { |
| 7472 return Representation::Tagged(); | 7464 return Representation::Tagged(); |
| 7473 } | 7465 } |
| 7474 | 7466 |
| 7475 DECLARE_CONCRETE_INSTRUCTION(Typeof) | 7467 DECLARE_CONCRETE_INSTRUCTION(Typeof) |
| 7476 | 7468 |
| 7477 private: | 7469 private: |
| 7478 explicit HTypeof(HValue* context, HValue* value) { | 7470 explicit HTypeof(HValue* context, HValue* value) { |
| 7479 SetOperandAt(0, context); | 7471 SetOperandAt(0, context); |
| 7480 SetOperandAt(1, value); | 7472 SetOperandAt(1, value); |
| 7481 set_representation(Representation::Tagged()); | 7473 set_representation(Representation::Tagged()); |
| 7482 } | 7474 } |
| 7483 | 7475 |
| 7484 bool IsDeletable() const OVERRIDE { return true; } | 7476 bool IsDeletable() const override { return true; } |
| 7485 }; | 7477 }; |
| 7486 | 7478 |
| 7487 | 7479 |
| 7488 class HTrapAllocationMemento FINAL : public HTemplateInstruction<1> { | 7480 class HTrapAllocationMemento final : public HTemplateInstruction<1> { |
| 7489 public: | 7481 public: |
| 7490 DECLARE_INSTRUCTION_FACTORY_P1(HTrapAllocationMemento, HValue*); | 7482 DECLARE_INSTRUCTION_FACTORY_P1(HTrapAllocationMemento, HValue*); |
| 7491 | 7483 |
| 7492 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7484 Representation RequiredInputRepresentation(int index) override { |
| 7493 return Representation::Tagged(); | 7485 return Representation::Tagged(); |
| 7494 } | 7486 } |
| 7495 | 7487 |
| 7496 HValue* object() { return OperandAt(0); } | 7488 HValue* object() { return OperandAt(0); } |
| 7497 | 7489 |
| 7498 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento) | 7490 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento) |
| 7499 | 7491 |
| 7500 private: | 7492 private: |
| 7501 explicit HTrapAllocationMemento(HValue* obj) { | 7493 explicit HTrapAllocationMemento(HValue* obj) { |
| 7502 SetOperandAt(0, obj); | 7494 SetOperandAt(0, obj); |
| 7503 } | 7495 } |
| 7504 }; | 7496 }; |
| 7505 | 7497 |
| 7506 | 7498 |
| 7507 class HToFastProperties FINAL : public HUnaryOperation { | 7499 class HToFastProperties final : public HUnaryOperation { |
| 7508 public: | 7500 public: |
| 7509 DECLARE_INSTRUCTION_FACTORY_P1(HToFastProperties, HValue*); | 7501 DECLARE_INSTRUCTION_FACTORY_P1(HToFastProperties, HValue*); |
| 7510 | 7502 |
| 7511 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7503 Representation RequiredInputRepresentation(int index) override { |
| 7512 return Representation::Tagged(); | 7504 return Representation::Tagged(); |
| 7513 } | 7505 } |
| 7514 | 7506 |
| 7515 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) | 7507 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) |
| 7516 | 7508 |
| 7517 private: | 7509 private: |
| 7518 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { | 7510 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { |
| 7519 set_representation(Representation::Tagged()); | 7511 set_representation(Representation::Tagged()); |
| 7520 SetChangesFlag(kNewSpacePromotion); | 7512 SetChangesFlag(kNewSpacePromotion); |
| 7521 | 7513 |
| 7522 // This instruction is not marked as kChangesMaps, but does | 7514 // This instruction is not marked as kChangesMaps, but does |
| 7523 // change the map of the input operand. Use it only when creating | 7515 // change the map of the input operand. Use it only when creating |
| 7524 // object literals via a runtime call. | 7516 // object literals via a runtime call. |
| 7525 DCHECK(value->IsCallRuntime()); | 7517 DCHECK(value->IsCallRuntime()); |
| 7526 #ifdef DEBUG | 7518 #ifdef DEBUG |
| 7527 const Runtime::Function* function = HCallRuntime::cast(value)->function(); | 7519 const Runtime::Function* function = HCallRuntime::cast(value)->function(); |
| 7528 DCHECK(function->function_id == Runtime::kCreateObjectLiteral); | 7520 DCHECK(function->function_id == Runtime::kCreateObjectLiteral); |
| 7529 #endif | 7521 #endif |
| 7530 } | 7522 } |
| 7531 | 7523 |
| 7532 bool IsDeletable() const OVERRIDE { return true; } | 7524 bool IsDeletable() const override { return true; } |
| 7533 }; | 7525 }; |
| 7534 | 7526 |
| 7535 | 7527 |
| 7536 class HDateField FINAL : public HUnaryOperation { | 7528 class HDateField final : public HUnaryOperation { |
| 7537 public: | 7529 public: |
| 7538 DECLARE_INSTRUCTION_FACTORY_P2(HDateField, HValue*, Smi*); | 7530 DECLARE_INSTRUCTION_FACTORY_P2(HDateField, HValue*, Smi*); |
| 7539 | 7531 |
| 7540 Smi* index() const { return index_; } | 7532 Smi* index() const { return index_; } |
| 7541 | 7533 |
| 7542 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7534 Representation RequiredInputRepresentation(int index) override { |
| 7543 return Representation::Tagged(); | 7535 return Representation::Tagged(); |
| 7544 } | 7536 } |
| 7545 | 7537 |
| 7546 DECLARE_CONCRETE_INSTRUCTION(DateField) | 7538 DECLARE_CONCRETE_INSTRUCTION(DateField) |
| 7547 | 7539 |
| 7548 private: | 7540 private: |
| 7549 HDateField(HValue* date, Smi* index) | 7541 HDateField(HValue* date, Smi* index) |
| 7550 : HUnaryOperation(date), index_(index) { | 7542 : HUnaryOperation(date), index_(index) { |
| 7551 set_representation(Representation::Tagged()); | 7543 set_representation(Representation::Tagged()); |
| 7552 } | 7544 } |
| 7553 | 7545 |
| 7554 Smi* index_; | 7546 Smi* index_; |
| 7555 }; | 7547 }; |
| 7556 | 7548 |
| 7557 | 7549 |
| 7558 class HSeqStringGetChar FINAL : public HTemplateInstruction<2> { | 7550 class HSeqStringGetChar final : public HTemplateInstruction<2> { |
| 7559 public: | 7551 public: |
| 7560 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, | 7552 static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, |
| 7561 String::Encoding encoding, HValue* string, | 7553 String::Encoding encoding, HValue* string, |
| 7562 HValue* index); | 7554 HValue* index); |
| 7563 | 7555 |
| 7564 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7556 Representation RequiredInputRepresentation(int index) override { |
| 7565 return (index == 0) ? Representation::Tagged() | 7557 return (index == 0) ? Representation::Tagged() |
| 7566 : Representation::Integer32(); | 7558 : Representation::Integer32(); |
| 7567 } | 7559 } |
| 7568 | 7560 |
| 7569 String::Encoding encoding() const { return encoding_; } | 7561 String::Encoding encoding() const { return encoding_; } |
| 7570 HValue* string() const { return OperandAt(0); } | 7562 HValue* string() const { return OperandAt(0); } |
| 7571 HValue* index() const { return OperandAt(1); } | 7563 HValue* index() const { return OperandAt(1); } |
| 7572 | 7564 |
| 7573 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar) | 7565 DECLARE_CONCRETE_INSTRUCTION(SeqStringGetChar) |
| 7574 | 7566 |
| 7575 protected: | 7567 protected: |
| 7576 bool DataEquals(HValue* other) OVERRIDE { | 7568 bool DataEquals(HValue* other) override { |
| 7577 return encoding() == HSeqStringGetChar::cast(other)->encoding(); | 7569 return encoding() == HSeqStringGetChar::cast(other)->encoding(); |
| 7578 } | 7570 } |
| 7579 | 7571 |
| 7580 Range* InferRange(Zone* zone) OVERRIDE { | 7572 Range* InferRange(Zone* zone) override { |
| 7581 if (encoding() == String::ONE_BYTE_ENCODING) { | 7573 if (encoding() == String::ONE_BYTE_ENCODING) { |
| 7582 return new(zone) Range(0, String::kMaxOneByteCharCode); | 7574 return new(zone) Range(0, String::kMaxOneByteCharCode); |
| 7583 } else { | 7575 } else { |
| 7584 DCHECK_EQ(String::TWO_BYTE_ENCODING, encoding()); | 7576 DCHECK_EQ(String::TWO_BYTE_ENCODING, encoding()); |
| 7585 return new(zone) Range(0, String::kMaxUtf16CodeUnit); | 7577 return new(zone) Range(0, String::kMaxUtf16CodeUnit); |
| 7586 } | 7578 } |
| 7587 } | 7579 } |
| 7588 | 7580 |
| 7589 private: | 7581 private: |
| 7590 HSeqStringGetChar(String::Encoding encoding, | 7582 HSeqStringGetChar(String::Encoding encoding, |
| 7591 HValue* string, | 7583 HValue* string, |
| 7592 HValue* index) : encoding_(encoding) { | 7584 HValue* index) : encoding_(encoding) { |
| 7593 SetOperandAt(0, string); | 7585 SetOperandAt(0, string); |
| 7594 SetOperandAt(1, index); | 7586 SetOperandAt(1, index); |
| 7595 set_representation(Representation::Integer32()); | 7587 set_representation(Representation::Integer32()); |
| 7596 SetFlag(kUseGVN); | 7588 SetFlag(kUseGVN); |
| 7597 SetDependsOnFlag(kStringChars); | 7589 SetDependsOnFlag(kStringChars); |
| 7598 } | 7590 } |
| 7599 | 7591 |
| 7600 bool IsDeletable() const OVERRIDE { return true; } | 7592 bool IsDeletable() const override { return true; } |
| 7601 | 7593 |
| 7602 String::Encoding encoding_; | 7594 String::Encoding encoding_; |
| 7603 }; | 7595 }; |
| 7604 | 7596 |
| 7605 | 7597 |
| 7606 class HSeqStringSetChar FINAL : public HTemplateInstruction<4> { | 7598 class HSeqStringSetChar final : public HTemplateInstruction<4> { |
| 7607 public: | 7599 public: |
| 7608 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4( | 7600 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4( |
| 7609 HSeqStringSetChar, String::Encoding, | 7601 HSeqStringSetChar, String::Encoding, |
| 7610 HValue*, HValue*, HValue*); | 7602 HValue*, HValue*, HValue*); |
| 7611 | 7603 |
| 7612 String::Encoding encoding() { return encoding_; } | 7604 String::Encoding encoding() { return encoding_; } |
| 7613 HValue* context() { return OperandAt(0); } | 7605 HValue* context() { return OperandAt(0); } |
| 7614 HValue* string() { return OperandAt(1); } | 7606 HValue* string() { return OperandAt(1); } |
| 7615 HValue* index() { return OperandAt(2); } | 7607 HValue* index() { return OperandAt(2); } |
| 7616 HValue* value() { return OperandAt(3); } | 7608 HValue* value() { return OperandAt(3); } |
| 7617 | 7609 |
| 7618 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7610 Representation RequiredInputRepresentation(int index) override { |
| 7619 return (index <= 1) ? Representation::Tagged() | 7611 return (index <= 1) ? Representation::Tagged() |
| 7620 : Representation::Integer32(); | 7612 : Representation::Integer32(); |
| 7621 } | 7613 } |
| 7622 | 7614 |
| 7623 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar) | 7615 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar) |
| 7624 | 7616 |
| 7625 private: | 7617 private: |
| 7626 HSeqStringSetChar(HValue* context, | 7618 HSeqStringSetChar(HValue* context, |
| 7627 String::Encoding encoding, | 7619 String::Encoding encoding, |
| 7628 HValue* string, | 7620 HValue* string, |
| 7629 HValue* index, | 7621 HValue* index, |
| 7630 HValue* value) : encoding_(encoding) { | 7622 HValue* value) : encoding_(encoding) { |
| 7631 SetOperandAt(0, context); | 7623 SetOperandAt(0, context); |
| 7632 SetOperandAt(1, string); | 7624 SetOperandAt(1, string); |
| 7633 SetOperandAt(2, index); | 7625 SetOperandAt(2, index); |
| 7634 SetOperandAt(3, value); | 7626 SetOperandAt(3, value); |
| 7635 set_representation(Representation::Tagged()); | 7627 set_representation(Representation::Tagged()); |
| 7636 SetChangesFlag(kStringChars); | 7628 SetChangesFlag(kStringChars); |
| 7637 } | 7629 } |
| 7638 | 7630 |
| 7639 String::Encoding encoding_; | 7631 String::Encoding encoding_; |
| 7640 }; | 7632 }; |
| 7641 | 7633 |
| 7642 | 7634 |
| 7643 class HCheckMapValue FINAL : public HTemplateInstruction<2> { | 7635 class HCheckMapValue final : public HTemplateInstruction<2> { |
| 7644 public: | 7636 public: |
| 7645 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); | 7637 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); |
| 7646 | 7638 |
| 7647 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7639 Representation RequiredInputRepresentation(int index) override { |
| 7648 return Representation::Tagged(); | 7640 return Representation::Tagged(); |
| 7649 } | 7641 } |
| 7650 | 7642 |
| 7651 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7643 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 7652 | 7644 |
| 7653 HType CalculateInferredType() OVERRIDE { | 7645 HType CalculateInferredType() override { |
| 7654 if (value()->type().IsHeapObject()) return value()->type(); | 7646 if (value()->type().IsHeapObject()) return value()->type(); |
| 7655 return HType::HeapObject(); | 7647 return HType::HeapObject(); |
| 7656 } | 7648 } |
| 7657 | 7649 |
| 7658 HValue* value() const { return OperandAt(0); } | 7650 HValue* value() const { return OperandAt(0); } |
| 7659 HValue* map() const { return OperandAt(1); } | 7651 HValue* map() const { return OperandAt(1); } |
| 7660 | 7652 |
| 7661 HValue* Canonicalize() OVERRIDE; | 7653 HValue* Canonicalize() override; |
| 7662 | 7654 |
| 7663 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue) | 7655 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue) |
| 7664 | 7656 |
| 7665 protected: | 7657 protected: |
| 7666 int RedefinedOperandIndex() OVERRIDE { return 0; } | 7658 int RedefinedOperandIndex() override { return 0; } |
| 7667 | 7659 |
| 7668 bool DataEquals(HValue* other) OVERRIDE { return true; } | 7660 bool DataEquals(HValue* other) override { return true; } |
| 7669 | 7661 |
| 7670 private: | 7662 private: |
| 7671 HCheckMapValue(HValue* value, HValue* map) | 7663 HCheckMapValue(HValue* value, HValue* map) |
| 7672 : HTemplateInstruction<2>(HType::HeapObject()) { | 7664 : HTemplateInstruction<2>(HType::HeapObject()) { |
| 7673 SetOperandAt(0, value); | 7665 SetOperandAt(0, value); |
| 7674 SetOperandAt(1, map); | 7666 SetOperandAt(1, map); |
| 7675 set_representation(Representation::Tagged()); | 7667 set_representation(Representation::Tagged()); |
| 7676 SetFlag(kUseGVN); | 7668 SetFlag(kUseGVN); |
| 7677 SetDependsOnFlag(kMaps); | 7669 SetDependsOnFlag(kMaps); |
| 7678 SetDependsOnFlag(kElementsKind); | 7670 SetDependsOnFlag(kElementsKind); |
| 7679 } | 7671 } |
| 7680 }; | 7672 }; |
| 7681 | 7673 |
| 7682 | 7674 |
| 7683 class HForInPrepareMap FINAL : public HTemplateInstruction<2> { | 7675 class HForInPrepareMap final : public HTemplateInstruction<2> { |
| 7684 public: | 7676 public: |
| 7685 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HForInPrepareMap, HValue*); | 7677 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HForInPrepareMap, HValue*); |
| 7686 | 7678 |
| 7687 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7679 Representation RequiredInputRepresentation(int index) override { |
| 7688 return Representation::Tagged(); | 7680 return Representation::Tagged(); |
| 7689 } | 7681 } |
| 7690 | 7682 |
| 7691 HValue* context() const { return OperandAt(0); } | 7683 HValue* context() const { return OperandAt(0); } |
| 7692 HValue* enumerable() const { return OperandAt(1); } | 7684 HValue* enumerable() const { return OperandAt(1); } |
| 7693 | 7685 |
| 7694 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7686 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 7695 | 7687 |
| 7696 HType CalculateInferredType() OVERRIDE { return HType::Tagged(); } | 7688 HType CalculateInferredType() override { return HType::Tagged(); } |
| 7697 | 7689 |
| 7698 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap); | 7690 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap); |
| 7699 | 7691 |
| 7700 private: | 7692 private: |
| 7701 HForInPrepareMap(HValue* context, | 7693 HForInPrepareMap(HValue* context, |
| 7702 HValue* object) { | 7694 HValue* object) { |
| 7703 SetOperandAt(0, context); | 7695 SetOperandAt(0, context); |
| 7704 SetOperandAt(1, object); | 7696 SetOperandAt(1, object); |
| 7705 set_representation(Representation::Tagged()); | 7697 set_representation(Representation::Tagged()); |
| 7706 SetAllSideEffects(); | 7698 SetAllSideEffects(); |
| 7707 } | 7699 } |
| 7708 }; | 7700 }; |
| 7709 | 7701 |
| 7710 | 7702 |
| 7711 class HForInCacheArray FINAL : public HTemplateInstruction<2> { | 7703 class HForInCacheArray final : public HTemplateInstruction<2> { |
| 7712 public: | 7704 public: |
| 7713 DECLARE_INSTRUCTION_FACTORY_P3(HForInCacheArray, HValue*, HValue*, int); | 7705 DECLARE_INSTRUCTION_FACTORY_P3(HForInCacheArray, HValue*, HValue*, int); |
| 7714 | 7706 |
| 7715 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7707 Representation RequiredInputRepresentation(int index) override { |
| 7716 return Representation::Tagged(); | 7708 return Representation::Tagged(); |
| 7717 } | 7709 } |
| 7718 | 7710 |
| 7719 HValue* enumerable() const { return OperandAt(0); } | 7711 HValue* enumerable() const { return OperandAt(0); } |
| 7720 HValue* map() const { return OperandAt(1); } | 7712 HValue* map() const { return OperandAt(1); } |
| 7721 int idx() const { return idx_; } | 7713 int idx() const { return idx_; } |
| 7722 | 7714 |
| 7723 HForInCacheArray* index_cache() { | 7715 HForInCacheArray* index_cache() { |
| 7724 return index_cache_; | 7716 return index_cache_; |
| 7725 } | 7717 } |
| 7726 | 7718 |
| 7727 void set_index_cache(HForInCacheArray* index_cache) { | 7719 void set_index_cache(HForInCacheArray* index_cache) { |
| 7728 index_cache_ = index_cache; | 7720 index_cache_ = index_cache; |
| 7729 } | 7721 } |
| 7730 | 7722 |
| 7731 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7723 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 7732 | 7724 |
| 7733 HType CalculateInferredType() OVERRIDE { return HType::Tagged(); } | 7725 HType CalculateInferredType() override { return HType::Tagged(); } |
| 7734 | 7726 |
| 7735 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray); | 7727 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray); |
| 7736 | 7728 |
| 7737 private: | 7729 private: |
| 7738 HForInCacheArray(HValue* enumerable, | 7730 HForInCacheArray(HValue* enumerable, |
| 7739 HValue* keys, | 7731 HValue* keys, |
| 7740 int idx) : idx_(idx) { | 7732 int idx) : idx_(idx) { |
| 7741 SetOperandAt(0, enumerable); | 7733 SetOperandAt(0, enumerable); |
| 7742 SetOperandAt(1, keys); | 7734 SetOperandAt(1, keys); |
| 7743 set_representation(Representation::Tagged()); | 7735 set_representation(Representation::Tagged()); |
| 7744 } | 7736 } |
| 7745 | 7737 |
| 7746 int idx_; | 7738 int idx_; |
| 7747 HForInCacheArray* index_cache_; | 7739 HForInCacheArray* index_cache_; |
| 7748 }; | 7740 }; |
| 7749 | 7741 |
| 7750 | 7742 |
| 7751 class HLoadFieldByIndex FINAL : public HTemplateInstruction<2> { | 7743 class HLoadFieldByIndex final : public HTemplateInstruction<2> { |
| 7752 public: | 7744 public: |
| 7753 DECLARE_INSTRUCTION_FACTORY_P2(HLoadFieldByIndex, HValue*, HValue*); | 7745 DECLARE_INSTRUCTION_FACTORY_P2(HLoadFieldByIndex, HValue*, HValue*); |
| 7754 | 7746 |
| 7755 HLoadFieldByIndex(HValue* object, | 7747 HLoadFieldByIndex(HValue* object, |
| 7756 HValue* index) { | 7748 HValue* index) { |
| 7757 SetOperandAt(0, object); | 7749 SetOperandAt(0, object); |
| 7758 SetOperandAt(1, index); | 7750 SetOperandAt(1, index); |
| 7759 SetChangesFlag(kNewSpacePromotion); | 7751 SetChangesFlag(kNewSpacePromotion); |
| 7760 set_representation(Representation::Tagged()); | 7752 set_representation(Representation::Tagged()); |
| 7761 } | 7753 } |
| 7762 | 7754 |
| 7763 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7755 Representation RequiredInputRepresentation(int index) override { |
| 7764 if (index == 1) { | 7756 if (index == 1) { |
| 7765 return Representation::Smi(); | 7757 return Representation::Smi(); |
| 7766 } else { | 7758 } else { |
| 7767 return Representation::Tagged(); | 7759 return Representation::Tagged(); |
| 7768 } | 7760 } |
| 7769 } | 7761 } |
| 7770 | 7762 |
| 7771 HValue* object() const { return OperandAt(0); } | 7763 HValue* object() const { return OperandAt(0); } |
| 7772 HValue* index() const { return OperandAt(1); } | 7764 HValue* index() const { return OperandAt(1); } |
| 7773 | 7765 |
| 7774 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7766 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 7775 | 7767 |
| 7776 HType CalculateInferredType() OVERRIDE { return HType::Tagged(); } | 7768 HType CalculateInferredType() override { return HType::Tagged(); } |
| 7777 | 7769 |
| 7778 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); | 7770 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); |
| 7779 | 7771 |
| 7780 private: | 7772 private: |
| 7781 bool IsDeletable() const OVERRIDE { return true; } | 7773 bool IsDeletable() const override { return true; } |
| 7782 }; | 7774 }; |
| 7783 | 7775 |
| 7784 | 7776 |
| 7785 class HStoreFrameContext: public HUnaryOperation { | 7777 class HStoreFrameContext: public HUnaryOperation { |
| 7786 public: | 7778 public: |
| 7787 DECLARE_INSTRUCTION_FACTORY_P1(HStoreFrameContext, HValue*); | 7779 DECLARE_INSTRUCTION_FACTORY_P1(HStoreFrameContext, HValue*); |
| 7788 | 7780 |
| 7789 HValue* context() { return OperandAt(0); } | 7781 HValue* context() { return OperandAt(0); } |
| 7790 | 7782 |
| 7791 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7783 Representation RequiredInputRepresentation(int index) override { |
| 7792 return Representation::Tagged(); | 7784 return Representation::Tagged(); |
| 7793 } | 7785 } |
| 7794 | 7786 |
| 7795 DECLARE_CONCRETE_INSTRUCTION(StoreFrameContext) | 7787 DECLARE_CONCRETE_INSTRUCTION(StoreFrameContext) |
| 7796 private: | 7788 private: |
| 7797 explicit HStoreFrameContext(HValue* context) | 7789 explicit HStoreFrameContext(HValue* context) |
| 7798 : HUnaryOperation(context) { | 7790 : HUnaryOperation(context) { |
| 7799 set_representation(Representation::Tagged()); | 7791 set_representation(Representation::Tagged()); |
| 7800 SetChangesFlag(kContextSlots); | 7792 SetChangesFlag(kContextSlots); |
| 7801 } | 7793 } |
| 7802 }; | 7794 }; |
| 7803 | 7795 |
| 7804 | 7796 |
| 7805 class HAllocateBlockContext: public HTemplateInstruction<2> { | 7797 class HAllocateBlockContext: public HTemplateInstruction<2> { |
| 7806 public: | 7798 public: |
| 7807 DECLARE_INSTRUCTION_FACTORY_P3(HAllocateBlockContext, HValue*, | 7799 DECLARE_INSTRUCTION_FACTORY_P3(HAllocateBlockContext, HValue*, |
| 7808 HValue*, Handle<ScopeInfo>); | 7800 HValue*, Handle<ScopeInfo>); |
| 7809 HValue* context() const { return OperandAt(0); } | 7801 HValue* context() const { return OperandAt(0); } |
| 7810 HValue* function() const { return OperandAt(1); } | 7802 HValue* function() const { return OperandAt(1); } |
| 7811 Handle<ScopeInfo> scope_info() const { return scope_info_; } | 7803 Handle<ScopeInfo> scope_info() const { return scope_info_; } |
| 7812 | 7804 |
| 7813 Representation RequiredInputRepresentation(int index) OVERRIDE { | 7805 Representation RequiredInputRepresentation(int index) override { |
| 7814 return Representation::Tagged(); | 7806 return Representation::Tagged(); |
| 7815 } | 7807 } |
| 7816 | 7808 |
| 7817 std::ostream& PrintDataTo(std::ostream& os) const OVERRIDE; // NOLINT | 7809 std::ostream& PrintDataTo(std::ostream& os) const override; // NOLINT |
| 7818 | 7810 |
| 7819 DECLARE_CONCRETE_INSTRUCTION(AllocateBlockContext) | 7811 DECLARE_CONCRETE_INSTRUCTION(AllocateBlockContext) |
| 7820 | 7812 |
| 7821 private: | 7813 private: |
| 7822 HAllocateBlockContext(HValue* context, | 7814 HAllocateBlockContext(HValue* context, |
| 7823 HValue* function, | 7815 HValue* function, |
| 7824 Handle<ScopeInfo> scope_info) | 7816 Handle<ScopeInfo> scope_info) |
| 7825 : scope_info_(scope_info) { | 7817 : scope_info_(scope_info) { |
| 7826 SetOperandAt(0, context); | 7818 SetOperandAt(0, context); |
| 7827 SetOperandAt(1, function); | 7819 SetOperandAt(1, function); |
| 7828 set_representation(Representation::Tagged()); | 7820 set_representation(Representation::Tagged()); |
| 7829 } | 7821 } |
| 7830 | 7822 |
| 7831 Handle<ScopeInfo> scope_info_; | 7823 Handle<ScopeInfo> scope_info_; |
| 7832 }; | 7824 }; |
| 7833 | 7825 |
| 7834 | 7826 |
| 7835 | 7827 |
| 7836 #undef DECLARE_INSTRUCTION | 7828 #undef DECLARE_INSTRUCTION |
| 7837 #undef DECLARE_CONCRETE_INSTRUCTION | 7829 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7838 | 7830 |
| 7839 } } // namespace v8::internal | 7831 } } // namespace v8::internal |
| 7840 | 7832 |
| 7841 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7833 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |