| 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 | 8 |
| 9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
| 10 #include "vm/code_generator.h" | 10 #include "vm/code_generator.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 const Function& function = parsed_function.function(); | 270 const Function& function = parsed_function.function(); |
| 271 const Code& code = Code::Handle( | 271 const Code& code = Code::Handle( |
| 272 Code::FinalizeCode(function, &assembler, optimized)); | 272 Code::FinalizeCode(function, &assembler, optimized)); |
| 273 code.set_is_optimized(optimized); | 273 code.set_is_optimized(optimized); |
| 274 graph_compiler.FinalizePcDescriptors(code); | 274 graph_compiler.FinalizePcDescriptors(code); |
| 275 graph_compiler.FinalizeDeoptInfo(code); | 275 graph_compiler.FinalizeDeoptInfo(code); |
| 276 graph_compiler.FinalizeStackmaps(code); | 276 graph_compiler.FinalizeStackmaps(code); |
| 277 graph_compiler.FinalizeVarDescriptors(code); | 277 graph_compiler.FinalizeVarDescriptors(code); |
| 278 graph_compiler.FinalizeExceptionHandlers(code); | 278 graph_compiler.FinalizeExceptionHandlers(code); |
| 279 graph_compiler.FinalizeComments(code); | 279 graph_compiler.FinalizeComments(code); |
| 280 graph_compiler.FinalizeStaticCallTargetsTable(code); |
| 280 if (optimized) { | 281 if (optimized) { |
| 281 CodePatcher::PatchEntry(Code::Handle(function.CurrentCode())); | 282 CodePatcher::PatchEntry(Code::Handle(function.CurrentCode())); |
| 282 function.SetCode(code); | 283 function.SetCode(code); |
| 283 if (FLAG_trace_compiler) { | 284 if (FLAG_trace_compiler) { |
| 284 OS::Print("--> patching entry %#"Px"\n", | 285 OS::Print("--> patching entry %#"Px"\n", |
| 285 Code::Handle(function.unoptimized_code()).EntryPoint()); | 286 Code::Handle(function.unoptimized_code()).EntryPoint()); |
| 286 } | 287 } |
| 287 } else { | 288 } else { |
| 288 function.set_unoptimized_code(code); | 289 function.set_unoptimized_code(code); |
| 289 function.SetCode(code); | 290 function.SetCode(code); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 OS::Print(" (valid %"Pd"-%"Pd")\n", | 410 OS::Print(" (valid %"Pd"-%"Pd")\n", |
| 410 var_info.begin_pos, var_info.end_pos); | 411 var_info.begin_pos, var_info.end_pos); |
| 411 } | 412 } |
| 412 } | 413 } |
| 413 OS::Print("}\n"); | 414 OS::Print("}\n"); |
| 414 | 415 |
| 415 OS::Print("Exception Handlers for function '%s' {\n", function_fullname); | 416 OS::Print("Exception Handlers for function '%s' {\n", function_fullname); |
| 416 const ExceptionHandlers& handlers = | 417 const ExceptionHandlers& handlers = |
| 417 ExceptionHandlers::Handle(code.exception_handlers()); | 418 ExceptionHandlers::Handle(code.exception_handlers()); |
| 418 OS::Print("%s}\n", handlers.ToCString()); | 419 OS::Print("%s}\n", handlers.ToCString()); |
| 420 |
| 421 { |
| 422 OS::Print("Static call target functions {\n"); |
| 423 const Array& table = Array::Handle(code.static_calls_target_table()); |
| 424 Smi& offset = Smi::Handle(); |
| 425 Function& function = Function::Handle(); |
| 426 Code& code = Code::Handle(); |
| 427 for (intptr_t i = 0; i < table.Length(); |
| 428 i += Code::kSCallTableEntryLength) { |
| 429 offset ^= table.At(i + Code::kSCallTableOffsetEntry); |
| 430 function ^= table.At(i + Code::kSCallTableFunctionEntry); |
| 431 code ^= table.At(i + Code::kSCallTableCodeEntry); |
| 432 OS::Print(" 0x%"Px": %s, %p\n", |
| 433 start + offset.Value(), |
| 434 function.ToFullyQualifiedCString(), |
| 435 code.raw()); |
| 436 } |
| 437 OS::Print("}\n"); |
| 438 } |
| 419 } | 439 } |
| 420 | 440 |
| 421 | 441 |
| 422 static RawError* CompileFunctionHelper(const Function& function, | 442 static RawError* CompileFunctionHelper(const Function& function, |
| 423 bool optimized) { | 443 bool optimized) { |
| 424 Isolate* isolate = Isolate::Current(); | 444 Isolate* isolate = Isolate::Current(); |
| 425 LongJump* base = isolate->long_jump_base(); | 445 LongJump* base = isolate->long_jump_base(); |
| 426 LongJump jump; | 446 LongJump jump; |
| 427 isolate->set_long_jump_base(&jump); | 447 isolate->set_long_jump_base(&jump); |
| 428 // Skips parsing if we need to only install unoptimized code. | 448 // Skips parsing if we need to only install unoptimized code. |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 result = isolate->object_store()->sticky_error(); | 627 result = isolate->object_store()->sticky_error(); |
| 608 isolate->object_store()->clear_sticky_error(); | 628 isolate->object_store()->clear_sticky_error(); |
| 609 isolate->set_long_jump_base(base); | 629 isolate->set_long_jump_base(base); |
| 610 return result.raw(); | 630 return result.raw(); |
| 611 } | 631 } |
| 612 UNREACHABLE(); | 632 UNREACHABLE(); |
| 613 return Object::null(); | 633 return Object::null(); |
| 614 } | 634 } |
| 615 | 635 |
| 616 } // namespace dart | 636 } // namespace dart |
| OLD | NEW |