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

Side by Side Diff: runtime/vm/stub_code_ia32.cc

Issue 11414136: Implement proposed new identity spec. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 | Annotate | Revision Log
OLDNEW
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
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 void StubCode::GenerateIdenticalWithNumberCheckStub(Assembler* assembler) {
2145 const Register left = EAX;
2146 const Register right = EDX;
2147 const Register temp = ECX;
2148 // Preserve left, right and temp.
2149 __ pushl(left);
2150 __ pushl(right);
2151 __ pushl(temp);
2152 // TOS + 0: saved temp
2153 // TOS + 1: saved right
2154 // TOS + 2: saved left
2155 // TOS + 3: return address
2156 // TOS + 4: right argument.
2157 // TOS + 5: left argument.
2158 __ movl(left, Address(ESP, 5 * kWordSize));
2159 __ movl(right, Address(ESP, 4 * kWordSize));
2160 Label reference_compare, done, check_mint, check_bigint;
2161 // If any of the arguments is Smi do reference compare.
2162 __ testl(left, Immediate(kSmiTagMask));
2163 __ j(ZERO, &reference_compare, Assembler::kNearJump);
2164 __ testl(right, Immediate(kSmiTagMask));
2165 __ j(ZERO, &reference_compare, Assembler::kNearJump);
2166
2167 // Value compare for two doubles.
2168 __ CompareClassId(left, kDoubleCid, temp);
2169 __ j(NOT_EQUAL, &check_mint, Assembler::kNearJump);
2170 __ CompareClassId(right, kDoubleCid, temp);
2171 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
2172
2173 // Double values bitwise compare.
2174 __ movl(temp, FieldAddress(left, Double::value_offset() + 0 * kWordSize));
2175 __ cmpl(temp, FieldAddress(right, Double::value_offset() + 0 * kWordSize));
2176 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
2177 __ movl(temp, FieldAddress(left, Double::value_offset() + 1 * kWordSize));
2178 __ cmpl(temp, FieldAddress(right, Double::value_offset() + 1 * kWordSize));
2179 __ jmp(&done, Assembler::kNearJump);
2180
2181 __ Bind(&check_mint);
2182 __ CompareClassId(left, kMintCid, temp);
2183 __ j(NOT_EQUAL, &check_bigint, Assembler::kNearJump);
2184 __ movl(temp, FieldAddress(left, Mint::value_offset() + 0 * kWordSize));
2185 __ cmpl(temp, FieldAddress(right, Mint::value_offset() + 0 * kWordSize));
Florian Schneider 2012/11/23 10:33:40 right has yet not been checked for kMintCid here.
srdjan 2012/11/23 19:45:39 Done.
2186 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
2187 __ movl(temp, FieldAddress(left, Mint::value_offset() + 1 * kWordSize));
2188 __ cmpl(temp, FieldAddress(right, Mint::value_offset() + 1 * kWordSize));
2189 __ jmp(&done, Assembler::kNearJump);
2190
2191 __ Bind(&check_bigint);
2192 __ CompareClassId(left, kBigintCid, temp);
2193 __ j(NOT_EQUAL, &reference_compare, Assembler::kNearJump);
2194 __ CompareClassId(right, kBigintCid, temp);
2195 __ j(NOT_EQUAL, &reference_compare, Assembler::kNearJump);
2196 __ EnterFrame(0);
2197 __ ReserveAlignedFrameSpace(2 * kWordSize);
2198 __ movl(Address(ESP, 1 * kWordSize), left);
2199 __ movl(Address(ESP, 0 * kWordSize), right);
2200 __ CallRuntime(kBigintCompareRuntimeEntry);
2201 // Result in EAX, 0 means equal.
2202 __ LeaveFrame();
2203 __ cmpl(EAX, Immediate(0));
2204 __ jmp(&done);
2205
2206 __ Bind(&reference_compare);
Florian Schneider 2012/11/23 10:33:40 Please add a comment that the code relies on the a
srdjan 2012/11/23 19:45:39 Added comment at the beginning of method: // Note:
2207 __ cmpl(left, right);
2208 __ Bind(&done);
2209 __ popl(temp);
2210 __ popl(right);
2211 __ popl(left);
2212 __ ret();
2213 }
2214
2133 } // namespace dart 2215 } // namespace dart
2134 2216
2135 #endif // defined TARGET_ARCH_IA32 2217 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698