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

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

Issue 10828319: Cleanup handling of NullType in type propagation. (Closed) Base URL: http://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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 289
290 protected: 290 protected:
291 EmbeddedArray<Value*, N> inputs_; 291 EmbeddedArray<Value*, N> inputs_;
292 }; 292 };
293 293
294 294
295 class Value : public TemplateComputation<0> { 295 class Value : public TemplateComputation<0> {
296 public: 296 public:
297 Value() { } 297 Value() { }
298 298
299 // Returns true if the value is constant null.
300 bool IsConstantNull() const;
301
302 // Reminder: The type of the constant null is the bottom type, which is more
303 // specific than any type.
299 bool CompileTypeIsMoreSpecificThan(const AbstractType& dst_type) const; 304 bool CompileTypeIsMoreSpecificThan(const AbstractType& dst_type) const;
300 305
301 virtual void RemoveFromUseList() = 0; 306 virtual void RemoveFromUseList() = 0;
302 307
303 private: 308 private:
304 DISALLOW_COPY_AND_ASSIGN(Value); 309 DISALLOW_COPY_AND_ASSIGN(Value);
305 }; 310 };
306 311
307 312
308 // Functions defined in all concrete computation classes. 313 // Functions defined in all concrete computation classes.
(...skipping 2564 matching lines...) Expand 10 before | Expand all | Expand 10 after
2873 2878
2874 DISALLOW_COPY_AND_ASSIGN(Environment); 2879 DISALLOW_COPY_AND_ASSIGN(Environment);
2875 }; 2880 };
2876 2881
2877 2882
2878 // Visitor base class to visit each instruction and computation in a flow 2883 // Visitor base class to visit each instruction and computation in a flow
2879 // graph as defined by a reversed list of basic blocks. 2884 // graph as defined by a reversed list of basic blocks.
2880 class FlowGraphVisitor : public ValueObject { 2885 class FlowGraphVisitor : public ValueObject {
2881 public: 2886 public:
2882 explicit FlowGraphVisitor(const GrowableArray<BlockEntryInstr*>& block_order) 2887 explicit FlowGraphVisitor(const GrowableArray<BlockEntryInstr*>& block_order)
2883 : block_order_(block_order) { } 2888 : block_order_(block_order), current_iterator_(NULL) { }
2884 virtual ~FlowGraphVisitor() { } 2889 virtual ~FlowGraphVisitor() { }
2885 2890
2891 ForwardInstructionIterator* current_iterator() const {
2892 return current_iterator_;
2893 }
2894
2886 // Visit each block in the block order, and for each block its 2895 // Visit each block in the block order, and for each block its
2887 // instructions in order from the block entry to exit. 2896 // instructions in order from the block entry to exit.
2888 virtual void VisitBlocks(); 2897 virtual void VisitBlocks();
2889 2898
2890 // Visit functions for instruction and computation classes, with empty 2899 // Visit functions for instruction and computation classes, with empty
2891 // default implementations. 2900 // default implementations.
2892 #define DECLARE_VISIT_COMPUTATION(ShortName, ClassName) \ 2901 #define DECLARE_VISIT_COMPUTATION(ShortName, ClassName) \
2893 virtual void Visit##ShortName(ClassName* comp, BindInstr* instr) { } 2902 virtual void Visit##ShortName(ClassName* comp, BindInstr* instr) { }
2894 2903
2895 #define DECLARE_VISIT_INSTRUCTION(ShortName) \ 2904 #define DECLARE_VISIT_INSTRUCTION(ShortName) \
2896 virtual void Visit##ShortName(ShortName##Instr* instr) { } 2905 virtual void Visit##ShortName(ShortName##Instr* instr) { }
2897 2906
2898 FOR_EACH_COMPUTATION(DECLARE_VISIT_COMPUTATION) 2907 FOR_EACH_COMPUTATION(DECLARE_VISIT_COMPUTATION)
2899 FOR_EACH_INSTRUCTION(DECLARE_VISIT_INSTRUCTION) 2908 FOR_EACH_INSTRUCTION(DECLARE_VISIT_INSTRUCTION)
2900 2909
2901 #undef DECLARE_VISIT_COMPUTATION 2910 #undef DECLARE_VISIT_COMPUTATION
2902 #undef DECLARE_VISIT_INSTRUCTION 2911 #undef DECLARE_VISIT_INSTRUCTION
2903 2912
2904 protected: 2913 protected:
2905 const GrowableArray<BlockEntryInstr*>& block_order_; 2914 const GrowableArray<BlockEntryInstr*>& block_order_;
2915 ForwardInstructionIterator* current_iterator_;
2906 2916
2907 private: 2917 private:
2908 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2918 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2909 }; 2919 };
2910 2920
2911 2921
2912 } // namespace dart 2922 } // namespace dart
2913 2923
2914 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2924 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698