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

Unified Diff: runtime/vm/intermediate_language.h

Issue 11568044: Add DoubleToSmi optimistically, preventing boxing/unboxing of doubles and propagate smi-nessof the … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 16259)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -253,6 +253,7 @@
M(CheckStackOverflow) \
M(SmiToDouble) \
M(DoubleToInteger) \
+ M(DoubleToSmi) \
M(CheckClass) \
M(CheckSmi) \
M(Constant) \
@@ -534,6 +535,7 @@
friend class CheckEitherNonSmiInstr;
friend class StringCharCodeAtInstr;
friend class LICM;
+ friend class DoubleToSmiInstr;
intptr_t deopt_id_;
intptr_t lifetime_position_; // Position used by register allocator.
@@ -3975,7 +3977,7 @@
class DoubleToIntegerInstr : public TemplateDefinition<1> {
public:
- explicit DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call)
+ DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call)
: instance_call_(instance_call) {
ASSERT(value != NULL);
inputs_[0] = value;
@@ -4003,6 +4005,39 @@
};
+// Similar to 'DoubleToIntegerInstr' but expects unboxed double as input
+// and creates a Smi.
+class DoubleToSmiInstr : public TemplateDefinition<1> {
+ public:
+ DoubleToSmiInstr(Value* value, InstanceCallInstr* instance_call) {
+ ASSERT(value != NULL);
+ inputs_[0] = value;
+ deopt_id_ = instance_call->deopt_id();
+ }
+
+ Value* value() const { return inputs_[0]; }
+
+ DECLARE_INSTRUCTION(DoubleToSmi)
+ virtual RawAbstractType* CompileType() const;
+
+ virtual bool CanDeoptimize() const { return true; }
+
+ virtual bool HasSideEffect() const { return false; }
+
+ virtual intptr_t ResultCid() const { return kSmiCid; }
+
+ virtual Representation RequiredInputRepresentation(intptr_t idx) const {
+ ASSERT(idx == 0);
+ return kUnboxedDouble;
+ }
+
+ virtual intptr_t DeoptimizationTarget() const { return deopt_id_; }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr);
+};
+
+
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