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

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

Issue 10832180: Eliminate phis that do not reach any non-environment uses. (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
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 2344 matching lines...) Expand 10 before | Expand all | Expand 10 after
2355 private: 2355 private:
2356 Computation* computation_; 2356 Computation* computation_;
2357 const bool is_used_; 2357 const bool is_used_;
2358 2358
2359 DISALLOW_COPY_AND_ASSIGN(BindInstr); 2359 DISALLOW_COPY_AND_ASSIGN(BindInstr);
2360 }; 2360 };
2361 2361
2362 2362
2363 class PhiInstr : public Definition { 2363 class PhiInstr : public Definition {
2364 public: 2364 public:
2365 explicit PhiInstr(intptr_t num_inputs) : inputs_(num_inputs) { 2365 explicit PhiInstr(intptr_t num_inputs)
2366 : inputs_(num_inputs), is_alive_(false) {
2366 for (intptr_t i = 0; i < num_inputs; ++i) { 2367 for (intptr_t i = 0; i < num_inputs; ++i) {
2367 inputs_.Add(NULL); 2368 inputs_.Add(NULL);
2368 } 2369 }
2369 } 2370 }
2370 2371
2371 // Least upper bound of the static types of the inputs. 2372 // Least upper bound of the static types of the inputs.
2372 virtual RawAbstractType* StaticType() const; 2373 virtual RawAbstractType* StaticType() const;
2373 2374
2374 virtual intptr_t ArgumentCount() const { return 0; } 2375 virtual intptr_t ArgumentCount() const { return 0; }
2375 2376
2376 intptr_t InputCount() const { return inputs_.length(); } 2377 intptr_t InputCount() const { return inputs_.length(); }
2377 2378
2378 Value* InputAt(intptr_t i) const { return inputs_[i]; } 2379 Value* InputAt(intptr_t i) const { return inputs_[i]; }
2379 2380
2380 void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } 2381 void SetInputAt(intptr_t i, Value* value) { inputs_[i] = value; }
2381 2382
2382 virtual bool CanDeoptimize() const { return false; } 2383 virtual bool CanDeoptimize() const { return false; }
2383 2384
2385 // Phi is alive if it reaches a non-environment use.
2386 bool is_alive() const { return is_alive_; }
2387 void mark_alive() { is_alive_ = true; }
2388
2384 DECLARE_INSTRUCTION(Phi) 2389 DECLARE_INSTRUCTION(Phi)
2385 2390
2386 private: 2391 private:
2387 GrowableArray<Value*> inputs_; 2392 GrowableArray<Value*> inputs_;
2393 bool is_alive_;
2388 2394
2389 DISALLOW_COPY_AND_ASSIGN(PhiInstr); 2395 DISALLOW_COPY_AND_ASSIGN(PhiInstr);
2390 }; 2396 };
2391 2397
2392 2398
2393 class ParameterInstr : public Definition { 2399 class ParameterInstr : public Definition {
2394 public: 2400 public:
2395 explicit ParameterInstr(intptr_t index) : index_(index) { } 2401 explicit ParameterInstr(intptr_t index) : index_(index) { }
2396 2402
2397 DECLARE_INSTRUCTION(Parameter) 2403 DECLARE_INSTRUCTION(Parameter)
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
2683 location_count_(0), 2689 location_count_(0),
2684 locations_(NULL), 2690 locations_(NULL),
2685 fixed_parameter_count_(fixed_parameter_count) { 2691 fixed_parameter_count_(fixed_parameter_count) {
2686 values_.AddArray(values); 2692 values_.AddArray(values);
2687 } 2693 }
2688 2694
2689 const GrowableArray<Value*>& values() const { 2695 const GrowableArray<Value*>& values() const {
2690 return values_; 2696 return values_;
2691 } 2697 }
2692 2698
2699 GrowableArray<Value*>* values_ptr() {
2700 return &values_;
2701 }
2702
2693 void InitializeLocations() { 2703 void InitializeLocations() {
2694 location_count_ = values_.length(); 2704 location_count_ = values_.length();
2695 if (location_count_ > 0) { 2705 if (location_count_ > 0) {
2696 locations_ = 2706 locations_ =
2697 Isolate::Current()->current_zone()->Alloc<Location>(location_count_); 2707 Isolate::Current()->current_zone()->Alloc<Location>(location_count_);
2698 } 2708 }
2699 } 2709 }
2700 2710
2701 Location LocationAt(intptr_t ix) const { 2711 Location LocationAt(intptr_t ix) const {
2702 ASSERT((ix >= 0) && (ix < location_count_)); 2712 ASSERT((ix >= 0) && (ix < location_count_));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2754 const GrowableArray<BlockEntryInstr*>& block_order_; 2764 const GrowableArray<BlockEntryInstr*>& block_order_;
2755 2765
2756 private: 2766 private:
2757 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2767 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2758 }; 2768 };
2759 2769
2760 2770
2761 } // namespace dart 2771 } // namespace dart
2762 2772
2763 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2773 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« runtime/vm/flow_graph_allocator.cc ('K') | « runtime/vm/flow_graph_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698