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

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

Issue 1331623002: Uses SNPRINT macro where possible. Otherwise uses #define for format. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add missing include Created 5 years, 3 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
« no previous file with comments | « runtime/vm/disassembler_ia32.cc ('k') | runtime/vm/isolate.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_X64) 8 #if defined(TARGET_ARCH_X64)
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 obj.IsBool() || 789 obj.IsBool() ||
790 obj.IsClass() || 790 obj.IsClass() ||
791 obj.IsFunction() || 791 obj.IsFunction() ||
792 obj.IsICData() || 792 obj.IsICData() ||
793 obj.IsField()) { 793 obj.IsField()) {
794 return obj.ToCString(); 794 return obj.ToCString();
795 } 795 }
796 796
797 const Class& clazz = Class::Handle(obj.clazz()); 797 const Class& clazz = Class::Handle(obj.clazz());
798 const char* full_class_name = clazz.ToCString(); 798 const char* full_class_name = clazz.ToCString();
799 const char* format = "instance of %s"; 799 return OS::SCreate(Thread::Current()->zone(),
800 intptr_t len = OS::SNPrint(NULL, 0, format, full_class_name) + 1; 800 "instance of %s", full_class_name);
801 char* chars = Thread::Current()->zone()->Alloc<char>(len);
802 OS::SNPrint(chars, len, format, full_class_name);
803 return chars;
804 } 801 }
805 802
806 803
807 void DisassemblerX64::AppendAddressToBuffer(uint8_t* addr_byte_ptr) { 804 void DisassemblerX64::AppendAddressToBuffer(uint8_t* addr_byte_ptr) {
808 uword addr = reinterpret_cast<uword>(addr_byte_ptr); 805 uword addr = reinterpret_cast<uword>(addr_byte_ptr);
809 AppendToBuffer("%#" Px "", addr); 806 AppendToBuffer("%#" Px "", addr);
810 // Try to print as heap object or stub name 807 // Try to print as heap object or stub name
811 if (((addr & kSmiTagMask) == kHeapObjectTag) && 808 if (((addr & kSmiTagMask) == kHeapObjectTag) &&
812 reinterpret_cast<RawObject*>(addr)->IsWellFormed() && 809 reinterpret_cast<RawObject*>(addr)->IsWellFormed() &&
813 reinterpret_cast<RawObject*>(addr)->IsOldObject() && 810 reinterpret_cast<RawObject*>(addr)->IsOldObject() &&
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 } 1949 }
1953 hex_buffer[hex_index] = '\0'; 1950 hex_buffer[hex_index] = '\0';
1954 if (out_instr_len) { 1951 if (out_instr_len) {
1955 *out_instr_len = instruction_length; 1952 *out_instr_len = instruction_length;
1956 } 1953 }
1957 } 1954 }
1958 1955
1959 } // namespace dart 1956 } // namespace dart
1960 1957
1961 #endif // defined TARGET_ARCH_X64 1958 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/disassembler_ia32.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698