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 // Class for intrinsifying functions. | 4 // Class for intrinsifying functions. |
5 | 5 |
6 #include "vm/assembler.h" | 6 #include "vm/assembler.h" |
7 #include "vm/intrinsifier.h" | 7 #include "vm/compiler.h" |
8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
9 #include "vm/object.h" | |
10 #include "vm/symbols.h" | |
11 | |
12 #include "vm/flow_graph.h" | 9 #include "vm/flow_graph.h" |
13 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
14 #include "vm/flow_graph_allocator.h" | 11 #include "vm/flow_graph_allocator.h" |
15 #include "vm/flow_graph_builder.h" | 12 #include "vm/flow_graph_builder.h" |
16 #include "vm/il_printer.h" | 13 #include "vm/il_printer.h" |
17 #include "vm/intermediate_language.h" | 14 #include "vm/intermediate_language.h" |
| 15 #include "vm/intrinsifier.h" |
| 16 #include "vm/object.h" |
18 #include "vm/parser.h" | 17 #include "vm/parser.h" |
| 18 #include "vm/symbols.h" |
| 19 |
19 | 20 |
20 namespace dart { | 21 namespace dart { |
21 | 22 |
22 DEFINE_FLAG(bool, intrinsify, true, "Instrinsify when possible"); | 23 DEFINE_FLAG(bool, intrinsify, true, "Instrinsify when possible"); |
23 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); | 24 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); |
24 DECLARE_FLAG(bool, code_comments); | 25 DECLARE_FLAG(bool, code_comments); |
25 DECLARE_FLAG(bool, print_flow_graph); | 26 DECLARE_FLAG(bool, print_flow_graph); |
26 DECLARE_FLAG(bool, print_flow_graph_optimized); | 27 DECLARE_FLAG(bool, print_flow_graph_optimized); |
27 | 28 |
28 bool Intrinsifier::CanIntrinsify(const Function& function) { | 29 bool Intrinsifier::CanIntrinsify(const Function& function) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 127 } |
127 | 128 |
128 | 129 |
129 bool Intrinsifier::GraphIntrinsify(const ParsedFunction& parsed_function, | 130 bool Intrinsifier::GraphIntrinsify(const ParsedFunction& parsed_function, |
130 FlowGraphCompiler* compiler) { | 131 FlowGraphCompiler* compiler) { |
131 ZoneGrowableArray<const ICData*>* ic_data_array = | 132 ZoneGrowableArray<const ICData*>* ic_data_array = |
132 new ZoneGrowableArray<const ICData*>(); | 133 new ZoneGrowableArray<const ICData*>(); |
133 FlowGraphBuilder builder(parsed_function, | 134 FlowGraphBuilder builder(parsed_function, |
134 *ic_data_array, | 135 *ic_data_array, |
135 NULL, // NULL = not inlining. | 136 NULL, // NULL = not inlining. |
136 Thread::kNoDeoptId); // No OSR id. | 137 Compiler::kNoOSRDeoptId); |
137 | 138 |
138 intptr_t block_id = builder.AllocateBlockId(); | 139 intptr_t block_id = builder.AllocateBlockId(); |
139 TargetEntryInstr* normal_entry = | 140 TargetEntryInstr* normal_entry = |
140 new TargetEntryInstr(block_id, | 141 new TargetEntryInstr(block_id, |
141 CatchClauseNode::kInvalidTryIndex); | 142 CatchClauseNode::kInvalidTryIndex); |
142 GraphEntryInstr* graph_entry = new GraphEntryInstr( | 143 GraphEntryInstr* graph_entry = new GraphEntryInstr( |
143 parsed_function, normal_entry, Thread::kNoDeoptId); // No OSR id. | 144 parsed_function, normal_entry, Compiler::kNoOSRDeoptId); |
144 FlowGraph* graph = new FlowGraph(parsed_function, graph_entry, block_id); | 145 FlowGraph* graph = new FlowGraph(parsed_function, graph_entry, block_id); |
145 const Function& function = parsed_function.function(); | 146 const Function& function = parsed_function.function(); |
146 switch (function.recognized_kind()) { | 147 switch (function.recognized_kind()) { |
147 #define EMIT_CASE(class_name, function_name, enum_name, fp) \ | 148 #define EMIT_CASE(class_name, function_name, enum_name, fp) \ |
148 case MethodRecognizer::k##enum_name: \ | 149 case MethodRecognizer::k##enum_name: \ |
149 if (!Build_##enum_name(graph)) return false; \ | 150 if (!Build_##enum_name(graph)) return false; \ |
150 break; | 151 break; |
151 | 152 |
152 GRAPH_INTRINSICS_LIST(EMIT_CASE); | 153 GRAPH_INTRINSICS_LIST(EMIT_CASE); |
153 default: | 154 default: |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 new Value(growable_array), | 862 new Value(growable_array), |
862 new Value(length), | 863 new Value(length), |
863 kNoStoreBarrier, | 864 kNoStoreBarrier, |
864 builder.TokenPos())); | 865 builder.TokenPos())); |
865 Definition* null_def = builder.AddNullDefinition(); | 866 Definition* null_def = builder.AddNullDefinition(); |
866 builder.AddIntrinsicReturn(new Value(null_def)); | 867 builder.AddIntrinsicReturn(new Value(null_def)); |
867 return true; | 868 return true; |
868 } | 869 } |
869 | 870 |
870 } // namespace dart | 871 } // namespace dart |
OLD | NEW |