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

Unified Diff: runtime/vm/intermediate_language.h

Issue 59613005: Merge (x & y) == 0 pattern to emit a single test instruction. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 29964)
+++ runtime/vm/intermediate_language.h (working copy)
@@ -661,8 +661,8 @@
M(BoxDouble) \
M(BoxFloat32x4) \
M(UnboxFloat32x4) \
- M(BoxInt32x4) \
- M(UnboxInt32x4) \
+ M(BoxInt32x4) \
+ M(UnboxInt32x4) \
M(UnboxInteger) \
M(BoxInteger) \
M(BinaryMintOp) \
@@ -689,14 +689,15 @@
M(Float32x4ZeroArg) \
M(Float32x4Clamp) \
M(Float32x4With) \
- M(Float32x4ToInt32x4) \
+ M(Float32x4ToInt32x4) \
M(MaterializeObject) \
- M(Int32x4BoolConstructor) \
- M(Int32x4GetFlag) \
- M(Int32x4Select) \
- M(Int32x4SetFlag) \
- M(Int32x4ToFloat32x4) \
- M(BinaryInt32x4Op) \
+ M(Int32x4BoolConstructor) \
+ M(Int32x4GetFlag) \
+ M(Int32x4Select) \
+ M(Int32x4SetFlag) \
+ M(Int32x4ToFloat32x4) \
+ M(BinaryInt32x4Op) \
+ M(TestSmi) \
#define FORWARD_DECLARATION(type) class type##Instr;
@@ -2985,6 +2986,45 @@
};
+// Comparison instruction that is equivalent to the (left & right) == 0
+// comparison pattern.
+class TestSmiInstr : public ComparisonInstr {
+ public:
+ TestSmiInstr(intptr_t token_pos, Token::Kind kind, Value* left, Value* right)
+ : ComparisonInstr(token_pos, kind, left, right) {
+ ASSERT(kind == Token::kEQ || kind == Token::kNE);
+ }
+
+ DECLARE_INSTRUCTION(TestSmi);
+ virtual CompileType ComputeType() const;
+
+ virtual bool CanDeoptimize() const { return false; }
+
+ virtual bool CanBecomeDeoptimizationTarget() const {
+ // TestSmi can be merged into Branch and thus needs an environment.
+ return true;
+ }
+
+ virtual intptr_t DeoptimizationTarget() const {
+ return GetDeoptId();
+ }
+
+ virtual Representation RequiredInputRepresentation(intptr_t idx) const {
+ return kTagged;
+ }
+
+ virtual EffectSet Effects() const { return EffectSet::None(); }
+
+ virtual bool MayThrow() const { return false; }
+
+ virtual void EmitBranchCode(FlowGraphCompiler* compiler,
+ BranchInstr* branch);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TestSmiInstr);
+};
+
+
class EqualityCompareInstr : public ComparisonInstr {
public:
EqualityCompareInstr(intptr_t token_pos,
@@ -3001,7 +3041,6 @@
DECLARE_INSTRUCTION(EqualityCompare)
virtual CompileType ComputeType() const;
- virtual bool RecomputeType();
virtual void PrintOperandsTo(BufferFormatter* f) const;
@@ -3051,7 +3090,6 @@
DECLARE_INSTRUCTION(RelationalOp)
virtual CompileType ComputeType() const;
- virtual bool RecomputeType();
virtual void PrintOperandsTo(BufferFormatter* f) const;

Powered by Google App Engine
This is Rietveld 408576698