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

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

Issue 10460002: Move CreateArray and CreateClosure to new location template. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 virtual void PrintOperandsTo(BufferFormatter* f) const; 959 virtual void PrintOperandsTo(BufferFormatter* f) const;
960 960
961 private: 961 private:
962 const ConstructorCallNode& ast_node_; 962 const ConstructorCallNode& ast_node_;
963 const intptr_t try_index_; 963 const intptr_t try_index_;
964 ZoneGrowableArray<Value*>* const arguments_; 964 ZoneGrowableArray<Value*>* const arguments_;
965 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp); 965 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp);
966 }; 966 };
967 967
968 968
969 class CreateArrayComp : public Computation { 969 class CreateArrayComp : public TemplateComputation<1> {
970 public: 970 public:
971 CreateArrayComp(intptr_t token_index, 971 CreateArrayComp(intptr_t token_index,
972 intptr_t try_index, 972 intptr_t try_index,
973 ZoneGrowableArray<Value*>* elements, 973 ZoneGrowableArray<Value*>* elements,
974 Value* element_type) 974 Value* element_type)
975 : token_index_(token_index), 975 : token_index_(token_index),
976 try_index_(try_index), 976 try_index_(try_index),
977 elements_(elements), 977 elements_(elements) {
978 element_type_(element_type) {
979 #if defined(DEBUG) 978 #if defined(DEBUG)
980 for (int i = 0; i < ElementCount(); ++i) { 979 for (int i = 0; i < ElementCount(); ++i) {
981 ASSERT(ElementAt(i) != NULL); 980 ASSERT(ElementAt(i) != NULL);
982 } 981 }
983 ASSERT(element_type_ != NULL); 982 ASSERT(element_type != NULL);
984 #endif 983 #endif
984 inputs_[0] = element_type;
985 } 985 }
986 986
987 DECLARE_COMPUTATION(CreateArray) 987 DECLARE_COMPUTATION(CreateArray)
988 988
989 intptr_t token_index() const { return token_index_; } 989 intptr_t token_index() const { return token_index_; }
990 intptr_t try_index() const { return try_index_; } 990 intptr_t try_index() const { return try_index_; }
991 intptr_t ElementCount() const { return elements_->length(); } 991 intptr_t ElementCount() const { return elements_->length(); }
992 Value* ElementAt(intptr_t i) const { return (*elements_)[i]; } 992 Value* ElementAt(intptr_t i) const { return (*elements_)[i]; }
993 Value* element_type() const { return element_type_; } 993 Value* element_type() const { return inputs_[0]; }
994 994
995 virtual intptr_t InputCount() const; 995 virtual intptr_t InputCount() const;
996 virtual Value* InputAt(intptr_t i) const { return ElementAt(i); } 996 virtual Value* InputAt(intptr_t i) const { return ElementAt(i); }
997 997
998 virtual void PrintOperandsTo(BufferFormatter* f) const; 998 virtual void PrintOperandsTo(BufferFormatter* f) const;
999 999
1000 private: 1000 private:
1001 const intptr_t token_index_; 1001 const intptr_t token_index_;
1002 const intptr_t try_index_; 1002 const intptr_t try_index_;
1003 ZoneGrowableArray<Value*>* const elements_; 1003 ZoneGrowableArray<Value*>* const elements_;
1004 Value* element_type_;
1005 1004
1006 DISALLOW_COPY_AND_ASSIGN(CreateArrayComp); 1005 DISALLOW_COPY_AND_ASSIGN(CreateArrayComp);
1007 }; 1006 };
1008 1007
1009 1008
1010 class CreateClosureComp : public Computation { 1009 class CreateClosureComp : public Computation {
1011 public: 1010 public:
1012 // 'type_arguments' is null if function() does not require type arguments. 1011 // 'type_arguments' is null if function() does not require type arguments.
1013 CreateClosureComp(ClosureNode* node, 1012 CreateClosureComp(ClosureNode* node,
1014 intptr_t try_index, 1013 intptr_t try_index,
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
1892 const GrowableArray<BlockEntryInstr*>& block_order_; 1891 const GrowableArray<BlockEntryInstr*>& block_order_;
1893 1892
1894 private: 1893 private:
1895 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 1894 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
1896 }; 1895 };
1897 1896
1898 1897
1899 } // namespace dart 1898 } // namespace dart
1900 1899
1901 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 1900 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698