| 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" |
| 11 #include "vm/debugger.h" | 11 #include "vm/debugger.h" |
| 12 #include "vm/deopt_instructions.h" | 12 #include "vm/deopt_instructions.h" |
| 13 #include "vm/exceptions.h" | 13 #include "vm/exceptions.h" |
| 14 #include "vm/flow_graph_allocator.h" | 14 #include "vm/flow_graph_allocator.h" |
| 15 #include "vm/il_printer.h" | 15 #include "vm/il_printer.h" |
| 16 #include "vm/intrinsifier.h" | 16 #include "vm/intrinsifier.h" |
| 17 #include "vm/locations.h" | 17 #include "vm/locations.h" |
| 18 #include "vm/longjump.h" | 18 #include "vm/longjump.h" |
| 19 #include "vm/object_store.h" | 19 #include "vm/object_store.h" |
| 20 #include "vm/parser.h" | 20 #include "vm/parser.h" |
| 21 #include "vm/stack_frame.h" | 21 #include "vm/stack_frame.h" |
| 22 #include "vm/stub_code.h" | 22 #include "vm/stub_code.h" |
| 23 #include "vm/symbols.h" | 23 #include "vm/symbols.h" |
| 24 | 24 |
| 25 namespace dart { | 25 namespace dart { |
| 26 | 26 |
| 27 DECLARE_FLAG(bool, code_comments); | 27 DECLARE_FLAG(bool, code_comments); |
| 28 DECLARE_FLAG(bool, disassemble); | 28 DECLARE_FLAG(bool, disassemble); |
| 29 DECLARE_FLAG(bool, disassemble_optimized); | 29 DECLARE_FLAG(bool, disassemble_optimized); |
| 30 DECLARE_FLAG(bool, emit_edge_counters); |
| 30 DECLARE_FLAG(bool, enable_type_checks); | 31 DECLARE_FLAG(bool, enable_type_checks); |
| 31 DECLARE_FLAG(bool, intrinsify); | 32 DECLARE_FLAG(bool, intrinsify); |
| 32 DECLARE_FLAG(bool, propagate_ic_data); | 33 DECLARE_FLAG(bool, propagate_ic_data); |
| 33 DECLARE_FLAG(int, optimization_counter_threshold); | 34 DECLARE_FLAG(int, optimization_counter_threshold); |
| 34 DECLARE_FLAG(bool, use_cha); | 35 DECLARE_FLAG(bool, use_cha); |
| 35 DECLARE_FLAG(bool, use_osr); | 36 DECLARE_FLAG(bool, use_osr); |
| 36 DECLARE_FLAG(int, stacktrace_every); | 37 DECLARE_FLAG(int, stacktrace_every); |
| 37 DECLARE_FLAG(charp, stacktrace_filter); | 38 DECLARE_FLAG(charp, stacktrace_filter); |
| 38 DECLARE_FLAG(int, deoptimize_every); | 39 DECLARE_FLAG(int, deoptimize_every); |
| 39 DECLARE_FLAG(charp, deoptimize_filter); | 40 DECLARE_FLAG(charp, deoptimize_filter); |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 | 955 |
| 955 | 956 |
| 956 void FlowGraphCompiler::EmitComment(Instruction* instr) { | 957 void FlowGraphCompiler::EmitComment(Instruction* instr) { |
| 957 char buffer[256]; | 958 char buffer[256]; |
| 958 BufferFormatter f(buffer, sizeof(buffer)); | 959 BufferFormatter f(buffer, sizeof(buffer)); |
| 959 instr->PrintTo(&f); | 960 instr->PrintTo(&f); |
| 960 assembler()->Comment("%s", buffer); | 961 assembler()->Comment("%s", buffer); |
| 961 } | 962 } |
| 962 | 963 |
| 963 | 964 |
| 965 bool FlowGraphCompiler::NeedsEdgeCounter(TargetEntryInstr* block) { |
| 966 // Only emit an edge counter if there is not goto at the end of the block, |
| 967 // except for the entry block. |
| 968 return (FLAG_emit_edge_counters |
| 969 && (!block->last_instruction()->IsGoto() |
| 970 || (block == flow_graph().graph_entry()->normal_entry()))); |
| 971 } |
| 972 |
| 973 |
| 964 // Allocate a register that is not explicitly blocked. | 974 // Allocate a register that is not explicitly blocked. |
| 965 static Register AllocateFreeRegister(bool* blocked_registers) { | 975 static Register AllocateFreeRegister(bool* blocked_registers) { |
| 966 for (intptr_t regno = 0; regno < kNumberOfCpuRegisters; regno++) { | 976 for (intptr_t regno = 0; regno < kNumberOfCpuRegisters; regno++) { |
| 967 if (!blocked_registers[regno]) { | 977 if (!blocked_registers[regno]) { |
| 968 blocked_registers[regno] = true; | 978 blocked_registers[regno] = true; |
| 969 return static_cast<Register>(regno); | 979 return static_cast<Register>(regno); |
| 970 } | 980 } |
| 971 } | 981 } |
| 972 UNREACHABLE(); | 982 UNREACHABLE(); |
| 973 return kNoRegister; | 983 return kNoRegister; |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 | 1318 |
| 1309 for (int i = 0; i < len; i++) { | 1319 for (int i = 0; i < len; i++) { |
| 1310 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), | 1320 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), |
| 1311 &Function::ZoneHandle(ic_data.GetTargetAt(i)), | 1321 &Function::ZoneHandle(ic_data.GetTargetAt(i)), |
| 1312 ic_data.GetCountAt(i))); | 1322 ic_data.GetCountAt(i))); |
| 1313 } | 1323 } |
| 1314 sorted->Sort(HighestCountFirst); | 1324 sorted->Sort(HighestCountFirst); |
| 1315 } | 1325 } |
| 1316 | 1326 |
| 1317 } // namespace dart | 1327 } // namespace dart |
| OLD | NEW |