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

Unified Diff: runtime/vm/intermediate_language.h

Issue 14251023: Merge (x & y) == 0 pattern to emit a single test instruction. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index 1b004138c83945117f66436c0aa1cbd9a7447255..5220543e73aeb741fe2ed03612bf9613c6cbbf0b 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -504,6 +504,7 @@ class EmbeddedArray<T, 0> {
M(InvokeMathCFunction) \
M(GuardField) \
M(IfThenElse) \
+ M(TestSmi) \
#define FORWARD_DECLARATION(type) class type##Instr;
FOR_EACH_INSTRUCTION(FORWARD_DECLARATION)
@@ -2486,6 +2487,10 @@ class ComparisonInstr : public TemplateDefinition<2> {
deopt_id_ = deopt_id;
}
+ virtual bool IsSmiEquality() const {
+ return false;
+ }
+
protected:
Token::Kind kind_;
};
@@ -2585,6 +2590,40 @@ class StrictCompareInstr : public ComparisonInstr {
};
+// Comparison instruction that is equivalent to the (left & right) == 0
+// comparison pattern.
+class TestSmiInstr : public ComparisonInstr {
+ public:
+ TestSmiInstr(Token::Kind kind, Value* left, Value* right)
+ : ComparisonInstr(kind, left, right) {
+ }
+
+ DECLARE_INSTRUCTION(TestSmi);
+
+ virtual CompileType ComputeType() const {
+ return CompileType::Bool();
+ }
+
+ virtual bool CanDeoptimize() const {
+ return false;
+ }
+
+ virtual bool HasSideEffect() const {
+ return false;
+ }
+
+ virtual void EmitBranchCode(FlowGraphCompiler* compiler,
+ BranchInstr* branch);
+
+ virtual Representation RequiredInputRepresentation(intptr_t idx) const {
+ return kTagged;
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TestSmiInstr);
+};
+
+
class EqualityCompareInstr : public ComparisonInstr {
public:
EqualityCompareInstr(intptr_t token_pos,
@@ -2647,6 +2686,10 @@ class EqualityCompareInstr : public ComparisonInstr {
bool IsPolymorphic() const;
+ virtual bool IsSmiEquality() const {
+ return receiver_class_id() == kSmiCid;
+ }
+
private:
const ICData* ic_data_;
const intptr_t token_pos_;
« 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