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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 1826463002: VM: Use propagated type to improve checked smi operations in aot compiler. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix build error Created 4 years, 9 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_mips.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_x64.cc
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
index 1738532b8acfe29782089f7cdfe2583f659b9f05..21d895ef9f1a88e3b19dfaf62550aed671a8bf70 100644
--- a/runtime/vm/intermediate_language_x64.cc
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -2848,13 +2848,24 @@ void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
new CheckedSmiSlowPath(this, compiler->CurrentTryIndex());
compiler->AddSlowPathCode(slow_path);
// Test operands if necessary.
+
+ intptr_t left_cid = left()->Type()->ToCid();
+ intptr_t right_cid = right()->Type()->ToCid();
Register left = locs()->in(0).reg();
Register right = locs()->in(1).reg();
- Register result = locs()->out(0).reg();
- __ movq(TMP, left);
- __ orq(TMP, right);
- __ testq(TMP, Immediate(kSmiTagMask));
+ if (this->left()->definition() == this->right()->definition()) {
+ __ testq(left, Immediate(kSmiTagMask));
+ } else if (left_cid == kSmiCid) {
+ __ testq(right, Immediate(kSmiTagMask));
+ } else if (right_cid == kSmiCid) {
+ __ testq(left, Immediate(kSmiTagMask));
+ } else {
+ __ movq(TMP, left);
+ __ orq(TMP, right);
+ __ testq(TMP, Immediate(kSmiTagMask));
+ }
__ j(NOT_ZERO, slow_path->entry_label());
+ Register result = locs()->out(0).reg();
switch (op_kind()) {
case Token::kADD:
__ movq(result, left);
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698