| 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 OS::Print("Static call target functions {\n"); |
| 422 const Array& table = Array::Handle(code.static_calls_target_table()); |
| 423 Smi& offset = Smi::Handle(); |
| 424 Function& target = Function::Handle(); |
| 425 for (intptr_t i = 0; i < table.Length(); i += 2) { |
| 426 offset ^= table.At(i); |
| 427 target ^= table.At(i + 1); |
| 428 OS::Print(" 0x%"Px": %s\n", |
| 429 start + offset.Value(), target.ToFullyQualifiedCString()); |
| 430 } |
| 431 OS::Print("}\n"); |
| 419 } | 432 } |
| 420 | 433 |
| 421 | 434 |
| 422 static RawError* CompileFunctionHelper(const Function& function, | 435 static RawError* CompileFunctionHelper(const Function& function, |
| 423 bool optimized) { | 436 bool optimized) { |
| 424 Isolate* isolate = Isolate::Current(); | 437 Isolate* isolate = Isolate::Current(); |
| 425 LongJump* base = isolate->long_jump_base(); | 438 LongJump* base = isolate->long_jump_base(); |
| 426 LongJump jump; | 439 LongJump jump; |
| 427 isolate->set_long_jump_base(&jump); | 440 isolate->set_long_jump_base(&jump); |
| 428 // Skips parsing if we need to only install unoptimized code. | 441 // 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(); | 620 result = isolate->object_store()->sticky_error(); |
| 608 isolate->object_store()->clear_sticky_error(); | 621 isolate->object_store()->clear_sticky_error(); |
| 609 isolate->set_long_jump_base(base); | 622 isolate->set_long_jump_base(base); |
| 610 return result.raw(); | 623 return result.raw(); |
| 611 } | 624 } |
| 612 UNREACHABLE(); | 625 UNREACHABLE(); |
| 613 return Object::null(); | 626 return Object::null(); |
| 614 } | 627 } |
| 615 | 628 |
| 616 } // namespace dart | 629 } // namespace dart |
| OLD | NEW |