| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_index_table.h" | 10 #include "vm/code_index_table.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // Unoptimized code. | 120 // Unoptimized code. |
| 121 if (Code::Handle(function.unoptimized_code()).IsNull()) { | 121 if (Code::Handle(function.unoptimized_code()).IsNull()) { |
| 122 ASSERT(Code::Handle(function.code()).IsNull()); | 122 ASSERT(Code::Handle(function.code()).IsNull()); |
| 123 // Compiling first time. | 123 // Compiling first time. |
| 124 CodeGenerator code_gen(&assembler, parsed_function); | 124 CodeGenerator code_gen(&assembler, parsed_function); |
| 125 code_gen.GenerateCode(); | 125 code_gen.GenerateCode(); |
| 126 const Code& code = | 126 const Code& code = |
| 127 Code::Handle(Code::FinalizeCode(function_fullname, &assembler)); | 127 Code::Handle(Code::FinalizeCode(function_fullname, &assembler)); |
| 128 code.set_is_optimized(false); | 128 code.set_is_optimized(false); |
| 129 code_gen.FinalizePcDescriptors(code); | 129 code_gen.FinalizePcDescriptors(code); |
| 130 code_gen.FinalizeVarDescriptors(code); |
| 130 code_gen.FinalizeExceptionHandlers(code); | 131 code_gen.FinalizeExceptionHandlers(code); |
| 131 function.set_unoptimized_code(code); | 132 function.set_unoptimized_code(code); |
| 132 function.SetCode(code); | 133 function.SetCode(code); |
| 133 ASSERT(CodePatcher::CodeIsPatchable(code)); | 134 ASSERT(CodePatcher::CodeIsPatchable(code)); |
| 134 code_index_table->AddFunction(function); | 135 code_index_table->AddFunction(function); |
| 135 } else { | 136 } else { |
| 136 // Disable optimized code. | 137 // Disable optimized code. |
| 137 const Code& optimized_code = Code::Handle(function.code()); | 138 const Code& optimized_code = Code::Handle(function.code()); |
| 138 ASSERT(optimized_code.is_optimized()); | 139 ASSERT(optimized_code.is_optimized()); |
| 139 CodePatcher::PatchEntry(Code::Handle(function.code())); | 140 CodePatcher::PatchEntry(Code::Handle(function.code())); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 kNoArgumentNames)); | 265 kNoArgumentNames)); |
| 265 if (result.IsUnhandledException()) { | 266 if (result.IsUnhandledException()) { |
| 266 // TODO(srdjan): implement proper exit from compiler. | 267 // TODO(srdjan): implement proper exit from compiler. |
| 267 UNIMPLEMENTED(); | 268 UNIMPLEMENTED(); |
| 268 } | 269 } |
| 269 return result.raw(); | 270 return result.raw(); |
| 270 } | 271 } |
| 271 | 272 |
| 272 | 273 |
| 273 } // namespace dart | 274 } // namespace dart |
| OLD | NEW |