| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
| 6 | 6 |
| 7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
| 8 | 8 |
| 9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 stackmap_table_builder_( | 145 stackmap_table_builder_( |
| 146 is_optimizing ? new StackmapTableBuilder() : NULL), | 146 is_optimizing ? new StackmapTableBuilder() : NULL), |
| 147 block_info_(block_order_.length()), | 147 block_info_(block_order_.length()), |
| 148 deopt_infos_(), | 148 deopt_infos_(), |
| 149 static_calls_target_table_(GrowableObjectArray::ZoneHandle( | 149 static_calls_target_table_(GrowableObjectArray::ZoneHandle( |
| 150 GrowableObjectArray::New())), | 150 GrowableObjectArray::New())), |
| 151 is_optimizing_(is_optimizing), | 151 is_optimizing_(is_optimizing), |
| 152 may_reoptimize_(false), | 152 may_reoptimize_(false), |
| 153 double_class_(Class::ZoneHandle( | 153 double_class_(Class::ZoneHandle( |
| 154 Isolate::Current()->object_store()->double_class())), | 154 Isolate::Current()->object_store()->double_class())), |
| 155 parallel_move_resolver_(this) { | 155 parallel_move_resolver_(this), |
| 156 pending_deoptimization_env_(NULL) { |
| 156 ASSERT(assembler != NULL); | 157 ASSERT(assembler != NULL); |
| 157 } | 158 } |
| 158 | 159 |
| 159 | 160 |
| 160 bool FlowGraphCompiler::HasFinally() const { | 161 bool FlowGraphCompiler::HasFinally() const { |
| 161 return parsed_function().function().has_finally(); | 162 return parsed_function().function().has_finally(); |
| 162 } | 163 } |
| 163 | 164 |
| 164 | 165 |
| 165 void FlowGraphCompiler::InitCompiler() { | 166 void FlowGraphCompiler::InitCompiler() { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 entry->PrepareEntry(this); | 218 entry->PrepareEntry(this); |
| 218 // Compile all successors until an exit, branch, or a block entry. | 219 // Compile all successors until an exit, branch, or a block entry. |
| 219 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { | 220 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) { |
| 220 Instruction* instr = it.Current(); | 221 Instruction* instr = it.Current(); |
| 221 if (FLAG_code_comments) EmitComment(instr); | 222 if (FLAG_code_comments) EmitComment(instr); |
| 222 if (instr->IsParallelMove()) { | 223 if (instr->IsParallelMove()) { |
| 223 parallel_move_resolver_.EmitNativeCode(instr->AsParallelMove()); | 224 parallel_move_resolver_.EmitNativeCode(instr->AsParallelMove()); |
| 224 } else { | 225 } else { |
| 225 ASSERT(instr->locs() != NULL); | 226 ASSERT(instr->locs() != NULL); |
| 226 EmitInstructionPrologue(instr); | 227 EmitInstructionPrologue(instr); |
| 228 ASSERT(pending_deoptimization_env_ == NULL); |
| 227 pending_deoptimization_env_ = instr->env(); | 229 pending_deoptimization_env_ = instr->env(); |
| 228 instr->EmitNativeCode(this); | 230 instr->EmitNativeCode(this); |
| 231 pending_deoptimization_env_ = NULL; |
| 229 EmitInstructionEpilogue(instr); | 232 EmitInstructionEpilogue(instr); |
| 230 } | 233 } |
| 231 } | 234 } |
| 232 } | 235 } |
| 233 set_current_block(NULL); | 236 set_current_block(NULL); |
| 234 } | 237 } |
| 235 | 238 |
| 236 | 239 |
| 237 void FlowGraphCompiler::Bailout(const char* reason) { | 240 void FlowGraphCompiler::Bailout(const char* reason) { |
| 238 const char* kFormat = "FlowGraphCompiler Bailout: %s %s."; | 241 const char* kFormat = "FlowGraphCompiler Bailout: %s %s."; |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 // This IC call may be closure call only. | 531 // This IC call may be closure call only. |
| 529 label_address = StubCode::ClosureCallInlineCacheEntryPoint(); | 532 label_address = StubCode::ClosureCallInlineCacheEntryPoint(); |
| 530 ExternalLabel target_label("InlineCache", label_address); | 533 ExternalLabel target_label("InlineCache", label_address); |
| 531 EmitInstanceCall(&target_label, | 534 EmitInstanceCall(&target_label, |
| 532 ICData::ZoneHandle(ic_data.AsUnaryClassChecks()), | 535 ICData::ZoneHandle(ic_data.AsUnaryClassChecks()), |
| 533 arguments_descriptor, argument_count, | 536 arguments_descriptor, argument_count, |
| 534 deopt_id, token_pos, locs); | 537 deopt_id, token_pos, locs); |
| 535 return; | 538 return; |
| 536 } | 539 } |
| 537 // Emit IC call that will count and thus may need reoptimization at | 540 // Emit IC call that will count and thus may need reoptimization at |
| 538 // return instruction. | 541 // function entry. |
| 539 ASSERT(!is_optimizing() || may_reoptimize()); | 542 ASSERT(!is_optimizing() || may_reoptimize()); |
| 540 switch (ic_data.num_args_tested()) { | 543 switch (ic_data.num_args_tested()) { |
| 541 case 1: | 544 case 1: |
| 542 label_address = StubCode::OneArgOptimizedCheckInlineCacheEntryPoint(); | 545 label_address = StubCode::OneArgOptimizedCheckInlineCacheEntryPoint(); |
| 543 break; | 546 break; |
| 544 case 2: | 547 case 2: |
| 545 label_address = StubCode::TwoArgsOptimizedCheckInlineCacheEntryPoint(); | 548 label_address = StubCode::TwoArgsOptimizedCheckInlineCacheEntryPoint(); |
| 546 break; | 549 break; |
| 547 case 3: | 550 case 3: |
| 548 label_address = | 551 label_address = |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 if (i != largest_ix) { | 993 if (i != largest_ix) { |
| 991 // Swap. | 994 // Swap. |
| 992 CidTarget temp = (*sorted)[i]; | 995 CidTarget temp = (*sorted)[i]; |
| 993 (*sorted)[i] = (*sorted)[largest_ix]; | 996 (*sorted)[i] = (*sorted)[largest_ix]; |
| 994 (*sorted)[largest_ix] = temp; | 997 (*sorted)[largest_ix] = temp; |
| 995 } | 998 } |
| 996 } | 999 } |
| 997 } | 1000 } |
| 998 | 1001 |
| 999 } // namespace dart | 1002 } // namespace dart |
| OLD | NEW |