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