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

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

Issue 2894953002: Support inlining of calls where type arguments are passed to generic functions. (Closed)
Patch Set: address review comments Created 3 years, 5 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
« no previous file with comments | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_inliner.cc » ('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) 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/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.h" 10 #include "vm/flow_graph.h"
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 696
697 // Save the range end because it may change below. 697 // Save the range end because it may change below.
698 intptr_t range_end = range->End(); 698 intptr_t range_end = range->End();
699 if (defn->IsParameter()) { 699 if (defn->IsParameter()) {
700 ParameterInstr* param = defn->AsParameter(); 700 ParameterInstr* param = defn->AsParameter();
701 // Assert that copied and non-copied parameters are mutually exclusive. 701 // Assert that copied and non-copied parameters are mutually exclusive.
702 // This might change in the future and, if so, the index will be wrong. 702 // This might change in the future and, if so, the index will be wrong.
703 ASSERT((flow_graph_.num_copied_params() == 0) || 703 ASSERT((flow_graph_.num_copied_params() == 0) ||
704 (flow_graph_.num_non_copied_params() == 0)); 704 (flow_graph_.num_non_copied_params() == 0));
705 intptr_t slot_index = param->index(); 705 intptr_t slot_index = param->index();
706 ASSERT(slot_index >= 0);
706 ASSERT((param->base_reg() == FPREG) || (param->base_reg() == SPREG)); 707 ASSERT((param->base_reg() == FPREG) || (param->base_reg() == SPREG));
707 if (param->base_reg() == FPREG) { 708 if (param->base_reg() == FPREG) {
708 // Slot index for the leftmost copied parameter is 0. 709 // Slot index for the leftmost copied parameter is 0.
709 // Slot index for the rightmost fixed parameter is -1. 710 // Slot index for the rightmost fixed parameter is -1.
710 slot_index -= flow_graph_.num_non_copied_params(); 711 slot_index -= flow_graph_.num_non_copied_params();
711 } 712 }
712 713
713 #if defined(TARGET_ARCH_DBC) 714 #if defined(TARGET_ARCH_DBC)
714 ASSERT(param->base_reg() == FPREG); 715 ASSERT(param->base_reg() == FPREG);
715 if (slot_index >= 0) { 716 if (slot_index >= 0) {
716 AssignSafepoints(defn, range); 717 AssignSafepoints(defn, range);
717 range->finger()->Initialize(range); 718 range->finger()->Initialize(range);
718 range->set_assigned_location(Location::RegisterLocation(slot_index)); 719 range->set_assigned_location(Location::RegisterLocation(slot_index));
719 SplitInitialDefinitionAt(range, kNormalEntryPos); 720 SplitInitialDefinitionAt(range, kNormalEntryPos);
720 ConvertAllUses(range); 721 ConvertAllUses(range);
721 return; 722 return;
722 } 723 }
723 #endif // defined(TARGET_ARCH_DBC) 724 #endif // defined(TARGET_ARCH_DBC)
724 range->set_assigned_location( 725 range->set_assigned_location(
725 Location::StackSlot(slot_index, param->base_reg())); 726 Location::StackSlot(slot_index, param->base_reg()));
726 range->set_spill_slot(Location::StackSlot(slot_index, param->base_reg())); 727 range->set_spill_slot(Location::StackSlot(slot_index, param->base_reg()));
727 728
728 } else if (defn->IsCurrentContext()) { 729 } else if (defn->IsSpecialParameter()) {
730 SpecialParameterInstr* param = defn->AsSpecialParameter();
731 if (param->kind() == SpecialParameterInstr::kContext) {
729 #if !defined(TARGET_ARCH_DBC) 732 #if !defined(TARGET_ARCH_DBC)
730 const Register context_reg = CTX; 733 const Register context_reg = CTX;
731 #else 734 #else
732 const intptr_t context_reg = flow_graph_.num_copied_params(); 735 const intptr_t context_reg = flow_graph_.num_copied_params();
733 #endif 736 #endif
734 737
735 AssignSafepoints(defn, range); 738 AssignSafepoints(defn, range);
736 range->finger()->Initialize(range); 739 range->finger()->Initialize(range);
737 range->set_assigned_location(Location::RegisterLocation(context_reg)); 740 range->set_assigned_location(Location::RegisterLocation(context_reg));
738 if (range->End() > kNormalEntryPos) { 741 if (range->End() > kNormalEntryPos) {
739 LiveRange* tail = range->SplitAt(kNormalEntryPos); 742 LiveRange* tail = range->SplitAt(kNormalEntryPos);
740 CompleteRange(tail, Location::kRegister); 743 CompleteRange(tail, Location::kRegister);
744 }
745 ConvertAllUses(range);
746 return;
741 } 747 }
742 ConvertAllUses(range); 748 ASSERT(param->kind() == SpecialParameterInstr::kTypeArgs);
743 return; 749 #if defined(TARGET_ARCH_DBC)
750 UNIMPLEMENTED();
751 #endif
752 const intptr_t slot_index = flow_graph_.num_copied_params();
753 range->set_assigned_location(Location::StackSlot(slot_index, FPREG));
754 range->set_spill_slot(Location::StackSlot(slot_index, FPREG));
744 } else { 755 } else {
745 ConstantInstr* constant = defn->AsConstant(); 756 ConstantInstr* constant = defn->AsConstant();
746 ASSERT(constant != NULL); 757 ASSERT(constant != NULL);
747 range->set_assigned_location(Location::Constant(constant)); 758 range->set_assigned_location(Location::Constant(constant));
748 range->set_spill_slot(Location::Constant(constant)); 759 range->set_spill_slot(Location::Constant(constant));
749 } 760 }
750 AssignSafepoints(defn, range); 761 AssignSafepoints(defn, range);
751 range->finger()->Initialize(range); 762 range->finger()->Initialize(range);
752 UsePosition* use = 763 UsePosition* use =
753 range->finger()->FirstRegisterBeneficialUse(block->start_pos()); 764 range->finger()->FirstRegisterBeneficialUse(block->start_pos());
754 if (use != NULL) { 765 if (use != NULL) {
755 LiveRange* tail = SplitBetween(range, block->start_pos(), use->pos()); 766 LiveRange* tail = SplitBetween(range, block->start_pos(), use->pos());
756 // Parameters and constants are tagged, so allocated to CPU registers. 767 // Parameters and constants are tagged, so allocated to CPU registers.
757 CompleteRange(tail, Location::kRegister); 768 CompleteRange(tail, Location::kRegister);
758 } 769 }
759 ConvertAllUses(range); 770 ConvertAllUses(range);
760 if (defn->IsParameter() && (range->spill_slot().stack_index() >= 0)) { 771 if (range->spill_slot().IsStackSlot() &&
761 // Parameters above the frame pointer consume spill slots and are marked 772 (range->spill_slot().stack_index() >= 0)) {
762 // in stack maps. 773 // On entry to the function, range is stored on the stack above the FP in
774 // the same space which is used for spill slots. Update spill slot state to
775 // reflect that and prevent register allocator from reusing this space as a
776 // spill slot.
763 spill_slots_.Add(range_end); 777 spill_slots_.Add(range_end);
764 quad_spill_slots_.Add(false); 778 quad_spill_slots_.Add(false);
765 untagged_spill_slots_.Add(false); 779 untagged_spill_slots_.Add(false);
766 // Note, all incoming parameters are assumed to be tagged. 780 // Note, all incoming parameters are assumed to be tagged.
767 MarkAsObjectAtSafepoints(range); 781 MarkAsObjectAtSafepoints(range);
768 } else if (defn->IsConstant() && block->IsCatchBlockEntry()) { 782 } else if (defn->IsConstant() && block->IsCatchBlockEntry()) {
769 // Constants at catch block entries consume spill slots. 783 // Constants at catch block entries consume spill slots.
770 spill_slots_.Add(range_end); 784 spill_slots_.Add(range_end);
771 quad_spill_slots_.Add(false); 785 quad_spill_slots_.Add(false);
772 untagged_spill_slots_.Add(false); 786 untagged_spill_slots_.Add(false);
(...skipping 2316 matching lines...) Expand 10 before | Expand all | Expand 10 after
3089 FlowGraphPrinter printer(flow_graph_, true); 3103 FlowGraphPrinter printer(flow_graph_, true);
3090 printer.PrintBlocks(); 3104 printer.PrintBlocks();
3091 #endif 3105 #endif
3092 } 3106 }
3093 THR_Print("----------------------------------------------\n"); 3107 THR_Print("----------------------------------------------\n");
3094 } 3108 }
3095 } 3109 }
3096 3110
3097 3111
3098 } // namespace dart 3112 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph.cc ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698