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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 10831179: Allocate the environment's location backing store during register allocation. (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 | « runtime/vm/il_printer.cc ('k') | no next file » | 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 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 2660 matching lines...) Expand 10 before | Expand all | Expand 10 after
2671 DISALLOW_COPY_AND_ASSIGN(BranchInstr); 2671 DISALLOW_COPY_AND_ASSIGN(BranchInstr);
2672 }; 2672 };
2673 2673
2674 2674
2675 #undef DECLARE_INSTRUCTION 2675 #undef DECLARE_INSTRUCTION
2676 2676
2677 2677
2678 class Environment : public ZoneAllocated { 2678 class Environment : public ZoneAllocated {
2679 public: 2679 public:
2680 // Construct an environment by copying from an array of values. 2680 // Construct an environment by copying from an array of values.
2681 // TODO(vegorov): it's absolutely crucial that locations_ backing store
2682 // is preallocated and never reallocated. We use pointers into it
2683 // during register allocation.
2684 explicit Environment(const GrowableArray<Value*>& values, 2681 explicit Environment(const GrowableArray<Value*>& values,
2685 intptr_t fixed_parameter_count) 2682 intptr_t fixed_parameter_count)
2686 : values_(values.length()), 2683 : values_(values.length()),
2687 locations_(values.length()), 2684 locations_(NULL),
2688 fixed_parameter_count_(fixed_parameter_count) { 2685 fixed_parameter_count_(fixed_parameter_count) {
2689 values_.AddArray(values); 2686 values_.AddArray(values);
2690 } 2687 }
2691 2688
2692 const GrowableArray<Value*>& values() const { 2689 const GrowableArray<Value*>& values() const {
2693 return values_; 2690 return values_;
2694 } 2691 }
2695 2692
2696 void AddLocation(Location value) { 2693 void InitializeLocations() {
2697 locations_.Add(value); 2694 locations_ =
2695 Isolate::Current()->current_zone()->Alloc<Location>(values_.length());
2698 } 2696 }
2699 2697
2700 Location LocationAt(intptr_t ix) const { 2698 Location LocationAt(intptr_t ix) const {
2701 return locations_[ix]; 2699 return locations_[ix];
Kevin Millikin (Google) 2012/08/06 14:59:18 It's not bulletproof, but I think I'll assert ix i
2702 } 2700 }
2703 2701
2704 Location* LocationSlotAt(intptr_t ix) const { 2702 Location* LocationSlotAt(intptr_t ix) const {
2705 return & locations_[ix]; 2703 return &locations_[ix];
2706 } 2704 }
2707 2705
2708 intptr_t fixed_parameter_count() const { 2706 intptr_t fixed_parameter_count() const {
2709 return fixed_parameter_count_; 2707 return fixed_parameter_count_;
2710 } 2708 }
2711 2709
2712 void PrintTo(BufferFormatter* f) const; 2710 void PrintTo(BufferFormatter* f) const;
2713 2711
2714 private: 2712 private:
2715 GrowableArray<Value*> values_; 2713 GrowableArray<Value*> values_;
2716 GrowableArray<Location> locations_; 2714 Location* locations_;
2717 const intptr_t fixed_parameter_count_; 2715 const intptr_t fixed_parameter_count_;
2718 2716
2719 DISALLOW_COPY_AND_ASSIGN(Environment); 2717 DISALLOW_COPY_AND_ASSIGN(Environment);
2720 }; 2718 };
2721 2719
2722 2720
2723 // Visitor base class to visit each instruction and computation in a flow 2721 // Visitor base class to visit each instruction and computation in a flow
2724 // graph as defined by a reversed list of basic blocks. 2722 // graph as defined by a reversed list of basic blocks.
2725 class FlowGraphVisitor : public ValueObject { 2723 class FlowGraphVisitor : public ValueObject {
2726 public: 2724 public:
(...skipping 23 matching lines...) Expand all
2750 const GrowableArray<BlockEntryInstr*>& block_order_; 2748 const GrowableArray<BlockEntryInstr*>& block_order_;
2751 2749
2752 private: 2750 private:
2753 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2751 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2754 }; 2752 };
2755 2753
2756 2754
2757 } // namespace dart 2755 } // namespace dart
2758 2756
2759 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2757 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698