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

Unified Diff: runtime/vm/intermediate_language.h

Issue 23219002: Add double unary operation (negate). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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
Index: runtime/vm/intermediate_language.h
===================================================================
--- runtime/vm/intermediate_language.h (revision 26122)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -581,6 +581,7 @@
M(CloneContext) \
M(BinarySmiOp) \
M(UnarySmiOp) \
+ M(UnaryDoubleOp) \
M(CheckStackOverflow) \
M(SmiToDouble) \
M(DoubleToInteger) \
@@ -920,6 +921,7 @@
friend class BinaryMintOpInstr;
friend class BinarySmiOpInstr;
friend class UnarySmiOpInstr;
+ friend class UnaryDoubleOpInstr;
friend class ShiftMintOpInstr;
friend class UnaryMintOpInstr;
friend class MathUnaryInstr;
@@ -6053,6 +6055,58 @@
};
+// Handles only NEGATE.
+class UnaryDoubleOpInstr : public TemplateDefinition<1> {
+ public:
+ UnaryDoubleOpInstr(Token::Kind op_kind,
+ Value* value,
+ intptr_t deopt_id)
+ : op_kind_(op_kind) {
+ ASSERT(op_kind == Token::kNEGATE);
+ SetInputAt(0, value);
+ // Overrided generated deopt_id.
regis 2013/08/14 22:07:47 Overridden
srdjan 2013/08/14 23:04:30 Done.
+ deopt_id_ = deopt_id;
+ }
+
+ Value* value() const { return inputs_[0]; }
+ Token::Kind op_kind() const { return op_kind_; }
+
+ virtual void PrintOperandsTo(BufferFormatter* f) const;
+
+ DECLARE_INSTRUCTION(UnaryDoubleOp)
+ virtual CompileType ComputeType() const;
+
+ virtual bool CanDeoptimize() const { return false; }
+
+ virtual intptr_t DeoptimizationTarget() const {
+ // Direct access since this instruction cannot deoptimize, and the deopt-id
+ // was inherited from another instruction that could deoptimize.
+ return deopt_id_;
+ }
+
+ virtual Representation representation() const {
+ return kUnboxedDouble;
+ }
+
+ virtual Representation RequiredInputRepresentation(intptr_t idx) const {
+ ASSERT(idx == 0);
+ return kUnboxedDouble;
+ }
+
+ virtual bool AllowsCSE() const { return true; }
+ virtual EffectSet Effects() const { return EffectSet::None(); }
+ virtual EffectSet Dependencies() const { return EffectSet::None(); }
+ virtual bool AttributesEqual(Instruction* other) const { return true; }
+
+ virtual bool MayThrow() const { return false; }
+
+ private:
+ const Token::Kind op_kind_;
+
+ DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr);
+};
+
+
class CheckStackOverflowInstr : public TemplateInstruction<0> {
public:
CheckStackOverflowInstr(intptr_t token_pos, intptr_t loop_depth)

Powered by Google App Engine
This is Rietveld 408576698