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

Side by Side Diff: runtime/vm/il_printer.cc

Issue 27727002: Optimize identical-comparisons based on propagated type information. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 68
69 void FlowGraphPrinter::PrintInstruction(Instruction* instr) { 69 void FlowGraphPrinter::PrintInstruction(Instruction* instr) {
70 PrintOneInstruction(instr, print_locations_); 70 PrintOneInstruction(instr, print_locations_);
71 } 71 }
72 72
73 73
74 void FlowGraphPrinter::PrintOneInstruction(Instruction* instr, 74 void FlowGraphPrinter::PrintOneInstruction(Instruction* instr,
75 bool print_locations) { 75 bool print_locations) {
76 char str[1000]; 76 char str[4000];
77 BufferFormatter f(str, sizeof(str)); 77 BufferFormatter f(str, sizeof(str));
78 instr->PrintTo(&f); 78 instr->PrintTo(&f);
79 if (FLAG_print_environments && (instr->env() != NULL)) { 79 if (FLAG_print_environments && (instr->env() != NULL)) {
80 instr->env()->PrintTo(&f); 80 instr->env()->PrintTo(&f);
81 } 81 }
82 if (print_locations && (instr->locs() != NULL)) { 82 if (print_locations && (instr->locs() != NULL)) {
83 instr->locs()->PrintTo(&f); 83 instr->locs()->PrintTo(&f);
84 } 84 }
85 if (instr->lifetime_position() != -1) { 85 if (instr->lifetime_position() != -1) {
86 OS::Print("%3" Pd ": ", instr->lifetime_position()); 86 OS::Print("%3" Pd ": ", instr->lifetime_position());
87 } 87 }
88 if (!instr->IsBlockEntry()) OS::Print(" "); 88 if (!instr->IsBlockEntry()) OS::Print(" ");
89 OS::Print("%s", str); 89 OS::Print("%s", str);
90 } 90 }
91 91
92 92
93 void FlowGraphPrinter::PrintTypeCheck(const ParsedFunction& parsed_function, 93 void FlowGraphPrinter::PrintTypeCheck(const ParsedFunction& parsed_function,
94 intptr_t token_pos, 94 intptr_t token_pos,
95 Value* value, 95 Value* value,
96 const AbstractType& dst_type, 96 const AbstractType& dst_type,
97 const String& dst_name, 97 const String& dst_name,
98 bool eliminated) { 98 bool eliminated) {
99 const char* compile_type_name = "unknown"; 99 const char* compile_type_name = "unknown";
100 if (value != NULL) { 100 if (value != NULL && value->reaching_type_ != NULL) {
101 compile_type_name = value->Type()->ToCString(); 101 compile_type_name = value->reaching_type_->ToCString();
102 } 102 }
103 OS::Print("%s type check: compile type %s is %s specific than " 103 OS::Print("%s type check: compile type %s is %s specific than "
104 "type '%s' of '%s'.\n", 104 "type '%s' of '%s'.\n",
105 eliminated ? "Eliminated" : "Generated", 105 eliminated ? "Eliminated" : "Generated",
106 compile_type_name, 106 compile_type_name,
107 eliminated ? "more" : "not more", 107 eliminated ? "more" : "not more",
108 String::Handle(dst_type.Name()).ToCString(), 108 String::Handle(dst_type.Name()).ToCString(),
109 dst_name.ToCString()); 109 dst_name.ToCString());
110 } 110 }
111 111
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 for (int i = 0; i < InputCount(); ++i) { 225 for (int i = 0; i < InputCount(); ++i) {
226 if (i > 0) f->Print(", "); 226 if (i > 0) f->Print(", ");
227 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f); 227 if (InputAt(i) != NULL) InputAt(i)->PrintTo(f);
228 } 228 }
229 } 229 }
230 230
231 231
232 void Value::PrintTo(BufferFormatter* f) const { 232 void Value::PrintTo(BufferFormatter* f) const {
233 PrintUse(f, *definition()); 233 PrintUse(f, *definition());
234 if ((reaching_type_ != NULL) && 234 if ((reaching_type_ != NULL) &&
235 (reaching_type_ != definition()->Type())) { 235 (reaching_type_ != definition()->type_)) {
236 f->Print(" "); 236 f->Print(" ");
237 reaching_type_->PrintTo(f); 237 reaching_type_->PrintTo(f);
238 } 238 }
239 } 239 }
240 240
241 241
242 void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const { 242 void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const {
243 const char* cstr = value().ToCString(); 243 const char* cstr = value().ToCString();
244 const char* new_line = strchr(cstr, '\n'); 244 const char* new_line = strchr(cstr, '\n');
245 if (new_line == NULL) { 245 if (new_line == NULL) {
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 f->Print(" ["); 979 f->Print(" [");
980 locations_[i].PrintTo(f); 980 locations_[i].PrintTo(f);
981 f->Print("]"); 981 f->Print("]");
982 } 982 }
983 } 983 }
984 f->Print(" }"); 984 f->Print(" }");
985 if (outer_ != NULL) outer_->PrintTo(f); 985 if (outer_ != NULL) outer_->PrintTo(f);
986 } 986 }
987 987
988 } // namespace dart 988 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698