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

Unified Diff: runtime/vm/intermediate_language_ia32.cc

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/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_ia32.cc
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index 689f965d55ebccbdc62c85076b7393f045b6224b..f8c4016ffcfc8514a659daf980f2416172463677 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -888,6 +888,41 @@ void EqualityCompareInstr::EmitBranchCode(FlowGraphCompiler* compiler,
}
+LocationSummary* TestSmiInstr::MakeLocationSummary() const {
+ const intptr_t kNumInputs = 2;
+ const intptr_t kNumTemps = 0;
+ LocationSummary* locs =
+ new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
+ locs->set_in(0, Location::RequiresRegister());
+ // Only one input can be a constant operand. The case of two constant
+ // operands should be handled by constant propagation.
+ locs->set_in(1, Location::RegisterOrConstant(right()));
+ return locs;
+}
+
+
+void TestSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ // Never emitted outside of the BranchInstr.
+ UNREACHABLE();
+}
+
+
+void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler,
+ BranchInstr* branch) {
+ Condition branch_condition = (kind() == Token::kNE) ? NOT_ZERO : ZERO;
+ Location right = locs()->in(1);
+ if (right.IsConstant()) {
+ ASSERT(right.constant().IsSmi());
+ const int32_t imm =
+ reinterpret_cast<int32_t>(right.constant().raw());
+ __ testl(locs()->in(0).reg(), Immediate(imm));
+ } else {
+ __ testl(locs()->in(0).reg(), right.reg());
+ }
+ branch->EmitBranchOnCondition(compiler, branch_condition);
+}
+
+
LocationSummary* RelationalOpInstr::MakeLocationSummary() const {
const intptr_t kNumInputs = 2;
const intptr_t kNumTemps = 0;
@@ -3734,8 +3769,7 @@ bool IfThenElseInstr::Supports(ComparisonInstr* comparison,
Value* v2) {
if (!(comparison->IsStrictCompare() &&
!comparison->AsStrictCompare()->needs_number_check()) &&
- !(comparison->IsEqualityCompare() &&
- (comparison->AsEqualityCompare()->receiver_class_id() == kSmiCid))) {
+ !comparison->IsSmiEquality()) {
return false;
}
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698