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