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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_optimizer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language.h
===================================================================
--- runtime/vm/intermediate_language.h (revision 13429)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -39,6 +39,8 @@
V(_StringBase, isEmpty, StringBaseIsEmpty) \
V(_IntegerImplementation, toDouble, IntegerToDouble) \
V(_Double, toDouble, DoubleToDouble) \
+ V(_Double, toInt, DoubleToInteger) \
+ V(_IntegerImplementation, toInt, IntegerToInteger) \
V(::, sqrt, MathSqrt) \
// Class that recognizes the name and owner of a function and returns the
@@ -248,6 +250,7 @@
M(CheckStackOverflow) \
M(DoubleToDouble) \
M(SmiToDouble) \
+ M(DoubleToInteger) \
M(CheckClass) \
M(CheckSmi) \
M(Constant) \
@@ -3868,6 +3871,36 @@
};
+class DoubleToIntegerInstr : public TemplateDefinition<1> {
+ public:
+ explicit DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call)
+ : instance_call_(instance_call) {
+ ASSERT(value != NULL);
+ inputs_[0] = value;
+ }
+
+ Value* value() const { return inputs_[0]; }
+ InstanceCallInstr* instance_call() const { return instance_call_; }
+
+ DECLARE_INSTRUCTION(DoubleToInteger)
+ virtual RawAbstractType* CompileType() const;
+
+ virtual intptr_t ArgumentCount() const { return 1; }
+
+ virtual bool CanDeoptimize() const { return true; }
+
+ virtual bool HasSideEffect() const { return false; }
+
+ // Result could be any of the int types.
+ virtual intptr_t ResultCid() const { return kDynamicCid; }
+
+ private:
+ InstanceCallInstr* instance_call_;
+
+ DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr);
+};
+
+
class CheckClassInstr : public TemplateInstruction<1> {
public:
CheckClassInstr(Value* value,
« 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