Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: src/ia32/lithium-ia32.h

Issue 17276002: Refactor lithium codegen to not pass around block_ids (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> { 475 class LUnknownOSRValue: public LTemplateInstruction<1, 0, 0> {
476 public: 476 public:
477 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; } 477 virtual bool HasInterestingComment(LCodeGen* gen) const { return false; }
478 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value") 478 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue, "unknown-osr-value")
479 }; 479 };
480 480
481 481
482 template<int I, int T> 482 template<int I, int T>
483 class LControlInstruction: public LTemplateInstruction<0, I, T> { 483 class LControlInstruction: public LTemplateInstruction<0, I, T> {
484 public: 484 public:
485 LControlInstruction() {
486 false_label_ = true_label_ = NULL;
Jakob Kummerow 2013/06/18 09:35:38 nit: Use initializers: LControlInstruction() :
487 }
488
485 virtual bool IsControl() const { return true; } 489 virtual bool IsControl() const { return true; }
486 490
487 int SuccessorCount() { return hydrogen()->SuccessorCount(); } 491 int SuccessorCount() { return hydrogen()->SuccessorCount(); }
488 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); } 492 HBasicBlock* SuccessorAt(int i) { return hydrogen()->SuccessorAt(i); }
489 int true_block_id() { return hydrogen()->SuccessorAt(0)->block_id(); } 493
490 int false_block_id() { return hydrogen()->SuccessorAt(1)->block_id(); } 494 int TrueDestination(LChunk* chunk) {
495 return chunk->LookupDestination(true_block_id());
496 }
497 int FalseDestination(LChunk* chunk) {
498 return chunk->LookupDestination(false_block_id());
499 }
500
501 Label* TrueLabel(LChunk* chunk) {
502 if (true_label_ == NULL) {
503 true_label_ = chunk->GetAssemblyLabel(TrueDestination(chunk));
504 }
505 return true_label_;
506 }
507 Label* FalseLabel(LChunk* chunk) {
508 if (false_label_ == NULL) {
509 false_label_ = chunk->GetAssemblyLabel(FalseDestination(chunk));
510 }
511 return false_label_;
512 }
513
514 protected:
515 int true_block_id() { return SuccessorAt(0)->block_id(); }
516 int false_block_id() { return SuccessorAt(1)->block_id(); }
491 517
492 private: 518 private:
493 HControlInstruction* hydrogen() { 519 HControlInstruction* hydrogen() {
494 return HControlInstruction::cast(this->hydrogen_value()); 520 return HControlInstruction::cast(this->hydrogen_value());
495 } 521 }
522
523 Label* false_label_;
524 Label* true_label_;
496 }; 525 };
497 526
498 527
499 class LWrapReceiver: public LTemplateInstruction<1, 2, 1> { 528 class LWrapReceiver: public LTemplateInstruction<1, 2, 1> {
500 public: 529 public:
501 LWrapReceiver(LOperand* receiver, 530 LWrapReceiver(LOperand* receiver,
502 LOperand* function, 531 LOperand* function,
503 LOperand* temp) { 532 LOperand* temp) {
504 inputs_[0] = receiver; 533 inputs_[0] = receiver;
505 inputs_[1] = function; 534 inputs_[1] = function;
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 LOperand* value() { return inputs_[0]; } 1228 LOperand* value() { return inputs_[0]; }
1200 LOperand* temp() { return temps_[0]; } 1229 LOperand* temp() { return temps_[0]; }
1201 1230
1202 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") 1231 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1203 DECLARE_HYDROGEN_ACCESSOR(Branch) 1232 DECLARE_HYDROGEN_ACCESSOR(Branch)
1204 1233
1205 virtual void PrintDataTo(StringStream* stream); 1234 virtual void PrintDataTo(StringStream* stream);
1206 }; 1235 };
1207 1236
1208 1237
1209 class LCmpMapAndBranch: public LTemplateInstruction<0, 1, 0> { 1238 class LCmpMapAndBranch: public LControlInstruction<1, 0> {
1210 public: 1239 public:
1211 explicit LCmpMapAndBranch(LOperand* value) { 1240 explicit LCmpMapAndBranch(LOperand* value) {
1212 inputs_[0] = value; 1241 inputs_[0] = value;
1213 } 1242 }
1214 1243
1215 LOperand* value() { return inputs_[0]; } 1244 LOperand* value() { return inputs_[0]; }
1216 1245
1217 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch") 1246 DECLARE_CONCRETE_INSTRUCTION(CmpMapAndBranch, "cmp-map-and-branch")
1218 DECLARE_HYDROGEN_ACCESSOR(CompareMap) 1247 DECLARE_HYDROGEN_ACCESSOR(CompareMap)
1219 1248
1220 virtual bool IsControl() const { return true; }
1221
1222 Handle<Map> map() const { return hydrogen()->map(); } 1249 Handle<Map> map() const { return hydrogen()->map(); }
1223 int true_block_id() const {
1224 return hydrogen()->FirstSuccessor()->block_id();
1225 }
1226 int false_block_id() const {
1227 return hydrogen()->SecondSuccessor()->block_id();
1228 }
1229 }; 1250 };
1230 1251
1231 1252
1232 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> { 1253 class LFixedArrayBaseLength: public LTemplateInstruction<1, 1, 0> {
1233 public: 1254 public:
1234 explicit LFixedArrayBaseLength(LOperand* value) { 1255 explicit LFixedArrayBaseLength(LOperand* value) {
1235 inputs_[0] = value; 1256 inputs_[0] = value;
1236 } 1257 }
1237 1258
1238 LOperand* value() { return inputs_[0]; } 1259 LOperand* value() { return inputs_[0]; }
(...skipping 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after
2963 2984
2964 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2985 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2965 }; 2986 };
2966 2987
2967 #undef DECLARE_HYDROGEN_ACCESSOR 2988 #undef DECLARE_HYDROGEN_ACCESSOR
2968 #undef DECLARE_CONCRETE_INSTRUCTION 2989 #undef DECLARE_CONCRETE_INSTRUCTION
2969 2990
2970 } } // namespace v8::internal 2991 } } // namespace v8::internal
2971 2992
2972 #endif // V8_IA32_LITHIUM_IA32_H_ 2993 #endif // V8_IA32_LITHIUM_IA32_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698