Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: runtime/vm/flow_graph_allocator.cc

Issue 10824177: Reapply "Added support for copied parameters to the SSA compiler." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4
5 #include "vm/flow_graph_allocator.h" 5 #include "vm/flow_graph_allocator.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 #include "vm/il_printer.h" 9 #include "vm/il_printer.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 // Skip parallel moves that we insert while processing instructions. 440 // Skip parallel moves that we insert while processing instructions.
441 if (!current->IsParallelMove()) { 441 if (!current->IsParallelMove()) {
442 ProcessOneInstruction(block, current); 442 ProcessOneInstruction(block, current);
443 } 443 }
444 current = current->previous(); 444 current = current->previous();
445 } 445 }
446 446
447 ConnectIncomingPhiMoves(block); 447 ConnectIncomingPhiMoves(block);
448 } 448 }
449 449
450 const bool copied = builder_->parsed_function().copied_parameter_count() > 0;
451
450 // Process incoming parameters. 452 // Process incoming parameters.
451 const intptr_t fixed_parameters_count = 453 const intptr_t fixed_parameters_count =
452 builder_->parsed_function().function().num_fixed_parameters(); 454 builder_->parsed_function().function().num_fixed_parameters();
453 455
454 GraphEntryInstr* graph_entry = postorder_[block_count - 1]->AsGraphEntry(); 456 GraphEntryInstr* graph_entry = postorder_[block_count - 1]->AsGraphEntry();
455 for (intptr_t i = 0; i < graph_entry->start_env()->values().length(); i++) { 457 for (intptr_t i = 0; i < graph_entry->start_env()->values().length(); i++) {
456 Value* val = graph_entry->start_env()->values()[i]; 458 Value* val = graph_entry->start_env()->values()[i];
457 if (val->IsUse()) { 459 if (val->IsUse()) {
458 ParameterInstr* param = val->AsUse()->definition()->AsParameter(); 460 ParameterInstr* param = val->AsUse()->definition()->AsParameter();
459 461
460 LiveRange* range = GetLiveRange(param->ssa_temp_index()); 462 LiveRange* range = GetLiveRange(param->ssa_temp_index());
461 range->AddUseInterval(graph_entry->start_pos(), graph_entry->end_pos()); 463 range->AddUseInterval(graph_entry->start_pos(), graph_entry->end_pos());
462 range->DefineAt(graph_entry->start_pos()); 464 range->DefineAt(graph_entry->start_pos());
463 465
464 // Slot index for the rightmost parameter is -1. 466 // Slot index for the leftmost copied parameter is 0.
465 const intptr_t slot_index = param->index() - fixed_parameters_count; 467 intptr_t slot_index = param->index();
468 if (!copied) {
469 // Slot index for the rightmost fixed parameter is -1.
470 slot_index -= fixed_parameters_count;
471 }
472
466 range->set_assigned_location(Location::StackSlot(slot_index)); 473 range->set_assigned_location(Location::StackSlot(slot_index));
467 range->set_spill_slot(Location::StackSlot(slot_index)); 474 range->set_spill_slot(Location::StackSlot(slot_index));
475 if (copied) {
476 ASSERT(spill_slots_.length() == slot_index);
477 spill_slots_.Add(range->End());
zerny-google 2012/08/06 09:39:53 This has to come before splitting. This is the bug
478 }
468 479
469 range->finger()->Initialize(range); 480 range->finger()->Initialize(range);
470 UsePosition* use = range->finger()->FirstRegisterBeneficialUse( 481 UsePosition* use = range->finger()->FirstRegisterBeneficialUse(
471 graph_entry->start_pos()); 482 graph_entry->start_pos());
472 if (use != NULL) { 483 if (use != NULL) {
473 LiveRange* tail = SplitBetween(range, 484 LiveRange* tail = SplitBetween(range,
474 graph_entry->start_pos(), 485 graph_entry->start_pos(),
475 use->pos()); 486 use->pos());
476 AddToUnallocated(tail); 487 AddToUnallocated(tail);
477 } 488 }
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", 1848 OS::Print("-- [after ssa allocator] ir [%s] -------------\n",
1838 function.ToFullyQualifiedCString()); 1849 function.ToFullyQualifiedCString());
1839 FlowGraphPrinter printer(Function::Handle(), block_order_, true); 1850 FlowGraphPrinter printer(Function::Handle(), block_order_, true);
1840 printer.PrintBlocks(); 1851 printer.PrintBlocks();
1841 OS::Print("----------------------------------------------\n"); 1852 OS::Print("----------------------------------------------\n");
1842 } 1853 }
1843 } 1854 }
1844 1855
1845 1856
1846 } // namespace dart 1857 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698