Chromium Code Reviews| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 graph_compiler.CompileGraph(); | 210 graph_compiler.CompileGraph(); |
| 211 } | 211 } |
| 212 { | 212 { |
| 213 TimerScope timer(FLAG_compiler_stats, | 213 TimerScope timer(FLAG_compiler_stats, |
| 214 &CompilerStats::codefinalizer_timer, | 214 &CompilerStats::codefinalizer_timer, |
| 215 isolate); | 215 isolate); |
| 216 const Function& function = parsed_function.function(); | 216 const Function& function = parsed_function.function(); |
| 217 const Code& code = Code::Handle(Code::FinalizeCode(function, &assembler)); | 217 const Code& code = Code::Handle(Code::FinalizeCode(function, &assembler)); |
| 218 code.set_is_optimized(optimized); | 218 code.set_is_optimized(optimized); |
| 219 graph_compiler.FinalizePcDescriptors(code); | 219 graph_compiler.FinalizePcDescriptors(code); |
| 220 graph_compiler.FinalizeDeoptInfo(code); | |
| 220 graph_compiler.FinalizeStackmaps(code); | 221 graph_compiler.FinalizeStackmaps(code); |
| 221 graph_compiler.FinalizeVarDescriptors(code); | 222 graph_compiler.FinalizeVarDescriptors(code); |
| 222 graph_compiler.FinalizeExceptionHandlers(code); | 223 graph_compiler.FinalizeExceptionHandlers(code); |
| 223 graph_compiler.FinalizeComments(code); | 224 graph_compiler.FinalizeComments(code); |
| 224 if (optimized) { | 225 if (optimized) { |
| 225 function.SetCode(code); | 226 function.SetCode(code); |
| 226 CodePatcher::PatchEntry(Code::Handle(function.unoptimized_code())); | 227 CodePatcher::PatchEntry(Code::Handle(function.unoptimized_code())); |
| 227 if (FLAG_trace_compiler) { | 228 if (FLAG_trace_compiler) { |
| 228 OS::Print("--> patching entry 0x%x\n", | 229 OS::Print("--> patching entry 0x%x\n", |
| 229 Code::Handle(function.unoptimized_code()).EntryPoint()); | 230 Code::Handle(function.unoptimized_code()).EntryPoint()); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 314 OS::Print("Pointer offsets for function: {\n"); | 315 OS::Print("Pointer offsets for function: {\n"); |
| 315 for (intptr_t i = 0; i < code.pointer_offsets_length(); i++) { | 316 for (intptr_t i = 0; i < code.pointer_offsets_length(); i++) { |
| 316 const uword addr = code.GetPointerOffsetAt(i) + code.EntryPoint(); | 317 const uword addr = code.GetPointerOffsetAt(i) + code.EntryPoint(); |
| 317 Object& obj = Object::Handle(); | 318 Object& obj = Object::Handle(); |
| 318 obj = *reinterpret_cast<RawObject**>(addr); | 319 obj = *reinterpret_cast<RawObject**>(addr); |
| 319 OS::Print(" %d : 0x%x '%s'\n", | 320 OS::Print(" %d : 0x%x '%s'\n", |
| 320 code.GetPointerOffsetAt(i), addr, obj.ToCString()); | 321 code.GetPointerOffsetAt(i), addr, obj.ToCString()); |
| 321 } | 322 } |
| 322 OS::Print("}\n"); | 323 OS::Print("}\n"); |
| 323 OS::Print("PC Descriptors for function '%s' {\n", function_fullname); | 324 OS::Print("PC Descriptors for function '%s' {\n", function_fullname); |
| 324 OS::Print("(pc\t\tkind\tid\ttry-ix\ttoken-index)\n"); | 325 OS::Print("(pc\t\tkind\t\tid\ttok-ix\ttry/deopt-ix)\n"); |
| 325 const PcDescriptors& descriptors = | 326 const PcDescriptors& descriptors = |
| 326 PcDescriptors::Handle(code.pc_descriptors()); | 327 PcDescriptors::Handle(code.pc_descriptors()); |
| 327 OS::Print("%s", descriptors.ToCString()); | 328 OS::Print("%s", descriptors.ToCString()); |
| 328 OS::Print("}\n"); | 329 OS::Print("\n}\n"); |
|
siva
2012/08/04 01:21:50
Could you move the \n to %s\n" above so that this
srdjan
2012/08/06 20:09:05
Done.
| |
| 330 const Array& deopt_info_array = Array::Handle(code.deopt_info_array()); | |
| 331 if (deopt_info_array.Length() > 0) { | |
| 332 OS::Print("DeoptInfo: {\n"); | |
| 333 for (intptr_t i = 0; i < deopt_info_array.Length(); i++) { | |
| 334 OS::Print(" %d: %s\n", | |
| 335 i, Object::Handle(deopt_info_array.At(i)).ToCString()); | |
| 336 } | |
| 337 OS::Print("}\n"); | |
| 338 } | |
| 339 const Array& object_table = Array::Handle(code.object_table()); | |
| 340 if (object_table.Length() > 0) { | |
| 341 OS::Print("Object Table: {\n"); | |
| 342 for (intptr_t i = 0; i < object_table.Length(); i++) { | |
| 343 OS::Print(" %d: %s\n", i, | |
| 344 Object::Handle(object_table.At(i)).ToCString()); | |
| 345 } | |
| 346 OS::Print("}\n"); | |
| 347 } | |
| 329 OS::Print("Variable Descriptors for function '%s' {\n", | 348 OS::Print("Variable Descriptors for function '%s' {\n", |
| 330 function_fullname); | 349 function_fullname); |
| 331 const LocalVarDescriptors& var_descriptors = | 350 const LocalVarDescriptors& var_descriptors = |
| 332 LocalVarDescriptors::Handle(code.var_descriptors()); | 351 LocalVarDescriptors::Handle(code.var_descriptors()); |
| 333 intptr_t var_desc_length = | 352 intptr_t var_desc_length = |
| 334 var_descriptors.IsNull() ? 0 : var_descriptors.Length(); | 353 var_descriptors.IsNull() ? 0 : var_descriptors.Length(); |
| 335 String& var_name = String::Handle(); | 354 String& var_name = String::Handle(); |
| 336 for (intptr_t i = 0; i < var_desc_length; i++) { | 355 for (intptr_t i = 0; i < var_desc_length; i++) { |
| 337 var_name = var_descriptors.GetName(i); | 356 var_name = var_descriptors.GetName(i); |
| 338 RawLocalVarDescriptors::VarInfo var_info; | 357 RawLocalVarDescriptors::VarInfo var_info; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 Object& result = Object::Handle(); | 508 Object& result = Object::Handle(); |
| 490 result = isolate->object_store()->sticky_error(); | 509 result = isolate->object_store()->sticky_error(); |
| 491 isolate->object_store()->clear_sticky_error(); | 510 isolate->object_store()->clear_sticky_error(); |
| 492 isolate->set_long_jump_base(base); | 511 isolate->set_long_jump_base(base); |
| 493 return result.raw(); | 512 return result.raw(); |
| 494 } | 513 } |
| 495 UNREACHABLE(); | 514 UNREACHABLE(); |
| 496 return Object::null(); | 515 return Object::null(); |
| 497 } | 516 } |
| 498 | 517 |
| 499 | |
| 500 } // namespace dart | 518 } // namespace dart |
| OLD | NEW |