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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> { | 483 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> { |
484 public: | 484 public: |
485 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } | 485 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } |
486 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") | 486 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") |
487 }; | 487 }; |
488 | 488 |
489 | 489 |
490 template<int I, int T> | 490 template<int I, int T> |
491 class LControlInstruction: public LTemplateInstruction<0, I, T> { | 491 class LControlInstruction: public LTemplateInstruction<0, I, T> { |
492 public: | 492 public: |
| 493 LControlInstruction() : false_label_(NULL), true_label_(NULL) { } |
| 494 |
493 virtual bool IsControl() const { return true; } | 495 virtual bool IsControl() const { return true; } |
494 | 496 |
495 int SuccessorCount() { return hydrogen()->SuccessorCount(); } | 497 int SuccessorCount() { return hydrogen()->SuccessorCount(); } |
496 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); } | 498 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); } |
497 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); } | 499 |
498 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); } | 500 int TrueDestination(LChunk* chunk) { |
| 501 return chunk->LookupDestination(true_block_id()); |
| 502 } |
| 503 int FalseDestination(LChunk* chunk) { |
| 504 return chunk->LookupDestination(false_block_id()); |
| 505 } |
| 506 |
| 507 Label* TrueLabel(LChunk* chunk) { |
| 508 if (true_label_ == NULL) { |
| 509 true_label_ = chunk->GetAssemblyLabel(TrueDestination(chunk)); |
| 510 } |
| 511 return true_label_; |
| 512 } |
| 513 Label* FalseLabel(LChunk* chunk) { |
| 514 if (false_label_ == NULL) { |
| 515 false_label_ = chunk->GetAssemblyLabel(FalseDestination(chunk)); |
| 516 } |
| 517 return false_label_; |
| 518 } |
| 519 |
| 520 protected: |
| 521 int true_block_id() { return SuccessorAt(0)->block_id(); } |
| 522 int false_block_id() { return SuccessorAt(1)->block_id(); } |
499 | 523 |
500 private: | 524 private: |
501 HControlInstruction* hydrogen() { | 525 HControlInstruction* hydrogen() { |
502 return HControlInstruction::cast(this->hydrogen_value()); | 526 return HControlInstruction::cast(this->hydrogen_value()); |
503 } | 527 } |
| 528 |
| 529 Label* false_label_; |
| 530 Label* true_label_; |
504 }; | 531 }; |
505 | 532 |
506 | 533 |
507 class LWrapReceiver: public LTemplateInstruction<1, 2, 0> { | 534 class LWrapReceiver: public LTemplateInstruction<1, 2, 0> { |
508 public: | 535 public: |
509 LWrapReceiver(LOperand* receiver, LOperand* function) { | 536 LWrapReceiver(LOperand* receiver, LOperand* function) { |
510 inputs_[0] = receiver; | 537 inputs_[0] = receiver; |
511 inputs_[1] = function; | 538 inputs_[1] = function; |
512 } | 539 } |
513 | 540 |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 virtual void PrintDataTo(StringStream* stream); | 1211 virtual void PrintDataTo(StringStream* stream); |
1185 }; | 1212 }; |
1186 | 1213 |
1187 | 1214 |
1188 class LDebugBreak: public LTemplateInstruction<0, 0, 0> { | 1215 class LDebugBreak: public LTemplateInstruction<0, 0, 0> { |
1189 public: | 1216 public: |
1190 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break") | 1217 DECLARE_CONCRETE_INSTRUCTION(DebugBreak, "break") |
1191 }; | 1218 }; |
1192 | 1219 |
1193 | 1220 |
1194 class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 0> { | 1221 class LCmpMapAndBranch: public LControlInstruction<1, 0> { |
1195 public: | 1222 public: |
1196 explicit LCmpMapAndBranch(LOperand* value) { | 1223 explicit LCmpMapAndBranch(LOperand* value) { |
1197 inputs_[0] = value; | 1224 inputs_[0] = value; |
1198 } | 1225 } |
1199 | 1226 |
1200 LOperand* value() { return inputs_[0]; } | 1227 LOperand* value() { return inputs_[0]; } |
1201 | 1228 |
1202 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") | 1229 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") |
1203 DECLARE_HYDROGEN_ACCESSOR(CompareMap) | 1230 DECLARE_HYDROGEN_ACCESSOR(CompareMap) |
1204 | 1231 |
1205 virtual bool IsControl() const { return true; } | |
1206 | |
1207 Handle<Map> map() const { return hydrogen()->map(); } | 1232 Handle<Map> map() const { return hydrogen()->map(); } |
1208 int true_block_id() const { | |
1209 return hydrogen()->FirstSuccessor()->block_id(); | |
1210 } | |
1211 int false_block_id() const { | |
1212 return hydrogen()->SecondSuccessor()->block_id(); | |
1213 } | |
1214 }; | 1233 }; |
1215 | 1234 |
1216 | 1235 |
1217 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { | 1236 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { |
1218 public: | 1237 public: |
1219 explicit LFixedArrayBaseLength(LOperand* value) { | 1238 explicit LFixedArrayBaseLength(LOperand* value) { |
1220 inputs_[0] = value; | 1239 inputs_[0] = value; |
1221 } | 1240 } |
1222 | 1241 |
1223 LOperand* value() { return inputs_[0]; } | 1242 LOperand* value() { return inputs_[0]; } |
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2748 | 2767 |
2749 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2768 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2750 }; | 2769 }; |
2751 | 2770 |
2752 #undef DECLARE_HYDROGEN_ACCESSOR | 2771 #undef DECLARE_HYDROGEN_ACCESSOR |
2753 #undef DECLARE_CONCRETE_INSTRUCTION | 2772 #undef DECLARE_CONCRETE_INSTRUCTION |
2754 | 2773 |
2755 } } // namespace v8::int | 2774 } } // namespace v8::int |
2756 | 2775 |
2757 #endif // V8_X64_LITHIUM_X64_H_ | 2776 #endif // V8_X64_LITHIUM_X64_H_ |
OLD | NEW |