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

Side by Side Diff: vm/il_printer.cc

Issue 10830275: Optimize expressions of the form (expr === true) when expr has boolean type. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: ready for review Created 8 years, 4 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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/il_printer.h" 5 #include "vm/il_printer.h"
6 6
7 #include "vm/intermediate_language.h" 7 #include "vm/intermediate_language.h"
8 #include "vm/os.h" 8 #include "vm/os.h"
9 #include "vm/parser.h" 9 #include "vm/parser.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 DEFINE_FLAG(bool, print_environments, false, "Print SSA environments."); 13 DEFINE_FLAG(bool, print_environments, false, "Print SSA environments.");
14 DEFINE_FLAG(bool, print_types, false, "Print propagated types.");
14 15
15 16
16 void BufferFormatter::Print(const char* format, ...) { 17 void BufferFormatter::Print(const char* format, ...) {
17 va_list args; 18 va_list args;
18 va_start(args, format); 19 va_start(args, format);
19 VPrint(format, args); 20 VPrint(format, args);
20 va_end(args); 21 va_end(args);
21 } 22 }
22 23
23 24
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 422 }
422 423
423 424
424 void PhiInstr::PrintTo(BufferFormatter* f) const { 425 void PhiInstr::PrintTo(BufferFormatter* f) const {
425 f->Print(" v%d <- phi(", ssa_temp_index()); 426 f->Print(" v%d <- phi(", ssa_temp_index());
426 for (intptr_t i = 0; i < inputs_.length(); ++i) { 427 for (intptr_t i = 0; i < inputs_.length(); ++i) {
427 if (inputs_[i] != NULL) inputs_[i]->PrintTo(f); 428 if (inputs_[i] != NULL) inputs_[i]->PrintTo(f);
428 if (i < inputs_.length() - 1) f->Print(", "); 429 if (i < inputs_.length() - 1) f->Print(", ");
429 } 430 }
430 f->Print(")"); 431 f->Print(")");
432 if (FLAG_print_types && HasPropagatedType()) {
433 f->Print(", propatated_type_=%s",
434 String::Handle(AbstractType::Handle(
435 PropagatedType()).Name()).ToCString());
436 }
431 } 437 }
432 438
433 439
434 void ParameterInstr::PrintTo(BufferFormatter* f) const { 440 void ParameterInstr::PrintTo(BufferFormatter* f) const {
435 f->Print(" v%d <- parameter(%d)", 441 f->Print(" v%d <- parameter(%d)",
436 HasSSATemp() ? ssa_temp_index() : temp_index(), 442 HasSSATemp() ? ssa_temp_index() : temp_index(),
437 index()); 443 index());
438 } 444 }
439 445
440 446
(...skipping 13 matching lines...) Expand all
454 460
455 void BindInstr::PrintTo(BufferFormatter* f) const { 461 void BindInstr::PrintTo(BufferFormatter* f) const {
456 if (!is_used()) { 462 if (!is_used()) {
457 f->Print(" "); 463 f->Print(" ");
458 } else if (HasSSATemp()) { 464 } else if (HasSSATemp()) {
459 f->Print(" v%d <- ", ssa_temp_index()); 465 f->Print(" v%d <- ", ssa_temp_index());
460 } else { 466 } else {
461 f->Print(" t%d <- ", temp_index()); 467 f->Print(" t%d <- ", temp_index());
462 } 468 }
463 computation()->PrintTo(f); 469 computation()->PrintTo(f);
470 if (FLAG_print_types && HasPropagatedType()) {
471 f->Print(", propatated_type_=%s",
472 String::Handle(AbstractType::Handle(
473 PropagatedType()).Name()).ToCString());
474 }
464 } 475 }
465 476
466 477
467 void PushArgumentInstr::PrintTo(BufferFormatter* f) const { 478 void PushArgumentInstr::PrintTo(BufferFormatter* f) const {
468 f->Print(" %s ", DebugName()); 479 f->Print(" %s ", DebugName());
469 value()->PrintTo(f); 480 value()->PrintTo(f);
470 } 481 }
471 482
472 483
473 void ReturnInstr::PrintTo(BufferFormatter* f) const { 484 void ReturnInstr::PrintTo(BufferFormatter* f) const {
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 !locations_[i].IsInvalid()) { 794 !locations_[i].IsInvalid()) {
784 f->Print(" ["); 795 f->Print(" [");
785 locations_[i].PrintTo(f); 796 locations_[i].PrintTo(f);
786 f->Print("]"); 797 f->Print("]");
787 } 798 }
788 } 799 }
789 f->Print(" }"); 800 f->Print(" }");
790 } 801 }
791 802
792 } // namespace dart 803 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698