| OLD | NEW |
| 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/flow_graph_range_analysis.h" | 7 #include "vm/flow_graph_range_analysis.h" |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 #include "vm/os.h" | 9 #include "vm/os.h" |
| 10 #include "vm/parser.h" | 10 #include "vm/parser.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 f->Print("T{%s%s}", type_name, is_nullable_ ? "?" : ""); | 175 f->Print("T{%s%s}", type_name, is_nullable_ ? "?" : ""); |
| 176 } | 176 } |
| 177 | 177 |
| 178 | 178 |
| 179 const char* CompileType::ToCString() const { | 179 const char* CompileType::ToCString() const { |
| 180 char buffer[1024]; | 180 char buffer[1024]; |
| 181 BufferFormatter f(buffer, sizeof(buffer)); | 181 BufferFormatter f(buffer, sizeof(buffer)); |
| 182 PrintTo(&f); | 182 PrintTo(&f); |
| 183 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); | 183 return Thread::Current()->zone()->MakeCopyOfString(buffer); |
| 184 } | 184 } |
| 185 | 185 |
| 186 | 186 |
| 187 static void PrintICDataHelper(BufferFormatter* f, const ICData& ic_data) { | 187 static void PrintICDataHelper(BufferFormatter* f, const ICData& ic_data) { |
| 188 f->Print(" IC["); | 188 f->Print(" IC["); |
| 189 if (ic_data.HasRangeFeedback()) { | 189 if (ic_data.HasRangeFeedback()) { |
| 190 f->Print("{%s", | 190 f->Print("{%s", |
| 191 ICData::RangeFeedbackToString(ic_data.DecodeRangeFeedbackAt(0))); | 191 ICData::RangeFeedbackToString(ic_data.DecodeRangeFeedbackAt(0))); |
| 192 if (ic_data.NumArgsTested() == 2) { | 192 if (ic_data.NumArgsTested() == 2) { |
| 193 f->Print(" x %s", | 193 f->Print(" x %s", |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 } else if (definition.HasTemp()) { | 240 } else if (definition.HasTemp()) { |
| 241 f->Print("t%" Pd "", definition.temp_index()); | 241 f->Print("t%" Pd "", definition.temp_index()); |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 | 244 |
| 245 | 245 |
| 246 const char* Instruction::ToCString() const { | 246 const char* Instruction::ToCString() const { |
| 247 char buffer[1024]; | 247 char buffer[1024]; |
| 248 BufferFormatter f(buffer, sizeof(buffer)); | 248 BufferFormatter f(buffer, sizeof(buffer)); |
| 249 PrintTo(&f); | 249 PrintTo(&f); |
| 250 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); | 250 return Thread::Current()->zone()->MakeCopyOfString(buffer); |
| 251 } | 251 } |
| 252 | 252 |
| 253 | 253 |
| 254 void Instruction::PrintTo(BufferFormatter* f) const { | 254 void Instruction::PrintTo(BufferFormatter* f) const { |
| 255 if (GetDeoptId() != Isolate::kNoDeoptId) { | 255 if (GetDeoptId() != Isolate::kNoDeoptId) { |
| 256 f->Print("%s:%" Pd "(", DebugName(), GetDeoptId()); | 256 f->Print("%s:%" Pd "(", DebugName(), GetDeoptId()); |
| 257 } else { | 257 } else { |
| 258 f->Print("%s(", DebugName()); | 258 f->Print("%s(", DebugName()); |
| 259 } | 259 } |
| 260 PrintOperandsTo(f); | 260 PrintOperandsTo(f); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 } | 314 } |
| 315 | 315 |
| 316 | 316 |
| 317 void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const { | 317 void ConstantInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 318 const char* cstr = value().ToCString(); | 318 const char* cstr = value().ToCString(); |
| 319 const char* new_line = strchr(cstr, '\n'); | 319 const char* new_line = strchr(cstr, '\n'); |
| 320 if (new_line == NULL) { | 320 if (new_line == NULL) { |
| 321 f->Print("#%s", cstr); | 321 f->Print("#%s", cstr); |
| 322 } else { | 322 } else { |
| 323 const intptr_t pos = new_line - cstr; | 323 const intptr_t pos = new_line - cstr; |
| 324 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(pos + 1); | 324 char* buffer = Thread::Current()->zone()->Alloc<char>(pos + 1); |
| 325 strncpy(buffer, cstr, pos); | 325 strncpy(buffer, cstr, pos); |
| 326 buffer[pos] = '\0'; | 326 buffer[pos] = '\0'; |
| 327 f->Print("#%s\\n...", buffer); | 327 f->Print("#%s\\n...", buffer); |
| 328 } | 328 } |
| 329 } | 329 } |
| 330 | 330 |
| 331 | 331 |
| 332 void ConstraintInstr::PrintOperandsTo(BufferFormatter* f) const { | 332 void ConstraintInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 333 value()->PrintTo(f); | 333 value()->PrintTo(f); |
| 334 f->Print(" ^ "); | 334 f->Print(" ^ "); |
| 335 constraint()->PrintTo(f); | 335 constraint()->PrintTo(f); |
| 336 } | 336 } |
| 337 | 337 |
| 338 | 338 |
| 339 void Range::PrintTo(BufferFormatter* f) const { | 339 void Range::PrintTo(BufferFormatter* f) const { |
| 340 f->Print("["); | 340 f->Print("["); |
| 341 min_.PrintTo(f); | 341 min_.PrintTo(f); |
| 342 f->Print(", "); | 342 f->Print(", "); |
| 343 max_.PrintTo(f); | 343 max_.PrintTo(f); |
| 344 f->Print("]"); | 344 f->Print("]"); |
| 345 } | 345 } |
| 346 | 346 |
| 347 | 347 |
| 348 const char* Range::ToCString(const Range* range) { | 348 const char* Range::ToCString(const Range* range) { |
| 349 if (range == NULL) return "[_|_, _|_]"; | 349 if (range == NULL) return "[_|_, _|_]"; |
| 350 | 350 |
| 351 char buffer[256]; | 351 char buffer[256]; |
| 352 BufferFormatter f(buffer, sizeof(buffer)); | 352 BufferFormatter f(buffer, sizeof(buffer)); |
| 353 range->PrintTo(&f); | 353 range->PrintTo(&f); |
| 354 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); | 354 return Thread::Current()->zone()->MakeCopyOfString(buffer); |
| 355 } | 355 } |
| 356 | 356 |
| 357 | 357 |
| 358 void RangeBoundary::PrintTo(BufferFormatter* f) const { | 358 void RangeBoundary::PrintTo(BufferFormatter* f) const { |
| 359 switch (kind_) { | 359 switch (kind_) { |
| 360 case kSymbol: | 360 case kSymbol: |
| 361 f->Print("v%" Pd "", | 361 f->Print("v%" Pd "", |
| 362 reinterpret_cast<Definition*>(value_)->ssa_temp_index()); | 362 reinterpret_cast<Definition*>(value_)->ssa_temp_index()); |
| 363 if (offset_ != 0) f->Print("%+" Pd64 "", offset_); | 363 if (offset_ != 0) f->Print("%+" Pd64 "", offset_); |
| 364 break; | 364 break; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 375 f->Print("_|_"); | 375 f->Print("_|_"); |
| 376 break; | 376 break; |
| 377 } | 377 } |
| 378 } | 378 } |
| 379 | 379 |
| 380 | 380 |
| 381 const char* RangeBoundary::ToCString() const { | 381 const char* RangeBoundary::ToCString() const { |
| 382 char buffer[256]; | 382 char buffer[256]; |
| 383 BufferFormatter f(buffer, sizeof(buffer)); | 383 BufferFormatter f(buffer, sizeof(buffer)); |
| 384 PrintTo(&f); | 384 PrintTo(&f); |
| 385 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); | 385 return Thread::Current()->zone()->MakeCopyOfString(buffer); |
| 386 } | 386 } |
| 387 | 387 |
| 388 | 388 |
| 389 void DropTempsInstr::PrintOperandsTo(BufferFormatter* f) const { | 389 void DropTempsInstr::PrintOperandsTo(BufferFormatter* f) const { |
| 390 f->Print("%" Pd "", num_temps()); | 390 f->Print("%" Pd "", num_temps()); |
| 391 if (value() != NULL) { | 391 if (value() != NULL) { |
| 392 f->Print(", "); | 392 f->Print(", "); |
| 393 value()->PrintTo(f); | 393 value()->PrintTo(f); |
| 394 } | 394 } |
| 395 } | 395 } |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 } | 1203 } |
| 1204 } | 1204 } |
| 1205 f->Print(" }"); | 1205 f->Print(" }"); |
| 1206 if (outer_ != NULL) outer_->PrintTo(f); | 1206 if (outer_ != NULL) outer_->PrintTo(f); |
| 1207 } | 1207 } |
| 1208 | 1208 |
| 1209 const char* Environment::ToCString() const { | 1209 const char* Environment::ToCString() const { |
| 1210 char buffer[1024]; | 1210 char buffer[1024]; |
| 1211 BufferFormatter bf(buffer, 1024); | 1211 BufferFormatter bf(buffer, 1024); |
| 1212 PrintTo(&bf); | 1212 PrintTo(&bf); |
| 1213 return Isolate::Current()->current_zone()->MakeCopyOfString(buffer); | 1213 return Thread::Current()->zone()->MakeCopyOfString(buffer); |
| 1214 } | 1214 } |
| 1215 | 1215 |
| 1216 } // namespace dart | 1216 } // namespace dart |
| OLD | NEW |