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

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

Issue 10850017: Revert "Use platform-independent format specifiers when disassembling code objects." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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/compiler.cc ('k') | no next file » | 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 6583 matching lines...) Expand 10 before | Expand all | Expand 10 after
6594 } 6594 }
6595 UNREACHABLE(); 6595 UNREACHABLE();
6596 return ""; 6596 return "";
6597 } 6597 }
6598 6598
6599 6599
6600 const char* PcDescriptors::ToCString() const { 6600 const char* PcDescriptors::ToCString() const {
6601 if (Length() == 0) { 6601 if (Length() == 0) {
6602 return "No pc descriptors\n"; 6602 return "No pc descriptors\n";
6603 } 6603 }
6604 const char* kFormat = 6604 const char* kFormat = "0x%x\t%s\t%ld\t%ld\t%ld\n";
6605 "0x%" PRIxPTR "\t%s\t%" PRIdPTR "\t%" PRIdPTR "\t%" PRIdPTR "\n";
6606 // First compute the buffer size required. 6605 // First compute the buffer size required.
6607 intptr_t len = 1; // Trailing '\0'. 6606 intptr_t len = 0;
6608 for (intptr_t i = 0; i < Length(); i++) { 6607 for (intptr_t i = 0; i < Length(); i++) {
6609 len += OS::SNPrint(NULL, 0, kFormat, 6608 len += OS::SNPrint(NULL, 0, kFormat,
6610 PC(i), KindAsStr(i), NodeId(i), TryIndex(i), TokenIndex(i)); 6609 PC(i), KindAsStr(i), NodeId(i), TryIndex(i), TokenIndex(i));
6611 } 6610 }
6612 // Allocate the buffer. 6611 // Allocate the buffer.
6613 char* buffer = reinterpret_cast<char*>( 6612 char* buffer = reinterpret_cast<char*>(
6614 Isolate::Current()->current_zone()->Allocate(len)); 6613 Isolate::Current()->current_zone()->Allocate(len + 1));
6615 // Layout the fields in the buffer. 6614 // Layout the fields in the buffer.
6616 intptr_t index = 0; 6615 intptr_t index = 0;
6617 for (intptr_t i = 0; i < Length(); i++) { 6616 for (intptr_t i = 0; i < Length(); i++) {
6618 index += OS::SNPrint((buffer + index), (len - index), kFormat, 6617 index += OS::SNPrint((buffer + index), (len - index), kFormat,
6619 PC(i), KindAsStr(i), NodeId(i), TryIndex(i), TokenIndex(i)); 6618 PC(i), KindAsStr(i), NodeId(i), TryIndex(i), TokenIndex(i));
6620 } 6619 }
6621 return buffer; 6620 return buffer;
6622 } 6621 }
6623 6622
6624 6623
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
6864 } 6863 }
6865 return result.raw(); 6864 return result.raw();
6866 } 6865 }
6867 6866
6868 6867
6869 const char* ExceptionHandlers::ToCString() const { 6868 const char* ExceptionHandlers::ToCString() const {
6870 if (Length() == 0) { 6869 if (Length() == 0) {
6871 return "No exception handlers\n"; 6870 return "No exception handlers\n";
6872 } 6871 }
6873 // First compute the buffer size required. 6872 // First compute the buffer size required.
6874 const char* kFormat = "%" PRIdPTR " => 0x%" PRIxPTR "\n"; 6873 intptr_t len = 0;
6875 intptr_t len = 1; // Trailing '\0'.
6876 for (intptr_t i = 0; i < Length(); i++) { 6874 for (intptr_t i = 0; i < Length(); i++) {
6877 len += OS::SNPrint(NULL, 0, kFormat, TryIndex(i), HandlerPC(i)); 6875 len += OS::SNPrint(NULL, 0, "%ld => 0x%x\n",
6876 TryIndex(i), HandlerPC(i));
6878 } 6877 }
6879 // Allocate the buffer. 6878 // Allocate the buffer.
6880 char* buffer = reinterpret_cast<char*>( 6879 char* buffer = reinterpret_cast<char*>(
6881 Isolate::Current()->current_zone()->Allocate(len)); 6880 Isolate::Current()->current_zone()->Allocate(len + 1));
6882 // Layout the fields in the buffer. 6881 // Layout the fields in the buffer.
6883 intptr_t index = 0; 6882 intptr_t index = 0;
6884 for (intptr_t i = 0; i < Length(); i++) { 6883 for (intptr_t i = 0; i < Length(); i++) {
6885 index += OS::SNPrint((buffer + index), 6884 index += OS::SNPrint((buffer + index),
6886 (len - index), 6885 (len - index),
6887 kFormat, 6886 "%ld => 0x%x\n",
6888 TryIndex(i), 6887 TryIndex(i),
6889 HandlerPC(i)); 6888 HandlerPC(i));
6890 } 6889 }
6891 return buffer; 6890 return buffer;
6892 } 6891 }
6893 6892
6894 6893
6895 Code::Comments& Code::Comments::New(intptr_t count) { 6894 Code::Comments& Code::Comments::New(intptr_t count) {
6896 Comments* comments; 6895 Comments* comments;
6897 if (count < 0 || count > (kIntptrMax / kNumberOfEntries)) { 6896 if (count < 0 || count > (kIntptrMax / kNumberOfEntries)) {
(...skipping 4065 matching lines...) Expand 10 before | Expand all | Expand 10 after
10963 const String& str = String::Handle(pattern()); 10962 const String& str = String::Handle(pattern());
10964 const char* format = "JSRegExp: pattern=%s flags=%s"; 10963 const char* format = "JSRegExp: pattern=%s flags=%s";
10965 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 10964 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
10966 char* chars = reinterpret_cast<char*>( 10965 char* chars = reinterpret_cast<char*>(
10967 Isolate::Current()->current_zone()->Allocate(len + 1)); 10966 Isolate::Current()->current_zone()->Allocate(len + 1));
10968 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 10967 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
10969 return chars; 10968 return chars;
10970 } 10969 }
10971 10970
10972 } // namespace dart 10971 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698