OLD | NEW |
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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 if (code.stackmaps() != Array::null()) { | 243 if (code.stackmaps() != Array::null()) { |
244 const Array& stackmap_table = Array::Handle(code.stackmaps()); | 244 const Array& stackmap_table = Array::Handle(code.stackmaps()); |
245 Stackmap& map = Stackmap::Handle(); | 245 Stackmap& map = Stackmap::Handle(); |
246 for (intptr_t i = 0; i < stackmap_table.Length(); ++i) { | 246 for (intptr_t i = 0; i < stackmap_table.Length(); ++i) { |
247 map ^= stackmap_table.At(i); | 247 map ^= stackmap_table.At(i); |
248 THR_Print("%s\n", map.ToCString()); | 248 THR_Print("%s\n", map.ToCString()); |
249 } | 249 } |
250 } | 250 } |
251 THR_Print("}\n"); | 251 THR_Print("}\n"); |
252 | 252 |
253 THR_Print("Variable Descriptors for function '%s' {\n", | 253 if (FLAG_print_variable_descriptors) { |
254 function_fullname); | 254 THR_Print("Variable Descriptors for function '%s' {\n", |
255 const LocalVarDescriptors& var_descriptors = | 255 function_fullname); |
256 LocalVarDescriptors::Handle(code.GetLocalVarDescriptors()); | 256 const LocalVarDescriptors& var_descriptors = |
257 intptr_t var_desc_length = | 257 LocalVarDescriptors::Handle(code.GetLocalVarDescriptors()); |
258 var_descriptors.IsNull() ? 0 : var_descriptors.Length(); | 258 intptr_t var_desc_length = |
259 String& var_name = String::Handle(); | 259 var_descriptors.IsNull() ? 0 : var_descriptors.Length(); |
260 for (intptr_t i = 0; i < var_desc_length; i++) { | 260 String& var_name = String::Handle(); |
261 var_name = var_descriptors.GetName(i); | 261 for (intptr_t i = 0; i < var_desc_length; i++) { |
262 RawLocalVarDescriptors::VarInfo var_info; | 262 var_name = var_descriptors.GetName(i); |
263 var_descriptors.GetInfo(i, &var_info); | 263 RawLocalVarDescriptors::VarInfo var_info; |
264 const int8_t kind = var_info.kind(); | 264 var_descriptors.GetInfo(i, &var_info); |
265 if (kind == RawLocalVarDescriptors::kSavedCurrentContext) { | 265 const int8_t kind = var_info.kind(); |
266 THR_Print(" saved current CTX reg offset %d\n", var_info.index()); | 266 if (kind == RawLocalVarDescriptors::kSavedCurrentContext) { |
267 } else { | 267 THR_Print(" saved current CTX reg offset %d\n", var_info.index()); |
268 if (kind == RawLocalVarDescriptors::kContextLevel) { | |
269 THR_Print(" context level %d scope %d", var_info.index(), | |
270 var_info.scope_id); | |
271 } else if (kind == RawLocalVarDescriptors::kStackVar) { | |
272 THR_Print(" stack var '%s' offset %d", | |
273 var_name.ToCString(), var_info.index()); | |
274 } else { | 268 } else { |
275 ASSERT(kind == RawLocalVarDescriptors::kContextVar); | 269 if (kind == RawLocalVarDescriptors::kContextLevel) { |
276 THR_Print(" context var '%s' level %d offset %d", | 270 THR_Print(" context level %d scope %d", var_info.index(), |
277 var_name.ToCString(), var_info.scope_id, var_info.index()); | 271 var_info.scope_id); |
| 272 } else if (kind == RawLocalVarDescriptors::kStackVar) { |
| 273 THR_Print(" stack var '%s' offset %d", |
| 274 var_name.ToCString(), var_info.index()); |
| 275 } else { |
| 276 ASSERT(kind == RawLocalVarDescriptors::kContextVar); |
| 277 THR_Print(" context var '%s' level %d offset %d", |
| 278 var_name.ToCString(), var_info.scope_id, var_info.index()); |
| 279 } |
| 280 THR_Print(" (valid %s-%s)\n", var_info.begin_pos.ToCString(), |
| 281 var_info.end_pos.ToCString()); |
278 } | 282 } |
279 THR_Print(" (valid %s-%s)\n", var_info.begin_pos.ToCString(), | |
280 var_info.end_pos.ToCString()); | |
281 } | 283 } |
| 284 THR_Print("}\n"); |
282 } | 285 } |
283 THR_Print("}\n"); | |
284 | 286 |
285 THR_Print("Exception Handlers for function '%s' {\n", function_fullname); | 287 THR_Print("Exception Handlers for function '%s' {\n", function_fullname); |
286 const ExceptionHandlers& handlers = | 288 const ExceptionHandlers& handlers = |
287 ExceptionHandlers::Handle(code.exception_handlers()); | 289 ExceptionHandlers::Handle(code.exception_handlers()); |
288 THR_Print("%s}\n", handlers.ToCString()); | 290 THR_Print("%s}\n", handlers.ToCString()); |
289 | 291 |
290 { | 292 { |
291 THR_Print("Static call target functions {\n"); | 293 THR_Print("Static call target functions {\n"); |
292 const Array& table = Array::Handle(code.static_calls_target_table()); | 294 const Array& table = Array::Handle(code.static_calls_target_table()); |
293 Smi& offset = Smi::Handle(); | 295 Smi& offset = Smi::Handle(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 const Function& function, bool optimized) { | 341 const Function& function, bool optimized) { |
340 const char* function_fullname = function.ToFullyQualifiedCString(); | 342 const char* function_fullname = function.ToFullyQualifiedCString(); |
341 const Code& code = Code::Handle(function.unoptimized_code()); | 343 const Code& code = Code::Handle(function.unoptimized_code()); |
342 DisassembleCodeHelper(function_fullname, code, optimized); | 344 DisassembleCodeHelper(function_fullname, code, optimized); |
343 } | 345 } |
344 | 346 |
345 | 347 |
346 #endif // !PRODUCT | 348 #endif // !PRODUCT |
347 | 349 |
348 } // namespace dart | 350 } // namespace dart |
OLD | NEW |