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/compiler.h" | 7 #include "vm/compiler.h" |
8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/flow_graph.h" | 10 #include "vm/flow_graph.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 FlowGraphCompiler* compiler) { | 163 FlowGraphCompiler* compiler) { |
164 #if !defined(TARGET_ARCH_DBC) | 164 #if !defined(TARGET_ARCH_DBC) |
165 ZoneGrowableArray<const ICData*>* ic_data_array = | 165 ZoneGrowableArray<const ICData*>* ic_data_array = |
166 new ZoneGrowableArray<const ICData*>(); | 166 new ZoneGrowableArray<const ICData*>(); |
167 FlowGraphBuilder builder(parsed_function, *ic_data_array, | 167 FlowGraphBuilder builder(parsed_function, *ic_data_array, |
168 NULL, // NULL = not inlining. | 168 NULL, // NULL = not inlining. |
169 Compiler::kNoOSRDeoptId); | 169 Compiler::kNoOSRDeoptId); |
170 | 170 |
171 intptr_t block_id = builder.AllocateBlockId(); | 171 intptr_t block_id = builder.AllocateBlockId(); |
172 TargetEntryInstr* normal_entry = | 172 TargetEntryInstr* normal_entry = |
173 new TargetEntryInstr(block_id, CatchClauseNode::kInvalidTryIndex, | 173 new TargetEntryInstr(block_id, CatchClauseNode::kInvalidTryIndex); |
174 Thread::Current()->GetNextDeoptId()); | |
175 GraphEntryInstr* graph_entry = new GraphEntryInstr( | 174 GraphEntryInstr* graph_entry = new GraphEntryInstr( |
176 parsed_function, normal_entry, Compiler::kNoOSRDeoptId); | 175 parsed_function, normal_entry, Compiler::kNoOSRDeoptId); |
177 FlowGraph* graph = new FlowGraph(parsed_function, graph_entry, block_id); | 176 FlowGraph* graph = new FlowGraph(parsed_function, graph_entry, block_id); |
178 const Function& function = parsed_function.function(); | 177 const Function& function = parsed_function.function(); |
179 switch (function.recognized_kind()) { | 178 switch (function.recognized_kind()) { |
180 #define EMIT_CASE(class_name, function_name, enum_name, type, fp) \ | 179 #define EMIT_CASE(class_name, function_name, enum_name, type, fp) \ |
181 case MethodRecognizer::k##enum_name: \ | 180 case MethodRecognizer::k##enum_name: \ |
182 if (!Build_##enum_name(graph)) return false; \ | 181 if (!Build_##enum_name(graph)) return false; \ |
183 break; | 182 break; |
184 | 183 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // Since we use the presence of an environment to determine if an | 311 // Since we use the presence of an environment to determine if an |
313 // instructions can deoptimize, we need an empty environment for | 312 // instructions can deoptimize, we need an empty environment for |
314 // instructions that "deoptimize" to the intrinsic fall-through code. | 313 // instructions that "deoptimize" to the intrinsic fall-through code. |
315 instr->SetEnvironment(fall_through_env_); | 314 instr->SetEnvironment(fall_through_env_); |
316 } | 315 } |
317 current_ = current_->AppendInstruction(instr); | 316 current_ = current_->AppendInstruction(instr); |
318 return instr; | 317 return instr; |
319 } | 318 } |
320 | 319 |
321 void AddIntrinsicReturn(Value* value) { | 320 void AddIntrinsicReturn(Value* value) { |
322 ReturnInstr* instr = | 321 ReturnInstr* instr = new ReturnInstr(TokenPos(), value); |
323 new ReturnInstr(TokenPos(), value, Thread::Current()->GetNextDeoptId()); | |
324 AddInstruction(instr); | 322 AddInstruction(instr); |
325 entry_->set_last_instruction(instr); | 323 entry_->set_last_instruction(instr); |
326 } | 324 } |
327 | 325 |
328 Definition* AddParameter(intptr_t index) { | 326 Definition* AddParameter(intptr_t index) { |
329 intptr_t adjustment = Intrinsifier::ParameterSlotFromSp(); | 327 intptr_t adjustment = Intrinsifier::ParameterSlotFromSp(); |
330 return AddToInitialDefinitions(new ParameterInstr( | 328 return AddToInitialDefinitions(new ParameterInstr( |
331 adjustment + index, flow_graph_->graph_entry(), SPREG)); | 329 adjustment + index, flow_graph_->graph_entry(), SPREG)); |
332 } | 330 } |
333 | 331 |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 } | 1171 } |
1174 | 1172 |
1175 | 1173 |
1176 void Intrinsifier::RegExp_ExecuteMatchSticky(Assembler* assembler) { | 1174 void Intrinsifier::RegExp_ExecuteMatchSticky(Assembler* assembler) { |
1177 IntrinsifyRegExpExecuteMatch(assembler, /*sticky=*/true); | 1175 IntrinsifyRegExpExecuteMatch(assembler, /*sticky=*/true); |
1178 } | 1176 } |
1179 #endif // !defined(TARGET_ARCH_DBC) | 1177 #endif // !defined(TARGET_ARCH_DBC) |
1180 | 1178 |
1181 | 1179 |
1182 } // namespace dart | 1180 } // namespace dart |
OLD | NEW |