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

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

Issue 11098009: Implement SmiToInt and DoubleToInt. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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_optimizer.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 21 matching lines...) Expand all
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
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(DoubleToInteger) \
251 M(CheckClass) \ 254 M(CheckClass) \
252 M(CheckSmi) \ 255 M(CheckSmi) \
253 M(Constant) \ 256 M(Constant) \
254 M(CheckEitherNonSmi) \ 257 M(CheckEitherNonSmi) \
255 M(BinaryDoubleOp) \ 258 M(BinaryDoubleOp) \
256 M(MathSqrt) \ 259 M(MathSqrt) \
257 M(UnboxDouble) \ 260 M(UnboxDouble) \
258 M(BoxDouble) \ 261 M(BoxDouble) \
259 M(UnboxInteger) \ 262 M(UnboxInteger) \
260 M(BoxInteger) \ 263 M(BoxInteger) \
(...skipping 3600 matching lines...) Expand 10 before | Expand all | Expand 10 after
3861 3864
3862 virtual intptr_t ResultCid() const { return kDoubleCid; } 3865 virtual intptr_t ResultCid() const { return kDoubleCid; }
3863 3866
3864 private: 3867 private:
3865 InstanceCallInstr* instance_call_; 3868 InstanceCallInstr* instance_call_;
3866 3869
3867 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); 3870 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr);
3868 }; 3871 };
3869 3872
3870 3873
3874 class DoubleToIntegerInstr : public TemplateDefinition<1> {
3875 public:
3876 explicit DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call)
3877 : instance_call_(instance_call) {
3878 ASSERT(value != NULL);
3879 inputs_[0] = value;
3880 }
3881
3882 Value* value() const { return inputs_[0]; }
3883 InstanceCallInstr* instance_call() const { return instance_call_; }
3884
3885 DECLARE_INSTRUCTION(DoubleToInteger)
3886 virtual RawAbstractType* CompileType() const;
3887
3888 virtual intptr_t ArgumentCount() const { return 1; }
3889
3890 virtual bool CanDeoptimize() const { return true; }
3891
3892 virtual bool HasSideEffect() const { return false; }
3893
3894 // Result could be any of the int types.
3895 virtual intptr_t ResultCid() const { return kDynamicCid; }
3896
3897 private:
3898 InstanceCallInstr* instance_call_;
3899
3900 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr);
3901 };
3902
3903
3871 class CheckClassInstr : public TemplateInstruction<1> { 3904 class CheckClassInstr : public TemplateInstruction<1> {
3872 public: 3905 public:
3873 CheckClassInstr(Value* value, 3906 CheckClassInstr(Value* value,
3874 intptr_t deopt_id, 3907 intptr_t deopt_id,
3875 const ICData& unary_checks) 3908 const ICData& unary_checks)
3876 : unary_checks_(unary_checks) { 3909 : unary_checks_(unary_checks) {
3877 ASSERT(value != NULL); 3910 ASSERT(value != NULL);
3878 inputs_[0] = value; 3911 inputs_[0] = value;
3879 deopt_id_ = deopt_id; 3912 deopt_id_ = deopt_id;
3880 } 3913 }
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
4184 ForwardInstructionIterator* current_iterator_; 4217 ForwardInstructionIterator* current_iterator_;
4185 4218
4186 private: 4219 private:
4187 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 4220 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
4188 }; 4221 };
4189 4222
4190 4223
4191 } // namespace dart 4224 } // namespace dart
4192 4225
4193 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 4226 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698