Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/disassembler.h" | 8 #include "vm/disassembler.h" |
| 9 | 9 |
| 10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 | 387 |
| 388 | 388 |
| 389 void X86Decoder::PrintAddress(uword addr) { | 389 void X86Decoder::PrintAddress(uword addr) { |
| 390 NoGCScope no_gc; | 390 NoGCScope no_gc; |
| 391 char addr_buffer[32]; | 391 char addr_buffer[32]; |
| 392 OS::SNPrint(addr_buffer, sizeof(addr_buffer), "%p", addr); | 392 OS::SNPrint(addr_buffer, sizeof(addr_buffer), "%p", addr); |
| 393 Print(addr_buffer); | 393 Print(addr_buffer); |
| 394 // Try to print as heap object or stub name | 394 // Try to print as heap object or stub name |
| 395 if (!Isolate::Current()->heap()->CodeContains(addr) && | 395 if (!Isolate::Current()->heap()->CodeContains(addr) && |
| 396 Isolate::Current()->heap()->Contains(addr - kHeapObjectTag)) { | 396 Isolate::Current()->heap()->Contains(addr - kHeapObjectTag)) { |
| 397 Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr)); | |
| 398 if (obj.IsArray()) { | |
| 399 const Array& arr = Array::CheckedHandle(obj.raw()); | |
|
siva
2011/11/12 01:11:55
You have already checked it is an array above so w
| |
| 400 intptr_t len = arr.Length(); | |
| 401 if (len > 5) len = 5; // At max print first 5 elements. | |
|
siva
2011/11/12 01:11:55
Print a max of 5 elements.
| |
| 402 Print(" Array["); | |
| 403 int i = 0; | |
| 404 while (i < len) { | |
| 405 obj = arr.At(i); | |
| 406 if (i > 0) Print(", "); | |
| 407 Print(obj.ToCString()); | |
| 408 i++; | |
| 409 } | |
| 410 if (i < arr.Length()) Print(", ..."); | |
| 411 Print("]"); | |
| 412 return; | |
| 413 } | |
| 397 Print(" '"); | 414 Print(" '"); |
| 398 const Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr)); | |
| 399 Print(obj.ToCString()); | 415 Print(obj.ToCString()); |
| 400 Print("'"); | 416 Print("'"); |
| 401 } else { | 417 } else { |
| 402 // 'addr' is not an object, but probably a code address. | 418 // 'addr' is not an object, but probably a code address. |
| 403 const char* name_of_stub = StubCode::NameOfStub(addr); | 419 const char* name_of_stub = StubCode::NameOfStub(addr); |
| 404 if (name_of_stub != NULL) { | 420 if (name_of_stub != NULL) { |
| 405 Print(" [stub: "); | 421 Print(" [stub: "); |
| 406 Print(name_of_stub); | 422 Print(name_of_stub); |
| 407 Print("]"); | 423 Print("]"); |
| 408 } else { | 424 } else { |
| (...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1505 | 1521 |
| 1506 const char* Disassembler::RegisterName(Register reg) { | 1522 const char* Disassembler::RegisterName(Register reg) { |
| 1507 ASSERT(0 <= reg); | 1523 ASSERT(0 <= reg); |
| 1508 ASSERT(reg < kMaxCPURegisters); | 1524 ASSERT(reg < kMaxCPURegisters); |
| 1509 return (cpu_regs[reg]); | 1525 return (cpu_regs[reg]); |
| 1510 } | 1526 } |
| 1511 | 1527 |
| 1512 } // namespace dart | 1528 } // namespace dart |
| 1513 | 1529 |
| 1514 #endif // defined TARGET_ARCH_IA32 | 1530 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |