OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> { | 476 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> { |
477 public: | 477 public: |
478 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } | 478 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } |
479 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") | 479 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") |
480 }; | 480 }; |
481 | 481 |
482 | 482 |
483 template<int I, int T> | 483 template<int I, int T> |
484 class LControlInstruction: public LTemplateInstruction<0, I, T> { | 484 class LControlInstruction: public LTemplateInstruction<0, I, T> { |
485 public: | 485 public: |
| 486 LControlInstruction() : false_label_(NULL), true_label_(NULL) { } |
| 487 |
486 virtual bool IsControl() const { return true; } | 488 virtual bool IsControl() const { return true; } |
487 | 489 |
488 int SuccessorCount() { return hydrogen()->SuccessorCount(); } | 490 int SuccessorCount() { return hydrogen()->SuccessorCount(); } |
489 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); } | 491 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); } |
490 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); } | 492 |
491 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); } | 493 int TrueDestination(LChunk* chunk) { |
| 494 return chunk->LookupDestination(true_block_id()); |
| 495 } |
| 496 int FalseDestination(LChunk* chunk) { |
| 497 return chunk->LookupDestination(false_block_id()); |
| 498 } |
| 499 |
| 500 Label* TrueLabel(LChunk* chunk) { |
| 501 if (true_label_ == NULL) { |
| 502 true_label_ = chunk->GetAssemblyLabel(TrueDestination(chunk)); |
| 503 } |
| 504 return true_label_; |
| 505 } |
| 506 Label* FalseLabel(LChunk* chunk) { |
| 507 if (false_label_ == NULL) { |
| 508 false_label_ = chunk->GetAssemblyLabel(FalseDestination(chunk)); |
| 509 } |
| 510 return false_label_; |
| 511 } |
| 512 |
| 513 protected: |
| 514 int true_block_id() { return SuccessorAt(0)->block_id(); } |
| 515 int false_block_id() { return SuccessorAt(1)->block_id(); } |
492 | 516 |
493 private: | 517 private: |
494 HControlInstruction* hydrogen() { | 518 HControlInstruction* hydrogen() { |
495 return HControlInstruction::cast(this->hydrogen_value()); | 519 return HControlInstruction::cast(this->hydrogen_value()); |
496 } | 520 } |
| 521 |
| 522 Label* false_label_; |
| 523 Label* true_label_; |
497 }; | 524 }; |
498 | 525 |
499 | 526 |
500 class LWrapReceiver: public LTemplateInstruction<1, 2, 1> { | 527 class LWrapReceiver: public LTemplateInstruction<1, 2, 1> { |
501 public: | 528 public: |
502 LWrapReceiver(LOperand* receiver, | 529 LWrapReceiver(LOperand* receiver, |
503 LOperand* function, | 530 LOperand* function, |
504 LOperand* temp) { | 531 LOperand* temp) { |
505 inputs_[0] = receiver; | 532 inputs_[0] = receiver; |
506 inputs_[1] = function; | 533 inputs_[1] = function; |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 LOperand* value() { return inputs_[0]; } | 1227 LOperand* value() { return inputs_[0]; } |
1201 LOperand* temp() { return temps_[0]; } | 1228 LOperand* temp() { return temps_[0]; } |
1202 | 1229 |
1203 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") | 1230 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") |
1204 DECLARE_HYDROGEN_ACCESSOR(Branch) | 1231 DECLARE_HYDROGEN_ACCESSOR(Branch) |
1205 | 1232 |
1206 virtual void PrintDataTo(StringStream* stream); | 1233 virtual void PrintDataTo(StringStream* stream); |
1207 }; | 1234 }; |
1208 | 1235 |
1209 | 1236 |
1210 class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 0> { | 1237 class LCmpMapAndBranch: public LControlInstruction<1, 0> { |
1211 public: | 1238 public: |
1212 explicit LCmpMapAndBranch(LOperand* value) { | 1239 explicit LCmpMapAndBranch(LOperand* value) { |
1213 inputs_[0] = value; | 1240 inputs_[0] = value; |
1214 } | 1241 } |
1215 | 1242 |
1216 LOperand* value() { return inputs_[0]; } | 1243 LOperand* value() { return inputs_[0]; } |
1217 | 1244 |
1218 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") | 1245 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") |
1219 DECLARE_HYDROGEN_ACCESSOR(CompareMap) | 1246 DECLARE_HYDROGEN_ACCESSOR(CompareMap) |
1220 | 1247 |
1221 virtual bool IsControl() const { return true; } | |
1222 | |
1223 Handle<Map> map() const { return hydrogen()->map(); } | 1248 Handle<Map> map() const { return hydrogen()->map(); } |
1224 int true_block_id() const { | |
1225 return hydrogen()->FirstSuccessor()->block_id(); | |
1226 } | |
1227 int false_block_id() const { | |
1228 return hydrogen()->SecondSuccessor()->block_id(); | |
1229 } | |
1230 }; | 1249 }; |
1231 | 1250 |
1232 | 1251 |
1233 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { | 1252 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { |
1234 public: | 1253 public: |
1235 explicit LFixedArrayBaseLength(LOperand* value) { | 1254 explicit LFixedArrayBaseLength(LOperand* value) { |
1236 inputs_[0] = value; | 1255 inputs_[0] = value; |
1237 } | 1256 } |
1238 | 1257 |
1239 LOperand* value() { return inputs_[0]; } | 1258 LOperand* value() { return inputs_[0]; } |
(...skipping 1739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2979 | 2998 |
2980 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2999 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2981 }; | 3000 }; |
2982 | 3001 |
2983 #undef DECLARE_HYDROGEN_ACCESSOR | 3002 #undef DECLARE_HYDROGEN_ACCESSOR |
2984 #undef DECLARE_CONCRETE_INSTRUCTION | 3003 #undef DECLARE_CONCRETE_INSTRUCTION |
2985 | 3004 |
2986 } } // namespace v8::internal | 3005 } } // namespace v8::internal |
2987 | 3006 |
2988 #endif // V8_IA32_LITHIUM_IA32_H_ | 3007 #endif // V8_IA32_LITHIUM_IA32_H_ |
OLD | NEW |