| OLD | NEW |
| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 #define RECOGNIZED_LIST(V) \ | 33 #define RECOGNIZED_LIST(V) \ |
| 34 V(_ObjectArray, get:length, ObjectArrayLength) \ | 34 V(_ObjectArray, get:length, ObjectArrayLength) \ |
| 35 V(_ImmutableArray, get:length, ImmutableArrayLength) \ | 35 V(_ImmutableArray, get:length, ImmutableArrayLength) \ |
| 36 V(_GrowableObjectArray, get:length, GrowableArrayLength) \ | 36 V(_GrowableObjectArray, get:length, GrowableArrayLength) \ |
| 37 V(_GrowableObjectArray, get:capacity, GrowableArrayCapacity) \ | 37 V(_GrowableObjectArray, get:capacity, GrowableArrayCapacity) \ |
| 38 V(_StringBase, get:length, StringBaseLength) \ | 38 V(_StringBase, get:length, StringBaseLength) \ |
| 39 V(_StringBase, isEmpty, StringBaseIsEmpty) \ | 39 V(_StringBase, isEmpty, StringBaseIsEmpty) \ |
| 40 V(_IntegerImplementation, toDouble, IntegerToDouble) \ | 40 V(_IntegerImplementation, toDouble, IntegerToDouble) \ |
| 41 V(_Double, toDouble, DoubleToDouble) \ | 41 V(_Double, toDouble, DoubleToDouble) \ |
| 42 V(_Double, toInt, DoubleToInteger) \ |
| 43 V(_IntegerImplementation, toInt, IntegerToInteger) \ |
| 42 V(::, sqrt, MathSqrt) \ | 44 V(::, sqrt, MathSqrt) \ |
| 43 | 45 |
| 44 // Class that recognizes the name and owner of a function and returns the | 46 // Class that recognizes the name and owner of a function and returns the |
| 45 // corresponding enum. See RECOGNIZED_LIST above for list of recognizable | 47 // corresponding enum. See RECOGNIZED_LIST above for list of recognizable |
| 46 // functions. | 48 // functions. |
| 47 class MethodRecognizer : public AllStatic { | 49 class MethodRecognizer : public AllStatic { |
| 48 public: | 50 public: |
| 49 enum Kind { | 51 enum Kind { |
| 50 kUnknown, | 52 kUnknown, |
| 51 #define DEFINE_ENUM_LIST(class_name, function_name, enum_name) k##enum_name, | 53 #define DEFINE_ENUM_LIST(class_name, function_name, enum_name) k##enum_name, |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 M(ExtractConstructorInstantiator) \ | 243 M(ExtractConstructorInstantiator) \ |
| 242 M(AllocateContext) \ | 244 M(AllocateContext) \ |
| 243 M(ChainContext) \ | 245 M(ChainContext) \ |
| 244 M(CloneContext) \ | 246 M(CloneContext) \ |
| 245 M(CatchEntry) \ | 247 M(CatchEntry) \ |
| 246 M(BinarySmiOp) \ | 248 M(BinarySmiOp) \ |
| 247 M(UnarySmiOp) \ | 249 M(UnarySmiOp) \ |
| 248 M(CheckStackOverflow) \ | 250 M(CheckStackOverflow) \ |
| 249 M(DoubleToDouble) \ | 251 M(DoubleToDouble) \ |
| 250 M(SmiToDouble) \ | 252 M(SmiToDouble) \ |
| 253 M(IntegerToInteger) \ |
| 254 M(DoubleToInteger) \ |
| 251 M(CheckClass) \ | 255 M(CheckClass) \ |
| 252 M(CheckSmi) \ | 256 M(CheckSmi) \ |
| 253 M(Constant) \ | 257 M(Constant) \ |
| 254 M(CheckEitherNonSmi) \ | 258 M(CheckEitherNonSmi) \ |
| 255 M(BinaryDoubleOp) \ | 259 M(BinaryDoubleOp) \ |
| 256 M(MathSqrt) \ | 260 M(MathSqrt) \ |
| 257 M(UnboxDouble) \ | 261 M(UnboxDouble) \ |
| 258 M(BoxDouble) \ | 262 M(BoxDouble) \ |
| 259 M(UnboxInteger) \ | 263 M(UnboxInteger) \ |
| 260 M(BoxInteger) \ | 264 M(BoxInteger) \ |
| (...skipping 3600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3861 | 3865 |
| 3862 virtual intptr_t ResultCid() const { return kDoubleCid; } | 3866 virtual intptr_t ResultCid() const { return kDoubleCid; } |
| 3863 | 3867 |
| 3864 private: | 3868 private: |
| 3865 InstanceCallInstr* instance_call_; | 3869 InstanceCallInstr* instance_call_; |
| 3866 | 3870 |
| 3867 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); | 3871 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); |
| 3868 }; | 3872 }; |
| 3869 | 3873 |
| 3870 | 3874 |
| 3875 class IntegerToIntegerInstr : public TemplateDefinition<1> { |
| 3876 public: |
| 3877 IntegerToIntegerInstr(Value* value, |
| 3878 InstanceCallInstr* instance_call, |
| 3879 intptr_t result_cid) |
| 3880 : instance_call_(instance_call), result_cid_(result_cid) { |
| 3881 ASSERT(value != NULL); |
| 3882 inputs_[0] = value; |
| 3883 } |
| 3884 |
| 3885 Value* value() const { return inputs_[0]; } |
| 3886 |
| 3887 InstanceCallInstr* instance_call() const { return instance_call_; } |
| 3888 |
| 3889 DECLARE_INSTRUCTION(IntegerToInteger) |
| 3890 virtual RawAbstractType* CompileType() const; |
| 3891 |
| 3892 virtual bool CanDeoptimize() const { return false; } |
| 3893 |
| 3894 virtual bool HasSideEffect() const { return false; } |
| 3895 |
| 3896 virtual intptr_t ResultCid() const { return result_cid_; } |
| 3897 |
| 3898 private: |
| 3899 InstanceCallInstr* instance_call_; |
| 3900 const intptr_t result_cid_; |
| 3901 |
| 3902 DISALLOW_COPY_AND_ASSIGN(IntegerToIntegerInstr); |
| 3903 }; |
| 3904 |
| 3905 |
| 3906 class DoubleToIntegerInstr : public TemplateDefinition<0> { |
| 3907 public: |
| 3908 explicit DoubleToIntegerInstr(InstanceCallInstr* instance_call) |
| 3909 : instance_call_(instance_call) { } |
| 3910 |
| 3911 InstanceCallInstr* instance_call() const { return instance_call_; } |
| 3912 |
| 3913 DECLARE_INSTRUCTION(DoubleToInteger) |
| 3914 virtual RawAbstractType* CompileType() const; |
| 3915 |
| 3916 virtual intptr_t ArgumentCount() const { return 1; } |
| 3917 |
| 3918 virtual bool CanDeoptimize() const { return true; } |
| 3919 |
| 3920 virtual bool HasSideEffect() const { return false; } |
| 3921 |
| 3922 // Result could be any of the int types. |
| 3923 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 3924 |
| 3925 private: |
| 3926 InstanceCallInstr* instance_call_; |
| 3927 |
| 3928 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr); |
| 3929 }; |
| 3930 |
| 3931 |
| 3871 class CheckClassInstr : public TemplateInstruction<1> { | 3932 class CheckClassInstr : public TemplateInstruction<1> { |
| 3872 public: | 3933 public: |
| 3873 CheckClassInstr(Value* value, | 3934 CheckClassInstr(Value* value, |
| 3874 intptr_t deopt_id, | 3935 intptr_t deopt_id, |
| 3875 const ICData& unary_checks) | 3936 const ICData& unary_checks) |
| 3876 : unary_checks_(unary_checks) { | 3937 : unary_checks_(unary_checks) { |
| 3877 ASSERT(value != NULL); | 3938 ASSERT(value != NULL); |
| 3878 inputs_[0] = value; | 3939 inputs_[0] = value; |
| 3879 deopt_id_ = deopt_id; | 3940 deopt_id_ = deopt_id; |
| 3880 } | 3941 } |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4184 ForwardInstructionIterator* current_iterator_; | 4245 ForwardInstructionIterator* current_iterator_; |
| 4185 | 4246 |
| 4186 private: | 4247 private: |
| 4187 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4248 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4188 }; | 4249 }; |
| 4189 | 4250 |
| 4190 | 4251 |
| 4191 } // namespace dart | 4252 } // namespace dart |
| 4192 | 4253 |
| 4193 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4254 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |