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

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

Issue 1005523003: Fix printing disassembly. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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 | 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/cpu.h" 10 #include "vm/cpu.h"
(...skipping 10584 matching lines...) Expand 10 before | Expand all | Expand 10 after
10595 UNREACHABLE(); 10595 UNREACHABLE();
10596 return ""; 10596 return "";
10597 } 10597 }
10598 10598
10599 10599
10600 void PcDescriptors::PrintHeaderString() { 10600 void PcDescriptors::PrintHeaderString() {
10601 // 4 bits per hex digit + 2 for "0x". 10601 // 4 bits per hex digit + 2 for "0x".
10602 const int addr_width = (kBitsPerWord / 4) + 2; 10602 const int addr_width = (kBitsPerWord / 4) + 2;
10603 // "*" in a printf format specifier tells it to read the field width from 10603 // "*" in a printf format specifier tells it to read the field width from
10604 // the printf argument list. 10604 // the printf argument list.
10605 OS::Print("%-*s\tkind \tdeopt-id\ttok-ix\ttry-ix\n", 10605 ISL_Print("%-*s\tkind \tdeopt-id\ttok-ix\ttry-ix\n",
10606 addr_width, "pc"); 10606 addr_width, "pc");
10607 } 10607 }
10608 10608
10609 10609
10610 const char* PcDescriptors::ToCString() const { 10610 const char* PcDescriptors::ToCString() const {
10611 if (Length() == 0) { 10611 if (Length() == 0) {
10612 return "No pc descriptors\n"; 10612 return "No pc descriptors\n";
10613 } 10613 }
10614 // 4 bits per hex digit. 10614 // 4 bits per hex digit.
10615 const int addr_width = kBitsPerWord / 4; 10615 const int addr_width = kBitsPerWord / 4;
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
11115 Type& type = Type::Handle(); 11115 Type& type = Type::Handle();
11116 RawExceptionHandlers::HandlerInfo info; 11116 RawExceptionHandlers::HandlerInfo info;
11117 // First compute the buffer size required. 11117 // First compute the buffer size required.
11118 const char* kFormat = "%" Pd " => %#" Px " (%" Pd 11118 const char* kFormat = "%" Pd " => %#" Px " (%" Pd
11119 " types) (outer %" Pd ")\n"; 11119 " types) (outer %" Pd ")\n";
11120 const char* kFormat2 = " %d. %s\n"; 11120 const char* kFormat2 = " %d. %s\n";
11121 intptr_t len = 1; // Trailing '\0'. 11121 intptr_t len = 1; // Trailing '\0'.
11122 for (intptr_t i = 0; i < num_entries(); i++) { 11122 for (intptr_t i = 0; i < num_entries(); i++) {
11123 GetHandlerInfo(i, &info); 11123 GetHandlerInfo(i, &info);
11124 handled_types = GetHandledTypes(i); 11124 handled_types = GetHandledTypes(i);
11125 ASSERT(!handled_types.IsNull()); 11125 const intptr_t num_types =
11126 const intptr_t num_types = handled_types.Length(); 11126 handled_types.IsNull() ? 0 : handled_types.Length();
11127 len += OS::SNPrint(NULL, 0, kFormat, 11127 len += OS::SNPrint(NULL, 0, kFormat,
11128 i, 11128 i,
11129 info.handler_pc_offset, 11129 info.handler_pc_offset,
11130 num_types, 11130 num_types,
11131 info.outer_try_index); 11131 info.outer_try_index);
11132 for (int k = 0; k < num_types; k++) { 11132 for (int k = 0; k < num_types; k++) {
11133 type ^= handled_types.At(k); 11133 type ^= handled_types.At(k);
11134 ASSERT(!type.IsNull()); 11134 ASSERT(!type.IsNull());
11135 len += OS::SNPrint(NULL, 0, kFormat2, k, type.ToCString()); 11135 len += OS::SNPrint(NULL, 0, kFormat2, k, type.ToCString());
11136 } 11136 }
11137 } 11137 }
11138 // Allocate the buffer. 11138 // Allocate the buffer.
11139 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len); 11139 char* buffer = Isolate::Current()->current_zone()->Alloc<char>(len);
11140 // Layout the fields in the buffer. 11140 // Layout the fields in the buffer.
11141 intptr_t num_chars = 0; 11141 intptr_t num_chars = 0;
11142 for (intptr_t i = 0; i < num_entries(); i++) { 11142 for (intptr_t i = 0; i < num_entries(); i++) {
11143 GetHandlerInfo(i, &info); 11143 GetHandlerInfo(i, &info);
11144 handled_types = GetHandledTypes(i); 11144 handled_types = GetHandledTypes(i);
11145 const intptr_t num_types = handled_types.Length(); 11145 const intptr_t num_types =
11146 handled_types.IsNull() ? 0 : handled_types.Length();
11146 num_chars += OS::SNPrint((buffer + num_chars), 11147 num_chars += OS::SNPrint((buffer + num_chars),
11147 (len - num_chars), 11148 (len - num_chars),
11148 kFormat, 11149 kFormat,
11149 i, 11150 i,
11150 info.handler_pc_offset, 11151 info.handler_pc_offset,
11151 num_types, 11152 num_types,
11152 info.outer_try_index); 11153 info.outer_try_index);
11153 for (int k = 0; k < num_types; k++) { 11154 for (int k = 0; k < num_types; k++) {
11154 type ^= handled_types.At(k); 11155 type ^= handled_types.At(k);
11155 num_chars += OS::SNPrint((buffer + num_chars), 11156 num_chars += OS::SNPrint((buffer + num_chars),
(...skipping 9592 matching lines...) Expand 10 before | Expand all | Expand 10 after
20748 return tag_label.ToCString(); 20749 return tag_label.ToCString();
20749 } 20750 }
20750 20751
20751 20752
20752 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20753 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20753 Instance::PrintJSONImpl(stream, ref); 20754 Instance::PrintJSONImpl(stream, ref);
20754 } 20755 }
20755 20756
20756 20757
20757 } // namespace dart 20758 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698