| 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" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 2046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2057 | 2057 |
| 2058 | 2058 |
| 2059 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, | 2059 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, |
| 2060 BigintCompare, | 2060 BigintCompare, |
| 2061 RawBigint* left, | 2061 RawBigint* left, |
| 2062 RawBigint* right); | 2062 RawBigint* right); |
| 2063 | 2063 |
| 2064 | 2064 |
| 2065 // Does identical check (object references are equal or not equal) with special | 2065 // Does identical check (object references are equal or not equal) with special |
| 2066 // checks for boxed numbers. | 2066 // checks for boxed numbers. |
| 2067 // Left and right are pushed on stack. | |
| 2068 // Return ZF set. | 2067 // Return ZF set. |
| 2069 // Note: A Mint cannot contain a value that would fit in Smi, a Bigint | 2068 // Note: A Mint cannot contain a value that would fit in Smi, a Bigint |
| 2070 // cannot contain a value that fits in Mint or Smi. | 2069 // cannot contain a value that fits in Mint or Smi. |
| 2071 void StubCode::GenerateIdenticalWithNumberCheckStub(Assembler* assembler) { | 2070 void StubCode::GenerateIdenticalWithNumberCheckStub(Assembler* assembler, |
| 2072 const Register left = EAX; | 2071 const Register left, |
| 2073 const Register right = EDX; | 2072 const Register right, |
| 2074 const Register temp = ECX; | 2073 const Register temp, |
| 2075 // Preserve left, right and temp. | 2074 const Register unused) { |
| 2076 __ pushl(left); | |
| 2077 __ pushl(right); | |
| 2078 __ pushl(temp); | |
| 2079 // TOS + 0: saved temp | |
| 2080 // TOS + 1: saved right | |
| 2081 // TOS + 2: saved left | |
| 2082 // TOS + 3: return address | |
| 2083 // TOS + 4: right argument. | |
| 2084 // TOS + 5: left argument. | |
| 2085 __ movl(left, Address(ESP, 5 * kWordSize)); | |
| 2086 __ movl(right, Address(ESP, 4 * kWordSize)); | |
| 2087 Label reference_compare, done, check_mint, check_bigint; | 2075 Label reference_compare, done, check_mint, check_bigint; |
| 2088 // If any of the arguments is Smi do reference compare. | 2076 // If any of the arguments is Smi do reference compare. |
| 2089 __ testl(left, Immediate(kSmiTagMask)); | 2077 __ testl(left, Immediate(kSmiTagMask)); |
| 2090 __ j(ZERO, &reference_compare, Assembler::kNearJump); | 2078 __ j(ZERO, &reference_compare, Assembler::kNearJump); |
| 2091 __ testl(right, Immediate(kSmiTagMask)); | 2079 __ testl(right, Immediate(kSmiTagMask)); |
| 2092 __ j(ZERO, &reference_compare, Assembler::kNearJump); | 2080 __ j(ZERO, &reference_compare, Assembler::kNearJump); |
| 2093 | 2081 |
| 2094 // Value compare for two doubles. | 2082 // Value compare for two doubles. |
| 2095 __ CompareClassId(left, kDoubleCid, temp); | 2083 __ CompareClassId(left, kDoubleCid, temp); |
| 2096 __ j(NOT_EQUAL, &check_mint, Assembler::kNearJump); | 2084 __ j(NOT_EQUAL, &check_mint, Assembler::kNearJump); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2128 __ movl(Address(ESP, 0 * kWordSize), right); | 2116 __ movl(Address(ESP, 0 * kWordSize), right); |
| 2129 __ CallRuntime(kBigintCompareRuntimeEntry); | 2117 __ CallRuntime(kBigintCompareRuntimeEntry); |
| 2130 // Result in EAX, 0 means equal. | 2118 // Result in EAX, 0 means equal. |
| 2131 __ LeaveFrame(); | 2119 __ LeaveFrame(); |
| 2132 __ cmpl(EAX, Immediate(0)); | 2120 __ cmpl(EAX, Immediate(0)); |
| 2133 __ jmp(&done); | 2121 __ jmp(&done); |
| 2134 | 2122 |
| 2135 __ Bind(&reference_compare); | 2123 __ Bind(&reference_compare); |
| 2136 __ cmpl(left, right); | 2124 __ cmpl(left, right); |
| 2137 __ Bind(&done); | 2125 __ Bind(&done); |
| 2126 } |
| 2127 |
| 2128 |
| 2129 // Called only from unoptimized code. All relevant registers have been saved. |
| 2130 // TOS + 0: return address |
| 2131 // TOS + 1: right argument. |
| 2132 // TOS + 2: left argument. |
| 2133 // Returns ZF set. |
| 2134 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( |
| 2135 Assembler* assembler) { |
| 2136 const Register left = EAX; |
| 2137 const Register right = EDX; |
| 2138 const Register temp = ECX; |
| 2139 __ movl(left, Address(ESP, 2 * kWordSize)); |
| 2140 __ movl(right, Address(ESP, 1 * kWordSize)); |
| 2141 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 2142 __ ret(); |
| 2143 } |
| 2144 |
| 2145 |
| 2146 // Called from otpimzied code only. Must preserve any registers that are |
| 2147 // destroyed. |
| 2148 // TOS + 0: return address |
| 2149 // TOS + 1: right argument. |
| 2150 // TOS + 2: left argument. |
| 2151 // Returns ZF set. |
| 2152 void StubCode::GenerateOptimizedIdenticalWithNumberCheckStub( |
| 2153 Assembler* assembler) { |
| 2154 const Register left = EAX; |
| 2155 const Register right = EDX; |
| 2156 const Register temp = ECX; |
| 2157 // Preserve left, right and temp. |
| 2158 __ pushl(left); |
| 2159 __ pushl(right); |
| 2160 __ pushl(temp); |
| 2161 __ movl(left, Address(ESP, 5 * kWordSize)); |
| 2162 __ movl(right, Address(ESP, 4 * kWordSize)); |
| 2163 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 2138 __ popl(temp); | 2164 __ popl(temp); |
| 2139 __ popl(right); | 2165 __ popl(right); |
| 2140 __ popl(left); | 2166 __ popl(left); |
| 2141 __ ret(); | 2167 __ ret(); |
| 2142 } | 2168 } |
| 2143 | 2169 |
| 2144 } // namespace dart | 2170 } // namespace dart |
| 2145 | 2171 |
| 2146 #endif // defined TARGET_ARCH_IA32 | 2172 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |