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/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/code_generator.h" | 8 #include "vm/code_generator.h" |
9 | 9 |
10 #include "lib/error.h" | 10 #include "lib/error.h" |
11 #include "vm/ast_printer.h" | 11 #include "vm/ast_printer.h" |
12 #include "vm/class_finalizer.h" | 12 #include "vm/class_finalizer.h" |
13 #include "vm/dart_entry.h" | 13 #include "vm/dart_entry.h" |
14 #include "vm/debugger.h" | 14 #include "vm/debugger.h" |
15 #include "vm/flow_graph_builder.h" | |
15 #include "vm/ic_data.h" | 16 #include "vm/ic_data.h" |
16 #include "vm/longjump.h" | 17 #include "vm/longjump.h" |
17 #include "vm/object.h" | 18 #include "vm/object.h" |
18 #include "vm/object_store.h" | 19 #include "vm/object_store.h" |
19 #include "vm/parser.h" | 20 #include "vm/parser.h" |
20 #include "vm/resolver.h" | 21 #include "vm/resolver.h" |
21 #include "vm/stub_code.h" | 22 #include "vm/stub_code.h" |
22 | 23 |
23 namespace dart { | 24 namespace dart { |
24 | 25 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 | 196 |
196 | 197 |
197 bool CodeGenerator::IsResultNeeded(AstNode* node) const { | 198 bool CodeGenerator::IsResultNeeded(AstNode* node) const { |
198 return !state()->IsRootNode(node); | 199 return !state()->IsRootNode(node); |
199 } | 200 } |
200 | 201 |
201 | 202 |
202 // NOTE: First 5 bytes of the code may be patched with a jump instruction. Do | 203 // NOTE: First 5 bytes of the code may be patched with a jump instruction. Do |
203 // not emit any objects in the first 5 bytes. | 204 // not emit any objects in the first 5 bytes. |
204 void CodeGenerator::GenerateCode() { | 205 void CodeGenerator::GenerateCode() { |
206 FlowGraphBuilder graph_builder(parsed_function()); | |
207 graph_builder.BuildGraph(); | |
srdjan
2012/02/16 14:14:34
You want to decouple FlowGraphBuilder from old com
Kevin Millikin (Google)
2012/02/20 14:50:19
Done.
| |
208 | |
205 CodeGeneratorState codegen_state(this); | 209 CodeGeneratorState codegen_state(this); |
206 if (FLAG_print_scopes && FLAG_print_ast) { | 210 if (FLAG_print_scopes && FLAG_print_ast) { |
207 // Print the function scope before code generation. | 211 // Print the function scope before code generation. |
208 AstPrinter::PrintFunctionScope(parsed_function_); | 212 AstPrinter::PrintFunctionScope(parsed_function_); |
209 } | 213 } |
210 if (FLAG_print_ast) { | 214 if (FLAG_print_ast) { |
211 // Print the function ast before code generation. | 215 // Print the function ast before code generation. |
212 AstPrinter::PrintFunctionNodes(parsed_function_); | 216 AstPrinter::PrintFunctionNodes(parsed_function_); |
213 } | 217 } |
214 if (FLAG_trace_functions) { | 218 if (FLAG_trace_functions) { |
(...skipping 2593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2808 const Error& error = Error::Handle( | 2812 const Error& error = Error::Handle( |
2809 Parser::FormatError(script, token_index, "Error", format, args)); | 2813 Parser::FormatError(script, token_index, "Error", format, args)); |
2810 va_end(args); | 2814 va_end(args); |
2811 Isolate::Current()->long_jump_base()->Jump(1, error); | 2815 Isolate::Current()->long_jump_base()->Jump(1, error); |
2812 UNREACHABLE(); | 2816 UNREACHABLE(); |
2813 } | 2817 } |
2814 | 2818 |
2815 } // namespace dart | 2819 } // namespace dart |
2816 | 2820 |
2817 #endif // defined TARGET_ARCH_IA32 | 2821 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |