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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 | 1258 |
1230 LOperand* value() { return inputs_[0]; } | 1259 LOperand* value() { return inputs_[0]; } |
1231 | 1260 |
1232 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") | 1261 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") |
1233 DECLARE_HYDROGEN_ACCESSOR(Branch) | 1262 DECLARE_HYDROGEN_ACCESSOR(Branch) |
1234 | 1263 |
1235 virtual void PrintDataTo(StringStream* stream); | 1264 virtual void PrintDataTo(StringStream* stream); |
1236 }; | 1265 }; |
1237 | 1266 |
1238 | 1267 |
1239 class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 1> { | 1268 class LCmpMapAndBranch: public LControlInstruction<1, 1> { |
1240 public: | 1269 public: |
1241 LCmpMapAndBranch(LOperand* value, LOperand* temp) { | 1270 LCmpMapAndBranch(LOperand* value, LOperand* temp) { |
1242 inputs_[0] = value; | 1271 inputs_[0] = value; |
1243 temps_[0] = temp; | 1272 temps_[0] = temp; |
1244 } | 1273 } |
1245 | 1274 |
1246 LOperand* value() { return inputs_[0]; } | 1275 LOperand* value() { return inputs_[0]; } |
1247 LOperand* temp() { return temps_[0]; } | 1276 LOperand* temp() { return temps_[0]; } |
1248 | 1277 |
1249 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") | 1278 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") |
1250 DECLARE_HYDROGEN_ACCESSOR(CompareMap) | 1279 DECLARE_HYDROGEN_ACCESSOR(CompareMap) |
1251 | 1280 |
1252 virtual bool IsControl() const { return true; } | |
1253 | |
1254 Handle<Map> map() const { return hydrogen()->map(); } | 1281 Handle<Map> map() const { return hydrogen()->map(); } |
1255 int true_block_id() const { | |
1256 return hydrogen()->FirstSuccessor()->block_id(); | |
1257 } | |
1258 int false_block_id() const { | |
1259 return hydrogen()->SecondSuccessor()->block_id(); | |
1260 } | |
1261 }; | 1282 }; |
1262 | 1283 |
1263 | 1284 |
1264 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { | 1285 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { |
1265 public: | 1286 public: |
1266 explicit LFixedArrayBaseLength(LOperand* value) { | 1287 explicit LFixedArrayBaseLength(LOperand* value) { |
1267 inputs_[0] = value; | 1288 inputs_[0] = value; |
1268 } | 1289 } |
1269 | 1290 |
1270 LOperand* value() { return inputs_[0]; } | 1291 LOperand* value() { return inputs_[0]; } |
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2832 | 2853 |
2833 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2854 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2834 }; | 2855 }; |
2835 | 2856 |
2836 #undef DECLARE_HYDROGEN_ACCESSOR | 2857 #undef DECLARE_HYDROGEN_ACCESSOR |
2837 #undef DECLARE_CONCRETE_INSTRUCTION | 2858 #undef DECLARE_CONCRETE_INSTRUCTION |
2838 | 2859 |
2839 } } // namespace v8::internal | 2860 } } // namespace v8::internal |
2840 | 2861 |
2841 #endif // V8_ARM_LITHIUM_ARM_H_ | 2862 #endif // V8_ARM_LITHIUM_ARM_H_ |
OLD | NEW |