Chromium Code Reviews| 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2084 AssemblerMacros::EnterStubFrame(assembler); | 2084 AssemblerMacros::EnterStubFrame(assembler); |
| 2085 __ pushq(RAX); | 2085 __ pushq(RAX); |
| 2086 __ pushq(RDX); | 2086 __ pushq(RDX); |
| 2087 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); | 2087 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry); |
| 2088 __ popq(RDX); | 2088 __ popq(RDX); |
| 2089 __ popq(RAX); | 2089 __ popq(RAX); |
| 2090 __ LeaveFrame(); | 2090 __ LeaveFrame(); |
| 2091 __ ret(); | 2091 __ ret(); |
| 2092 } | 2092 } |
| 2093 | 2093 |
| 2094 | |
| 2095 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, | |
| 2096 BigintCompare, | |
| 2097 RawBigint* left, | |
| 2098 RawBigint* right); | |
| 2099 | |
| 2100 | |
| 2101 // Does identical check (object references are equal or not equal) with special | |
| 2102 // checks for boxed numbers. | |
| 2103 // Left and right are pushed on stack. | |
| 2104 // Return ZF set. | |
| 2105 void StubCode::GenerateIdenticalWithNumberCheckStub(Assembler* assembler) { | |
| 2106 const Register left = RAX; | |
| 2107 const Register right = RDX; | |
| 2108 // Preserve left, right and temp. | |
| 2109 __ pushq(left); | |
| 2110 __ pushq(right); | |
| 2111 // TOS + 0: saved right | |
| 2112 // TOS + 1: saved left | |
| 2113 // TOS + 2: return address | |
| 2114 // TOS + 3: right argument. | |
| 2115 // TOS + 4: left argument. | |
| 2116 __ movq(left, Address(RSP, 4 * kWordSize)); | |
| 2117 __ movq(right, Address(RSP, 3 * kWordSize)); | |
| 2118 Label reference_compare, done, check_mint, check_bigint; | |
| 2119 // If any of the arguments is Smi do reference compare. | |
| 2120 __ testq(left, Immediate(kSmiTagMask)); | |
| 2121 __ j(ZERO, &reference_compare); | |
| 2122 __ testq(right, Immediate(kSmiTagMask)); | |
| 2123 __ j(ZERO, &reference_compare); | |
| 2124 | |
| 2125 // Value compare for two doubles. | |
| 2126 __ CompareClassId(left, kDoubleCid); | |
| 2127 __ j(NOT_EQUAL, &check_mint, Assembler::kNearJump); | |
| 2128 __ CompareClassId(right, kDoubleCid); | |
| 2129 __ j(NOT_EQUAL, &done, Assembler::kNearJump); | |
| 2130 | |
| 2131 // Double values bitwise compare. | |
| 2132 __ movq(left, FieldAddress(left, Double::value_offset())); | |
| 2133 __ cmpq(left, FieldAddress(right, Double::value_offset())); | |
| 2134 __ jmp(&done, Assembler::kNearJump); | |
| 2135 | |
| 2136 __ Bind(&check_mint); | |
| 2137 __ CompareClassId(left, kMintCid); | |
| 2138 __ j(NOT_EQUAL, &check_bigint, Assembler::kNearJump); | |
| 2139 __ movq(left, FieldAddress(left, Mint::value_offset())); | |
| 2140 __ cmpq(left, FieldAddress(right, Mint::value_offset())); | |
|
Florian Schneider
2012/11/23 10:33:40
right has not yet been checked for kMintCid here.
srdjan
2012/11/23 19:45:39
Done.
| |
| 2141 __ jmp(&done, Assembler::kNearJump); | |
| 2142 | |
| 2143 __ Bind(&check_bigint); | |
| 2144 __ CompareClassId(left, kBigintCid); | |
| 2145 __ j(NOT_EQUAL, &reference_compare, Assembler::kNearJump); | |
| 2146 __ CompareClassId(right, kBigintCid); | |
| 2147 __ j(NOT_EQUAL, &reference_compare, Assembler::kNearJump); | |
| 2148 __ EnterFrame(0); | |
| 2149 __ ReserveAlignedFrameSpace(0); | |
| 2150 __ movq(RDI, left); | |
| 2151 __ movq(RSI, right); | |
| 2152 __ CallRuntime(kBigintCompareRuntimeEntry); | |
| 2153 // Result in RAX, 0 means equal. | |
| 2154 __ LeaveFrame(); | |
| 2155 __ cmpq(RAX, Immediate(0)); | |
| 2156 __ jmp(&done); | |
| 2157 | |
| 2158 __ 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 and the head of the function.
| |
| 2159 __ cmpq(left, right); | |
| 2160 __ Bind(&done); | |
| 2161 __ popq(right); | |
| 2162 __ popq(left); | |
| 2163 __ ret(); | |
| 2164 } | |
| 2165 | |
| 2094 } // namespace dart | 2166 } // namespace dart |
| 2095 | 2167 |
| 2096 #endif // defined TARGET_ARCH_X64 | 2168 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |