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

Unified Diff: runtime/vm/intermediate_language.h

Issue 10440099: Adding unary op optimizations. missing assembly operations/ (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/il_printer.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 8171)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -65,6 +65,8 @@
M(CloneContext, CloneContextComp) \
M(CatchEntry, CatchEntryComp) \
M(BinaryOp, BinaryOpComp) \
+ M(UnarySmiOp, UnarySmiOpComp) \
+ M(NumberNegate, NumberNegateComp) \
#define FORWARD_DECLARATION(ShortName, ClassName) class ClassName;
@@ -1282,6 +1284,8 @@
Value* left,
Value* right)
: op_kind_(op_kind), instance_call_(instance_call) {
+ ASSERT(left != NULL);
+ ASSERT(right != NULL);
inputs_[0] = left;
inputs_[1] = right;
}
@@ -1304,6 +1308,56 @@
DISALLOW_COPY_AND_ASSIGN(BinaryOpComp);
};
+
+// Handles both Smi operations: BIT_OR and NEGATE.
+class UnarySmiOpComp : public TemplateComputation<1> {
+ public:
+ UnarySmiOpComp(Token::Kind op_kind,
+ InstanceCallComp* instance_call,
+ Value* value)
+ : op_kind_(op_kind), instance_call_(instance_call) {
+ ASSERT(value != NULL);
+ inputs_[0] = value;
+ }
+
+ Value* value() const { return inputs_[0]; }
+ Token::Kind op_kind() const { return op_kind_; }
+
+ InstanceCallComp* instance_call() const { return instance_call_; }
+
+ virtual void PrintOperandsTo(BufferFormatter* f) const;
+
+ DECLARE_COMPUTATION(UnarySmiOp)
+
+ private:
+ const Token::Kind op_kind_;
+ InstanceCallComp* instance_call_;
+
+ DISALLOW_COPY_AND_ASSIGN(UnarySmiOpComp);
+};
+
+
+// Handles non-Smi NEGATE operations
+class NumberNegateComp : public TemplateComputation<1> {
+ public:
+ NumberNegateComp(InstanceCallComp* instance_call,
+ Value* value) : instance_call_(instance_call) {
+ ASSERT(value != NULL);
+ inputs_[0] = value;
+ }
+
+ Value* value() const { return inputs_[0]; }
+
+ InstanceCallComp* instance_call() const { return instance_call_; }
+
+ DECLARE_COMPUTATION(NumberNegate)
+
+ private:
+ InstanceCallComp* instance_call_;
+
+ DISALLOW_COPY_AND_ASSIGN(NumberNegateComp);
+};
+
#undef DECLARE_COMPUTATION
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698