| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1871 __ cdq(); // Sign extend EAX -> EDX:EAX. | 1871 __ cdq(); // Sign extend EAX -> EDX:EAX. |
| 1872 __ idivl(right_temp); // EAX: quotient, EDX: remainder. | 1872 __ idivl(right_temp); // EAX: quotient, EDX: remainder. |
| 1873 // Check the corner case of dividing the 'MIN_SMI' with -1, in which | 1873 // Check the corner case of dividing the 'MIN_SMI' with -1, in which |
| 1874 // case we cannot tag the result. | 1874 // case we cannot tag the result. |
| 1875 __ cmpl(result, Immediate(0x40000000)); | 1875 __ cmpl(result, Immediate(0x40000000)); |
| 1876 __ j(EQUAL, deopt); | 1876 __ j(EQUAL, deopt); |
| 1877 __ SmiTag(result); | 1877 __ SmiTag(result); |
| 1878 break; | 1878 break; |
| 1879 } | 1879 } |
| 1880 case Token::kSHR: { | 1880 case Token::kSHR: { |
| 1881 if (CanDeoptimize()) { |
| 1882 __ cmpl(right, Immediate(0)); |
| 1883 __ j(LESS, deopt); |
| 1884 } |
| 1885 __ SmiUntag(right); |
| 1881 // sarl operation masks the count to 5 bits. | 1886 // sarl operation masks the count to 5 bits. |
| 1882 const Immediate kCountLimit = Immediate(0x1F); | 1887 const intptr_t kCountLimit = 0x1F; |
| 1883 __ cmpl(right, Immediate(0)); | 1888 Range* right_range = this->right()->definition()->range(); |
| 1884 __ j(LESS, deopt); | 1889 if ((right_range == NULL) || |
| 1885 __ SmiUntag(right); | 1890 !right_range->IsWithin(RangeBoundary::kMinusInfinity, kCountLimit)) { |
| 1886 __ cmpl(right, kCountLimit); | 1891 __ cmpl(right, Immediate(kCountLimit)); |
| 1887 Label count_ok; | 1892 Label count_ok; |
| 1888 __ j(LESS, &count_ok, Assembler::kNearJump); | 1893 __ j(LESS, &count_ok, Assembler::kNearJump); |
| 1889 __ movl(right, kCountLimit); | 1894 __ movl(right, Immediate(kCountLimit)); |
| 1890 __ Bind(&count_ok); | 1895 __ Bind(&count_ok); |
| 1896 } |
| 1891 ASSERT(right == ECX); // Count must be in ECX | 1897 ASSERT(right == ECX); // Count must be in ECX |
| 1892 __ SmiUntag(left); | 1898 __ SmiUntag(left); |
| 1893 __ sarl(left, right); | 1899 __ sarl(left, right); |
| 1894 __ SmiTag(left); | 1900 __ SmiTag(left); |
| 1895 break; | 1901 break; |
| 1896 } | 1902 } |
| 1897 case Token::kSHL: { | 1903 case Token::kSHL: { |
| 1898 Register temp = locs()->temp(0).reg(); | 1904 Register temp = locs()->temp(0).reg(); |
| 1899 // Check if count too large for handling it inlined. | 1905 // Check if count too large for handling it inlined. |
| 1900 __ movl(temp, left); | 1906 __ movl(temp, left); |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2691 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. | 2697 __ pcmpeqq(XMM0, XMM0); // Generate all 1's. |
| 2692 __ pxor(value, XMM0); | 2698 __ pxor(value, XMM0); |
| 2693 } | 2699 } |
| 2694 | 2700 |
| 2695 | 2701 |
| 2696 } // namespace dart | 2702 } // namespace dart |
| 2697 | 2703 |
| 2698 #undef __ | 2704 #undef __ |
| 2699 | 2705 |
| 2700 #endif // defined TARGET_ARCH_X64 | 2706 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |