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

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

Issue 363323003: More OStreamsUse OStreams more often. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased and polished. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-gvn.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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 "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
11 #include "src/code-stubs.h" 11 #include "src/code-stubs.h"
12 #include "src/conversions.h" 12 #include "src/conversions.h"
13 #include "src/data-flow.h" 13 #include "src/data-flow.h"
14 #include "src/deoptimizer.h" 14 #include "src/deoptimizer.h"
15 #include "src/hydrogen-types.h" 15 #include "src/hydrogen-types.h"
16 #include "src/ostreams.h"
16 #include "src/small-pointer-list.h" 17 #include "src/small-pointer-list.h"
17 #include "src/string-stream.h"
18 #include "src/unique.h" 18 #include "src/unique.h"
19 #include "src/utils.h" 19 #include "src/utils.h"
20 #include "src/zone.h" 20 #include "src/zone.h"
21 21
22 namespace v8 { 22 namespace v8 {
23 namespace internal { 23 namespace internal {
24 24
25 // Forward declarations. 25 // Forward declarations.
26 class ChangesOf;
26 class HBasicBlock; 27 class HBasicBlock;
27 class HDiv; 28 class HDiv;
28 class HEnvironment; 29 class HEnvironment;
29 class HInferRepresentationPhase; 30 class HInferRepresentationPhase;
30 class HInstruction; 31 class HInstruction;
31 class HLoopInformation; 32 class HLoopInformation;
32 class HStoreNamedField; 33 class HStoreNamedField;
33 class HValue; 34 class HValue;
34 class LInstruction; 35 class LInstruction;
35 class LChunkBuilder; 36 class LChunkBuilder;
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 439
439 int inlining_id() const { return InliningIdField::decode(value_); } 440 int inlining_id() const { return InliningIdField::decode(value_); }
440 void set_inlining_id(int inlining_id) { 441 void set_inlining_id(int inlining_id) {
441 if (FLAG_hydrogen_track_positions) { 442 if (FLAG_hydrogen_track_positions) {
442 value_ = static_cast<int>(InliningIdField::update(value_, inlining_id)); 443 value_ = static_cast<int>(InliningIdField::update(value_, inlining_id));
443 } 444 }
444 } 445 }
445 446
446 int raw() const { return value_; } 447 int raw() const { return value_; }
447 448
448 void PrintTo(FILE* f);
449
450 private: 449 private:
451 typedef BitField<int, 0, 9> InliningIdField; 450 typedef BitField<int, 0, 9> InliningIdField;
452 451
453 // Offset from the start of the inlined function. 452 // Offset from the start of the inlined function.
454 typedef BitField<int, 9, 22> PositionField; 453 typedef BitField<int, 9, 22> PositionField;
455 454
456 // On HPositionInfo can use this constructor. 455 // On HPositionInfo can use this constructor.
457 explicit HSourcePosition(int value) : value_(value) { } 456 explicit HSourcePosition(int value) : value_(value) { }
458 457
459 friend class HPositionInfo; 458 friend class HPositionInfo;
460 459
461 // If FLAG_hydrogen_track_positions is set contains bitfields InliningIdField 460 // If FLAG_hydrogen_track_positions is set contains bitfields InliningIdField
462 // and PositionField. 461 // and PositionField.
463 // Otherwise contains absolute offset from the script start. 462 // Otherwise contains absolute offset from the script start.
464 int value_; 463 int value_;
465 }; 464 };
466 465
467 466
467 OStream& operator<<(OStream& os, const HSourcePosition& p);
468
469
468 class HValue : public ZoneObject { 470 class HValue : public ZoneObject {
469 public: 471 public:
470 static const int kNoNumber = -1; 472 static const int kNoNumber = -1;
471 473
472 enum Flag { 474 enum Flag {
473 kFlexibleRepresentation, 475 kFlexibleRepresentation,
474 kCannotBeTagged, 476 kCannotBeTagged,
475 // Participate in Global Value Numbering, i.e. elimination of 477 // Participate in Global Value Numbering, i.e. elimination of
476 // unnecessary recomputations. If an instruction sets this flag, it must 478 // unnecessary recomputations. If an instruction sets this flag, it must
477 // implement DataEquals(), which will be used to determine if other 479 // implement DataEquals(), which will be used to determine if other
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 return value; 651 return value;
650 } 652 }
651 653
652 bool IsInteger32Constant(); 654 bool IsInteger32Constant();
653 int32_t GetInteger32Constant(); 655 int32_t GetInteger32Constant();
654 bool EqualsInteger32Constant(int32_t value); 656 bool EqualsInteger32Constant(int32_t value);
655 657
656 bool IsDefinedAfter(HBasicBlock* other) const; 658 bool IsDefinedAfter(HBasicBlock* other) const;
657 659
658 // Operands. 660 // Operands.
659 virtual int OperandCount() = 0; 661 virtual int OperandCount() const = 0;
660 virtual HValue* OperandAt(int index) const = 0; 662 virtual HValue* OperandAt(int index) const = 0;
661 void SetOperandAt(int index, HValue* value); 663 void SetOperandAt(int index, HValue* value);
662 664
663 void DeleteAndReplaceWith(HValue* other); 665 void DeleteAndReplaceWith(HValue* other);
664 void ReplaceAllUsesWith(HValue* other); 666 void ReplaceAllUsesWith(HValue* other);
665 bool HasNoUses() const { return use_list_ == NULL; } 667 bool HasNoUses() const { return use_list_ == NULL; }
666 bool HasOneUse() const { 668 bool HasOneUse() const {
667 return use_list_ != NULL && use_list_->tail() == NULL; 669 return use_list_ != NULL && use_list_->tail() == NULL;
668 } 670 }
669 bool HasMultipleUses() const { 671 bool HasMultipleUses() const {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 // then return it. Return NULL to have the instruction deleted. 760 // then return it. Return NULL to have the instruction deleted.
759 virtual HValue* Canonicalize() { return this; } 761 virtual HValue* Canonicalize() { return this; }
760 762
761 bool Equals(HValue* other); 763 bool Equals(HValue* other);
762 virtual intptr_t Hashcode(); 764 virtual intptr_t Hashcode();
763 765
764 // Compute unique ids upfront that is safe wrt GC and concurrent compilation. 766 // Compute unique ids upfront that is safe wrt GC and concurrent compilation.
765 virtual void FinalizeUniqueness() { } 767 virtual void FinalizeUniqueness() { }
766 768
767 // Printing support. 769 // Printing support.
768 virtual void PrintTo(StringStream* stream) = 0; 770 virtual OStream& PrintTo(OStream& os) const = 0; // NOLINT
769 void PrintNameTo(StringStream* stream);
770 void PrintTypeTo(StringStream* stream);
771 void PrintChangesTo(StringStream* stream);
772 771
773 const char* Mnemonic() const; 772 const char* Mnemonic() const;
774 773
775 // Type information helpers. 774 // Type information helpers.
776 bool HasMonomorphicJSObjectType(); 775 bool HasMonomorphicJSObjectType();
777 776
778 // TODO(mstarzinger): For now instructions can override this function to 777 // TODO(mstarzinger): For now instructions can override this function to
779 // specify statically known types, once HType can convey more information 778 // specify statically known types, once HType can convey more information
780 // it should be based on the HType. 779 // it should be based on the HType.
781 virtual Handle<Map> GetMonomorphicJSObjectMap() { return Handle<Map>(); } 780 virtual Handle<Map> GetMonomorphicJSObjectMap() { return Handle<Map>(); }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 #undef ADD_FLAG 877 #undef ADD_FLAG
879 return result; 878 return result;
880 } 879 }
881 880
882 // A flag mask to mark an instruction as having arbitrary side effects. 881 // A flag mask to mark an instruction as having arbitrary side effects.
883 static GVNFlagSet AllSideEffectsFlagSet() { 882 static GVNFlagSet AllSideEffectsFlagSet() {
884 GVNFlagSet result = AllFlagSet(); 883 GVNFlagSet result = AllFlagSet();
885 result.Remove(kOsrEntries); 884 result.Remove(kOsrEntries);
886 return result; 885 return result;
887 } 886 }
887 friend OStream& operator<<(OStream& os, const ChangesOf& v);
888 888
889 // A flag mask of all side effects that can make observable changes in 889 // A flag mask of all side effects that can make observable changes in
890 // an executing program (i.e. are not safe to repeat, move or remove); 890 // an executing program (i.e. are not safe to repeat, move or remove);
891 static GVNFlagSet AllObservableSideEffectsFlagSet() { 891 static GVNFlagSet AllObservableSideEffectsFlagSet() {
892 GVNFlagSet result = AllFlagSet(); 892 GVNFlagSet result = AllFlagSet();
893 result.Remove(kNewSpacePromotion); 893 result.Remove(kNewSpacePromotion);
894 result.Remove(kElementsKind); 894 result.Remove(kElementsKind);
895 result.Remove(kElementsPointer); 895 result.Remove(kElementsPointer);
896 result.Remove(kMaps); 896 result.Remove(kMaps);
897 return result; 897 return result;
(...skipping 21 matching lines...) Expand all
919 int flags_; 919 int flags_;
920 GVNFlagSet changes_flags_; 920 GVNFlagSet changes_flags_;
921 GVNFlagSet depends_on_flags_; 921 GVNFlagSet depends_on_flags_;
922 922
923 private: 923 private:
924 virtual bool IsDeletable() const { return false; } 924 virtual bool IsDeletable() const { return false; }
925 925
926 DISALLOW_COPY_AND_ASSIGN(HValue); 926 DISALLOW_COPY_AND_ASSIGN(HValue);
927 }; 927 };
928 928
929 // Support for printing various aspects of an HValue.
930 struct NameOf {
931 explicit NameOf(const HValue* const v) : value(v) {}
932 const HValue* value;
933 };
934
935
936 struct TypeOf {
937 explicit TypeOf(const HValue* const v) : value(v) {}
938 const HValue* value;
939 };
940
941
942 struct ChangesOf {
943 explicit ChangesOf(const HValue* const v) : value(v) {}
944 const HValue* value;
945 };
946
929 947
930 OStream& operator<<(OStream& os, const HValue& v); 948 OStream& operator<<(OStream& os, const HValue& v);
949 OStream& operator<<(OStream& os, const NameOf& v);
950 OStream& operator<<(OStream& os, const TypeOf& v);
951 OStream& operator<<(OStream& os, const ChangesOf& v);
931 952
932 953
933 #define DECLARE_INSTRUCTION_FACTORY_P0(I) \ 954 #define DECLARE_INSTRUCTION_FACTORY_P0(I) \
934 static I* New(Zone* zone, HValue* context) { \ 955 static I* New(Zone* zone, HValue* context) { \
935 return new(zone) I(); \ 956 return new(zone) I(); \
936 } 957 }
937 958
938 #define DECLARE_INSTRUCTION_FACTORY_P1(I, P1) \ 959 #define DECLARE_INSTRUCTION_FACTORY_P1(I, P1) \
939 static I* New(Zone* zone, HValue* context, P1 p1) { \ 960 static I* New(Zone* zone, HValue* context, P1 p1) { \
940 return new(zone) I(p1); \ 961 return new(zone) I(p1); \
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 1137
1117 intptr_t data_; 1138 intptr_t data_;
1118 }; 1139 };
1119 1140
1120 1141
1121 class HInstruction : public HValue { 1142 class HInstruction : public HValue {
1122 public: 1143 public:
1123 HInstruction* next() const { return next_; } 1144 HInstruction* next() const { return next_; }
1124 HInstruction* previous() const { return previous_; } 1145 HInstruction* previous() const { return previous_; }
1125 1146
1126 virtual void PrintTo(StringStream* stream) V8_OVERRIDE; 1147 virtual OStream& PrintTo(OStream& os) const V8_OVERRIDE; // NOLINT
1127 virtual void PrintDataTo(StringStream* stream); 1148 virtual OStream& PrintDataTo(OStream& os) const; // NOLINT
1128 1149
1129 bool IsLinked() const { return block() != NULL; } 1150 bool IsLinked() const { return block() != NULL; }
1130 void Unlink(); 1151 void Unlink();
1131 1152
1132 void InsertBefore(HInstruction* next); 1153 void InsertBefore(HInstruction* next);
1133 1154
1134 template<class T> T* Prepend(T* instr) { 1155 template<class T> T* Prepend(T* instr) {
1135 instr->InsertBefore(this); 1156 instr->InsertBefore(this);
1136 return instr; 1157 return instr;
1137 } 1158 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 } 1213 }
1193 1214
1194 virtual void DeleteFromGraph() V8_OVERRIDE { Unlink(); } 1215 virtual void DeleteFromGraph() V8_OVERRIDE { Unlink(); }
1195 1216
1196 private: 1217 private:
1197 void InitializeAsFirst(HBasicBlock* block) { 1218 void InitializeAsFirst(HBasicBlock* block) {
1198 ASSERT(!IsLinked()); 1219 ASSERT(!IsLinked());
1199 SetBlock(block); 1220 SetBlock(block);
1200 } 1221 }
1201 1222
1202 void PrintMnemonicTo(StringStream* stream);
1203
1204 HInstruction* next_; 1223 HInstruction* next_;
1205 HInstruction* previous_; 1224 HInstruction* previous_;
1206 HPositionInfo position_; 1225 HPositionInfo position_;
1207 1226
1208 friend class HBasicBlock; 1227 friend class HBasicBlock;
1209 }; 1228 };
1210 1229
1211 1230
1212 template<int V> 1231 template<int V>
1213 class HTemplateInstruction : public HInstruction { 1232 class HTemplateInstruction : public HInstruction {
1214 public: 1233 public:
1215 virtual int OperandCount() V8_FINAL V8_OVERRIDE { return V; } 1234 virtual int OperandCount() const V8_FINAL V8_OVERRIDE { return V; }
1216 virtual HValue* OperandAt(int i) const V8_FINAL V8_OVERRIDE { 1235 virtual HValue* OperandAt(int i) const V8_FINAL V8_OVERRIDE {
1217 return inputs_[i]; 1236 return inputs_[i];
1218 } 1237 }
1219 1238
1220 protected: 1239 protected:
1221 HTemplateInstruction(HType type = HType::Tagged()) : HInstruction(type) {} 1240 HTemplateInstruction(HType type = HType::Tagged()) : HInstruction(type) {}
1222 1241
1223 virtual void InternalSetOperandAt(int i, HValue* value) V8_FINAL V8_OVERRIDE { 1242 virtual void InternalSetOperandAt(int i, HValue* value) V8_FINAL V8_OVERRIDE {
1224 inputs_[i] = value; 1243 inputs_[i] = value;
1225 } 1244 }
1226 1245
1227 private: 1246 private:
1228 EmbeddedContainer<HValue*, V> inputs_; 1247 EmbeddedContainer<HValue*, V> inputs_;
1229 }; 1248 };
1230 1249
1231 1250
1232 class HControlInstruction : public HInstruction { 1251 class HControlInstruction : public HInstruction {
1233 public: 1252 public:
1234 virtual HBasicBlock* SuccessorAt(int i) = 0; 1253 virtual HBasicBlock* SuccessorAt(int i) const = 0;
1235 virtual int SuccessorCount() = 0; 1254 virtual int SuccessorCount() const = 0;
1236 virtual void SetSuccessorAt(int i, HBasicBlock* block) = 0; 1255 virtual void SetSuccessorAt(int i, HBasicBlock* block) = 0;
1237 1256
1238 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1257 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
1239 1258
1240 virtual bool KnownSuccessorBlock(HBasicBlock** block) { 1259 virtual bool KnownSuccessorBlock(HBasicBlock** block) {
1241 *block = NULL; 1260 *block = NULL;
1242 return false; 1261 return false;
1243 } 1262 }
1244 1263
1245 HBasicBlock* FirstSuccessor() { 1264 HBasicBlock* FirstSuccessor() {
1246 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL; 1265 return SuccessorCount() > 0 ? SuccessorAt(0) : NULL;
1247 } 1266 }
1248 HBasicBlock* SecondSuccessor() { 1267 HBasicBlock* SecondSuccessor() {
1249 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL; 1268 return SuccessorCount() > 1 ? SuccessorAt(1) : NULL;
1250 } 1269 }
1251 1270
1252 void Not() { 1271 void Not() {
1253 HBasicBlock* swap = SuccessorAt(0); 1272 HBasicBlock* swap = SuccessorAt(0);
1254 SetSuccessorAt(0, SuccessorAt(1)); 1273 SetSuccessorAt(0, SuccessorAt(1));
1255 SetSuccessorAt(1, swap); 1274 SetSuccessorAt(1, swap);
1256 } 1275 }
1257 1276
1258 DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction) 1277 DECLARE_ABSTRACT_INSTRUCTION(ControlInstruction)
1259 }; 1278 };
1260 1279
1261 1280
1262 class HSuccessorIterator V8_FINAL BASE_EMBEDDED { 1281 class HSuccessorIterator V8_FINAL BASE_EMBEDDED {
1263 public: 1282 public:
1264 explicit HSuccessorIterator(HControlInstruction* instr) 1283 explicit HSuccessorIterator(const HControlInstruction* instr)
1265 : instr_(instr), current_(0) { } 1284 : instr_(instr), current_(0) {}
1266 1285
1267 bool Done() { return current_ >= instr_->SuccessorCount(); } 1286 bool Done() { return current_ >= instr_->SuccessorCount(); }
1268 HBasicBlock* Current() { return instr_->SuccessorAt(current_); } 1287 HBasicBlock* Current() { return instr_->SuccessorAt(current_); }
1269 void Advance() { current_++; } 1288 void Advance() { current_++; }
1270 1289
1271 private: 1290 private:
1272 HControlInstruction* instr_; 1291 const HControlInstruction* instr_;
1273 int current_; 1292 int current_;
1274 }; 1293 };
1275 1294
1276 1295
1277 template<int S, int V> 1296 template<int S, int V>
1278 class HTemplateControlInstruction : public HControlInstruction { 1297 class HTemplateControlInstruction : public HControlInstruction {
1279 public: 1298 public:
1280 int SuccessorCount() V8_OVERRIDE { return S; } 1299 int SuccessorCount() const V8_OVERRIDE { return S; }
1281 HBasicBlock* SuccessorAt(int i) V8_OVERRIDE { return successors_[i]; } 1300 HBasicBlock* SuccessorAt(int i) const V8_OVERRIDE { return successors_[i]; }
1282 void SetSuccessorAt(int i, HBasicBlock* block) V8_OVERRIDE { 1301 void SetSuccessorAt(int i, HBasicBlock* block) V8_OVERRIDE {
1283 successors_[i] = block; 1302 successors_[i] = block;
1284 } 1303 }
1285 1304
1286 int OperandCount() V8_OVERRIDE { return V; } 1305 int OperandCount() const V8_OVERRIDE { return V; }
1287 HValue* OperandAt(int i) const V8_OVERRIDE { return inputs_[i]; } 1306 HValue* OperandAt(int i) const V8_OVERRIDE { return inputs_[i]; }
1288 1307
1289 1308
1290 protected: 1309 protected:
1291 void InternalSetOperandAt(int i, HValue* value) V8_OVERRIDE { 1310 void InternalSetOperandAt(int i, HValue* value) V8_OVERRIDE {
1292 inputs_[i] = value; 1311 inputs_[i] = value;
1293 } 1312 }
1294 1313
1295 private: 1314 private:
1296 EmbeddedContainer<HBasicBlock*, S> successors_; 1315 EmbeddedContainer<HBasicBlock*, S> successors_;
(...skipping 14 matching lines...) Expand all
1311 class HDummyUse V8_FINAL : public HTemplateInstruction<1> { 1330 class HDummyUse V8_FINAL : public HTemplateInstruction<1> {
1312 public: 1331 public:
1313 explicit HDummyUse(HValue* value) 1332 explicit HDummyUse(HValue* value)
1314 : HTemplateInstruction<1>(HType::Smi()) { 1333 : HTemplateInstruction<1>(HType::Smi()) {
1315 SetOperandAt(0, value); 1334 SetOperandAt(0, value);
1316 // Pretend to be a Smi so that the HChange instructions inserted 1335 // Pretend to be a Smi so that the HChange instructions inserted
1317 // before any use generate as little code as possible. 1336 // before any use generate as little code as possible.
1318 set_representation(Representation::Tagged()); 1337 set_representation(Representation::Tagged());
1319 } 1338 }
1320 1339
1321 HValue* value() { return OperandAt(0); } 1340 HValue* value() const { return OperandAt(0); }
1322 1341
1323 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 1342 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; }
1324 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1343 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1325 return Representation::None(); 1344 return Representation::None();
1326 } 1345 }
1327 1346
1328 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1347 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
1329 1348
1330 DECLARE_CONCRETE_INSTRUCTION(DummyUse); 1349 DECLARE_CONCRETE_INSTRUCTION(DummyUse);
1331 }; 1350 };
1332 1351
1333 1352
1334 // Inserts an int3/stop break instruction for debugging purposes. 1353 // Inserts an int3/stop break instruction for debugging purposes.
1335 class HDebugBreak V8_FINAL : public HTemplateInstruction<0> { 1354 class HDebugBreak V8_FINAL : public HTemplateInstruction<0> {
1336 public: 1355 public:
1337 DECLARE_INSTRUCTION_FACTORY_P0(HDebugBreak); 1356 DECLARE_INSTRUCTION_FACTORY_P0(HDebugBreak);
1338 1357
(...skipping 13 matching lines...) Expand all
1352 1371
1353 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE { 1372 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE {
1354 *block = FirstSuccessor(); 1373 *block = FirstSuccessor();
1355 return true; 1374 return true;
1356 } 1375 }
1357 1376
1358 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1377 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1359 return Representation::None(); 1378 return Representation::None();
1360 } 1379 }
1361 1380
1362 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1381 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
1363 1382
1364 DECLARE_CONCRETE_INSTRUCTION(Goto) 1383 DECLARE_CONCRETE_INSTRUCTION(Goto)
1365 }; 1384 };
1366 1385
1367 1386
1368 class HDeoptimize V8_FINAL : public HTemplateControlInstruction<1, 0> { 1387 class HDeoptimize V8_FINAL : public HTemplateControlInstruction<1, 0> {
1369 public: 1388 public:
1370 static HDeoptimize* New(Zone* zone, 1389 static HDeoptimize* New(Zone* zone,
1371 HValue* context, 1390 HValue* context,
1372 const char* reason, 1391 const char* reason,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 class HUnaryControlInstruction : public HTemplateControlInstruction<2, 1> { 1424 class HUnaryControlInstruction : public HTemplateControlInstruction<2, 1> {
1406 public: 1425 public:
1407 HUnaryControlInstruction(HValue* value, 1426 HUnaryControlInstruction(HValue* value,
1408 HBasicBlock* true_target, 1427 HBasicBlock* true_target,
1409 HBasicBlock* false_target) { 1428 HBasicBlock* false_target) {
1410 SetOperandAt(0, value); 1429 SetOperandAt(0, value);
1411 SetSuccessorAt(0, true_target); 1430 SetSuccessorAt(0, true_target);
1412 SetSuccessorAt(1, false_target); 1431 SetSuccessorAt(1, false_target);
1413 } 1432 }
1414 1433
1415 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1434 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
1416 1435
1417 HValue* value() { return OperandAt(0); } 1436 HValue* value() const { return OperandAt(0); }
1418 }; 1437 };
1419 1438
1420 1439
1421 class HBranch V8_FINAL : public HUnaryControlInstruction { 1440 class HBranch V8_FINAL : public HUnaryControlInstruction {
1422 public: 1441 public:
1423 DECLARE_INSTRUCTION_FACTORY_P1(HBranch, HValue*); 1442 DECLARE_INSTRUCTION_FACTORY_P1(HBranch, HValue*);
1424 DECLARE_INSTRUCTION_FACTORY_P2(HBranch, HValue*, 1443 DECLARE_INSTRUCTION_FACTORY_P2(HBranch, HValue*,
1425 ToBooleanStub::Types); 1444 ToBooleanStub::Types);
1426 DECLARE_INSTRUCTION_FACTORY_P4(HBranch, HValue*, 1445 DECLARE_INSTRUCTION_FACTORY_P4(HBranch, HValue*,
1427 ToBooleanStub::Types, 1446 ToBooleanStub::Types,
1428 HBasicBlock*, HBasicBlock*); 1447 HBasicBlock*, HBasicBlock*);
1429 1448
1430 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1449 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1431 return Representation::None(); 1450 return Representation::None();
1432 } 1451 }
1433 virtual Representation observed_input_representation(int index) V8_OVERRIDE; 1452 virtual Representation observed_input_representation(int index) V8_OVERRIDE;
1434 1453
1435 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 1454 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE;
1436 1455
1437 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1456 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
1438 1457
1439 ToBooleanStub::Types expected_input_types() const { 1458 ToBooleanStub::Types expected_input_types() const {
1440 return expected_input_types_; 1459 return expected_input_types_;
1441 } 1460 }
1442 1461
1443 DECLARE_CONCRETE_INSTRUCTION(Branch) 1462 DECLARE_CONCRETE_INSTRUCTION(Branch)
1444 1463
1445 private: 1464 private:
1446 HBranch(HValue* value, 1465 HBranch(HValue* value,
1447 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(), 1466 ToBooleanStub::Types expected_input_types = ToBooleanStub::Types(),
(...skipping 16 matching lines...) Expand all
1464 1483
1465 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE { 1484 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE {
1466 if (known_successor_index() != kNoKnownSuccessorIndex) { 1485 if (known_successor_index() != kNoKnownSuccessorIndex) {
1467 *block = SuccessorAt(known_successor_index()); 1486 *block = SuccessorAt(known_successor_index());
1468 return true; 1487 return true;
1469 } 1488 }
1470 *block = NULL; 1489 *block = NULL;
1471 return false; 1490 return false;
1472 } 1491 }
1473 1492
1474 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1493 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
1475 1494
1476 static const int kNoKnownSuccessorIndex = -1; 1495 static const int kNoKnownSuccessorIndex = -1;
1477 int known_successor_index() const { return known_successor_index_; } 1496 int known_successor_index() const { return known_successor_index_; }
1478 void set_known_successor_index(int known_successor_index) { 1497 void set_known_successor_index(int known_successor_index) {
1479 known_successor_index_ = known_successor_index; 1498 known_successor_index_ = known_successor_index;
1480 } 1499 }
1481 1500
1482 Unique<Map> map() const { return map_; } 1501 Unique<Map> map() const { return map_; }
1483 bool map_is_stable() const { return map_is_stable_; } 1502 bool map_is_stable() const { return map_is_stable_; }
1484 1503
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 public: 1557 public:
1539 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HReturn, HValue*, HValue*); 1558 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HReturn, HValue*, HValue*);
1540 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HReturn, HValue*); 1559 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HReturn, HValue*);
1541 1560
1542 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1561 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1543 // TODO(titzer): require an Int32 input for faster returns. 1562 // TODO(titzer): require an Int32 input for faster returns.
1544 if (index == 2) return Representation::Smi(); 1563 if (index == 2) return Representation::Smi();
1545 return Representation::Tagged(); 1564 return Representation::Tagged();
1546 } 1565 }
1547 1566
1548 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1567 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
1549 1568
1550 HValue* value() { return OperandAt(0); } 1569 HValue* value() const { return OperandAt(0); }
1551 HValue* context() { return OperandAt(1); } 1570 HValue* context() const { return OperandAt(1); }
1552 HValue* parameter_count() { return OperandAt(2); } 1571 HValue* parameter_count() const { return OperandAt(2); }
1553 1572
1554 DECLARE_CONCRETE_INSTRUCTION(Return) 1573 DECLARE_CONCRETE_INSTRUCTION(Return)
1555 1574
1556 private: 1575 private:
1557 HReturn(HValue* context, HValue* value, HValue* parameter_count = 0) { 1576 HReturn(HValue* context, HValue* value, HValue* parameter_count = 0) {
1558 SetOperandAt(0, value); 1577 SetOperandAt(0, value);
1559 SetOperandAt(1, context); 1578 SetOperandAt(1, context);
1560 SetOperandAt(2, parameter_count); 1579 SetOperandAt(2, parameter_count);
1561 } 1580 }
1562 }; 1581 };
(...skipping 18 matching lines...) Expand all
1581 HUnaryOperation(HValue* value, HType type = HType::Tagged()) 1600 HUnaryOperation(HValue* value, HType type = HType::Tagged())
1582 : HTemplateInstruction<1>(type) { 1601 : HTemplateInstruction<1>(type) {
1583 SetOperandAt(0, value); 1602 SetOperandAt(0, value);
1584 } 1603 }
1585 1604
1586 static HUnaryOperation* cast(HValue* value) { 1605 static HUnaryOperation* cast(HValue* value) {
1587 return reinterpret_cast<HUnaryOperation*>(value); 1606 return reinterpret_cast<HUnaryOperation*>(value);
1588 } 1607 }
1589 1608
1590 HValue* value() const { return OperandAt(0); } 1609 HValue* value() const { return OperandAt(0); }
1591 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1610 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
1592 }; 1611 };
1593 1612
1594 1613
1595 class HUseConst V8_FINAL : public HUnaryOperation { 1614 class HUseConst V8_FINAL : public HUnaryOperation {
1596 public: 1615 public:
1597 DECLARE_INSTRUCTION_FACTORY_P1(HUseConst, HValue*); 1616 DECLARE_INSTRUCTION_FACTORY_P1(HUseConst, HValue*);
1598 1617
1599 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1618 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1600 return Representation::None(); 1619 return Representation::None();
1601 } 1620 }
1602 1621
1603 DECLARE_CONCRETE_INSTRUCTION(UseConst) 1622 DECLARE_CONCRETE_INSTRUCTION(UseConst)
1604 1623
1605 private: 1624 private:
1606 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } 1625 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { }
1607 }; 1626 };
1608 1627
1609 1628
1610 class HForceRepresentation V8_FINAL : public HTemplateInstruction<1> { 1629 class HForceRepresentation V8_FINAL : public HTemplateInstruction<1> {
1611 public: 1630 public:
1612 static HInstruction* New(Zone* zone, HValue* context, HValue* value, 1631 static HInstruction* New(Zone* zone, HValue* context, HValue* value,
1613 Representation required_representation); 1632 Representation required_representation);
1614 1633
1615 HValue* value() { return OperandAt(0); } 1634 HValue* value() const { return OperandAt(0); }
1616 1635
1617 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1636 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1618 return representation(); // Same as the output representation. 1637 return representation(); // Same as the output representation.
1619 } 1638 }
1620 1639
1621 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1640 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
1622 1641
1623 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) 1642 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation)
1624 1643
1625 private: 1644 private:
1626 HForceRepresentation(HValue* value, Representation required_representation) { 1645 HForceRepresentation(HValue* value, Representation required_representation) {
1627 SetOperandAt(0, value); 1646 SetOperandAt(0, value);
1628 set_representation(required_representation); 1647 set_representation(required_representation);
1629 } 1648 }
1630 }; 1649 };
1631 1650
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 Representation to() const { return representation(); } 1686 Representation to() const { return representation(); }
1668 bool deoptimize_on_minus_zero() const { 1687 bool deoptimize_on_minus_zero() const {
1669 return CheckFlag(kBailoutOnMinusZero); 1688 return CheckFlag(kBailoutOnMinusZero);
1670 } 1689 }
1671 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1690 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1672 return from(); 1691 return from();
1673 } 1692 }
1674 1693
1675 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 1694 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
1676 1695
1677 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1696 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
1678 1697
1679 DECLARE_CONCRETE_INSTRUCTION(Change) 1698 DECLARE_CONCRETE_INSTRUCTION(Change)
1680 1699
1681 protected: 1700 protected:
1682 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 1701 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
1683 1702
1684 private: 1703 private:
1685 virtual bool IsDeletable() const V8_OVERRIDE { 1704 virtual bool IsDeletable() const V8_OVERRIDE {
1686 return !from().IsTagged() || value()->type().IsSmi(); 1705 return !from().IsTagged() || value()->type().IsSmi();
1687 } 1706 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 RemovableSimulate removable) 1805 RemovableSimulate removable)
1787 : ast_id_(ast_id), 1806 : ast_id_(ast_id),
1788 pop_count_(pop_count), 1807 pop_count_(pop_count),
1789 values_(2, zone), 1808 values_(2, zone),
1790 assigned_indexes_(2, zone), 1809 assigned_indexes_(2, zone),
1791 zone_(zone), 1810 zone_(zone),
1792 removable_(removable), 1811 removable_(removable),
1793 done_with_replay_(false) {} 1812 done_with_replay_(false) {}
1794 ~HSimulate() {} 1813 ~HSimulate() {}
1795 1814
1796 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1815 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
1797 1816
1798 bool HasAstId() const { return !ast_id_.IsNone(); } 1817 bool HasAstId() const { return !ast_id_.IsNone(); }
1799 BailoutId ast_id() const { return ast_id_; } 1818 BailoutId ast_id() const { return ast_id_; }
1800 void set_ast_id(BailoutId id) { 1819 void set_ast_id(BailoutId id) {
1801 ASSERT(!HasAstId()); 1820 ASSERT(!HasAstId());
1802 ast_id_ = id; 1821 ast_id_ = id;
1803 } 1822 }
1804 1823
1805 int pop_count() const { return pop_count_; } 1824 int pop_count() const { return pop_count_; }
1806 const ZoneList<HValue*>* values() const { return &values_; } 1825 const ZoneList<HValue*>* values() const { return &values_; }
1807 int GetAssignedIndexAt(int index) const { 1826 int GetAssignedIndexAt(int index) const {
1808 ASSERT(HasAssignedIndexAt(index)); 1827 ASSERT(HasAssignedIndexAt(index));
1809 return assigned_indexes_[index]; 1828 return assigned_indexes_[index];
1810 } 1829 }
1811 bool HasAssignedIndexAt(int index) const { 1830 bool HasAssignedIndexAt(int index) const {
1812 return assigned_indexes_[index] != kNoIndex; 1831 return assigned_indexes_[index] != kNoIndex;
1813 } 1832 }
1814 void AddAssignedValue(int index, HValue* value) { 1833 void AddAssignedValue(int index, HValue* value) {
1815 AddValue(index, value); 1834 AddValue(index, value);
1816 } 1835 }
1817 void AddPushedValue(HValue* value) { 1836 void AddPushedValue(HValue* value) {
1818 AddValue(kNoIndex, value); 1837 AddValue(kNoIndex, value);
1819 } 1838 }
1820 int ToOperandIndex(int environment_index) { 1839 int ToOperandIndex(int environment_index) {
1821 for (int i = 0; i < assigned_indexes_.length(); ++i) { 1840 for (int i = 0; i < assigned_indexes_.length(); ++i) {
1822 if (assigned_indexes_[i] == environment_index) return i; 1841 if (assigned_indexes_[i] == environment_index) return i;
1823 } 1842 }
1824 return -1; 1843 return -1;
1825 } 1844 }
1826 virtual int OperandCount() V8_OVERRIDE { return values_.length(); } 1845 virtual int OperandCount() const V8_OVERRIDE { return values_.length(); }
1827 virtual HValue* OperandAt(int index) const V8_OVERRIDE { 1846 virtual HValue* OperandAt(int index) const V8_OVERRIDE {
1828 return values_[index]; 1847 return values_[index];
1829 } 1848 }
1830 1849
1831 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 1850 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; }
1832 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1851 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1833 return Representation::None(); 1852 return Representation::None();
1834 } 1853 }
1835 1854
1836 void MergeWith(ZoneList<HSimulate*>* list); 1855 void MergeWith(ZoneList<HSimulate*>* list);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 #endif 1900 #endif
1882 }; 1901 };
1883 1902
1884 1903
1885 class HEnvironmentMarker V8_FINAL : public HTemplateInstruction<1> { 1904 class HEnvironmentMarker V8_FINAL : public HTemplateInstruction<1> {
1886 public: 1905 public:
1887 enum Kind { BIND, LOOKUP }; 1906 enum Kind { BIND, LOOKUP };
1888 1907
1889 DECLARE_INSTRUCTION_FACTORY_P2(HEnvironmentMarker, Kind, int); 1908 DECLARE_INSTRUCTION_FACTORY_P2(HEnvironmentMarker, Kind, int);
1890 1909
1891 Kind kind() { return kind_; } 1910 Kind kind() const { return kind_; }
1892 int index() { return index_; } 1911 int index() const { return index_; }
1893 HSimulate* next_simulate() { return next_simulate_; } 1912 HSimulate* next_simulate() { return next_simulate_; }
1894 void set_next_simulate(HSimulate* simulate) { 1913 void set_next_simulate(HSimulate* simulate) {
1895 next_simulate_ = simulate; 1914 next_simulate_ = simulate;
1896 } 1915 }
1897 1916
1898 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1917 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1899 return Representation::None(); 1918 return Representation::None();
1900 } 1919 }
1901 1920
1902 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1921 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
1903 1922
1904 #ifdef DEBUG 1923 #ifdef DEBUG
1905 void set_closure(Handle<JSFunction> closure) { 1924 void set_closure(Handle<JSFunction> closure) {
1906 ASSERT(closure_.is_null()); 1925 ASSERT(closure_.is_null());
1907 ASSERT(!closure.is_null()); 1926 ASSERT(!closure.is_null());
1908 closure_ = closure; 1927 closure_ = closure;
1909 } 1928 }
1910 Handle<JSFunction> closure() const { return closure_; } 1929 Handle<JSFunction> closure() const { return closure_; }
1911 #endif 1930 #endif
1912 1931
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1987 Variable* arguments_var, 2006 Variable* arguments_var,
1988 HArgumentsObject* arguments_object) { 2007 HArgumentsObject* arguments_object) {
1989 return new(zone) HEnterInlined(return_id, closure, arguments_count, 2008 return new(zone) HEnterInlined(return_id, closure, arguments_count,
1990 function, inlining_kind, arguments_var, 2009 function, inlining_kind, arguments_var,
1991 arguments_object, zone); 2010 arguments_object, zone);
1992 } 2011 }
1993 2012
1994 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone); 2013 void RegisterReturnTarget(HBasicBlock* return_target, Zone* zone);
1995 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; } 2014 ZoneList<HBasicBlock*>* return_targets() { return &return_targets_; }
1996 2015
1997 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2016 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
1998 2017
1999 Handle<JSFunction> closure() const { return closure_; } 2018 Handle<JSFunction> closure() const { return closure_; }
2000 int arguments_count() const { return arguments_count_; } 2019 int arguments_count() const { return arguments_count_; }
2001 bool arguments_pushed() const { return arguments_pushed_; } 2020 bool arguments_pushed() const { return arguments_pushed_; }
2002 void set_arguments_pushed() { arguments_pushed_ = true; } 2021 void set_arguments_pushed() { arguments_pushed_ = true; }
2003 FunctionLiteral* function() const { return function_; } 2022 FunctionLiteral* function() const { return function_; }
2004 InliningKind inlining_kind() const { return inlining_kind_; } 2023 InliningKind inlining_kind() const { return inlining_kind_; }
2005 BailoutId ReturnId() const { return return_id_; } 2024 BailoutId ReturnId() const { return return_id_; }
2006 2025
2007 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2026 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 return instr; 2122 return instr;
2104 } 2123 }
2105 2124
2106 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2125 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2107 return Representation::Tagged(); 2126 return Representation::Tagged();
2108 } 2127 }
2109 2128
2110 virtual int argument_delta() const V8_OVERRIDE { return inputs_.length(); } 2129 virtual int argument_delta() const V8_OVERRIDE { return inputs_.length(); }
2111 HValue* argument(int i) { return OperandAt(i); } 2130 HValue* argument(int i) { return OperandAt(i); }
2112 2131
2113 virtual int OperandCount() V8_FINAL V8_OVERRIDE { return inputs_.length(); } 2132 virtual int OperandCount() const V8_FINAL V8_OVERRIDE {
2133 return inputs_.length();
2134 }
2114 virtual HValue* OperandAt(int i) const V8_FINAL V8_OVERRIDE { 2135 virtual HValue* OperandAt(int i) const V8_FINAL V8_OVERRIDE {
2115 return inputs_[i]; 2136 return inputs_[i];
2116 } 2137 }
2117 2138
2118 void AddInput(HValue* value); 2139 void AddInput(HValue* value);
2119 2140
2120 DECLARE_CONCRETE_INSTRUCTION(PushArguments) 2141 DECLARE_CONCRETE_INSTRUCTION(PushArguments)
2121 2142
2122 protected: 2143 protected:
2123 virtual void InternalSetOperandAt(int i, HValue* value) V8_FINAL V8_OVERRIDE { 2144 virtual void InternalSetOperandAt(int i, HValue* value) V8_FINAL V8_OVERRIDE {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
2220 HUnaryCall(HValue* value, int argument_count) 2241 HUnaryCall(HValue* value, int argument_count)
2221 : HCall<1>(argument_count) { 2242 : HCall<1>(argument_count) {
2222 SetOperandAt(0, value); 2243 SetOperandAt(0, value);
2223 } 2244 }
2224 2245
2225 virtual Representation RequiredInputRepresentation( 2246 virtual Representation RequiredInputRepresentation(
2226 int index) V8_FINAL V8_OVERRIDE { 2247 int index) V8_FINAL V8_OVERRIDE {
2227 return Representation::Tagged(); 2248 return Representation::Tagged();
2228 } 2249 }
2229 2250
2230 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2251 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
2231 2252
2232 HValue* value() { return OperandAt(0); } 2253 HValue* value() const { return OperandAt(0); }
2233 }; 2254 };
2234 2255
2235 2256
2236 class HBinaryCall : public HCall<2> { 2257 class HBinaryCall : public HCall<2> {
2237 public: 2258 public:
2238 HBinaryCall(HValue* first, HValue* second, int argument_count) 2259 HBinaryCall(HValue* first, HValue* second, int argument_count)
2239 : HCall<2>(argument_count) { 2260 : HCall<2>(argument_count) {
2240 SetOperandAt(0, first); 2261 SetOperandAt(0, first);
2241 SetOperandAt(1, second); 2262 SetOperandAt(1, second);
2242 } 2263 }
2243 2264
2244 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2265 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
2245 2266
2246 virtual Representation RequiredInputRepresentation( 2267 virtual Representation RequiredInputRepresentation(
2247 int index) V8_FINAL V8_OVERRIDE { 2268 int index) V8_FINAL V8_OVERRIDE {
2248 return Representation::Tagged(); 2269 return Representation::Tagged();
2249 } 2270 }
2250 2271
2251 HValue* first() { return OperandAt(0); } 2272 HValue* first() const { return OperandAt(0); }
2252 HValue* second() { return OperandAt(1); } 2273 HValue* second() const { return OperandAt(1); }
2253 }; 2274 };
2254 2275
2255 2276
2256 class HCallJSFunction V8_FINAL : public HCall<1> { 2277 class HCallJSFunction V8_FINAL : public HCall<1> {
2257 public: 2278 public:
2258 static HCallJSFunction* New(Zone* zone, 2279 static HCallJSFunction* New(Zone* zone,
2259 HValue* context, 2280 HValue* context,
2260 HValue* function, 2281 HValue* function,
2261 int argument_count, 2282 int argument_count,
2262 bool pass_argument_count); 2283 bool pass_argument_count);
2263 2284
2264 HValue* function() { return OperandAt(0); } 2285 HValue* function() const { return OperandAt(0); }
2265 2286
2266 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2287 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
2267 2288
2268 virtual Representation RequiredInputRepresentation( 2289 virtual Representation RequiredInputRepresentation(
2269 int index) V8_FINAL V8_OVERRIDE { 2290 int index) V8_FINAL V8_OVERRIDE {
2270 ASSERT(index == 0); 2291 ASSERT(index == 0);
2271 return Representation::Tagged(); 2292 return Representation::Tagged();
2272 } 2293 }
2273 2294
2274 bool pass_argument_count() const { return pass_argument_count_; } 2295 bool pass_argument_count() const { return pass_argument_count_; }
2275 2296
2276 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE { 2297 virtual bool HasStackCheck() V8_FINAL V8_OVERRIDE {
(...skipping 26 matching lines...) Expand all
2303 int argument_count, 2324 int argument_count,
2304 const CallInterfaceDescriptor* descriptor, 2325 const CallInterfaceDescriptor* descriptor,
2305 const Vector<HValue*>& operands) { 2326 const Vector<HValue*>& operands) {
2306 ASSERT(operands.length() == descriptor->environment_length()); 2327 ASSERT(operands.length() == descriptor->environment_length());
2307 HCallWithDescriptor* res = 2328 HCallWithDescriptor* res =
2308 new(zone) HCallWithDescriptor(target, argument_count, 2329 new(zone) HCallWithDescriptor(target, argument_count,
2309 descriptor, operands, zone); 2330 descriptor, operands, zone);
2310 return res; 2331 return res;
2311 } 2332 }
2312 2333
2313 virtual int OperandCount() V8_FINAL V8_OVERRIDE { return values_.length(); } 2334 virtual int OperandCount() const V8_FINAL V8_OVERRIDE {
2335 return values_.length();
2336 }
2314 virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE { 2337 virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE {
2315 return values_[index]; 2338 return values_[index];
2316 } 2339 }
2317 2340
2318 virtual Representation RequiredInputRepresentation( 2341 virtual Representation RequiredInputRepresentation(
2319 int index) V8_FINAL V8_OVERRIDE { 2342 int index) V8_FINAL V8_OVERRIDE {
2320 if (index == 0) { 2343 if (index == 0) {
2321 return Representation::Tagged(); 2344 return Representation::Tagged();
2322 } else { 2345 } else {
2323 int par_index = index - 1; 2346 int par_index = index - 1;
(...skipping 17 matching lines...) Expand all
2341 } 2364 }
2342 2365
2343 const CallInterfaceDescriptor* descriptor() const { 2366 const CallInterfaceDescriptor* descriptor() const {
2344 return descriptor_; 2367 return descriptor_;
2345 } 2368 }
2346 2369
2347 HValue* target() { 2370 HValue* target() {
2348 return OperandAt(0); 2371 return OperandAt(0);
2349 } 2372 }
2350 2373
2351 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2374 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
2352 2375
2353 private: 2376 private:
2354 // The argument count includes the receiver. 2377 // The argument count includes the receiver.
2355 HCallWithDescriptor(HValue* target, 2378 HCallWithDescriptor(HValue* target,
2356 int argument_count, 2379 int argument_count,
2357 const CallInterfaceDescriptor* descriptor, 2380 const CallInterfaceDescriptor* descriptor,
2358 const Vector<HValue*>& operands, 2381 const Vector<HValue*>& operands,
2359 Zone* zone) 2382 Zone* zone)
2360 : descriptor_(descriptor), 2383 : descriptor_(descriptor),
2361 values_(descriptor->environment_length() + 1, zone) { 2384 values_(descriptor->environment_length() + 1, zone) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2476 class HCallNewArray V8_FINAL : public HBinaryCall { 2499 class HCallNewArray V8_FINAL : public HBinaryCall {
2477 public: 2500 public:
2478 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallNewArray, 2501 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallNewArray,
2479 HValue*, 2502 HValue*,
2480 int, 2503 int,
2481 ElementsKind); 2504 ElementsKind);
2482 2505
2483 HValue* context() { return first(); } 2506 HValue* context() { return first(); }
2484 HValue* constructor() { return second(); } 2507 HValue* constructor() { return second(); }
2485 2508
2486 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2509 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
2487 2510
2488 ElementsKind elements_kind() const { return elements_kind_; } 2511 ElementsKind elements_kind() const { return elements_kind_; }
2489 2512
2490 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) 2513 DECLARE_CONCRETE_INSTRUCTION(CallNewArray)
2491 2514
2492 private: 2515 private:
2493 HCallNewArray(HValue* context, HValue* constructor, int argument_count, 2516 HCallNewArray(HValue* context, HValue* constructor, int argument_count,
2494 ElementsKind elements_kind) 2517 ElementsKind elements_kind)
2495 : HBinaryCall(context, constructor, argument_count), 2518 : HBinaryCall(context, constructor, argument_count),
2496 elements_kind_(elements_kind) {} 2519 elements_kind_(elements_kind) {}
2497 2520
2498 ElementsKind elements_kind_; 2521 ElementsKind elements_kind_;
2499 }; 2522 };
2500 2523
2501 2524
2502 class HCallRuntime V8_FINAL : public HCall<1> { 2525 class HCallRuntime V8_FINAL : public HCall<1> {
2503 public: 2526 public:
2504 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallRuntime, 2527 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCallRuntime,
2505 Handle<String>, 2528 Handle<String>,
2506 const Runtime::Function*, 2529 const Runtime::Function*,
2507 int); 2530 int);
2508 2531
2509 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2532 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
2510 2533
2511 HValue* context() { return OperandAt(0); } 2534 HValue* context() { return OperandAt(0); }
2512 const Runtime::Function* function() const { return c_function_; } 2535 const Runtime::Function* function() const { return c_function_; }
2513 Handle<String> name() const { return name_; } 2536 Handle<String> name() const { return name_; }
2514 SaveFPRegsMode save_doubles() const { return save_doubles_; } 2537 SaveFPRegsMode save_doubles() const { return save_doubles_; }
2515 void set_save_doubles(SaveFPRegsMode save_doubles) { 2538 void set_save_doubles(SaveFPRegsMode save_doubles) {
2516 save_doubles_ = save_doubles; 2539 save_doubles_ = save_doubles;
2517 } 2540 }
2518 2541
2519 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2542 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2563 }; 2586 };
2564 2587
2565 2588
2566 class HUnaryMathOperation V8_FINAL : public HTemplateInstruction<2> { 2589 class HUnaryMathOperation V8_FINAL : public HTemplateInstruction<2> {
2567 public: 2590 public:
2568 static HInstruction* New(Zone* zone, 2591 static HInstruction* New(Zone* zone,
2569 HValue* context, 2592 HValue* context,
2570 HValue* value, 2593 HValue* value,
2571 BuiltinFunctionId op); 2594 BuiltinFunctionId op);
2572 2595
2573 HValue* context() { return OperandAt(0); } 2596 HValue* context() const { return OperandAt(0); }
2574 HValue* value() { return OperandAt(1); } 2597 HValue* value() const { return OperandAt(1); }
2575 2598
2576 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2599 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
2577 2600
2578 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2601 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2579 if (index == 0) { 2602 if (index == 0) {
2580 return Representation::Tagged(); 2603 return Representation::Tagged();
2581 } else { 2604 } else {
2582 switch (op_) { 2605 switch (op_) {
2583 case kMathFloor: 2606 case kMathFloor:
2584 case kMathRound: 2607 case kMathRound:
2585 case kMathSqrt: 2608 case kMathSqrt:
2586 case kMathPowHalf: 2609 case kMathPowHalf:
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2734 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 2757 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; }
2735 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2758 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2736 return Representation::Tagged(); 2759 return Representation::Tagged();
2737 } 2760 }
2738 2761
2739 virtual HType CalculateInferredType() V8_OVERRIDE { 2762 virtual HType CalculateInferredType() V8_OVERRIDE {
2740 if (value()->type().IsHeapObject()) return value()->type(); 2763 if (value()->type().IsHeapObject()) return value()->type();
2741 return HType::HeapObject(); 2764 return HType::HeapObject();
2742 } 2765 }
2743 2766
2744 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2767 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
2745 2768
2746 HValue* value() const { return OperandAt(0); } 2769 HValue* value() const { return OperandAt(0); }
2747 HValue* typecheck() const { return OperandAt(1); } 2770 HValue* typecheck() const { return OperandAt(1); }
2748 2771
2749 const UniqueSet<Map>* maps() const { return maps_; } 2772 const UniqueSet<Map>* maps() const { return maps_; }
2750 void set_maps(const UniqueSet<Map>* maps) { maps_ = maps; } 2773 void set_maps(const UniqueSet<Map>* maps) { maps_ = maps; }
2751 2774
2752 bool maps_are_stable() const { return maps_are_stable_; } 2775 bool maps_are_stable() const { return maps_are_stable_; }
2753 2776
2754 bool HasMigrationTarget() const { return has_migration_target_; } 2777 bool HasMigrationTarget() const { return has_migration_target_; }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
2842 return new(zone) HCheckValue(value, target, object_in_new_space); 2865 return new(zone) HCheckValue(value, target, object_in_new_space);
2843 } 2866 }
2844 2867
2845 virtual void FinalizeUniqueness() V8_OVERRIDE { 2868 virtual void FinalizeUniqueness() V8_OVERRIDE {
2846 object_ = Unique<HeapObject>(object_.handle()); 2869 object_ = Unique<HeapObject>(object_.handle());
2847 } 2870 }
2848 2871
2849 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2872 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2850 return Representation::Tagged(); 2873 return Representation::Tagged();
2851 } 2874 }
2852 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2875 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
2853 2876
2854 virtual HValue* Canonicalize() V8_OVERRIDE; 2877 virtual HValue* Canonicalize() V8_OVERRIDE;
2855 2878
2856 #ifdef DEBUG 2879 #ifdef DEBUG
2857 virtual void Verify() V8_OVERRIDE; 2880 virtual void Verify() V8_OVERRIDE;
2858 #endif 2881 #endif
2859 2882
2860 Unique<HeapObject> object() const { return object_; } 2883 Unique<HeapObject> object() const { return object_; }
2861 bool object_in_new_space() const { return object_in_new_space_; } 2884 bool object_in_new_space() const { return object_in_new_space_; }
2862 2885
(...skipping 25 matching lines...) Expand all
2888 enum Check { 2911 enum Check {
2889 IS_SPEC_OBJECT, 2912 IS_SPEC_OBJECT,
2890 IS_JS_ARRAY, 2913 IS_JS_ARRAY,
2891 IS_STRING, 2914 IS_STRING,
2892 IS_INTERNALIZED_STRING, 2915 IS_INTERNALIZED_STRING,
2893 LAST_INTERVAL_CHECK = IS_JS_ARRAY 2916 LAST_INTERVAL_CHECK = IS_JS_ARRAY
2894 }; 2917 };
2895 2918
2896 DECLARE_INSTRUCTION_FACTORY_P2(HCheckInstanceType, HValue*, Check); 2919 DECLARE_INSTRUCTION_FACTORY_P2(HCheckInstanceType, HValue*, Check);
2897 2920
2898 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2921 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
2899 2922
2900 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2923 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2901 return Representation::Tagged(); 2924 return Representation::Tagged();
2902 } 2925 }
2903 2926
2904 virtual HType CalculateInferredType() V8_OVERRIDE { 2927 virtual HType CalculateInferredType() V8_OVERRIDE {
2905 switch (check_) { 2928 switch (check_) {
2906 case IS_SPEC_OBJECT: return HType::JSObject(); 2929 case IS_SPEC_OBJECT: return HType::JSObject();
2907 case IS_JS_ARRAY: return HType::JSArray(); 2930 case IS_JS_ARRAY: return HType::JSArray();
2908 case IS_STRING: return HType::String(); 2931 case IS_STRING: return HType::String();
(...skipping 18 matching lines...) Expand all
2927 // type checks if we have already performed an instance type check 2950 // type checks if we have already performed an instance type check
2928 // with a larger range. 2951 // with a larger range.
2929 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 2952 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
2930 HCheckInstanceType* b = HCheckInstanceType::cast(other); 2953 HCheckInstanceType* b = HCheckInstanceType::cast(other);
2931 return check_ == b->check_; 2954 return check_ == b->check_;
2932 } 2955 }
2933 2956
2934 virtual int RedefinedOperandIndex() { return 0; } 2957 virtual int RedefinedOperandIndex() { return 0; }
2935 2958
2936 private: 2959 private:
2937 const char* GetCheckName(); 2960 const char* GetCheckName() const;
2938 2961
2939 HCheckInstanceType(HValue* value, Check check) 2962 HCheckInstanceType(HValue* value, Check check)
2940 : HUnaryOperation(value, HType::HeapObject()), check_(check) { 2963 : HUnaryOperation(value, HType::HeapObject()), check_(check) {
2941 set_representation(Representation::Tagged()); 2964 set_representation(Representation::Tagged());
2942 SetFlag(kUseGVN); 2965 SetFlag(kUseGVN);
2943 } 2966 }
2944 2967
2945 const Check check_; 2968 const Check check_;
2946 }; 2969 };
2947 2970
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
3252 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 3275 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
3253 virtual void InferRepresentation( 3276 virtual void InferRepresentation(
3254 HInferRepresentationPhase* h_infer) V8_OVERRIDE; 3277 HInferRepresentationPhase* h_infer) V8_OVERRIDE;
3255 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3278 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
3256 return representation(); 3279 return representation();
3257 } 3280 }
3258 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { 3281 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE {
3259 return representation(); 3282 return representation();
3260 } 3283 }
3261 virtual HType CalculateInferredType() V8_OVERRIDE; 3284 virtual HType CalculateInferredType() V8_OVERRIDE;
3262 virtual int OperandCount() V8_OVERRIDE { return inputs_.length(); } 3285 virtual int OperandCount() const V8_OVERRIDE { return inputs_.length(); }
3263 virtual HValue* OperandAt(int index) const V8_OVERRIDE { 3286 virtual HValue* OperandAt(int index) const V8_OVERRIDE {
3264 return inputs_[index]; 3287 return inputs_[index];
3265 } 3288 }
3266 HValue* GetRedundantReplacement(); 3289 HValue* GetRedundantReplacement();
3267 void AddInput(HValue* value); 3290 void AddInput(HValue* value);
3268 bool HasRealUses(); 3291 bool HasRealUses();
3269 3292
3270 bool IsReceiver() const { return merged_index_ == 0; } 3293 bool IsReceiver() const { return merged_index_ == 0; }
3271 bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; } 3294 bool HasMergedIndex() const { return merged_index_ != kInvalidMergedIndex; }
3272 3295
3273 virtual HSourcePosition position() const V8_OVERRIDE; 3296 virtual HSourcePosition position() const V8_OVERRIDE;
3274 3297
3275 int merged_index() const { return merged_index_; } 3298 int merged_index() const { return merged_index_; }
3276 3299
3277 InductionVariableData* induction_variable_data() { 3300 InductionVariableData* induction_variable_data() {
3278 return induction_variable_data_; 3301 return induction_variable_data_;
3279 } 3302 }
3280 bool IsInductionVariable() { 3303 bool IsInductionVariable() {
3281 return induction_variable_data_ != NULL; 3304 return induction_variable_data_ != NULL;
3282 } 3305 }
3283 bool IsLimitedInductionVariable() { 3306 bool IsLimitedInductionVariable() {
3284 return IsInductionVariable() && 3307 return IsInductionVariable() &&
3285 induction_variable_data_->limit() != NULL; 3308 induction_variable_data_->limit() != NULL;
3286 } 3309 }
3287 void DetectInductionVariable() { 3310 void DetectInductionVariable() {
3288 ASSERT(induction_variable_data_ == NULL); 3311 ASSERT(induction_variable_data_ == NULL);
3289 induction_variable_data_ = InductionVariableData::ExaminePhi(this); 3312 induction_variable_data_ = InductionVariableData::ExaminePhi(this);
3290 } 3313 }
3291 3314
3292 virtual void PrintTo(StringStream* stream) V8_OVERRIDE; 3315 virtual OStream& PrintTo(OStream& os) const V8_OVERRIDE; // NOLINT
3293 3316
3294 #ifdef DEBUG 3317 #ifdef DEBUG
3295 virtual void Verify() V8_OVERRIDE; 3318 virtual void Verify() V8_OVERRIDE;
3296 #endif 3319 #endif
3297 3320
3298 void InitRealUses(int id); 3321 void InitRealUses(int id);
3299 void AddNonPhiUsesFrom(HPhi* other); 3322 void AddNonPhiUsesFrom(HPhi* other);
3300 void AddIndirectUsesTo(int* use_count); 3323 void AddIndirectUsesTo(int* use_count);
3301 3324
3302 int tagged_non_phi_uses() const { 3325 int tagged_non_phi_uses() const {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
3354 // TODO(titzer): we can't eliminate the receiver for generating backtraces 3377 // TODO(titzer): we can't eliminate the receiver for generating backtraces
3355 virtual bool IsDeletable() const V8_OVERRIDE { return !IsReceiver(); } 3378 virtual bool IsDeletable() const V8_OVERRIDE { return !IsReceiver(); }
3356 }; 3379 };
3357 3380
3358 3381
3359 // Common base class for HArgumentsObject and HCapturedObject. 3382 // Common base class for HArgumentsObject and HCapturedObject.
3360 class HDematerializedObject : public HInstruction { 3383 class HDematerializedObject : public HInstruction {
3361 public: 3384 public:
3362 HDematerializedObject(int count, Zone* zone) : values_(count, zone) {} 3385 HDematerializedObject(int count, Zone* zone) : values_(count, zone) {}
3363 3386
3364 virtual int OperandCount() V8_FINAL V8_OVERRIDE { return values_.length(); } 3387 virtual int OperandCount() const V8_FINAL V8_OVERRIDE {
3388 return values_.length();
3389 }
3365 virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE { 3390 virtual HValue* OperandAt(int index) const V8_FINAL V8_OVERRIDE {
3366 return values_[index]; 3391 return values_[index];
3367 } 3392 }
3368 3393
3369 virtual bool HasEscapingOperandAt(int index) V8_FINAL V8_OVERRIDE { 3394 virtual bool HasEscapingOperandAt(int index) V8_FINAL V8_OVERRIDE {
3370 return false; 3395 return false;
3371 } 3396 }
3372 virtual Representation RequiredInputRepresentation( 3397 virtual Representation RequiredInputRepresentation(
3373 int index) V8_FINAL V8_OVERRIDE { 3398 int index) V8_FINAL V8_OVERRIDE {
3374 return Representation::None(); 3399 return Representation::None();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
3432 3457
3433 void ReuseSideEffectsFromStore(HInstruction* store) { 3458 void ReuseSideEffectsFromStore(HInstruction* store) {
3434 ASSERT(store->HasObservableSideEffects()); 3459 ASSERT(store->HasObservableSideEffects());
3435 ASSERT(store->IsStoreNamedField()); 3460 ASSERT(store->IsStoreNamedField());
3436 changes_flags_.Add(store->ChangesFlags()); 3461 changes_flags_.Add(store->ChangesFlags());
3437 } 3462 }
3438 3463
3439 // Replay effects of this instruction on the given environment. 3464 // Replay effects of this instruction on the given environment.
3440 void ReplayEnvironment(HEnvironment* env); 3465 void ReplayEnvironment(HEnvironment* env);
3441 3466
3442 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 3467 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
3443 3468
3444 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) 3469 DECLARE_CONCRETE_INSTRUCTION(CapturedObject)
3445 3470
3446 private: 3471 private:
3447 int capture_id_; 3472 int capture_id_;
3448 3473
3449 // Note that we cannot DCE captured objects as they are used to replay 3474 // Note that we cannot DCE captured objects as they are used to replay
3450 // the environment. This method is here as an explicit reminder. 3475 // the environment. This method is here as an explicit reminder.
3451 // TODO(mstarzinger): Turn HSimulates into full snapshots maybe? 3476 // TODO(mstarzinger): Turn HSimulates into full snapshots maybe?
3452 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return false; } 3477 virtual bool IsDeletable() const V8_FINAL V8_OVERRIDE { return false; }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
3538 3563
3539 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { 3564 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE {
3540 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi(); 3565 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi();
3541 if (HasInteger32Value()) return Representation::Integer32(); 3566 if (HasInteger32Value()) return Representation::Integer32();
3542 if (HasNumberValue()) return Representation::Double(); 3567 if (HasNumberValue()) return Representation::Double();
3543 if (HasExternalReferenceValue()) return Representation::External(); 3568 if (HasExternalReferenceValue()) return Representation::External();
3544 return Representation::Tagged(); 3569 return Representation::Tagged();
3545 } 3570 }
3546 3571
3547 virtual bool EmitAtUses() V8_OVERRIDE; 3572 virtual bool EmitAtUses() V8_OVERRIDE;
3548 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 3573 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
3549 HConstant* CopyToRepresentation(Representation r, Zone* zone) const; 3574 HConstant* CopyToRepresentation(Representation r, Zone* zone) const;
3550 Maybe<HConstant*> CopyToTruncatedInt32(Zone* zone); 3575 Maybe<HConstant*> CopyToTruncatedInt32(Zone* zone);
3551 Maybe<HConstant*> CopyToTruncatedNumber(Zone* zone); 3576 Maybe<HConstant*> CopyToTruncatedNumber(Zone* zone);
3552 bool HasInteger32Value() const { return has_int32_value_; } 3577 bool HasInteger32Value() const { return has_int32_value_; }
3553 int32_t Integer32Value() const { 3578 int32_t Integer32Value() const {
3554 ASSERT(HasInteger32Value()); 3579 ASSERT(HasInteger32Value());
3555 return int32_value_; 3580 return int32_value_;
3556 } 3581 }
3557 bool HasSmiValue() const { return has_smi_value_; } 3582 bool HasSmiValue() const { return has_smi_value_; }
3558 bool HasDoubleValue() const { return has_double_value_; } 3583 bool HasDoubleValue() const { return has_double_value_; }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
3800 } 3825 }
3801 3826
3802 virtual void InferRepresentation( 3827 virtual void InferRepresentation(
3803 HInferRepresentationPhase* h_infer) V8_OVERRIDE; 3828 HInferRepresentationPhase* h_infer) V8_OVERRIDE;
3804 virtual Representation RepresentationFromInputs() V8_OVERRIDE; 3829 virtual Representation RepresentationFromInputs() V8_OVERRIDE;
3805 Representation RepresentationFromOutput(); 3830 Representation RepresentationFromOutput();
3806 virtual void AssumeRepresentation(Representation r) V8_OVERRIDE; 3831 virtual void AssumeRepresentation(Representation r) V8_OVERRIDE;
3807 3832
3808 virtual bool IsCommutative() const { return false; } 3833 virtual bool IsCommutative() const { return false; }
3809 3834
3810 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 3835 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
3811 3836
3812 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3837 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
3813 if (index == 0) return Representation::Tagged(); 3838 if (index == 0) return Representation::Tagged();
3814 return representation(); 3839 return representation();
3815 } 3840 }
3816 3841
3817 void SetOperandPositions(Zone* zone, 3842 void SetOperandPositions(Zone* zone,
3818 HSourcePosition left_pos, 3843 HSourcePosition left_pos,
3819 HSourcePosition right_pos) { 3844 HSourcePosition right_pos) {
3820 set_operand_position(zone, 1, left_pos); 3845 set_operand_position(zone, 1, left_pos);
(...skipping 19 matching lines...) Expand all
3840 class HWrapReceiver V8_FINAL : public HTemplateInstruction<2> { 3865 class HWrapReceiver V8_FINAL : public HTemplateInstruction<2> {
3841 public: 3866 public:
3842 DECLARE_INSTRUCTION_FACTORY_P2(HWrapReceiver, HValue*, HValue*); 3867 DECLARE_INSTRUCTION_FACTORY_P2(HWrapReceiver, HValue*, HValue*);
3843 3868
3844 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 3869 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
3845 3870
3846 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3871 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
3847 return Representation::Tagged(); 3872 return Representation::Tagged();
3848 } 3873 }
3849 3874
3850 HValue* receiver() { return OperandAt(0); } 3875 HValue* receiver() const { return OperandAt(0); }
3851 HValue* function() { return OperandAt(1); } 3876 HValue* function() const { return OperandAt(1); }
3852 3877
3853 virtual HValue* Canonicalize() V8_OVERRIDE; 3878 virtual HValue* Canonicalize() V8_OVERRIDE;
3854 3879
3855 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 3880 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
3856 bool known_function() const { return known_function_; } 3881 bool known_function() const { return known_function_; }
3857 3882
3858 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver) 3883 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver)
3859 3884
3860 private: 3885 private:
3861 HWrapReceiver(HValue* receiver, HValue* function) { 3886 HWrapReceiver(HValue* receiver, HValue* function) {
3862 known_function_ = function->IsConstant() && 3887 known_function_ = function->IsConstant() &&
3863 HConstant::cast(function)->handle(function->isolate())->IsJSFunction(); 3888 HConstant::cast(function)->handle(function->isolate())->IsJSFunction();
3864 set_representation(Representation::Tagged()); 3889 set_representation(Representation::Tagged());
3865 SetOperandAt(0, receiver); 3890 SetOperandAt(0, receiver);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
3954 } 3979 }
3955 3980
3956 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 3981 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
3957 }; 3982 };
3958 3983
3959 3984
3960 class HAccessArgumentsAt V8_FINAL : public HTemplateInstruction<3> { 3985 class HAccessArgumentsAt V8_FINAL : public HTemplateInstruction<3> {
3961 public: 3986 public:
3962 DECLARE_INSTRUCTION_FACTORY_P3(HAccessArgumentsAt, HValue*, HValue*, HValue*); 3987 DECLARE_INSTRUCTION_FACTORY_P3(HAccessArgumentsAt, HValue*, HValue*, HValue*);
3963 3988
3964 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 3989 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
3965 3990
3966 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3991 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
3967 // The arguments elements is considered tagged. 3992 // The arguments elements is considered tagged.
3968 return index == 0 3993 return index == 0
3969 ? Representation::Tagged() 3994 ? Representation::Tagged()
3970 : Representation::Integer32(); 3995 : Representation::Integer32();
3971 } 3996 }
3972 3997
3973 HValue* arguments() { return OperandAt(0); } 3998 HValue* arguments() const { return OperandAt(0); }
3974 HValue* length() { return OperandAt(1); } 3999 HValue* length() const { return OperandAt(1); }
3975 HValue* index() { return OperandAt(2); } 4000 HValue* index() const { return OperandAt(2); }
3976 4001
3977 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt) 4002 DECLARE_CONCRETE_INSTRUCTION(AccessArgumentsAt)
3978 4003
3979 private: 4004 private:
3980 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { 4005 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) {
3981 set_representation(Representation::Tagged()); 4006 set_representation(Representation::Tagged());
3982 SetFlag(kUseGVN); 4007 SetFlag(kUseGVN);
3983 SetOperandAt(0, arguments); 4008 SetOperandAt(0, arguments);
3984 SetOperandAt(1, length); 4009 SetOperandAt(1, length);
3985 SetOperandAt(2, index); 4010 SetOperandAt(2, index);
3986 } 4011 }
3987 4012
3988 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4013 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
3989 }; 4014 };
3990 4015
3991 4016
3992 class HBoundsCheckBaseIndexInformation; 4017 class HBoundsCheckBaseIndexInformation;
3993 4018
3994 4019
3995 class HBoundsCheck V8_FINAL : public HTemplateInstruction<2> { 4020 class HBoundsCheck V8_FINAL : public HTemplateInstruction<2> {
3996 public: 4021 public:
3997 DECLARE_INSTRUCTION_FACTORY_P2(HBoundsCheck, HValue*, HValue*); 4022 DECLARE_INSTRUCTION_FACTORY_P2(HBoundsCheck, HValue*, HValue*);
3998 4023
3999 bool skip_check() const { return skip_check_; } 4024 bool skip_check() const { return skip_check_; }
4000 void set_skip_check() { skip_check_ = true; } 4025 void set_skip_check() { skip_check_ = true; }
4001 4026
4002 HValue* base() { return base_; } 4027 HValue* base() const { return base_; }
4003 int offset() { return offset_; } 4028 int offset() const { return offset_; }
4004 int scale() { return scale_; } 4029 int scale() const { return scale_; }
4005 4030
4006 void ApplyIndexChange(); 4031 void ApplyIndexChange();
4007 bool DetectCompoundIndex() { 4032 bool DetectCompoundIndex() {
4008 ASSERT(base() == NULL); 4033 ASSERT(base() == NULL);
4009 4034
4010 DecompositionResult decomposition; 4035 DecompositionResult decomposition;
4011 if (index()->TryDecompose(&decomposition)) { 4036 if (index()->TryDecompose(&decomposition)) {
4012 base_ = decomposition.base(); 4037 base_ = decomposition.base();
4013 offset_ = decomposition.offset(); 4038 offset_ = decomposition.offset();
4014 scale_ = decomposition.scale(); 4039 scale_ = decomposition.scale();
4015 return true; 4040 return true;
4016 } else { 4041 } else {
4017 base_ = index(); 4042 base_ = index();
4018 offset_ = 0; 4043 offset_ = 0;
4019 scale_ = 0; 4044 scale_ = 0;
4020 return false; 4045 return false;
4021 } 4046 }
4022 } 4047 }
4023 4048
4024 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4049 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4025 return representation(); 4050 return representation();
4026 } 4051 }
4027 4052
4028 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4053 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
4029 virtual void InferRepresentation( 4054 virtual void InferRepresentation(
4030 HInferRepresentationPhase* h_infer) V8_OVERRIDE; 4055 HInferRepresentationPhase* h_infer) V8_OVERRIDE;
4031 4056
4032 HValue* index() { return OperandAt(0); } 4057 HValue* index() const { return OperandAt(0); }
4033 HValue* length() { return OperandAt(1); } 4058 HValue* length() const { return OperandAt(1); }
4034 bool allow_equality() { return allow_equality_; } 4059 bool allow_equality() const { return allow_equality_; }
4035 void set_allow_equality(bool v) { allow_equality_ = v; } 4060 void set_allow_equality(bool v) { allow_equality_ = v; }
4036 4061
4037 virtual int RedefinedOperandIndex() V8_OVERRIDE { return 0; } 4062 virtual int RedefinedOperandIndex() V8_OVERRIDE { return 0; }
4038 virtual bool IsPurelyInformativeDefinition() V8_OVERRIDE { 4063 virtual bool IsPurelyInformativeDefinition() V8_OVERRIDE {
4039 return skip_check(); 4064 return skip_check();
4040 } 4065 }
4041 4066
4042 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck) 4067 DECLARE_CONCRETE_INSTRUCTION(BoundsCheck)
4043 4068
4044 protected: 4069 protected:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
4080 explicit HBoundsCheckBaseIndexInformation(HBoundsCheck* check) { 4105 explicit HBoundsCheckBaseIndexInformation(HBoundsCheck* check) {
4081 DecompositionResult decomposition; 4106 DecompositionResult decomposition;
4082 if (check->index()->TryDecompose(&decomposition)) { 4107 if (check->index()->TryDecompose(&decomposition)) {
4083 SetOperandAt(0, decomposition.base()); 4108 SetOperandAt(0, decomposition.base());
4084 SetOperandAt(1, check); 4109 SetOperandAt(1, check);
4085 } else { 4110 } else {
4086 UNREACHABLE(); 4111 UNREACHABLE();
4087 } 4112 }
4088 } 4113 }
4089 4114
4090 HValue* base_index() { return OperandAt(0); } 4115 HValue* base_index() const { return OperandAt(0); }
4091 HBoundsCheck* bounds_check() { return HBoundsCheck::cast(OperandAt(1)); } 4116 HBoundsCheck* bounds_check() { return HBoundsCheck::cast(OperandAt(1)); }
4092 4117
4093 DECLARE_CONCRETE_INSTRUCTION(BoundsCheckBaseIndexInformation) 4118 DECLARE_CONCRETE_INSTRUCTION(BoundsCheckBaseIndexInformation)
4094 4119
4095 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4120 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4096 return representation(); 4121 return representation();
4097 } 4122 }
4098 4123
4099 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4124 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
4100 4125
4101 virtual int RedefinedOperandIndex() V8_OVERRIDE { return 0; } 4126 virtual int RedefinedOperandIndex() V8_OVERRIDE { return 0; }
4102 virtual bool IsPurelyInformativeDefinition() V8_OVERRIDE { return true; } 4127 virtual bool IsPurelyInformativeDefinition() V8_OVERRIDE { return true; }
4103 }; 4128 };
4104 4129
4105 4130
4106 class HBitwiseBinaryOperation : public HBinaryOperation { 4131 class HBitwiseBinaryOperation : public HBinaryOperation {
4107 public: 4132 public:
4108 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, 4133 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right,
4109 HType type = HType::TaggedNumber()) 4134 HType type = HType::TaggedNumber())
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
4215 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGeneric, HValue*, 4240 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HCompareGeneric, HValue*,
4216 HValue*, Token::Value); 4241 HValue*, Token::Value);
4217 4242
4218 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4243 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4219 return index == 0 4244 return index == 0
4220 ? Representation::Tagged() 4245 ? Representation::Tagged()
4221 : representation(); 4246 : representation();
4222 } 4247 }
4223 4248
4224 Token::Value token() const { return token_; } 4249 Token::Value token() const { return token_; }
4225 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4250 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
4226 4251
4227 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) 4252 DECLARE_CONCRETE_INSTRUCTION(CompareGeneric)
4228 4253
4229 private: 4254 private:
4230 HCompareGeneric(HValue* context, 4255 HCompareGeneric(HValue* context,
4231 HValue* left, 4256 HValue* left,
4232 HValue* right, 4257 HValue* right,
4233 Token::Value token) 4258 Token::Value token)
4234 : HBinaryOperation(context, left, right, HType::Boolean()), 4259 : HBinaryOperation(context, left, right, HType::Boolean()),
4235 token_(token) { 4260 token_(token) {
4236 ASSERT(Token::IsCompareOp(token)); 4261 ASSERT(Token::IsCompareOp(token));
4237 set_representation(Representation::Tagged()); 4262 set_representation(Representation::Tagged());
4238 SetAllSideEffects(); 4263 SetAllSideEffects();
4239 } 4264 }
4240 4265
4241 Token::Value token_; 4266 Token::Value token_;
4242 }; 4267 };
4243 4268
4244 4269
4245 class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> { 4270 class HCompareNumericAndBranch : public HTemplateControlInstruction<2, 2> {
4246 public: 4271 public:
4247 DECLARE_INSTRUCTION_FACTORY_P3(HCompareNumericAndBranch, 4272 DECLARE_INSTRUCTION_FACTORY_P3(HCompareNumericAndBranch,
4248 HValue*, HValue*, Token::Value); 4273 HValue*, HValue*, Token::Value);
4249 DECLARE_INSTRUCTION_FACTORY_P5(HCompareNumericAndBranch, 4274 DECLARE_INSTRUCTION_FACTORY_P5(HCompareNumericAndBranch,
4250 HValue*, HValue*, Token::Value, 4275 HValue*, HValue*, Token::Value,
4251 HBasicBlock*, HBasicBlock*); 4276 HBasicBlock*, HBasicBlock*);
4252 4277
4253 HValue* left() { return OperandAt(0); } 4278 HValue* left() const { return OperandAt(0); }
4254 HValue* right() { return OperandAt(1); } 4279 HValue* right() const { return OperandAt(1); }
4255 Token::Value token() const { return token_; } 4280 Token::Value token() const { return token_; }
4256 4281
4257 void set_observed_input_representation(Representation left, 4282 void set_observed_input_representation(Representation left,
4258 Representation right) { 4283 Representation right) {
4259 observed_input_representation_[0] = left; 4284 observed_input_representation_[0] = left;
4260 observed_input_representation_[1] = right; 4285 observed_input_representation_[1] = right;
4261 } 4286 }
4262 4287
4263 virtual void InferRepresentation( 4288 virtual void InferRepresentation(
4264 HInferRepresentationPhase* h_infer) V8_OVERRIDE; 4289 HInferRepresentationPhase* h_infer) V8_OVERRIDE;
4265 4290
4266 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4291 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4267 return representation(); 4292 return representation();
4268 } 4293 }
4269 virtual Representation observed_input_representation(int index) V8_OVERRIDE { 4294 virtual Representation observed_input_representation(int index) V8_OVERRIDE {
4270 return observed_input_representation_[index]; 4295 return observed_input_representation_[index];
4271 } 4296 }
4272 4297
4273 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 4298 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE;
4274 4299
4275 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4300 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
4276 4301
4277 void SetOperandPositions(Zone* zone, 4302 void SetOperandPositions(Zone* zone,
4278 HSourcePosition left_pos, 4303 HSourcePosition left_pos,
4279 HSourcePosition right_pos) { 4304 HSourcePosition right_pos) {
4280 set_operand_position(zone, 0, left_pos); 4305 set_operand_position(zone, 0, left_pos);
4281 set_operand_position(zone, 1, right_pos); 4306 set_operand_position(zone, 1, right_pos);
4282 } 4307 }
4283 4308
4284 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch) 4309 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch)
4285 4310
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
4358 HBasicBlock*, HBasicBlock*); 4383 HBasicBlock*, HBasicBlock*);
4359 4384
4360 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 4385 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE;
4361 4386
4362 static const int kNoKnownSuccessorIndex = -1; 4387 static const int kNoKnownSuccessorIndex = -1;
4363 int known_successor_index() const { return known_successor_index_; } 4388 int known_successor_index() const { return known_successor_index_; }
4364 void set_known_successor_index(int known_successor_index) { 4389 void set_known_successor_index(int known_successor_index) {
4365 known_successor_index_ = known_successor_index; 4390 known_successor_index_ = known_successor_index;
4366 } 4391 }
4367 4392
4368 HValue* left() { return OperandAt(0); } 4393 HValue* left() const { return OperandAt(0); }
4369 HValue* right() { return OperandAt(1); } 4394 HValue* right() const { return OperandAt(1); }
4370 4395
4371 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4396 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
4372 4397
4373 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4398 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4374 return Representation::Tagged(); 4399 return Representation::Tagged();
4375 } 4400 }
4376 4401
4377 virtual Representation observed_input_representation(int index) V8_OVERRIDE { 4402 virtual Representation observed_input_representation(int index) V8_OVERRIDE {
4378 return Representation::Tagged(); 4403 return Representation::Tagged();
4379 } 4404 }
4380 4405
4381 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) 4406 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch)
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
4505 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HStringCompareAndBranch, 4530 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HStringCompareAndBranch,
4506 HValue*, 4531 HValue*,
4507 HValue*, 4532 HValue*,
4508 Token::Value); 4533 Token::Value);
4509 4534
4510 HValue* context() { return OperandAt(0); } 4535 HValue* context() { return OperandAt(0); }
4511 HValue* left() { return OperandAt(1); } 4536 HValue* left() { return OperandAt(1); }
4512 HValue* right() { return OperandAt(2); } 4537 HValue* right() { return OperandAt(2); }
4513 Token::Value token() const { return token_; } 4538 Token::Value token() const { return token_; }
4514 4539
4515 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4540 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
4516 4541
4517 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4542 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4518 return Representation::Tagged(); 4543 return Representation::Tagged();
4519 } 4544 }
4520 4545
4521 Representation GetInputRepresentation() const { 4546 Representation GetInputRepresentation() const {
4522 return Representation::Tagged(); 4547 return Representation::Tagged();
4523 } 4548 }
4524 4549
4525 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch) 4550 DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4559 class HHasInstanceTypeAndBranch V8_FINAL : public HUnaryControlInstruction { 4584 class HHasInstanceTypeAndBranch V8_FINAL : public HUnaryControlInstruction {
4560 public: 4585 public:
4561 DECLARE_INSTRUCTION_FACTORY_P2( 4586 DECLARE_INSTRUCTION_FACTORY_P2(
4562 HHasInstanceTypeAndBranch, HValue*, InstanceType); 4587 HHasInstanceTypeAndBranch, HValue*, InstanceType);
4563 DECLARE_INSTRUCTION_FACTORY_P3( 4588 DECLARE_INSTRUCTION_FACTORY_P3(
4564 HHasInstanceTypeAndBranch, HValue*, InstanceType, InstanceType); 4589 HHasInstanceTypeAndBranch, HValue*, InstanceType, InstanceType);
4565 4590
4566 InstanceType from() { return from_; } 4591 InstanceType from() { return from_; }
4567 InstanceType to() { return to_; } 4592 InstanceType to() { return to_; }
4568 4593
4569 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4594 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
4570 4595
4571 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4596 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4572 return Representation::Tagged(); 4597 return Representation::Tagged();
4573 } 4598 }
4574 4599
4575 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 4600 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE;
4576 4601
4577 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) 4602 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch)
4578 4603
4579 private: 4604 private:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
4631 public: 4656 public:
4632 DECLARE_INSTRUCTION_FACTORY_P2(HClassOfTestAndBranch, HValue*, 4657 DECLARE_INSTRUCTION_FACTORY_P2(HClassOfTestAndBranch, HValue*,
4633 Handle<String>); 4658 Handle<String>);
4634 4659
4635 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch) 4660 DECLARE_CONCRETE_INSTRUCTION(ClassOfTestAndBranch)
4636 4661
4637 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4662 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4638 return Representation::Tagged(); 4663 return Representation::Tagged();
4639 } 4664 }
4640 4665
4641 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4666 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
4642 4667
4643 Handle<String> class_name() const { return class_name_; } 4668 Handle<String> class_name() const { return class_name_; }
4644 4669
4645 private: 4670 private:
4646 HClassOfTestAndBranch(HValue* value, Handle<String> class_name) 4671 HClassOfTestAndBranch(HValue* value, Handle<String> class_name)
4647 : HUnaryControlInstruction(value, NULL, NULL), 4672 : HUnaryControlInstruction(value, NULL, NULL),
4648 class_name_(class_name) { } 4673 class_name_(class_name) { }
4649 4674
4650 Handle<String> class_name_; 4675 Handle<String> class_name_;
4651 }; 4676 };
4652 4677
4653 4678
4654 class HTypeofIsAndBranch V8_FINAL : public HUnaryControlInstruction { 4679 class HTypeofIsAndBranch V8_FINAL : public HUnaryControlInstruction {
4655 public: 4680 public:
4656 DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>); 4681 DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>);
4657 4682
4658 Handle<String> type_literal() { return type_literal_.handle(); } 4683 Handle<String> type_literal() const { return type_literal_.handle(); }
4659 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4684 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
4660 4685
4661 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) 4686 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch)
4662 4687
4663 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4688 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4664 return Representation::None(); 4689 return Representation::None();
4665 } 4690 }
4666 4691
4667 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 4692 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE;
4668 4693
4669 virtual void FinalizeUniqueness() V8_OVERRIDE { 4694 virtual void FinalizeUniqueness() V8_OVERRIDE {
(...skipping 10 matching lines...) Expand all
4680 4705
4681 4706
4682 class HInstanceOf V8_FINAL : public HBinaryOperation { 4707 class HInstanceOf V8_FINAL : public HBinaryOperation {
4683 public: 4708 public:
4684 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOf, HValue*, HValue*); 4709 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOf, HValue*, HValue*);
4685 4710
4686 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4711 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4687 return Representation::Tagged(); 4712 return Representation::Tagged();
4688 } 4713 }
4689 4714
4690 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4715 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
4691 4716
4692 DECLARE_CONCRETE_INSTRUCTION(InstanceOf) 4717 DECLARE_CONCRETE_INSTRUCTION(InstanceOf)
4693 4718
4694 private: 4719 private:
4695 HInstanceOf(HValue* context, HValue* left, HValue* right) 4720 HInstanceOf(HValue* context, HValue* left, HValue* right)
4696 : HBinaryOperation(context, left, right, HType::Boolean()) { 4721 : HBinaryOperation(context, left, right, HType::Boolean()) {
4697 set_representation(Representation::Tagged()); 4722 set_representation(Representation::Tagged());
4698 SetAllSideEffects(); 4723 SetAllSideEffects();
4699 } 4724 }
4700 }; 4725 };
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
5039 Token::Value op, 5064 Token::Value op,
5040 HValue* left, 5065 HValue* left,
5041 HValue* right); 5066 HValue* right);
5042 5067
5043 Token::Value op() const { return op_; } 5068 Token::Value op() const { return op_; }
5044 5069
5045 virtual bool IsCommutative() const V8_OVERRIDE { return true; } 5070 virtual bool IsCommutative() const V8_OVERRIDE { return true; }
5046 5071
5047 virtual HValue* Canonicalize() V8_OVERRIDE; 5072 virtual HValue* Canonicalize() V8_OVERRIDE;
5048 5073
5049 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5074 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
5050 5075
5051 DECLARE_CONCRETE_INSTRUCTION(Bitwise) 5076 DECLARE_CONCRETE_INSTRUCTION(Bitwise)
5052 5077
5053 protected: 5078 protected:
5054 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 5079 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
5055 return op() == HBitwise::cast(other)->op(); 5080 return op() == HBitwise::cast(other)->op();
5056 } 5081 }
5057 5082
5058 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 5083 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
5059 5084
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
5262 }; 5287 };
5263 5288
5264 DECLARE_INSTRUCTION_FACTORY_P1(HParameter, unsigned); 5289 DECLARE_INSTRUCTION_FACTORY_P1(HParameter, unsigned);
5265 DECLARE_INSTRUCTION_FACTORY_P2(HParameter, unsigned, ParameterKind); 5290 DECLARE_INSTRUCTION_FACTORY_P2(HParameter, unsigned, ParameterKind);
5266 DECLARE_INSTRUCTION_FACTORY_P3(HParameter, unsigned, ParameterKind, 5291 DECLARE_INSTRUCTION_FACTORY_P3(HParameter, unsigned, ParameterKind,
5267 Representation); 5292 Representation);
5268 5293
5269 unsigned index() const { return index_; } 5294 unsigned index() const { return index_; }
5270 ParameterKind kind() const { return kind_; } 5295 ParameterKind kind() const { return kind_; }
5271 5296
5272 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5297 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
5273 5298
5274 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5299 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5275 return Representation::None(); 5300 return Representation::None();
5276 } 5301 }
5277 5302
5278 DECLARE_CONCRETE_INSTRUCTION(Parameter) 5303 DECLARE_CONCRETE_INSTRUCTION(Parameter)
5279 5304
5280 private: 5305 private:
5281 explicit HParameter(unsigned index, 5306 explicit HParameter(unsigned index,
5282 ParameterKind kind = STACK_PARAMETER) 5307 ParameterKind kind = STACK_PARAMETER)
(...skipping 15 matching lines...) Expand all
5298 }; 5323 };
5299 5324
5300 5325
5301 class HCallStub V8_FINAL : public HUnaryCall { 5326 class HCallStub V8_FINAL : public HUnaryCall {
5302 public: 5327 public:
5303 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallStub, CodeStub::Major, int); 5328 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HCallStub, CodeStub::Major, int);
5304 CodeStub::Major major_key() { return major_key_; } 5329 CodeStub::Major major_key() { return major_key_; }
5305 5330
5306 HValue* context() { return value(); } 5331 HValue* context() { return value(); }
5307 5332
5308 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5333 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
5309 5334
5310 DECLARE_CONCRETE_INSTRUCTION(CallStub) 5335 DECLARE_CONCRETE_INSTRUCTION(CallStub)
5311 5336
5312 private: 5337 private:
5313 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) 5338 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count)
5314 : HUnaryCall(context, argument_count), 5339 : HUnaryCall(context, argument_count),
5315 major_key_(major_key) { 5340 major_key_(major_key) {
5316 } 5341 }
5317 5342
5318 CodeStub::Major major_key_; 5343 CodeStub::Major major_key_;
5319 }; 5344 };
5320 5345
5321 5346
5322 class HUnknownOSRValue V8_FINAL : public HTemplateInstruction<0> { 5347 class HUnknownOSRValue V8_FINAL : public HTemplateInstruction<0> {
5323 public: 5348 public:
5324 DECLARE_INSTRUCTION_FACTORY_P2(HUnknownOSRValue, HEnvironment*, int); 5349 DECLARE_INSTRUCTION_FACTORY_P2(HUnknownOSRValue, HEnvironment*, int);
5325 5350
5326 virtual void PrintDataTo(StringStream* stream); 5351 virtual OStream& PrintDataTo(OStream& os) const; // NOLINT
5327 5352
5328 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5353 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5329 return Representation::None(); 5354 return Representation::None();
5330 } 5355 }
5331 5356
5332 void set_incoming_value(HPhi* value) { incoming_value_ = value; } 5357 void set_incoming_value(HPhi* value) { incoming_value_ = value; }
5333 HPhi* incoming_value() { return incoming_value_; } 5358 HPhi* incoming_value() { return incoming_value_; }
5334 HEnvironment *environment() { return environment_; } 5359 HEnvironment *environment() { return environment_; }
5335 int index() { return index_; } 5360 int index() { return index_; }
5336 5361
(...skipping 19 matching lines...) Expand all
5356 5381
5357 5382
5358 class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> { 5383 class HLoadGlobalCell V8_FINAL : public HTemplateInstruction<0> {
5359 public: 5384 public:
5360 DECLARE_INSTRUCTION_FACTORY_P2(HLoadGlobalCell, Handle<Cell>, 5385 DECLARE_INSTRUCTION_FACTORY_P2(HLoadGlobalCell, Handle<Cell>,
5361 PropertyDetails); 5386 PropertyDetails);
5362 5387
5363 Unique<Cell> cell() const { return cell_; } 5388 Unique<Cell> cell() const { return cell_; }
5364 bool RequiresHoleCheck() const; 5389 bool RequiresHoleCheck() const;
5365 5390
5366 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5391 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
5367 5392
5368 virtual intptr_t Hashcode() V8_OVERRIDE { 5393 virtual intptr_t Hashcode() V8_OVERRIDE {
5369 return cell_.Hashcode(); 5394 return cell_.Hashcode();
5370 } 5395 }
5371 5396
5372 virtual void FinalizeUniqueness() V8_OVERRIDE { 5397 virtual void FinalizeUniqueness() V8_OVERRIDE {
5373 cell_ = Unique<Cell>(cell_.handle()); 5398 cell_ = Unique<Cell>(cell_.handle());
5374 } 5399 }
5375 5400
5376 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5401 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
(...skipping 18 matching lines...) Expand all
5395 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); } 5420 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); }
5396 5421
5397 Unique<Cell> cell_; 5422 Unique<Cell> cell_;
5398 PropertyDetails details_; 5423 PropertyDetails details_;
5399 }; 5424 };
5400 5425
5401 5426
5402 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { 5427 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> {
5403 public: 5428 public:
5404 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*, 5429 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalGeneric, HValue*,
5405 Handle<Object>, bool); 5430 Handle<String>, bool);
5406 5431
5407 HValue* context() { return OperandAt(0); } 5432 HValue* context() { return OperandAt(0); }
5408 HValue* global_object() { return OperandAt(1); } 5433 HValue* global_object() { return OperandAt(1); }
5409 Handle<Object> name() const { return name_; } 5434 Handle<String> name() const { return name_; }
5410 bool for_typeof() const { return for_typeof_; } 5435 bool for_typeof() const { return for_typeof_; }
5411 5436
5412 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5437 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
5413 5438
5414 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5439 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5415 return Representation::Tagged(); 5440 return Representation::Tagged();
5416 } 5441 }
5417 5442
5418 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric) 5443 DECLARE_CONCRETE_INSTRUCTION(LoadGlobalGeneric)
5419 5444
5420 private: 5445 private:
5421 HLoadGlobalGeneric(HValue* context, 5446 HLoadGlobalGeneric(HValue* context, HValue* global_object,
5422 HValue* global_object, 5447 Handle<String> name, bool for_typeof)
5423 Handle<Object> name, 5448 : name_(name), for_typeof_(for_typeof) {
5424 bool for_typeof)
5425 : name_(name),
5426 for_typeof_(for_typeof) {
5427 SetOperandAt(0, context); 5449 SetOperandAt(0, context);
5428 SetOperandAt(1, global_object); 5450 SetOperandAt(1, global_object);
5429 set_representation(Representation::Tagged()); 5451 set_representation(Representation::Tagged());
5430 SetAllSideEffects(); 5452 SetAllSideEffects();
5431 } 5453 }
5432 5454
5433 Handle<Object> name_; 5455 Handle<String> name_;
5434 bool for_typeof_; 5456 bool for_typeof_;
5435 }; 5457 };
5436 5458
5437 5459
5438 class HAllocate V8_FINAL : public HTemplateInstruction<2> { 5460 class HAllocate V8_FINAL : public HTemplateInstruction<2> {
5439 public: 5461 public:
5440 static bool CompatibleInstanceTypes(InstanceType type1, 5462 static bool CompatibleInstanceTypes(InstanceType type1,
5441 InstanceType type2) { 5463 InstanceType type2) {
5442 return ComputeFlags(TENURED, type1) == ComputeFlags(TENURED, type2) && 5464 return ComputeFlags(TENURED, type1) == ComputeFlags(TENURED, type2) &&
5443 ComputeFlags(NOT_TENURED, type1) == ComputeFlags(NOT_TENURED, type2); 5465 ComputeFlags(NOT_TENURED, type1) == ComputeFlags(NOT_TENURED, type2);
5444 } 5466 }
5445 5467
5446 static HAllocate* New(Zone* zone, 5468 static HAllocate* New(Zone* zone,
5447 HValue* context, 5469 HValue* context,
5448 HValue* size, 5470 HValue* size,
5449 HType type, 5471 HType type,
5450 PretenureFlag pretenure_flag, 5472 PretenureFlag pretenure_flag,
5451 InstanceType instance_type, 5473 InstanceType instance_type,
5452 Handle<AllocationSite> allocation_site = 5474 Handle<AllocationSite> allocation_site =
5453 Handle<AllocationSite>::null()) { 5475 Handle<AllocationSite>::null()) {
5454 return new(zone) HAllocate(context, size, type, pretenure_flag, 5476 return new(zone) HAllocate(context, size, type, pretenure_flag,
5455 instance_type, allocation_site); 5477 instance_type, allocation_site);
5456 } 5478 }
5457 5479
5458 // Maximum instance size for which allocations will be inlined. 5480 // Maximum instance size for which allocations will be inlined.
5459 static const int kMaxInlineSize = 64 * kPointerSize; 5481 static const int kMaxInlineSize = 64 * kPointerSize;
5460 5482
5461 HValue* context() { return OperandAt(0); } 5483 HValue* context() const { return OperandAt(0); }
5462 HValue* size() { return OperandAt(1); } 5484 HValue* size() const { return OperandAt(1); }
5463 5485
5464 bool has_size_upper_bound() { return size_upper_bound_ != NULL; } 5486 bool has_size_upper_bound() { return size_upper_bound_ != NULL; }
5465 HConstant* size_upper_bound() { return size_upper_bound_; } 5487 HConstant* size_upper_bound() { return size_upper_bound_; }
5466 void set_size_upper_bound(HConstant* value) { 5488 void set_size_upper_bound(HConstant* value) {
5467 ASSERT(size_upper_bound_ == NULL); 5489 ASSERT(size_upper_bound_ == NULL);
5468 size_upper_bound_ = value; 5490 size_upper_bound_ = value;
5469 } 5491 }
5470 5492
5471 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5493 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5472 if (index == 0) { 5494 if (index == 0) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
5512 return (flags_ & CLEAR_NEXT_MAP_WORD) != 0; 5534 return (flags_ & CLEAR_NEXT_MAP_WORD) != 0;
5513 } 5535 }
5514 5536
5515 void MakeDoubleAligned() { 5537 void MakeDoubleAligned() {
5516 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED); 5538 flags_ = static_cast<HAllocate::Flags>(flags_ | ALLOCATE_DOUBLE_ALIGNED);
5517 } 5539 }
5518 5540
5519 virtual bool HandleSideEffectDominator(GVNFlag side_effect, 5541 virtual bool HandleSideEffectDominator(GVNFlag side_effect,
5520 HValue* dominator) V8_OVERRIDE; 5542 HValue* dominator) V8_OVERRIDE;
5521 5543
5522 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5544 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
5523 5545
5524 DECLARE_CONCRETE_INSTRUCTION(Allocate) 5546 DECLARE_CONCRETE_INSTRUCTION(Allocate)
5525 5547
5526 private: 5548 private:
5527 enum Flags { 5549 enum Flags {
5528 ALLOCATE_IN_NEW_SPACE = 1 << 0, 5550 ALLOCATE_IN_NEW_SPACE = 1 << 0,
5529 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, 5551 ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1,
5530 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, 5552 ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2,
5531 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, 5553 ALLOCATE_DOUBLE_ALIGNED = 1 << 3,
5532 PREFILL_WITH_FILLER = 1 << 4, 5554 PREFILL_WITH_FILLER = 1 << 4,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
5652 class HInnerAllocatedObject V8_FINAL : public HTemplateInstruction<2> { 5674 class HInnerAllocatedObject V8_FINAL : public HTemplateInstruction<2> {
5653 public: 5675 public:
5654 static HInnerAllocatedObject* New(Zone* zone, 5676 static HInnerAllocatedObject* New(Zone* zone,
5655 HValue* context, 5677 HValue* context,
5656 HValue* value, 5678 HValue* value,
5657 HValue* offset, 5679 HValue* offset,
5658 HType type) { 5680 HType type) {
5659 return new(zone) HInnerAllocatedObject(value, offset, type); 5681 return new(zone) HInnerAllocatedObject(value, offset, type);
5660 } 5682 }
5661 5683
5662 HValue* base_object() { return OperandAt(0); } 5684 HValue* base_object() const { return OperandAt(0); }
5663 HValue* offset() { return OperandAt(1); } 5685 HValue* offset() const { return OperandAt(1); }
5664 5686
5665 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5687 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5666 return index == 0 ? Representation::Tagged() : Representation::Integer32(); 5688 return index == 0 ? Representation::Tagged() : Representation::Integer32();
5667 } 5689 }
5668 5690
5669 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5691 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
5670 5692
5671 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject) 5693 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject)
5672 5694
5673 private: 5695 private:
5674 HInnerAllocatedObject(HValue* value, 5696 HInnerAllocatedObject(HValue* value,
5675 HValue* offset, 5697 HValue* offset,
5676 HType type) : HTemplateInstruction<2>(type) { 5698 HType type) : HTemplateInstruction<2>(type) {
5677 ASSERT(value->IsAllocate()); 5699 ASSERT(value->IsAllocate());
5678 ASSERT(type.IsHeapObject()); 5700 ASSERT(type.IsHeapObject());
5679 SetOperandAt(0, value); 5701 SetOperandAt(0, value);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
5759 return StoringValueNeedsWriteBarrier(value()); 5781 return StoringValueNeedsWriteBarrier(value());
5760 } 5782 }
5761 5783
5762 virtual void FinalizeUniqueness() V8_OVERRIDE { 5784 virtual void FinalizeUniqueness() V8_OVERRIDE {
5763 cell_ = Unique<PropertyCell>(cell_.handle()); 5785 cell_ = Unique<PropertyCell>(cell_.handle());
5764 } 5786 }
5765 5787
5766 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5788 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5767 return Representation::Tagged(); 5789 return Representation::Tagged();
5768 } 5790 }
5769 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5791 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
5770 5792
5771 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) 5793 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell)
5772 5794
5773 private: 5795 private:
5774 HStoreGlobalCell(HValue* value, 5796 HStoreGlobalCell(HValue* value,
5775 Handle<PropertyCell> cell, 5797 Handle<PropertyCell> cell,
5776 PropertyDetails details) 5798 PropertyDetails details)
5777 : HUnaryOperation(value), 5799 : HUnaryOperation(value),
5778 cell_(Unique<PropertyCell>::CreateUninitialized(cell)), 5800 cell_(Unique<PropertyCell>::CreateUninitialized(cell)),
5779 details_(details) { 5801 details_(details) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5815 } 5837 }
5816 5838
5817 bool RequiresHoleCheck() const { 5839 bool RequiresHoleCheck() const {
5818 return mode_ != kNoCheck; 5840 return mode_ != kNoCheck;
5819 } 5841 }
5820 5842
5821 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5843 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5822 return Representation::Tagged(); 5844 return Representation::Tagged();
5823 } 5845 }
5824 5846
5825 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5847 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
5826 5848
5827 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot) 5849 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot)
5828 5850
5829 protected: 5851 protected:
5830 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 5852 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
5831 HLoadContextSlot* b = HLoadContextSlot::cast(other); 5853 HLoadContextSlot* b = HLoadContextSlot::cast(other);
5832 return (slot_index() == b->slot_index()); 5854 return (slot_index() == b->slot_index());
5833 } 5855 }
5834 5856
5835 private: 5857 private:
(...skipping 15 matching lines...) Expand all
5851 // harmony bindings where we deoptimize into full-codegen generated code 5873 // harmony bindings where we deoptimize into full-codegen generated code
5852 // which will subsequently throw a reference error. 5874 // which will subsequently throw a reference error.
5853 kCheckDeoptimize, 5875 kCheckDeoptimize,
5854 // Check the previous value and ignore assignment if it isn't a hole value 5876 // Check the previous value and ignore assignment if it isn't a hole value
5855 kCheckIgnoreAssignment 5877 kCheckIgnoreAssignment
5856 }; 5878 };
5857 5879
5858 DECLARE_INSTRUCTION_FACTORY_P4(HStoreContextSlot, HValue*, int, 5880 DECLARE_INSTRUCTION_FACTORY_P4(HStoreContextSlot, HValue*, int,
5859 Mode, HValue*); 5881 Mode, HValue*);
5860 5882
5861 HValue* context() { return OperandAt(0); } 5883 HValue* context() const { return OperandAt(0); }
5862 HValue* value() { return OperandAt(1); } 5884 HValue* value() const { return OperandAt(1); }
5863 int slot_index() const { return slot_index_; } 5885 int slot_index() const { return slot_index_; }
5864 Mode mode() const { return mode_; } 5886 Mode mode() const { return mode_; }
5865 5887
5866 bool NeedsWriteBarrier() { 5888 bool NeedsWriteBarrier() {
5867 return StoringValueNeedsWriteBarrier(value()); 5889 return StoringValueNeedsWriteBarrier(value());
5868 } 5890 }
5869 5891
5870 bool DeoptimizesOnHole() { 5892 bool DeoptimizesOnHole() {
5871 return mode_ == kCheckDeoptimize; 5893 return mode_ == kCheckDeoptimize;
5872 } 5894 }
5873 5895
5874 bool RequiresHoleCheck() { 5896 bool RequiresHoleCheck() {
5875 return mode_ != kNoCheck; 5897 return mode_ != kNoCheck;
5876 } 5898 }
5877 5899
5878 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5900 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5879 return Representation::Tagged(); 5901 return Representation::Tagged();
5880 } 5902 }
5881 5903
5882 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5904 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
5883 5905
5884 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) 5906 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot)
5885 5907
5886 private: 5908 private:
5887 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value) 5909 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value)
5888 : slot_index_(slot_index), mode_(mode) { 5910 : slot_index_(slot_index), mode_(mode) {
5889 SetOperandAt(0, context); 5911 SetOperandAt(0, context);
5890 SetOperandAt(1, value); 5912 SetOperandAt(1, value);
5891 SetChangesFlag(kContextSlots); 5913 SetChangesFlag(kContextSlots);
5892 } 5914 }
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
6199 6221
6200 static HObjectAccess ForJSArrayBufferViewByteLength() { 6222 static HObjectAccess ForJSArrayBufferViewByteLength() {
6201 return HObjectAccess::ForObservableJSObjectOffset( 6223 return HObjectAccess::ForObservableJSObjectOffset(
6202 JSArrayBufferView::kByteLengthOffset); 6224 JSArrayBufferView::kByteLengthOffset);
6203 } 6225 }
6204 6226
6205 static HObjectAccess ForGlobalObjectNativeContext() { 6227 static HObjectAccess ForGlobalObjectNativeContext() {
6206 return HObjectAccess(kInobject, GlobalObject::kNativeContextOffset); 6228 return HObjectAccess(kInobject, GlobalObject::kNativeContextOffset);
6207 } 6229 }
6208 6230
6209 void PrintTo(StringStream* stream) const;
6210
6211 inline bool Equals(HObjectAccess that) const { 6231 inline bool Equals(HObjectAccess that) const {
6212 return value_ == that.value_; // portion and offset must match 6232 return value_ == that.value_; // portion and offset must match
6213 } 6233 }
6214 6234
6215 protected: 6235 protected:
6216 void SetGVNFlags(HValue *instr, PropertyAccessType access_type); 6236 void SetGVNFlags(HValue *instr, PropertyAccessType access_type);
6217 6237
6218 private: 6238 private:
6219 // internal use only; different parts of an object or array 6239 // internal use only; different parts of an object or array
6220 enum Portion { 6240 enum Portion {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
6256 class ImmutableField : public BitField<bool, 7, 1> {}; 6276 class ImmutableField : public BitField<bool, 7, 1> {};
6257 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {}; 6277 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {};
6258 class OffsetField : public BitField<int, 9, 23> {}; 6278 class OffsetField : public BitField<int, 9, 23> {};
6259 6279
6260 uint32_t value_; // encodes portion, representation, immutable, and offset 6280 uint32_t value_; // encodes portion, representation, immutable, and offset
6261 Handle<String> name_; 6281 Handle<String> name_;
6262 6282
6263 friend class HLoadNamedField; 6283 friend class HLoadNamedField;
6264 friend class HStoreNamedField; 6284 friend class HStoreNamedField;
6265 friend class SideEffectsTracker; 6285 friend class SideEffectsTracker;
6286 friend OStream& operator<<(OStream& os, const HObjectAccess& access);
6266 6287
6267 inline Portion portion() const { 6288 inline Portion portion() const {
6268 return PortionField::decode(value_); 6289 return PortionField::decode(value_);
6269 } 6290 }
6270 }; 6291 };
6271 6292
6272 6293
6294 OStream& operator<<(OStream& os, const HObjectAccess& access);
6295
6296
6273 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> { 6297 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> {
6274 public: 6298 public:
6275 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, 6299 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*,
6276 HValue*, HObjectAccess); 6300 HValue*, HObjectAccess);
6277 DECLARE_INSTRUCTION_FACTORY_P5(HLoadNamedField, HValue*, HValue*, 6301 DECLARE_INSTRUCTION_FACTORY_P5(HLoadNamedField, HValue*, HValue*,
6278 HObjectAccess, const UniqueSet<Map>*, HType); 6302 HObjectAccess, const UniqueSet<Map>*, HType);
6279 6303
6280 HValue* object() { return OperandAt(0); } 6304 HValue* object() const { return OperandAt(0); }
6281 HValue* dependency() { 6305 HValue* dependency() const {
6282 ASSERT(HasDependency()); 6306 ASSERT(HasDependency());
6283 return OperandAt(1); 6307 return OperandAt(1);
6284 } 6308 }
6285 bool HasDependency() const { return OperandAt(0) != OperandAt(1); } 6309 bool HasDependency() const { return OperandAt(0) != OperandAt(1); }
6286 HObjectAccess access() const { return access_; } 6310 HObjectAccess access() const { return access_; }
6287 Representation field_representation() const { 6311 Representation field_representation() const {
6288 return access_.representation(); 6312 return access_.representation();
6289 } 6313 }
6290 6314
6291 const UniqueSet<Map>* maps() const { return maps_; } 6315 const UniqueSet<Map>* maps() const { return maps_; }
6292 6316
6293 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 6317 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; }
6294 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE { 6318 virtual bool HasOutOfBoundsAccess(int size) V8_OVERRIDE {
6295 return !access().IsInobject() || access().offset() >= size; 6319 return !access().IsInobject() || access().offset() >= size;
6296 } 6320 }
6297 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6321 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6298 if (index == 0 && access().IsExternalMemory()) { 6322 if (index == 0 && access().IsExternalMemory()) {
6299 // object must be external in case of external memory access 6323 // object must be external in case of external memory access
6300 return Representation::External(); 6324 return Representation::External();
6301 } 6325 }
6302 return Representation::Tagged(); 6326 return Representation::Tagged();
6303 } 6327 }
6304 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 6328 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
6305 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6329 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
6306 6330
6307 bool CanBeReplacedWith(HValue* other) const { 6331 bool CanBeReplacedWith(HValue* other) const {
6308 if (!CheckFlag(HValue::kCantBeReplaced)) return false; 6332 if (!CheckFlag(HValue::kCantBeReplaced)) return false;
6309 if (!type().Equals(other->type())) return false; 6333 if (!type().Equals(other->type())) return false;
6310 if (!representation().Equals(other->representation())) return false; 6334 if (!representation().Equals(other->representation())) return false;
6311 if (!other->IsLoadNamedField()) return true; 6335 if (!other->IsLoadNamedField()) return true;
6312 HLoadNamedField* that = HLoadNamedField::cast(other); 6336 HLoadNamedField* that = HLoadNamedField::cast(other);
6313 if (this->maps_ == that->maps_) return true; 6337 if (this->maps_ == that->maps_) return true;
6314 if (this->maps_ == NULL || that->maps_ == NULL) return false; 6338 if (this->maps_ == NULL || that->maps_ == NULL) return false;
6315 return this->maps_->IsSubset(that->maps_); 6339 return this->maps_->IsSubset(that->maps_);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
6387 HObjectAccess access_; 6411 HObjectAccess access_;
6388 const UniqueSet<Map>* maps_; 6412 const UniqueSet<Map>* maps_;
6389 }; 6413 };
6390 6414
6391 6415
6392 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> { 6416 class HLoadNamedGeneric V8_FINAL : public HTemplateInstruction<2> {
6393 public: 6417 public:
6394 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*, 6418 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadNamedGeneric, HValue*,
6395 Handle<Object>); 6419 Handle<Object>);
6396 6420
6397 HValue* context() { return OperandAt(0); } 6421 HValue* context() const { return OperandAt(0); }
6398 HValue* object() { return OperandAt(1); } 6422 HValue* object() const { return OperandAt(1); }
6399 Handle<Object> name() const { return name_; } 6423 Handle<Object> name() const { return name_; }
6400 6424
6401 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6425 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6402 return Representation::Tagged(); 6426 return Representation::Tagged();
6403 } 6427 }
6404 6428
6405 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6429 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
6406 6430
6407 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric) 6431 DECLARE_CONCRETE_INSTRUCTION(LoadNamedGeneric)
6408 6432
6409 private: 6433 private:
6410 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name) 6434 HLoadNamedGeneric(HValue* context, HValue* object, Handle<Object> name)
6411 : name_(name) { 6435 : name_(name) {
6412 SetOperandAt(0, context); 6436 SetOperandAt(0, context);
6413 SetOperandAt(1, object); 6437 SetOperandAt(1, object);
6414 set_representation(Representation::Tagged()); 6438 set_representation(Representation::Tagged());
6415 SetAllSideEffects(); 6439 SetAllSideEffects();
(...skipping 27 matching lines...) Expand all
6443 } 6467 }
6444 }; 6468 };
6445 6469
6446 class ArrayInstructionInterface { 6470 class ArrayInstructionInterface {
6447 public: 6471 public:
6448 virtual HValue* GetKey() = 0; 6472 virtual HValue* GetKey() = 0;
6449 virtual void SetKey(HValue* key) = 0; 6473 virtual void SetKey(HValue* key) = 0;
6450 virtual ElementsKind elements_kind() const = 0; 6474 virtual ElementsKind elements_kind() const = 0;
6451 // TryIncreaseBaseOffset returns false if overflow would result. 6475 // TryIncreaseBaseOffset returns false if overflow would result.
6452 virtual bool TryIncreaseBaseOffset(uint32_t increase_by_value) = 0; 6476 virtual bool TryIncreaseBaseOffset(uint32_t increase_by_value) = 0;
6453 virtual bool IsDehoisted() = 0; 6477 virtual bool IsDehoisted() const = 0;
6454 virtual void SetDehoisted(bool is_dehoisted) = 0; 6478 virtual void SetDehoisted(bool is_dehoisted) = 0;
6455 virtual ~ArrayInstructionInterface() { } 6479 virtual ~ArrayInstructionInterface() { }
6456 6480
6457 static Representation KeyedAccessIndexRequirement(Representation r) { 6481 static Representation KeyedAccessIndexRequirement(Representation r) {
6458 return r.IsInteger32() || SmiValuesAre32Bits() 6482 return r.IsInteger32() || SmiValuesAre32Bits()
6459 ? Representation::Integer32() : Representation::Smi(); 6483 ? Representation::Integer32() : Representation::Smi();
6460 } 6484 }
6461 }; 6485 };
6462 6486
6463 6487
(...skipping 17 matching lines...) Expand all
6481 6505
6482 bool is_external() const { 6506 bool is_external() const {
6483 return IsExternalArrayElementsKind(elements_kind()); 6507 return IsExternalArrayElementsKind(elements_kind());
6484 } 6508 }
6485 bool is_fixed_typed_array() const { 6509 bool is_fixed_typed_array() const {
6486 return IsFixedTypedArrayElementsKind(elements_kind()); 6510 return IsFixedTypedArrayElementsKind(elements_kind());
6487 } 6511 }
6488 bool is_typed_elements() const { 6512 bool is_typed_elements() const {
6489 return is_external() || is_fixed_typed_array(); 6513 return is_external() || is_fixed_typed_array();
6490 } 6514 }
6491 HValue* elements() { return OperandAt(0); } 6515 HValue* elements() const { return OperandAt(0); }
6492 HValue* key() { return OperandAt(1); } 6516 HValue* key() const { return OperandAt(1); }
6493 HValue* dependency() { 6517 HValue* dependency() const {
6494 ASSERT(HasDependency()); 6518 ASSERT(HasDependency());
6495 return OperandAt(2); 6519 return OperandAt(2);
6496 } 6520 }
6497 bool HasDependency() const { return OperandAt(0) != OperandAt(2); } 6521 bool HasDependency() const { return OperandAt(0) != OperandAt(2); }
6498 uint32_t base_offset() { return BaseOffsetField::decode(bit_field_); } 6522 uint32_t base_offset() const { return BaseOffsetField::decode(bit_field_); }
6499 bool TryIncreaseBaseOffset(uint32_t increase_by_value); 6523 bool TryIncreaseBaseOffset(uint32_t increase_by_value);
6500 HValue* GetKey() { return key(); } 6524 HValue* GetKey() { return key(); }
6501 void SetKey(HValue* key) { SetOperandAt(1, key); } 6525 void SetKey(HValue* key) { SetOperandAt(1, key); }
6502 bool IsDehoisted() { return IsDehoistedField::decode(bit_field_); } 6526 bool IsDehoisted() const { return IsDehoistedField::decode(bit_field_); }
6503 void SetDehoisted(bool is_dehoisted) { 6527 void SetDehoisted(bool is_dehoisted) {
6504 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted); 6528 bit_field_ = IsDehoistedField::update(bit_field_, is_dehoisted);
6505 } 6529 }
6506 virtual ElementsKind elements_kind() const V8_OVERRIDE { 6530 virtual ElementsKind elements_kind() const V8_OVERRIDE {
6507 return ElementsKindField::decode(bit_field_); 6531 return ElementsKindField::decode(bit_field_);
6508 } 6532 }
6509 LoadKeyedHoleMode hole_mode() const { 6533 LoadKeyedHoleMode hole_mode() const {
6510 return HoleModeField::decode(bit_field_); 6534 return HoleModeField::decode(bit_field_);
6511 } 6535 }
6512 6536
(...skipping 10 matching lines...) Expand all
6523 return ArrayInstructionInterface::KeyedAccessIndexRequirement( 6547 return ArrayInstructionInterface::KeyedAccessIndexRequirement(
6524 OperandAt(1)->representation()); 6548 OperandAt(1)->representation());
6525 } 6549 }
6526 return Representation::None(); 6550 return Representation::None();
6527 } 6551 }
6528 6552
6529 virtual Representation observed_input_representation(int index) V8_OVERRIDE { 6553 virtual Representation observed_input_representation(int index) V8_OVERRIDE {
6530 return RequiredInputRepresentation(index); 6554 return RequiredInputRepresentation(index);
6531 } 6555 }
6532 6556
6533 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6557 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
6534 6558
6535 bool UsesMustHandleHole() const; 6559 bool UsesMustHandleHole() const;
6536 bool AllUsesCanTreatHoleAsNaN() const; 6560 bool AllUsesCanTreatHoleAsNaN() const;
6537 bool RequiresHoleCheck() const; 6561 bool RequiresHoleCheck() const;
6538 6562
6539 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 6563 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
6540 6564
6541 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed) 6565 DECLARE_CONCRETE_INSTRUCTION(LoadKeyed)
6542 6566
6543 protected: 6567 protected:
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
6651 public BitField<bool, kStartIsDehoisted, kBitsForIsDehoisted> 6675 public BitField<bool, kStartIsDehoisted, kBitsForIsDehoisted>
6652 {}; // NOLINT 6676 {}; // NOLINT
6653 uint32_t bit_field_; 6677 uint32_t bit_field_;
6654 }; 6678 };
6655 6679
6656 6680
6657 class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> { 6681 class HLoadKeyedGeneric V8_FINAL : public HTemplateInstruction<3> {
6658 public: 6682 public:
6659 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadKeyedGeneric, HValue*, 6683 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadKeyedGeneric, HValue*,
6660 HValue*); 6684 HValue*);
6661 HValue* object() { return OperandAt(0); } 6685 HValue* object() const { return OperandAt(0); }
6662 HValue* key() { return OperandAt(1); } 6686 HValue* key() const { return OperandAt(1); }
6663 HValue* context() { return OperandAt(2); } 6687 HValue* context() const { return OperandAt(2); }
6664 6688
6665 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6689 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
6666 6690
6667 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6691 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6668 // tagged[tagged] 6692 // tagged[tagged]
6669 return Representation::Tagged(); 6693 return Representation::Tagged();
6670 } 6694 }
6671 6695
6672 virtual HValue* Canonicalize() V8_OVERRIDE; 6696 virtual HValue* Canonicalize() V8_OVERRIDE;
6673 6697
6674 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) 6698 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric)
6675 6699
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
6734 } 6758 }
6735 return Representation::Tagged(); 6759 return Representation::Tagged();
6736 } 6760 }
6737 virtual bool HandleSideEffectDominator(GVNFlag side_effect, 6761 virtual bool HandleSideEffectDominator(GVNFlag side_effect,
6738 HValue* dominator) V8_OVERRIDE { 6762 HValue* dominator) V8_OVERRIDE {
6739 ASSERT(side_effect == kNewSpacePromotion); 6763 ASSERT(side_effect == kNewSpacePromotion);
6740 if (!FLAG_use_write_barrier_elimination) return false; 6764 if (!FLAG_use_write_barrier_elimination) return false;
6741 dominator_ = dominator; 6765 dominator_ = dominator;
6742 return false; 6766 return false;
6743 } 6767 }
6744 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6768 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
6745 6769
6746 HValue* object() const { return OperandAt(0); } 6770 HValue* object() const { return OperandAt(0); }
6747 HValue* value() const { return OperandAt(1); } 6771 HValue* value() const { return OperandAt(1); }
6748 HValue* transition() const { return OperandAt(2); } 6772 HValue* transition() const { return OperandAt(2); }
6749 6773
6750 HObjectAccess access() const { return access_; } 6774 HObjectAccess access() const { return access_; }
6751 HValue* dominator() const { return dominator_; } 6775 HValue* dominator() const { return dominator_; }
6752 bool has_transition() const { return has_transition_; } 6776 bool has_transition() const { return has_transition_; }
6753 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } 6777 StoreFieldOrKeyedMode store_mode() const { return store_mode_; }
6754 6778
6755 Handle<Map> transition_map() const { 6779 Handle<Map> transition_map() const {
6756 if (has_transition()) { 6780 if (has_transition()) {
6757 return Handle<Map>::cast( 6781 return Handle<Map>::cast(
6758 HConstant::cast(transition())->handle(Isolate::Current())); 6782 HConstant::cast(transition())->handle(Isolate::Current()));
6759 } else { 6783 } else {
6760 return Handle<Map>(); 6784 return Handle<Map>();
6761 } 6785 }
6762 } 6786 }
6763 6787
6764 void SetTransition(HConstant* transition) { 6788 void SetTransition(HConstant* transition) {
6765 ASSERT(!has_transition()); // Only set once. 6789 ASSERT(!has_transition()); // Only set once.
6766 SetOperandAt(2, transition); 6790 SetOperandAt(2, transition);
6767 has_transition_ = true; 6791 has_transition_ = true;
6768 SetChangesFlag(kMaps); 6792 SetChangesFlag(kMaps);
6769 } 6793 }
6770 6794
6771 bool NeedsWriteBarrier() { 6795 bool NeedsWriteBarrier() const {
6772 ASSERT(!field_representation().IsDouble() || !has_transition()); 6796 ASSERT(!field_representation().IsDouble() || !has_transition());
6773 if (field_representation().IsDouble()) return false; 6797 if (field_representation().IsDouble()) return false;
6774 if (field_representation().IsSmi()) return false; 6798 if (field_representation().IsSmi()) return false;
6775 if (field_representation().IsInteger32()) return false; 6799 if (field_representation().IsInteger32()) return false;
6776 if (field_representation().IsExternal()) return false; 6800 if (field_representation().IsExternal()) return false;
6777 return StoringValueNeedsWriteBarrier(value()) && 6801 return StoringValueNeedsWriteBarrier(value()) &&
6778 ReceiverObjectNeedsWriteBarrier(object(), value(), dominator()); 6802 ReceiverObjectNeedsWriteBarrier(object(), value(), dominator());
6779 } 6803 }
6780 6804
6781 bool NeedsWriteBarrierForMap() { 6805 bool NeedsWriteBarrierForMap() {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
6838 bool has_transition_ : 1; 6862 bool has_transition_ : 1;
6839 StoreFieldOrKeyedMode store_mode_ : 1; 6863 StoreFieldOrKeyedMode store_mode_ : 1;
6840 }; 6864 };
6841 6865
6842 6866
6843 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { 6867 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> {
6844 public: 6868 public:
6845 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, 6869 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*,
6846 Handle<String>, HValue*, 6870 Handle<String>, HValue*,
6847 StrictMode); 6871 StrictMode);
6848 HValue* object() { return OperandAt(0); } 6872 HValue* object() const { return OperandAt(0); }
6849 HValue* value() { return OperandAt(1); } 6873 HValue* value() const { return OperandAt(1); }
6850 HValue* context() { return OperandAt(2); } 6874 HValue* context() const { return OperandAt(2); }
6851 Handle<String> name() { return name_; } 6875 Handle<String> name() const { return name_; }
6852 StrictMode strict_mode() { return strict_mode_; } 6876 StrictMode strict_mode() const { return strict_mode_; }
6853 6877
6854 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6878 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
6855 6879
6856 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6880 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6857 return Representation::Tagged(); 6881 return Representation::Tagged();
6858 } 6882 }
6859 6883
6860 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) 6884 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric)
6861 6885
6862 private: 6886 private:
6863 HStoreNamedGeneric(HValue* context, 6887 HStoreNamedGeneric(HValue* context,
6864 HValue* object, 6888 HValue* object,
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
6952 } 6976 }
6953 6977
6954 HValue* elements() const { return OperandAt(0); } 6978 HValue* elements() const { return OperandAt(0); }
6955 HValue* key() const { return OperandAt(1); } 6979 HValue* key() const { return OperandAt(1); }
6956 HValue* value() const { return OperandAt(2); } 6980 HValue* value() const { return OperandAt(2); }
6957 bool value_is_smi() const { 6981 bool value_is_smi() const {
6958 return IsFastSmiElementsKind(elements_kind_); 6982 return IsFastSmiElementsKind(elements_kind_);
6959 } 6983 }
6960 StoreFieldOrKeyedMode store_mode() const { return store_mode_; } 6984 StoreFieldOrKeyedMode store_mode() const { return store_mode_; }
6961 ElementsKind elements_kind() const { return elements_kind_; } 6985 ElementsKind elements_kind() const { return elements_kind_; }
6962 uint32_t base_offset() { return base_offset_; } 6986 uint32_t base_offset() const { return base_offset_; }
6963 bool TryIncreaseBaseOffset(uint32_t increase_by_value); 6987 bool TryIncreaseBaseOffset(uint32_t increase_by_value);
6964 HValue* GetKey() { return key(); } 6988 HValue* GetKey() { return key(); }
6965 void SetKey(HValue* key) { SetOperandAt(1, key); } 6989 void SetKey(HValue* key) { SetOperandAt(1, key); }
6966 bool IsDehoisted() { return is_dehoisted_; } 6990 bool IsDehoisted() const { return is_dehoisted_; }
6967 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; } 6991 void SetDehoisted(bool is_dehoisted) { is_dehoisted_ = is_dehoisted; }
6968 bool IsUninitialized() { return is_uninitialized_; } 6992 bool IsUninitialized() { return is_uninitialized_; }
6969 void SetUninitialized(bool is_uninitialized) { 6993 void SetUninitialized(bool is_uninitialized) {
6970 is_uninitialized_ = is_uninitialized; 6994 is_uninitialized_ = is_uninitialized;
6971 } 6995 }
6972 6996
6973 bool IsConstantHoleStore() { 6997 bool IsConstantHoleStore() {
6974 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); 6998 return value()->IsConstant() && HConstant::cast(value())->IsTheHole();
6975 } 6999 }
6976 7000
(...skipping 14 matching lines...) Expand all
6991 ReceiverObjectNeedsWriteBarrier(elements(), value(), dominator()); 7015 ReceiverObjectNeedsWriteBarrier(elements(), value(), dominator());
6992 } 7016 }
6993 } 7017 }
6994 7018
6995 PointersToHereCheck PointersToHereCheckForValue() const { 7019 PointersToHereCheck PointersToHereCheckForValue() const {
6996 return PointersToHereCheckForObject(value(), dominator()); 7020 return PointersToHereCheckForObject(value(), dominator());
6997 } 7021 }
6998 7022
6999 bool NeedsCanonicalization(); 7023 bool NeedsCanonicalization();
7000 7024
7001 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 7025 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
7002 7026
7003 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) 7027 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed)
7004 7028
7005 private: 7029 private:
7006 HStoreKeyed(HValue* obj, HValue* key, HValue* val, 7030 HStoreKeyed(HValue* obj, HValue* key, HValue* val,
7007 ElementsKind elements_kind, 7031 ElementsKind elements_kind,
7008 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE, 7032 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE,
7009 int offset = kDefaultKeyedHeaderOffsetSentinel) 7033 int offset = kDefaultKeyedHeaderOffsetSentinel)
7010 : elements_kind_(elements_kind), 7034 : elements_kind_(elements_kind),
7011 base_offset_(offset == kDefaultKeyedHeaderOffsetSentinel 7035 base_offset_(offset == kDefaultKeyedHeaderOffsetSentinel
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
7056 StoreFieldOrKeyedMode store_mode_: 1; 7080 StoreFieldOrKeyedMode store_mode_: 1;
7057 HValue* dominator_; 7081 HValue* dominator_;
7058 }; 7082 };
7059 7083
7060 7084
7061 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { 7085 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> {
7062 public: 7086 public:
7063 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, 7087 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*,
7064 HValue*, HValue*, StrictMode); 7088 HValue*, HValue*, StrictMode);
7065 7089
7066 HValue* object() { return OperandAt(0); } 7090 HValue* object() const { return OperandAt(0); }
7067 HValue* key() { return OperandAt(1); } 7091 HValue* key() const { return OperandAt(1); }
7068 HValue* value() { return OperandAt(2); } 7092 HValue* value() const { return OperandAt(2); }
7069 HValue* context() { return OperandAt(3); } 7093 HValue* context() const { return OperandAt(3); }
7070 StrictMode strict_mode() { return strict_mode_; } 7094 StrictMode strict_mode() const { return strict_mode_; }
7071 7095
7072 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7096 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
7073 // tagged[tagged] = tagged 7097 // tagged[tagged] = tagged
7074 return Representation::Tagged(); 7098 return Representation::Tagged();
7075 } 7099 }
7076 7100
7077 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 7101 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
7078 7102
7079 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) 7103 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric)
7080 7104
7081 private: 7105 private:
7082 HStoreKeyedGeneric(HValue* context, 7106 HStoreKeyedGeneric(HValue* context,
7083 HValue* object, 7107 HValue* object,
7084 HValue* key, 7108 HValue* key,
7085 HValue* value, 7109 HValue* value,
7086 StrictMode strict_mode) 7110 StrictMode strict_mode)
7087 : strict_mode_(strict_mode) { 7111 : strict_mode_(strict_mode) {
(...skipping 16 matching lines...) Expand all
7104 Handle<Map> original_map, 7128 Handle<Map> original_map,
7105 Handle<Map> transitioned_map) { 7129 Handle<Map> transitioned_map) {
7106 return new(zone) HTransitionElementsKind(context, object, 7130 return new(zone) HTransitionElementsKind(context, object,
7107 original_map, transitioned_map); 7131 original_map, transitioned_map);
7108 } 7132 }
7109 7133
7110 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7134 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
7111 return Representation::Tagged(); 7135 return Representation::Tagged();
7112 } 7136 }
7113 7137
7114 HValue* object() { return OperandAt(0); } 7138 HValue* object() const { return OperandAt(0); }
7115 HValue* context() { return OperandAt(1); } 7139 HValue* context() const { return OperandAt(1); }
7116 Unique<Map> original_map() { return original_map_; } 7140 Unique<Map> original_map() const { return original_map_; }
7117 Unique<Map> transitioned_map() { return transitioned_map_; } 7141 Unique<Map> transitioned_map() const { return transitioned_map_; }
7118 ElementsKind from_kind() { return from_kind_; } 7142 ElementsKind from_kind() const { return from_kind_; }
7119 ElementsKind to_kind() { return to_kind_; } 7143 ElementsKind to_kind() const { return to_kind_; }
7120 7144
7121 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 7145 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
7122 7146
7123 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) 7147 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind)
7124 7148
7125 protected: 7149 protected:
7126 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 7150 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
7127 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); 7151 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other);
7128 return original_map_ == instr->original_map_ && 7152 return original_map_ == instr->original_map_ &&
7129 transitioned_map_ == instr->transitioned_map_; 7153 transitioned_map_ == instr->transitioned_map_;
7130 } 7154 }
7131 7155
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
7169 Handle<AllocationSite> allocation_site = 7193 Handle<AllocationSite> allocation_site =
7170 Handle<AllocationSite>::null()); 7194 Handle<AllocationSite>::null());
7171 7195
7172 StringAddFlags flags() const { return flags_; } 7196 StringAddFlags flags() const { return flags_; }
7173 PretenureFlag pretenure_flag() const { return pretenure_flag_; } 7197 PretenureFlag pretenure_flag() const { return pretenure_flag_; }
7174 7198
7175 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7199 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
7176 return Representation::Tagged(); 7200 return Representation::Tagged();
7177 } 7201 }
7178 7202
7179 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 7203 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
7180 7204
7181 DECLARE_CONCRETE_INSTRUCTION(StringAdd) 7205 DECLARE_CONCRETE_INSTRUCTION(StringAdd)
7182 7206
7183 protected: 7207 protected:
7184 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 7208 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
7185 return flags_ == HStringAdd::cast(other)->flags_ && 7209 return flags_ == HStringAdd::cast(other)->flags_ &&
7186 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_; 7210 pretenure_flag_ == HStringAdd::cast(other)->pretenure_flag_;
7187 } 7211 }
7188 7212
7189 private: 7213 private:
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
7404 bool has_no_literals_ : 1; 7428 bool has_no_literals_ : 1;
7405 bool is_generator_ : 1; 7429 bool is_generator_ : 1;
7406 StrictMode strict_mode_; 7430 StrictMode strict_mode_;
7407 }; 7431 };
7408 7432
7409 7433
7410 class HTypeof V8_FINAL : public HTemplateInstruction<2> { 7434 class HTypeof V8_FINAL : public HTemplateInstruction<2> {
7411 public: 7435 public:
7412 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HTypeof, HValue*); 7436 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HTypeof, HValue*);
7413 7437
7414 HValue* context() { return OperandAt(0); } 7438 HValue* context() const { return OperandAt(0); }
7415 HValue* value() { return OperandAt(1); } 7439 HValue* value() const { return OperandAt(1); }
7416 7440
7417 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 7441 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
7418 7442
7419 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7443 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
7420 return Representation::Tagged(); 7444 return Representation::Tagged();
7421 } 7445 }
7422 7446
7423 DECLARE_CONCRETE_INSTRUCTION(Typeof) 7447 DECLARE_CONCRETE_INSTRUCTION(Typeof)
7424 7448
7425 private: 7449 private:
7426 explicit HTypeof(HValue* context, HValue* value) { 7450 explicit HTypeof(HValue* context, HValue* value) {
7427 SetOperandAt(0, context); 7451 SetOperandAt(0, context);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
7591 7615
7592 7616
7593 class HCheckMapValue V8_FINAL : public HTemplateInstruction<2> { 7617 class HCheckMapValue V8_FINAL : public HTemplateInstruction<2> {
7594 public: 7618 public:
7595 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); 7619 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*);
7596 7620
7597 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7621 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
7598 return Representation::Tagged(); 7622 return Representation::Tagged();
7599 } 7623 }
7600 7624
7601 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 7625 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
7602 7626
7603 virtual HType CalculateInferredType() V8_OVERRIDE { 7627 virtual HType CalculateInferredType() V8_OVERRIDE {
7604 if (value()->type().IsHeapObject()) return value()->type(); 7628 if (value()->type().IsHeapObject()) return value()->type();
7605 return HType::HeapObject(); 7629 return HType::HeapObject();
7606 } 7630 }
7607 7631
7608 HValue* value() const { return OperandAt(0); } 7632 HValue* value() const { return OperandAt(0); }
7609 HValue* map() const { return OperandAt(1); } 7633 HValue* map() const { return OperandAt(1); }
7610 7634
7611 virtual HValue* Canonicalize() V8_OVERRIDE; 7635 virtual HValue* Canonicalize() V8_OVERRIDE;
(...skipping 21 matching lines...) Expand all
7633 7657
7634 7658
7635 class HForInPrepareMap V8_FINAL : public HTemplateInstruction<2> { 7659 class HForInPrepareMap V8_FINAL : public HTemplateInstruction<2> {
7636 public: 7660 public:
7637 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HForInPrepareMap, HValue*); 7661 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HForInPrepareMap, HValue*);
7638 7662
7639 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7663 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
7640 return Representation::Tagged(); 7664 return Representation::Tagged();
7641 } 7665 }
7642 7666
7643 HValue* context() { return OperandAt(0); } 7667 HValue* context() const { return OperandAt(0); }
7644 HValue* enumerable() { return OperandAt(1); } 7668 HValue* enumerable() const { return OperandAt(1); }
7645 7669
7646 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 7670 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
7647 7671
7648 virtual HType CalculateInferredType() V8_OVERRIDE { 7672 virtual HType CalculateInferredType() V8_OVERRIDE {
7649 return HType::Tagged(); 7673 return HType::Tagged();
7650 } 7674 }
7651 7675
7652 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap); 7676 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap);
7653 7677
7654 private: 7678 private:
7655 HForInPrepareMap(HValue* context, 7679 HForInPrepareMap(HValue* context,
7656 HValue* object) { 7680 HValue* object) {
7657 SetOperandAt(0, context); 7681 SetOperandAt(0, context);
7658 SetOperandAt(1, object); 7682 SetOperandAt(1, object);
7659 set_representation(Representation::Tagged()); 7683 set_representation(Representation::Tagged());
7660 SetAllSideEffects(); 7684 SetAllSideEffects();
7661 } 7685 }
7662 }; 7686 };
7663 7687
7664 7688
7665 class HForInCacheArray V8_FINAL : public HTemplateInstruction<2> { 7689 class HForInCacheArray V8_FINAL : public HTemplateInstruction<2> {
7666 public: 7690 public:
7667 DECLARE_INSTRUCTION_FACTORY_P3(HForInCacheArray, HValue*, HValue*, int); 7691 DECLARE_INSTRUCTION_FACTORY_P3(HForInCacheArray, HValue*, HValue*, int);
7668 7692
7669 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7693 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
7670 return Representation::Tagged(); 7694 return Representation::Tagged();
7671 } 7695 }
7672 7696
7673 HValue* enumerable() { return OperandAt(0); } 7697 HValue* enumerable() const { return OperandAt(0); }
7674 HValue* map() { return OperandAt(1); } 7698 HValue* map() const { return OperandAt(1); }
7675 int idx() { return idx_; } 7699 int idx() const { return idx_; }
7676 7700
7677 HForInCacheArray* index_cache() { 7701 HForInCacheArray* index_cache() {
7678 return index_cache_; 7702 return index_cache_;
7679 } 7703 }
7680 7704
7681 void set_index_cache(HForInCacheArray* index_cache) { 7705 void set_index_cache(HForInCacheArray* index_cache) {
7682 index_cache_ = index_cache; 7706 index_cache_ = index_cache;
7683 } 7707 }
7684 7708
7685 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 7709 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
7686 7710
7687 virtual HType CalculateInferredType() V8_OVERRIDE { 7711 virtual HType CalculateInferredType() V8_OVERRIDE {
7688 return HType::Tagged(); 7712 return HType::Tagged();
7689 } 7713 }
7690 7714
7691 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray); 7715 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray);
7692 7716
7693 private: 7717 private:
7694 HForInCacheArray(HValue* enumerable, 7718 HForInCacheArray(HValue* enumerable,
7695 HValue* keys, 7719 HValue* keys,
(...skipping 21 matching lines...) Expand all
7717 } 7741 }
7718 7742
7719 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7743 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
7720 if (index == 1) { 7744 if (index == 1) {
7721 return Representation::Smi(); 7745 return Representation::Smi();
7722 } else { 7746 } else {
7723 return Representation::Tagged(); 7747 return Representation::Tagged();
7724 } 7748 }
7725 } 7749 }
7726 7750
7727 HValue* object() { return OperandAt(0); } 7751 HValue* object() const { return OperandAt(0); }
7728 HValue* index() { return OperandAt(1); } 7752 HValue* index() const { return OperandAt(1); }
7729 7753
7730 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 7754 virtual OStream& PrintDataTo(OStream& os) const V8_OVERRIDE; // NOLINT
7731 7755
7732 virtual HType CalculateInferredType() V8_OVERRIDE { 7756 virtual HType CalculateInferredType() V8_OVERRIDE {
7733 return HType::Tagged(); 7757 return HType::Tagged();
7734 } 7758 }
7735 7759
7736 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); 7760 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex);
7737 7761
7738 private: 7762 private:
7739 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7763 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7740 }; 7764 };
(...skipping 16 matching lines...) Expand all
7757 set_representation(Representation::Tagged()); 7781 set_representation(Representation::Tagged());
7758 SetChangesFlag(kContextSlots); 7782 SetChangesFlag(kContextSlots);
7759 } 7783 }
7760 }; 7784 };
7761 7785
7762 7786
7763 class HAllocateBlockContext: public HTemplateInstruction<2> { 7787 class HAllocateBlockContext: public HTemplateInstruction<2> {
7764 public: 7788 public:
7765 DECLARE_INSTRUCTION_FACTORY_P3(HAllocateBlockContext, HValue*, 7789 DECLARE_INSTRUCTION_FACTORY_P3(HAllocateBlockContext, HValue*,
7766 HValue*, Handle<ScopeInfo>); 7790 HValue*, Handle<ScopeInfo>);
7767 HValue* context() { return OperandAt(0); } 7791 HValue* context() const { return OperandAt(0); }
7768 HValue* function() { return OperandAt(1); } 7792 HValue* function() const { return OperandAt(1); }
7769 Handle<ScopeInfo> scope_info() { return scope_info_; } 7793 Handle<ScopeInfo> scope_info() const { return scope_info_; }
7770 7794
7771 virtual Representation RequiredInputRepresentation(int index) { 7795 virtual Representation RequiredInputRepresentation(int index) {
7772 return Representation::Tagged(); 7796 return Representation::Tagged();
7773 } 7797 }
7774 7798
7775 virtual void PrintDataTo(StringStream* stream); 7799 virtual OStream& PrintDataTo(OStream& os) const; // NOLINT
7776 7800
7777 DECLARE_CONCRETE_INSTRUCTION(AllocateBlockContext) 7801 DECLARE_CONCRETE_INSTRUCTION(AllocateBlockContext)
7778 7802
7779 private: 7803 private:
7780 HAllocateBlockContext(HValue* context, 7804 HAllocateBlockContext(HValue* context,
7781 HValue* function, 7805 HValue* function,
7782 Handle<ScopeInfo> scope_info) 7806 Handle<ScopeInfo> scope_info)
7783 : scope_info_(scope_info) { 7807 : scope_info_(scope_info) {
7784 SetOperandAt(0, context); 7808 SetOperandAt(0, context);
7785 SetOperandAt(1, function); 7809 SetOperandAt(1, function);
7786 set_representation(Representation::Tagged()); 7810 set_representation(Representation::Tagged());
7787 } 7811 }
7788 7812
7789 Handle<ScopeInfo> scope_info_; 7813 Handle<ScopeInfo> scope_info_;
7790 }; 7814 };
7791 7815
7792 7816
7793 7817
7794 #undef DECLARE_INSTRUCTION 7818 #undef DECLARE_INSTRUCTION
7795 #undef DECLARE_CONCRETE_INSTRUCTION 7819 #undef DECLARE_CONCRETE_INSTRUCTION
7796 7820
7797 } } // namespace v8::internal 7821 } } // namespace v8::internal
7798 7822
7799 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7823 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-gvn.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698