| 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" | 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/assembler_macros.h" | 9 #include "vm/assembler_macros.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2123 AssemblerMacros::EnterStubFrame(assembler); | 2123 AssemblerMacros::EnterStubFrame(assembler); |
| 2124 __ pushl(EAX); | 2124 __ pushl(EAX); |
| 2125 __ pushl(EDX); | 2125 __ pushl(EDX); |
| 2126 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); | 2126 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); |
| 2127 __ popl(EDX); | 2127 __ popl(EDX); |
| 2128 __ popl(EAX); | 2128 __ popl(EAX); |
| 2129 __ LeaveFrame(); | 2129 __ LeaveFrame(); |
| 2130 __ ret(); | 2130 __ ret(); |
| 2131 } | 2131 } |
| 2132 | 2132 |
| 2133 |
| 2134 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, |
| 2135 BigintCompare, |
| 2136 RawBigint* left, |
| 2137 RawBigint* right); |
| 2138 |
| 2139 |
| 2140 // Does identical check (object references are equal or not equal) with special |
| 2141 // checks for boxed numbers. |
| 2142 // Left and right are pushed on stack. |
| 2143 // Return ZF set. |
| 2144 // Note: A Mint cannot contain a value that would fit in Smi, a Bigint |
| 2145 // cannot contain a value that fits in Mint or Smi. |
| 2146 void StubCode::GenerateIdenticalWithNumberCheckStub(Assembler* assembler) { |
| 2147 const Register left = EAX; |
| 2148 const Register right = EDX; |
| 2149 const Register temp = ECX; |
| 2150 // Preserve left, right and temp. |
| 2151 __ pushl(left); |
| 2152 __ pushl(right); |
| 2153 __ pushl(temp); |
| 2154 // TOS + 0: saved temp |
| 2155 // TOS + 1: saved right |
| 2156 // TOS + 2: saved left |
| 2157 // TOS + 3: return address |
| 2158 // TOS + 4: right argument. |
| 2159 // TOS + 5: left argument. |
| 2160 __ movl(left, Address(ESP, 5 * kWordSize)); |
| 2161 __ movl(right, Address(ESP, 4 * kWordSize)); |
| 2162 Label reference_compare, done, check_mint, check_bigint; |
| 2163 // If any of the arguments is Smi do reference compare. |
| 2164 __ testl(left, Immediate(kSmiTagMask)); |
| 2165 __ j(ZERO, &reference_compare, Assembler::kNearJump); |
| 2166 __ testl(right, Immediate(kSmiTagMask)); |
| 2167 __ j(ZERO, &reference_compare, Assembler::kNearJump); |
| 2168 |
| 2169 // Value compare for two doubles. |
| 2170 __ CompareClassId(left, kDoubleCid, temp); |
| 2171 __ j(NOT_EQUAL, &check_mint, Assembler::kNearJump); |
| 2172 __ CompareClassId(right, kDoubleCid, temp); |
| 2173 __ j(NOT_EQUAL, &done, Assembler::kNearJump); |
| 2174 |
| 2175 // Double values bitwise compare. |
| 2176 __ movl(temp, FieldAddress(left, Double::value_offset() + 0 * kWordSize)); |
| 2177 __ cmpl(temp, FieldAddress(right, Double::value_offset() + 0 * kWordSize)); |
| 2178 __ j(NOT_EQUAL, &done, Assembler::kNearJump); |
| 2179 __ movl(temp, FieldAddress(left, Double::value_offset() + 1 * kWordSize)); |
| 2180 __ cmpl(temp, FieldAddress(right, Double::value_offset() + 1 * kWordSize)); |
| 2181 __ jmp(&done, Assembler::kNearJump); |
| 2182 |
| 2183 __ Bind(&check_mint); |
| 2184 __ CompareClassId(left, kMintCid, temp); |
| 2185 __ j(NOT_EQUAL, &check_bigint, Assembler::kNearJump); |
| 2186 __ CompareClassId(right, kMintCid, temp); |
| 2187 __ j(NOT_EQUAL, &done, Assembler::kNearJump); |
| 2188 __ movl(temp, FieldAddress(left, Mint::value_offset() + 0 * kWordSize)); |
| 2189 __ cmpl(temp, FieldAddress(right, Mint::value_offset() + 0 * kWordSize)); |
| 2190 __ j(NOT_EQUAL, &done, Assembler::kNearJump); |
| 2191 __ movl(temp, FieldAddress(left, Mint::value_offset() + 1 * kWordSize)); |
| 2192 __ cmpl(temp, FieldAddress(right, Mint::value_offset() + 1 * kWordSize)); |
| 2193 __ jmp(&done, Assembler::kNearJump); |
| 2194 |
| 2195 __ Bind(&check_bigint); |
| 2196 __ CompareClassId(left, kBigintCid, temp); |
| 2197 __ j(NOT_EQUAL, &reference_compare, Assembler::kNearJump); |
| 2198 __ CompareClassId(right, kBigintCid, temp); |
| 2199 __ j(NOT_EQUAL, &done, Assembler::kNearJump); |
| 2200 __ EnterFrame(0); |
| 2201 __ ReserveAlignedFrameSpace(2 * kWordSize); |
| 2202 __ movl(Address(ESP, 1 * kWordSize), left); |
| 2203 __ movl(Address(ESP, 0 * kWordSize), right); |
| 2204 __ CallRuntime(kBigintCompareRuntimeEntry); |
| 2205 // Result in EAX, 0 means equal. |
| 2206 __ LeaveFrame(); |
| 2207 __ cmpl(EAX, Immediate(0)); |
| 2208 __ jmp(&done); |
| 2209 |
| 2210 __ Bind(&reference_compare); |
| 2211 __ cmpl(left, right); |
| 2212 __ Bind(&done); |
| 2213 __ popl(temp); |
| 2214 __ popl(right); |
| 2215 __ popl(left); |
| 2216 __ ret(); |
| 2217 } |
| 2218 |
| 2133 } // namespace dart | 2219 } // namespace dart |
| 2134 | 2220 |
| 2135 #endif // defined TARGET_ARCH_IA32 | 2221 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |