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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 ASSERT(mat != NULL); | 76 ASSERT(mat != NULL); |
77 builder->AddMaterialization(mat); | 77 builder->AddMaterialization(mat); |
78 } | 78 } |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 | 82 |
83 FlowGraphCompiler::FlowGraphCompiler(Assembler* assembler, | 83 FlowGraphCompiler::FlowGraphCompiler(Assembler* assembler, |
84 FlowGraph* flow_graph, | 84 FlowGraph* flow_graph, |
85 bool is_optimizing) | 85 bool is_optimizing) |
86 : assembler_(assembler), | 86 : isolate_(Isolate::Current()), |
| 87 assembler_(assembler), |
87 parsed_function_(flow_graph->parsed_function()), | 88 parsed_function_(flow_graph->parsed_function()), |
88 flow_graph_(*flow_graph), | 89 flow_graph_(*flow_graph), |
89 block_order_(*flow_graph->CodegenBlockOrder(is_optimizing)), | 90 block_order_(*flow_graph->CodegenBlockOrder(is_optimizing)), |
90 current_block_(NULL), | 91 current_block_(NULL), |
91 exception_handlers_list_(NULL), | 92 exception_handlers_list_(NULL), |
92 pc_descriptors_list_(NULL), | 93 pc_descriptors_list_(NULL), |
93 stackmap_table_builder_( | 94 stackmap_table_builder_( |
94 is_optimizing ? new StackmapTableBuilder() : NULL), | 95 is_optimizing ? new StackmapTableBuilder() : NULL), |
95 block_info_(block_order_.length()), | 96 block_info_(block_order_.length()), |
96 deopt_infos_(), | 97 deopt_infos_(), |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 if (i == ex_idx || i == st_idx) continue; | 389 if (i == ex_idx || i == st_idx) continue; |
389 if ((*idefs)[i]->IsConstant()) continue; | 390 if ((*idefs)[i]->IsConstant()) continue; |
390 Location src = env->LocationAt(i); | 391 Location src = env->LocationAt(i); |
391 ASSERT(!src.IsFpuRegister()); | 392 ASSERT(!src.IsFpuRegister()); |
392 ASSERT(!src.IsDoubleStackSlot()); | 393 ASSERT(!src.IsDoubleStackSlot()); |
393 intptr_t dest_index = i - num_non_copied_params; | 394 intptr_t dest_index = i - num_non_copied_params; |
394 Location dest = Location::StackSlot(dest_index); | 395 Location dest = Location::StackSlot(dest_index); |
395 move_instr->AddMove(dest, src); | 396 move_instr->AddMove(dest, src); |
396 // Update safepoint bitmap to indicate that the target location | 397 // Update safepoint bitmap to indicate that the target location |
397 // now contains a pointer. | 398 // now contains a pointer. |
398 instr->locs()->stack_bitmap()->Set(dest_index, true); | 399 instr->locs()->SetStackBit(dest_index); |
399 } | 400 } |
400 parallel_move_resolver()->EmitNativeCode(move_instr); | 401 parallel_move_resolver()->EmitNativeCode(move_instr); |
401 } | 402 } |
402 | 403 |
403 | 404 |
404 intptr_t FlowGraphCompiler::StackSize() const { | 405 intptr_t FlowGraphCompiler::StackSize() const { |
405 if (is_optimizing_) { | 406 if (is_optimizing_) { |
406 return flow_graph_.graph_entry()->spill_slot_count(); | 407 return flow_graph_.graph_entry()->spill_slot_count(); |
407 } else { | 408 } else { |
408 return parsed_function_.num_stack_locals() + | 409 return parsed_function_.num_stack_locals() + |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 } | 970 } |
970 } | 971 } |
971 UNREACHABLE(); | 972 UNREACHABLE(); |
972 return kNoRegister; | 973 return kNoRegister; |
973 } | 974 } |
974 | 975 |
975 | 976 |
976 void FlowGraphCompiler::AllocateRegistersLocally(Instruction* instr) { | 977 void FlowGraphCompiler::AllocateRegistersLocally(Instruction* instr) { |
977 ASSERT(!is_optimizing()); | 978 ASSERT(!is_optimizing()); |
978 | 979 |
979 instr->InitializeLocationSummary(false); // Not optimizing. | 980 instr->InitializeLocationSummary(isolate(), false); // Not optimizing. |
980 LocationSummary* locs = instr->locs(); | 981 LocationSummary* locs = instr->locs(); |
981 | 982 |
982 bool blocked_registers[kNumberOfCpuRegisters]; | 983 bool blocked_registers[kNumberOfCpuRegisters]; |
983 | 984 |
984 // Mark all available registers free. | 985 // Mark all available registers free. |
985 for (intptr_t i = 0; i < kNumberOfCpuRegisters; i++) { | 986 for (intptr_t i = 0; i < kNumberOfCpuRegisters; i++) { |
986 blocked_registers[i] = false; | 987 blocked_registers[i] = false; |
987 } | 988 } |
988 | 989 |
989 // Mark all fixed input, temp and output registers as used. | 990 // Mark all fixed input, temp and output registers as used. |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 | 1352 |
1352 for (int i = 0; i < len; i++) { | 1353 for (int i = 0; i < len; i++) { |
1353 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), | 1354 sorted->Add(CidTarget(ic_data.GetReceiverClassIdAt(i), |
1354 &Function::ZoneHandle(ic_data.GetTargetAt(i)), | 1355 &Function::ZoneHandle(ic_data.GetTargetAt(i)), |
1355 ic_data.GetCountAt(i))); | 1356 ic_data.GetCountAt(i))); |
1356 } | 1357 } |
1357 sorted->Sort(HighestCountFirst); | 1358 sorted->Sort(HighestCountFirst); |
1358 } | 1359 } |
1359 | 1360 |
1360 } // namespace dart | 1361 } // namespace dart |
OLD | NEW |