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

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

Issue 11826024: Clean up uses of X::CheckedHandle where X::Cast or X::Handle is sufficient. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | « no previous file | runtime/vm/disassembler_x64.cc » ('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/disassembler.h" 5 #include "vm/disassembler.h"
6 6
7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. 7 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
8 #if defined(TARGET_ARCH_IA32) 8 #if defined(TARGET_ARCH_IA32)
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 obj.IsString() || 403 obj.IsString() ||
404 obj.IsNull() || 404 obj.IsNull() ||
405 obj.IsBool() || 405 obj.IsBool() ||
406 obj.IsClass() || 406 obj.IsClass() ||
407 obj.IsFunction() || 407 obj.IsFunction() ||
408 obj.IsICData() || 408 obj.IsICData() ||
409 obj.IsField()) { 409 obj.IsField()) {
410 return obj.ToCString(); 410 return obj.ToCString();
411 } 411 }
412 412
413 const Class& clazz = Class::CheckedHandle(obj.clazz()); 413 const Class& clazz = Class::Handle(obj.clazz());
414 const char* full_class_name = clazz.ToCString(); 414 const char* full_class_name = clazz.ToCString();
415 const char* format = "instance of %s"; 415 const char* format = "instance of %s";
416 intptr_t len = OS::SNPrint(NULL, 0, format, full_class_name) + 1; 416 intptr_t len = OS::SNPrint(NULL, 0, format, full_class_name) + 1;
417 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 417 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
418 OS::SNPrint(chars, len, format, full_class_name); 418 OS::SNPrint(chars, len, format, full_class_name);
419 return chars; 419 return chars;
420 } 420 }
421 421
422 422
423 void X86Decoder::PrintAddress(uword addr) { 423 void X86Decoder::PrintAddress(uword addr) {
424 NoGCScope no_gc; 424 NoGCScope no_gc;
425 char addr_buffer[32]; 425 char addr_buffer[32];
426 OS::SNPrint(addr_buffer, sizeof(addr_buffer), "%#"Px"", addr); 426 OS::SNPrint(addr_buffer, sizeof(addr_buffer), "%#"Px"", addr);
427 Print(addr_buffer); 427 Print(addr_buffer);
428 // Try to print as heap object or stub name 428 // Try to print as heap object or stub name
429 if (((addr & kSmiTagMask) == kHeapObjectTag) && 429 if (((addr & kSmiTagMask) == kHeapObjectTag) &&
430 !Isolate::Current()->heap()->CodeContains(addr) && 430 !Isolate::Current()->heap()->CodeContains(addr) &&
431 Isolate::Current()->heap()->Contains(addr - kHeapObjectTag)) { 431 Isolate::Current()->heap()->Contains(addr - kHeapObjectTag)) {
432 Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr)); 432 const Object& obj = Object::Handle(reinterpret_cast<RawObject*>(addr));
433 if (obj.IsArray()) { 433 if (obj.IsArray()) {
434 const Array& arr = Array::CheckedHandle(obj.raw()); 434 const Array& arr = Array::Cast(obj);
435 intptr_t len = arr.Length(); 435 intptr_t len = arr.Length();
436 if (len > 5) len = 5; // Print a max of 5 elements. 436 if (len > 5) len = 5; // Print a max of 5 elements.
437 Print(" Array["); 437 Print(" Array[");
438 int i = 0; 438 int i = 0;
439 Object& element = Object::Handle();
439 while (i < len) { 440 while (i < len) {
440 obj = arr.At(i); 441 element = arr.At(i);
441 if (i > 0) Print(", "); 442 if (i > 0) Print(", ");
442 Print(ObjectToCStringNoGC(obj)); 443 Print(ObjectToCStringNoGC(element));
443 i++; 444 i++;
444 } 445 }
445 if (i < arr.Length()) Print(", ..."); 446 if (i < arr.Length()) Print(", ...");
446 Print("]"); 447 Print("]");
447 return; 448 return;
448 } 449 }
449 Print(" '"); 450 Print(" '");
450 Print(ObjectToCStringNoGC(obj)); 451 Print(ObjectToCStringNoGC(obj));
451 Print("'"); 452 Print("'");
452 } else { 453 } else {
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 const Code::Comments& comments) { 1682 const Code::Comments& comments) {
1682 ASSERT(formatter != NULL); 1683 ASSERT(formatter != NULL);
1683 char hex_buffer[kHexadecimalBufferSize]; // Instruction in hexadecimal form. 1684 char hex_buffer[kHexadecimalBufferSize]; // Instruction in hexadecimal form.
1684 char human_buffer[kUserReadableBufferSize]; // Human-readable instruction. 1685 char human_buffer[kUserReadableBufferSize]; // Human-readable instruction.
1685 uword pc = start; 1686 uword pc = start;
1686 intptr_t comment_finger = 0; 1687 intptr_t comment_finger = 0;
1687 while (pc < end) { 1688 while (pc < end) {
1688 const intptr_t offset = pc - start; 1689 const intptr_t offset = pc - start;
1689 while (comment_finger < comments.Length() && 1690 while (comment_finger < comments.Length() &&
1690 comments.PCOffsetAt(comment_finger) <= offset) { 1691 comments.PCOffsetAt(comment_finger) <= offset) {
1691 formatter->Print(" ;; %s\n", 1692 formatter->Print(
1692 comments.CommentAt(comment_finger).ToCString()); 1693 " ;; %s\n",
1694 String::Handle(comments.CommentAt(comment_finger)).ToCString());
1693 comment_finger++; 1695 comment_finger++;
1694 } 1696 }
1695 int instruction_length = DecodeInstruction(hex_buffer, 1697 int instruction_length = DecodeInstruction(hex_buffer,
1696 sizeof(hex_buffer), 1698 sizeof(hex_buffer),
1697 human_buffer, 1699 human_buffer,
1698 sizeof(human_buffer), 1700 sizeof(human_buffer),
1699 pc); 1701 pc);
1700 formatter->ConsumeInstruction(hex_buffer, 1702 formatter->ConsumeInstruction(hex_buffer,
1701 sizeof(hex_buffer), 1703 sizeof(hex_buffer),
1702 human_buffer, 1704 human_buffer,
1703 sizeof(human_buffer), 1705 sizeof(human_buffer),
1704 pc); 1706 pc);
1705 pc += instruction_length; 1707 pc += instruction_length;
1706 } 1708 }
1707 } 1709 }
1708 1710
1709 } // namespace dart 1711 } // namespace dart
1710 1712
1711 #endif // defined TARGET_ARCH_IA32 1713 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/disassembler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698