| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 2830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2841 } | 2841 } |
| 2842 return summary; | 2842 return summary; |
| 2843 } | 2843 } |
| 2844 | 2844 |
| 2845 | 2845 |
| 2846 void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2846 void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2847 CheckedSmiSlowPath* slow_path = | 2847 CheckedSmiSlowPath* slow_path = |
| 2848 new CheckedSmiSlowPath(this, compiler->CurrentTryIndex()); | 2848 new CheckedSmiSlowPath(this, compiler->CurrentTryIndex()); |
| 2849 compiler->AddSlowPathCode(slow_path); | 2849 compiler->AddSlowPathCode(slow_path); |
| 2850 // Test operands if necessary. | 2850 // Test operands if necessary. |
| 2851 |
| 2852 intptr_t left_cid = left()->Type()->ToCid(); |
| 2853 intptr_t right_cid = right()->Type()->ToCid(); |
| 2851 Register left = locs()->in(0).reg(); | 2854 Register left = locs()->in(0).reg(); |
| 2852 Register right = locs()->in(1).reg(); | 2855 Register right = locs()->in(1).reg(); |
| 2856 if (this->left()->definition() == this->right()->definition()) { |
| 2857 __ testq(left, Immediate(kSmiTagMask)); |
| 2858 } else if (left_cid == kSmiCid) { |
| 2859 __ testq(right, Immediate(kSmiTagMask)); |
| 2860 } else if (right_cid == kSmiCid) { |
| 2861 __ testq(left, Immediate(kSmiTagMask)); |
| 2862 } else { |
| 2863 __ movq(TMP, left); |
| 2864 __ orq(TMP, right); |
| 2865 __ testq(TMP, Immediate(kSmiTagMask)); |
| 2866 } |
| 2867 __ j(NOT_ZERO, slow_path->entry_label()); |
| 2853 Register result = locs()->out(0).reg(); | 2868 Register result = locs()->out(0).reg(); |
| 2854 __ movq(TMP, left); | |
| 2855 __ orq(TMP, right); | |
| 2856 __ testq(TMP, Immediate(kSmiTagMask)); | |
| 2857 __ j(NOT_ZERO, slow_path->entry_label()); | |
| 2858 switch (op_kind()) { | 2869 switch (op_kind()) { |
| 2859 case Token::kADD: | 2870 case Token::kADD: |
| 2860 __ movq(result, left); | 2871 __ movq(result, left); |
| 2861 __ addq(result, right); | 2872 __ addq(result, right); |
| 2862 __ j(OVERFLOW, slow_path->entry_label()); | 2873 __ j(OVERFLOW, slow_path->entry_label()); |
| 2863 break; | 2874 break; |
| 2864 case Token::kSUB: | 2875 case Token::kSUB: |
| 2865 __ movq(result, left); | 2876 __ movq(result, left); |
| 2866 __ subq(result, right); | 2877 __ subq(result, right); |
| 2867 __ j(OVERFLOW, slow_path->entry_label()); | 2878 __ j(OVERFLOW, slow_path->entry_label()); |
| (...skipping 3639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6507 __ Drop(1); | 6518 __ Drop(1); |
| 6508 __ popq(result); | 6519 __ popq(result); |
| 6509 } | 6520 } |
| 6510 | 6521 |
| 6511 | 6522 |
| 6512 } // namespace dart | 6523 } // namespace dart |
| 6513 | 6524 |
| 6514 #undef __ | 6525 #undef __ |
| 6515 | 6526 |
| 6516 #endif // defined TARGET_ARCH_X64 | 6527 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |