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

Unified Diff: runtime/vm/intermediate_language_mips.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_arm64.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_mips.cc
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc
index 7342fb698f6d42b1d7d01eee8f7d4a6afed788b4..d1fd55c3b4b43e7fd306eb0cf236e1f3b0ca4e8a 100644
--- a/runtime/vm/intermediate_language_mips.cc
+++ b/runtime/vm/intermediate_language_mips.cc
@@ -2928,8 +2928,20 @@ void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Register left = locs()->in(0).reg();
Register right = locs()->in(1).reg();
Register result = locs()->out(0).reg();
- __ or_(result, left, right);
- __ andi(CMPRES1, result, Immediate(kSmiTagMask));
+ intptr_t left_cid = this->left()->Type()->ToCid();
+ intptr_t right_cid = this->right()->Type()->ToCid();
+ bool combined_smi_check = false;
+ if (this->left()->definition() == this->right()->definition()) {
+ __ andi(CMPRES1, left, Immediate(kSmiTagMask));
+ } else if (left_cid == kSmiCid) {
+ __ andi(CMPRES1, right, Immediate(kSmiTagMask));
+ } else if (right_cid == kSmiCid) {
+ __ andi(CMPRES1, left, Immediate(kSmiTagMask));
+ } else {
+ combined_smi_check = true;
+ __ or_(result, left, right);
+ __ andi(CMPRES1, result, Immediate(kSmiTagMask));
+ }
__ bne(CMPRES1, ZR, slow_path->entry_label());
switch (op_kind()) {
case Token::kADD:
@@ -2942,6 +2954,9 @@ void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
break;
case Token::kBIT_OR:
// Operation part of combined smi check.
+ if (!combined_smi_check) {
+ __ or_(result, left, right);
+ }
break;
case Token::kBIT_AND:
__ and_(result, left, right);
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698