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