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

Side by Side Diff: runtime/vm/intermediate_language_arm64.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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64.
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 2791 matching lines...) Expand 10 before | Expand all | Expand 10 after
2802 2802
2803 2803
2804 void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2804 void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2805 CheckedSmiSlowPath* slow_path = 2805 CheckedSmiSlowPath* slow_path =
2806 new CheckedSmiSlowPath(this, compiler->CurrentTryIndex()); 2806 new CheckedSmiSlowPath(this, compiler->CurrentTryIndex());
2807 compiler->AddSlowPathCode(slow_path); 2807 compiler->AddSlowPathCode(slow_path);
2808 // Test operands if necessary. 2808 // Test operands if necessary.
2809 Register left = locs()->in(0).reg(); 2809 Register left = locs()->in(0).reg();
2810 Register right = locs()->in(1).reg(); 2810 Register right = locs()->in(1).reg();
2811 Register result = locs()->out(0).reg(); 2811 Register result = locs()->out(0).reg();
2812 __ orr(result, left, Operand(right)); 2812 intptr_t left_cid = this->left()->Type()->ToCid();
2813 __ tsti(result, Immediate(kSmiTagMask)); 2813 intptr_t right_cid = this->right()->Type()->ToCid();
2814 bool combined_smi_check = false;
2815 if (this->left()->definition() == this->right()->definition()) {
2816 __ tsti(left, Immediate(kSmiTagMask));
2817 } else if (left_cid == kSmiCid) {
2818 __ tsti(right, Immediate(kSmiTagMask));
2819 } else if (right_cid == kSmiCid) {
2820 __ tsti(left, Immediate(kSmiTagMask));
2821 } else {
2822 combined_smi_check = true;
2823 __ orr(result, left, Operand(right));
2824 __ tsti(result, Immediate(kSmiTagMask));
2825 }
2826
2814 __ b(slow_path->entry_label(), NE); 2827 __ b(slow_path->entry_label(), NE);
2815 switch (op_kind()) { 2828 switch (op_kind()) {
2816 case Token::kADD: 2829 case Token::kADD:
2817 __ adds(result, left, Operand(right)); 2830 __ adds(result, left, Operand(right));
2818 __ b(slow_path->entry_label(), VS); 2831 __ b(slow_path->entry_label(), VS);
2819 break; 2832 break;
2820 case Token::kSUB: 2833 case Token::kSUB:
2821 __ subs(result, left, Operand(right)); 2834 __ subs(result, left, Operand(right));
2822 __ b(slow_path->entry_label(), VS); 2835 __ b(slow_path->entry_label(), VS);
2823 break; 2836 break;
2824 case Token::kBIT_OR: 2837 case Token::kBIT_OR:
2825 // Operation part of combined smi check. 2838 // Operation may be part of combined smi check.
2839 if (!combined_smi_check) {
2840 __ orr(result, left, Operand(right));
2841 }
2826 break; 2842 break;
2827 case Token::kBIT_AND: 2843 case Token::kBIT_AND:
2828 __ and_(result, left, Operand(right)); 2844 __ and_(result, left, Operand(right));
2829 break; 2845 break;
2830 case Token::kBIT_XOR: 2846 case Token::kBIT_XOR:
2831 __ eor(result, left, Operand(right)); 2847 __ eor(result, left, Operand(right));
2832 break; 2848 break;
2833 case Token::kEQ: 2849 case Token::kEQ:
2834 case Token::kLT: 2850 case Token::kLT:
2835 case Token::kLTE: 2851 case Token::kLTE:
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
3148 3164
3149 3165
3150 void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3166 void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3151 Label* deopt = compiler->AddDeoptStub(deopt_id(), 3167 Label* deopt = compiler->AddDeoptStub(deopt_id(),
3152 ICData::kDeoptBinaryDoubleOp, 3168 ICData::kDeoptBinaryDoubleOp,
3153 licm_hoisted_ ? ICData::kHoisted : 0); 3169 licm_hoisted_ ? ICData::kHoisted : 0);
3154 intptr_t left_cid = left()->Type()->ToCid(); 3170 intptr_t left_cid = left()->Type()->ToCid();
3155 intptr_t right_cid = right()->Type()->ToCid(); 3171 intptr_t right_cid = right()->Type()->ToCid();
3156 const Register left = locs()->in(0).reg(); 3172 const Register left = locs()->in(0).reg();
3157 const Register right = locs()->in(1).reg(); 3173 const Register right = locs()->in(1).reg();
3158 if (left_cid == kSmiCid) { 3174 if (this->left()->definition() == this->right()->definition()) {
3175 __ tsti(left, Immediate(kSmiTagMask));
3176 } else if (left_cid == kSmiCid) {
3159 __ tsti(right, Immediate(kSmiTagMask)); 3177 __ tsti(right, Immediate(kSmiTagMask));
3160 } else if (right_cid == kSmiCid) { 3178 } else if (right_cid == kSmiCid) {
3161 __ tsti(left, Immediate(kSmiTagMask)); 3179 __ tsti(left, Immediate(kSmiTagMask));
3162 } else { 3180 } else {
3163 __ orr(TMP, left, Operand(right)); 3181 __ orr(TMP, left, Operand(right));
3164 __ tsti(TMP, Immediate(kSmiTagMask)); 3182 __ tsti(TMP, Immediate(kSmiTagMask));
3165 } 3183 }
3166 __ b(deopt, EQ); 3184 __ b(deopt, EQ);
3167 } 3185 }
3168 3186
(...skipping 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after
5671 1, 5689 1,
5672 locs()); 5690 locs());
5673 __ Drop(1); 5691 __ Drop(1);
5674 __ Pop(result); 5692 __ Pop(result);
5675 } 5693 }
5676 5694
5677 5695
5678 } // namespace dart 5696 } // namespace dart
5679 5697
5680 #endif // defined TARGET_ARCH_ARM64 5698 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« 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