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

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

Issue 10368004: Properly set the element type of literal lists. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language.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) 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 M(StoreInstanceField, StoreInstanceFieldComp) \ 47 M(StoreInstanceField, StoreInstanceFieldComp) \
48 M(LoadStaticField, LoadStaticFieldComp) \ 48 M(LoadStaticField, LoadStaticFieldComp) \
49 M(StoreStaticField, StoreStaticFieldComp) \ 49 M(StoreStaticField, StoreStaticFieldComp) \
50 M(BooleanNegate, BooleanNegateComp) \ 50 M(BooleanNegate, BooleanNegateComp) \
51 M(InstanceOf, InstanceOfComp) \ 51 M(InstanceOf, InstanceOfComp) \
52 M(CreateArray, CreateArrayComp) \ 52 M(CreateArray, CreateArrayComp) \
53 M(CreateClosure, CreateClosureComp) \ 53 M(CreateClosure, CreateClosureComp) \
54 M(AllocateObject, AllocateObjectComp) \ 54 M(AllocateObject, AllocateObjectComp) \
55 M(AllocateObjectWithBoundsCheck, AllocateObjectWithBoundsCheckComp) \ 55 M(AllocateObjectWithBoundsCheck, AllocateObjectWithBoundsCheckComp) \
56 M(NativeLoadField, NativeLoadFieldComp) \ 56 M(NativeLoadField, NativeLoadFieldComp) \
57 M(ExtractFactoryTypeArguments, ExtractFactoryTypeArgumentsComp) \ 57 M(InstantiateTypeArguments, InstantiateTypeArgumentsComp) \
58 M(ExtractConstructorTypeArguments, ExtractConstructorTypeArgumentsComp) \ 58 M(ExtractConstructorTypeArguments, ExtractConstructorTypeArgumentsComp) \
59 M(ExtractConstructorInstantiator, ExtractConstructorInstantiatorComp) \ 59 M(ExtractConstructorInstantiator, ExtractConstructorInstantiatorComp) \
60 M(AllocateContext, AllocateContextComp) \ 60 M(AllocateContext, AllocateContextComp) \
61 M(ChainContext, ChainContextComp) \ 61 M(ChainContext, ChainContextComp) \
62 M(CloneContext, CloneContextComp) \ 62 M(CloneContext, CloneContextComp) \
63 M(CatchEntry, CatchEntryComp) \ 63 M(CatchEntry, CatchEntryComp) \
64 64
65 65
66 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; 66 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName;
67 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) 67 FOR_EACH_COMPUTATION(FORWARD_DECLARATION)
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 private: 841 private:
842 const ConstructorCallNode& ast_node_; 842 const ConstructorCallNode& ast_node_;
843 const intptr_t try_index_; 843 const intptr_t try_index_;
844 ZoneGrowableArray<Value*>* const arguments_; 844 ZoneGrowableArray<Value*>* const arguments_;
845 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp); 845 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp);
846 }; 846 };
847 847
848 848
849 class CreateArrayComp : public Computation { 849 class CreateArrayComp : public Computation {
850 public: 850 public:
851 CreateArrayComp(ArrayNode* node, 851 CreateArrayComp(intptr_t token_index,
852 intptr_t try_index, 852 intptr_t try_index,
853 ZoneGrowableArray<Value*>* elements) 853 ZoneGrowableArray<Value*>* elements,
854 : ast_node_(*node), try_index_(try_index), elements_(elements) { 854 Value* element_type)
855 : token_index_(token_index),
856 try_index_(try_index),
857 elements_(elements),
858 element_type_(element_type) {
855 #if defined(DEBUG) 859 #if defined(DEBUG)
856 for (int i = 0; i < ElementCount(); ++i) { 860 for (int i = 0; i < ElementCount(); ++i) {
857 ASSERT(ElementAt(i) != NULL); 861 ASSERT(ElementAt(i) != NULL);
858 } 862 }
863 ASSERT(element_type_ != NULL);
859 #endif 864 #endif
860 } 865 }
861 866
862 DECLARE_COMPUTATION(CreateArray) 867 DECLARE_COMPUTATION(CreateArray)
863 868
864 intptr_t token_index() const { return ast_node_.token_index(); } 869 intptr_t token_index() const { return token_index_; }
865 intptr_t try_index() const { return try_index_; } 870 intptr_t try_index() const { return try_index_; }
866 const AbstractTypeArguments& type_arguments() const {
867 return ast_node_.type_arguments();
868 }
869 intptr_t ElementCount() const { return elements_->length(); } 871 intptr_t ElementCount() const { return elements_->length(); }
870 Value* ElementAt(intptr_t i) const { return (*elements_)[i]; } 872 Value* ElementAt(intptr_t i) const { return (*elements_)[i]; }
873 Value* element_type() const { return element_type_; }
871 874
872 virtual intptr_t InputCount() const; 875 virtual intptr_t InputCount() const;
873 876
874 private: 877 private:
875 const ArrayNode& ast_node_; 878 const intptr_t token_index_;
876 const intptr_t try_index_; 879 const intptr_t try_index_;
877 ZoneGrowableArray<Value*>* const elements_; 880 ZoneGrowableArray<Value*>* const elements_;
881 Value* element_type_;
878 882
879 DISALLOW_COPY_AND_ASSIGN(CreateArrayComp); 883 DISALLOW_COPY_AND_ASSIGN(CreateArrayComp);
880 }; 884 };
881 885
882 886
883 class CreateClosureComp : public Computation { 887 class CreateClosureComp : public Computation {
884 public: 888 public:
885 // 'type_arguments' is null if function() does not require type arguments. 889 // 'type_arguments' is null if function() does not require type arguments.
886 CreateClosureComp(ClosureNode* node, 890 CreateClosureComp(ClosureNode* node,
887 intptr_t try_index, 891 intptr_t try_index,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 Value* value() { return inputs_[0]; } 925 Value* value() { return inputs_[0]; }
922 intptr_t offset_in_bytes() const { return offset_in_bytes_; } 926 intptr_t offset_in_bytes() const { return offset_in_bytes_; }
923 927
924 private: 928 private:
925 intptr_t offset_in_bytes_; 929 intptr_t offset_in_bytes_;
926 930
927 DISALLOW_COPY_AND_ASSIGN(NativeLoadFieldComp); 931 DISALLOW_COPY_AND_ASSIGN(NativeLoadFieldComp);
928 }; 932 };
929 933
930 934
931 class ExtractFactoryTypeArgumentsComp : public TemplateComputation<1> { 935 class InstantiateTypeArgumentsComp : public TemplateComputation<1> {
932 public: 936 public:
933 ExtractFactoryTypeArgumentsComp(ConstructorCallNode* ast_node, 937 InstantiateTypeArgumentsComp(intptr_t token_index,
934 intptr_t try_index, 938 intptr_t try_index,
935 Value* instantiator) 939 const AbstractTypeArguments& type_arguments,
936 : ast_node_(*ast_node), 940 Value* instantiator)
937 try_index_(try_index) { 941 : token_index_(token_index),
942 try_index_(try_index),
943 type_arguments_(type_arguments) {
938 ASSERT(instantiator != NULL); 944 ASSERT(instantiator != NULL);
939 inputs_[0] = instantiator; 945 inputs_[0] = instantiator;
940 } 946 }
941 947
942 DECLARE_COMPUTATION(ExtractFactoryTypeArguments) 948 DECLARE_COMPUTATION(InstantiateTypeArguments)
943 949
944 Value* instantiator() { return inputs_[0]; } 950 Value* instantiator() { return inputs_[0]; }
945 const AbstractTypeArguments& type_arguments() const { 951 const AbstractTypeArguments& type_arguments() const {
946 return ast_node_.type_arguments(); 952 return type_arguments_;
947 } 953 }
948 const Function& factory() const { return ast_node_.constructor(); } 954 intptr_t token_index() const { return token_index_; }
949 intptr_t token_index() const { return ast_node_.token_index(); }
950 intptr_t try_index() const { return try_index_; } 955 intptr_t try_index() const { return try_index_; }
951 956
952 private: 957 private:
953 const ConstructorCallNode& ast_node_; 958 const intptr_t token_index_;
954 const intptr_t try_index_; 959 const intptr_t try_index_;
960 const AbstractTypeArguments& type_arguments_;
955 961
956 DISALLOW_COPY_AND_ASSIGN(ExtractFactoryTypeArgumentsComp); 962 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsComp);
957 }; 963 };
958 964
959 965
960 class ExtractConstructorTypeArgumentsComp : public TemplateComputation<1> { 966 class ExtractConstructorTypeArgumentsComp : public TemplateComputation<1> {
961 public: 967 public:
962 ExtractConstructorTypeArgumentsComp(ConstructorCallNode* ast_node, 968 ExtractConstructorTypeArgumentsComp(
963 Value* instantiator) 969 intptr_t token_index,
964 : ast_node_(*ast_node) { 970 intptr_t try_index,
971 const AbstractTypeArguments& type_arguments,
972 Value* instantiator)
973 : token_index_(token_index),
974 try_index_(try_index),
975 type_arguments_(type_arguments) {
965 ASSERT(instantiator != NULL); 976 ASSERT(instantiator != NULL);
966 inputs_[0] = instantiator; 977 inputs_[0] = instantiator;
967 } 978 }
968 979
969 DECLARE_COMPUTATION(ExtractConstructorTypeArguments) 980 DECLARE_COMPUTATION(ExtractConstructorTypeArguments)
970 981
971 Value* instantiator() { return inputs_[0]; } 982 Value* instantiator() { return inputs_[0]; }
972 const AbstractTypeArguments& type_arguments() const { 983 const AbstractTypeArguments& type_arguments() const {
973 return ast_node_.type_arguments(); 984 return type_arguments_;
974 } 985 }
975 const Function& constructor() const { return ast_node_.constructor(); } 986 intptr_t token_index() const { return token_index_; }
976 intptr_t token_index() const { return ast_node_.token_index(); } 987 intptr_t try_index() const { return try_index_; }
977 988
978 private: 989 private:
979 const ConstructorCallNode& ast_node_; 990 const intptr_t token_index_;
991 const intptr_t try_index_;
992 const AbstractTypeArguments& type_arguments_;
980 993
981 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsComp); 994 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsComp);
982 }; 995 };
983 996
984 997
985 class ExtractConstructorInstantiatorComp : public TemplateComputation<2> { 998 class ExtractConstructorInstantiatorComp : public TemplateComputation<2> {
986 public: 999 public:
987 ExtractConstructorInstantiatorComp(ConstructorCallNode* ast_node, 1000 ExtractConstructorInstantiatorComp(ConstructorCallNode* ast_node,
988 Value* instantiator, 1001 Value* instantiator,
989 Value* discard_value) 1002 Value* discard_value)
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 const GrowableArray<BlockEntryInstr*>& block_order_; 1651 const GrowableArray<BlockEntryInstr*>& block_order_;
1639 1652
1640 private: 1653 private:
1641 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 1654 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
1642 }; 1655 };
1643 1656
1644 1657
1645 } // namespace dart 1658 } // namespace dart
1646 1659
1647 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 1660 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698