| OLD | NEW |
| 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/compiler.h" | 5 #include "vm/compiler.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 function_fullname); | 305 function_fullname); |
| 306 const Code& code = Code::Handle(function.CurrentCode()); | 306 const Code& code = Code::Handle(function.CurrentCode()); |
| 307 const Instructions& instructions = | 307 const Instructions& instructions = |
| 308 Instructions::Handle(code.instructions()); | 308 Instructions::Handle(code.instructions()); |
| 309 uword start = instructions.EntryPoint(); | 309 uword start = instructions.EntryPoint(); |
| 310 Disassembler::Disassemble(start, | 310 Disassembler::Disassemble(start, |
| 311 start + instructions.size(), | 311 start + instructions.size(), |
| 312 code.comments()); | 312 code.comments()); |
| 313 OS::Print("}\n"); | 313 OS::Print("}\n"); |
| 314 OS::Print("Pointer offsets for function: {\n"); | 314 OS::Print("Pointer offsets for function: {\n"); |
| 315 // Pointer offsets are stored in descending order. | 315 for (intptr_t i = 0; i < code.pointer_offsets_length(); i++) { |
| 316 for (intptr_t i = code.pointer_offsets_length() - 1; i >= 0; i--) { | |
| 317 const uword addr = code.GetPointerOffsetAt(i) + code.EntryPoint(); | 316 const uword addr = code.GetPointerOffsetAt(i) + code.EntryPoint(); |
| 318 Object& obj = Object::Handle(); | 317 Object& obj = Object::Handle(); |
| 319 obj = *reinterpret_cast<RawObject**>(addr); | 318 obj = *reinterpret_cast<RawObject**>(addr); |
| 320 OS::Print(" %" PRIdPTR " : 0x%" PRIxPTR " '%s'\n", | 319 OS::Print(" %d : 0x%x '%s'\n", |
| 321 code.GetPointerOffsetAt(i), addr, obj.ToCString()); | 320 code.GetPointerOffsetAt(i), addr, obj.ToCString()); |
| 322 } | 321 } |
| 323 OS::Print("}\n"); | 322 OS::Print("}\n"); |
| 324 OS::Print("PC Descriptors for function '%s' {\n", function_fullname); | 323 OS::Print("PC Descriptors for function '%s' {\n", function_fullname); |
| 325 OS::Print("pc\t\tkind\tid\ttry-ix\ttoken-index\n"); | 324 OS::Print("(pc\t\tkind\tid\ttry-ix\ttoken-index)\n"); |
| 326 const PcDescriptors& descriptors = | 325 const PcDescriptors& descriptors = |
| 327 PcDescriptors::Handle(code.pc_descriptors()); | 326 PcDescriptors::Handle(code.pc_descriptors()); |
| 328 OS::Print("%s}\n", descriptors.ToCString()); | 327 OS::Print("%s", descriptors.ToCString()); |
| 328 OS::Print("}\n"); |
| 329 OS::Print("Variable Descriptors for function '%s' {\n", | 329 OS::Print("Variable Descriptors for function '%s' {\n", |
| 330 function_fullname); | 330 function_fullname); |
| 331 const LocalVarDescriptors& var_descriptors = | 331 const LocalVarDescriptors& var_descriptors = |
| 332 LocalVarDescriptors::Handle(code.var_descriptors()); | 332 LocalVarDescriptors::Handle(code.var_descriptors()); |
| 333 intptr_t var_desc_length = | 333 intptr_t var_desc_length = |
| 334 var_descriptors.IsNull() ? 0 : var_descriptors.Length(); | 334 var_descriptors.IsNull() ? 0 : var_descriptors.Length(); |
| 335 String& var_name = String::Handle(); | 335 String& var_name = String::Handle(); |
| 336 for (intptr_t i = 0; i < var_desc_length; i++) { | 336 for (intptr_t i = 0; i < var_desc_length; i++) { |
| 337 var_name = var_descriptors.GetName(i); | 337 var_name = var_descriptors.GetName(i); |
| 338 RawLocalVarDescriptors::VarInfo var_info; | 338 RawLocalVarDescriptors::VarInfo var_info; |
| 339 var_descriptors.GetInfo(i, &var_info); | 339 var_descriptors.GetInfo(i, &var_info); |
| 340 if (var_info.kind == RawLocalVarDescriptors::kContextChain) { | 340 if (var_info.kind == RawLocalVarDescriptors::kContextLevel) { |
| 341 OS::Print(" saved CTX reg offset %" PRIdPTR "\n", var_info.index); | 341 OS::Print(" context level %d scope %d (valid %d-%d)\n", |
| 342 } else { | 342 var_info.index, |
| 343 if (var_info.kind == RawLocalVarDescriptors::kContextLevel) { | 343 var_info.scope_id, |
| 344 OS::Print(" context level %" PRIdPTR " scope %d", | 344 var_info.begin_pos, |
| 345 var_info.index, var_info.scope_id); | 345 var_info.end_pos); |
| 346 } else if (var_info.kind == RawLocalVarDescriptors::kStackVar) { | 346 } else if (var_info.kind == RawLocalVarDescriptors::kContextChain) { |
| 347 OS::Print(" stack var '%s' offset %" PRIdPTR, | 347 OS::Print(" saved CTX reg offset %d\n", var_info.index); |
| 348 var_name.ToCString(), var_info.index); | 348 } else if (var_info.kind == RawLocalVarDescriptors::kStackVar) { |
| 349 } else { | 349 OS::Print(" stack var '%s' offset %d (valid %d-%d) \n", |
| 350 ASSERT(var_info.kind == RawLocalVarDescriptors::kContextVar); | 350 var_name.ToCString(), |
| 351 OS::Print(" context var '%s' level %d offset %" PRIdPTR, | 351 var_info.index, |
| 352 var_name.ToCString(), var_info.scope_id, var_info.index); | 352 var_info.begin_pos, |
| 353 } | 353 var_info.end_pos); |
| 354 OS::Print(" (valid %" PRIdPTR "-%" PRIdPTR ")\n", | 354 } else if (var_info.kind == RawLocalVarDescriptors::kContextVar) { |
| 355 var_info.begin_pos, var_info.end_pos); | 355 OS::Print(" context var '%s' level %d offset %d (valid %d-%d)\n", |
| 356 var_name.ToCString(), |
| 357 var_info.scope_id, |
| 358 var_info.index, |
| 359 var_info.begin_pos, |
| 360 var_info.end_pos); |
| 356 } | 361 } |
| 357 } | 362 } |
| 358 OS::Print("}\n"); | 363 OS::Print("}\n"); |
| 359 OS::Print("Exception Handlers for function '%s' {\n", function_fullname); | 364 OS::Print("Exception Handlers for function '%s' {\n", function_fullname); |
| 360 const ExceptionHandlers& handlers = | 365 const ExceptionHandlers& handlers = |
| 361 ExceptionHandlers::Handle(code.exception_handlers()); | 366 ExceptionHandlers::Handle(code.exception_handlers()); |
| 362 OS::Print("%s}\n", handlers.ToCString()); | 367 OS::Print("%s", handlers.ToCString()); |
| 368 OS::Print("}\n"); |
| 363 } | 369 } |
| 364 isolate->set_long_jump_base(base); | 370 isolate->set_long_jump_base(base); |
| 365 return Error::null(); | 371 return Error::null(); |
| 366 } else { | 372 } else { |
| 367 Error& error = Error::Handle(); | 373 Error& error = Error::Handle(); |
| 368 // We got an error during compilation. | 374 // We got an error during compilation. |
| 369 error = isolate->object_store()->sticky_error(); | 375 error = isolate->object_store()->sticky_error(); |
| 370 isolate->object_store()->clear_sticky_error(); | 376 isolate->object_store()->clear_sticky_error(); |
| 371 isolate->set_long_jump_base(base); | 377 isolate->set_long_jump_base(base); |
| 372 return error.raw(); | 378 return error.raw(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 isolate->object_store()->clear_sticky_error(); | 493 isolate->object_store()->clear_sticky_error(); |
| 488 isolate->set_long_jump_base(base); | 494 isolate->set_long_jump_base(base); |
| 489 return result.raw(); | 495 return result.raw(); |
| 490 } | 496 } |
| 491 UNREACHABLE(); | 497 UNREACHABLE(); |
| 492 return Object::null(); | 498 return Object::null(); |
| 493 } | 499 } |
| 494 | 500 |
| 495 | 501 |
| 496 } // namespace dart | 502 } // namespace dart |
| OLD | NEW |