| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 return error.raw(); | 92 return error.raw(); |
| 93 } | 93 } |
| 94 UNREACHABLE(); | 94 UNREACHABLE(); |
| 95 return Error::null(); | 95 return Error::null(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 | 98 |
| 99 static void InstallUnoptimizedCode(const Function& function) { | 99 static void InstallUnoptimizedCode(const Function& function) { |
| 100 // Disable optimized code. | 100 // Disable optimized code. |
| 101 ASSERT(function.HasOptimizedCode()); | 101 ASSERT(function.HasOptimizedCode()); |
| 102 // Patch entry of optimized code. | |
| 103 CodePatcher::PatchEntry(Code::Handle(function.CurrentCode())); | |
| 104 if (FLAG_trace_compiler) { | 102 if (FLAG_trace_compiler) { |
| 105 OS::Print("--> patching entry %#"Px"\n", | 103 OS::Print("--> patching entry %#"Px"\n", |
| 106 Code::Handle(function.CurrentCode()).EntryPoint()); | 104 Code::Handle(function.CurrentCode()).EntryPoint()); |
| 107 } | 105 } |
| 108 // Use previously compiled code. | 106 function.SwitchToUnoptimizedCode(); |
| 109 function.SetCode(Code::Handle(function.unoptimized_code())); | |
| 110 CodePatcher::RestoreEntry(Code::Handle(function.unoptimized_code())); | |
| 111 if (FLAG_trace_compiler) { | 107 if (FLAG_trace_compiler) { |
| 112 OS::Print("--> restoring entry at %#"Px"\n", | 108 OS::Print("--> restoring entry at %#"Px"\n", |
| 113 Code::Handle(function.unoptimized_code()).EntryPoint()); | 109 Code::Handle(function.unoptimized_code()).EntryPoint()); |
| 114 } | 110 } |
| 115 } | 111 } |
| 116 | 112 |
| 117 | 113 |
| 118 // Return false if bailed out. | 114 // Return false if bailed out. |
| 119 static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function, | 115 static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function, |
| 120 bool optimized) { | 116 bool optimized) { |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 result = isolate->object_store()->sticky_error(); | 605 result = isolate->object_store()->sticky_error(); |
| 610 isolate->object_store()->clear_sticky_error(); | 606 isolate->object_store()->clear_sticky_error(); |
| 611 isolate->set_long_jump_base(base); | 607 isolate->set_long_jump_base(base); |
| 612 return result.raw(); | 608 return result.raw(); |
| 613 } | 609 } |
| 614 UNREACHABLE(); | 610 UNREACHABLE(); |
| 615 return Object::null(); | 611 return Object::null(); |
| 616 } | 612 } |
| 617 | 613 |
| 618 } // namespace dart | 614 } // namespace dart |
| OLD | NEW |