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

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

Issue 2372973003: Fix too strict debug assertion in disassembler. (Closed)
Patch Set: Created 4 years, 2 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 | « 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) 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/disassembler.h" 5 #include "vm/disassembler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/deopt_instructions.h" 8 #include "vm/deopt_instructions.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/il_printer.h" 10 #include "vm/il_printer.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 jsarr_.AddValue(p); 98 jsarr_.AddValue(p);
99 jsarr_.AddValueNull(); 99 jsarr_.AddValueNull();
100 free(p); 100 free(p);
101 } 101 }
102 102
103 103
104 void Disassembler::Disassemble(uword start, 104 void Disassembler::Disassemble(uword start,
105 uword end, 105 uword end,
106 DisassemblyFormatter* formatter, 106 DisassemblyFormatter* formatter,
107 const Code& code) { 107 const Code& code) {
108 NoSafepointScope no_safepoint;
109 const Code::Comments& comments = 108 const Code::Comments& comments =
110 code.IsNull() ? Code::Comments::New(0) : code.comments(); 109 code.IsNull() ? Code::Comments::New(0) : code.comments();
111 ASSERT(formatter != NULL); 110 ASSERT(formatter != NULL);
112 char hex_buffer[kHexadecimalBufferSize]; // Instruction in hexadecimal form. 111 char hex_buffer[kHexadecimalBufferSize]; // Instruction in hexadecimal form.
113 char human_buffer[kUserReadableBufferSize]; // Human-readable instruction. 112 char human_buffer[kUserReadableBufferSize]; // Human-readable instruction.
114 uword pc = start; 113 uword pc = start;
115 intptr_t comment_finger = 0; 114 intptr_t comment_finger = 0;
116 GrowableArray<Function*> inlined_functions; 115 GrowableArray<Function*> inlined_functions;
117 while (pc < end) { 116 while (pc < end) {
118 const intptr_t offset = pc - start; 117 const intptr_t offset = pc - start;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 pc); 160 pc);
162 pc += instruction_length; 161 pc += instruction_length;
163 } 162 }
164 } 163 }
165 164
166 165
167 void Disassembler::DisassembleCodeHelper( 166 void Disassembler::DisassembleCodeHelper(
168 const char* function_fullname, const Code& code, bool optimized) { 167 const char* function_fullname, const Code& code, bool optimized) {
169 LocalVarDescriptors& var_descriptors = LocalVarDescriptors::Handle(); 168 LocalVarDescriptors& var_descriptors = LocalVarDescriptors::Handle();
170 if (FLAG_print_variable_descriptors) { 169 if (FLAG_print_variable_descriptors) {
171 // This flag is not on by default, and for debugging purposes only.
172 // Since this may allocate, do it outside the NoSafepointScope.
173 var_descriptors = code.GetLocalVarDescriptors(); 170 var_descriptors = code.GetLocalVarDescriptors();
174 } 171 }
175 NoSafepointScope no_safepoint;
176 THR_Print("Code for %sfunction '%s' {\n", 172 THR_Print("Code for %sfunction '%s' {\n",
177 optimized ? "optimized " : "", 173 optimized ? "optimized " : "",
178 function_fullname); 174 function_fullname);
179 code.Disassemble(); 175 code.Disassemble();
180 THR_Print("}\n"); 176 THR_Print("}\n");
181 177
182 #if defined(TARGET_ARCH_IA32) 178 #if defined(TARGET_ARCH_IA32)
183 THR_Print("Pointer offsets for function: {\n"); 179 THR_Print("Pointer offsets for function: {\n");
184 // Pointer offsets are stored in descending order. 180 // Pointer offsets are stored in descending order.
185 Object& obj = Object::Handle(); 181 Object& obj = Object::Handle();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 const Function& function, bool optimized) { 321 const Function& function, bool optimized) {
326 const char* function_fullname = function.ToFullyQualifiedCString(); 322 const char* function_fullname = function.ToFullyQualifiedCString();
327 const Code& code = Code::Handle(function.unoptimized_code()); 323 const Code& code = Code::Handle(function.unoptimized_code());
328 DisassembleCodeHelper(function_fullname, code, optimized); 324 DisassembleCodeHelper(function_fullname, code, optimized);
329 } 325 }
330 326
331 327
332 #endif // !PRODUCT 328 #endif // !PRODUCT
333 329
334 } // namespace dart 330 } // 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