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/os.h" | 9 #include "vm/os.h" |
10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 __ movq(RAX, Address(R12, RAX, TIMES_2, 256 * kWordSize)); | 193 __ movq(RAX, Address(R12, RAX, TIMES_2, 256 * kWordSize)); |
194 __ movq(RAX, Address(R12, R10, TIMES_2, 256 * kWordSize)); | 194 __ movq(RAX, Address(R12, R10, TIMES_2, 256 * kWordSize)); |
195 __ movq(RAX, Address(R12, R12, TIMES_2, 256 * kWordSize)); | 195 __ movq(RAX, Address(R12, R12, TIMES_2, 256 * kWordSize)); |
196 __ movq(RAX, Address(R12, R13, TIMES_2, 256 * kWordSize)); | 196 __ movq(RAX, Address(R12, R13, TIMES_2, 256 * kWordSize)); |
197 | 197 |
198 __ movq(RAX, Address(R13, RBP, TIMES_2, 256 * kWordSize)); | 198 __ movq(RAX, Address(R13, RBP, TIMES_2, 256 * kWordSize)); |
199 __ movq(RAX, Address(R13, RAX, TIMES_2, 256 * kWordSize)); | 199 __ movq(RAX, Address(R13, RAX, TIMES_2, 256 * kWordSize)); |
200 __ movq(RAX, Address(R13, R10, TIMES_2, 256 * kWordSize)); | 200 __ movq(RAX, Address(R13, R10, TIMES_2, 256 * kWordSize)); |
201 __ movq(RAX, Address(R13, R12, TIMES_2, 256 * kWordSize)); | 201 __ movq(RAX, Address(R13, R12, TIMES_2, 256 * kWordSize)); |
202 __ movq(RAX, Address(R13, R13, TIMES_2, 256 * kWordSize)); | 202 __ movq(RAX, Address(R13, R13, TIMES_2, 256 * kWordSize)); |
| 203 |
| 204 __ FixedSizeAddressOffsetTest(); |
203 } | 205 } |
204 | 206 |
205 | 207 |
206 ASSEMBLER_TEST_RUN(AddressingModes, test) { | 208 ASSEMBLER_TEST_RUN(AddressingModes, test) { |
207 // Avoid running the code since it is constructed to lead to crashes. | 209 // Avoid running the code since it is constructed to lead to crashes. |
208 } | 210 } |
209 | 211 |
210 | 212 |
211 ASSEMBLER_TEST_GENERATE(JumpAroundCrash, assembler) { | 213 ASSEMBLER_TEST_GENERATE(JumpAroundCrash, assembler) { |
212 Label done; | 214 Label done; |
(...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2152 typedef int64_t (*DoubleToInt64ConversionCode)(); | 2154 typedef int64_t (*DoubleToInt64ConversionCode)(); |
2153 int64_t res = reinterpret_cast<DoubleToInt64ConversionCode>(test->entry())(); | 2155 int64_t res = reinterpret_cast<DoubleToInt64ConversionCode>(test->entry())(); |
2154 EXPECT_EQ(0, res); | 2156 EXPECT_EQ(0, res); |
2155 } | 2157 } |
2156 | 2158 |
2157 | 2159 |
2158 ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { | 2160 ASSEMBLER_TEST_GENERATE(TestObjectCompare, assembler) { |
2159 ObjectStore* object_store = Isolate::Current()->object_store(); | 2161 ObjectStore* object_store = Isolate::Current()->object_store(); |
2160 const Object& obj = Object::ZoneHandle(object_store->smi_class()); | 2162 const Object& obj = Object::ZoneHandle(object_store->smi_class()); |
2161 Label fail; | 2163 Label fail; |
2162 __ LoadObject(RAX, obj); | 2164 __ EnterDartFrame(0); |
| 2165 __ LoadObjectFromPool(RAX, obj, PP); |
2163 __ CompareObject(RAX, obj); | 2166 __ CompareObject(RAX, obj); |
2164 __ j(NOT_EQUAL, &fail); | 2167 __ j(NOT_EQUAL, &fail); |
2165 __ LoadObject(RCX, obj); | 2168 __ LoadObjectFromPool(RCX, obj, PP); |
2166 __ CompareObject(RCX, obj); | 2169 __ CompareObject(RCX, obj); |
2167 __ j(NOT_EQUAL, &fail); | 2170 __ j(NOT_EQUAL, &fail); |
2168 const Smi& smi = Smi::ZoneHandle(Smi::New(15)); | 2171 const Smi& smi = Smi::ZoneHandle(Smi::New(15)); |
2169 __ LoadObject(RCX, smi); | 2172 __ LoadObjectFromPool(RCX, smi, PP); |
2170 __ CompareObject(RCX, smi); | 2173 __ CompareObject(RCX, smi); |
2171 __ j(NOT_EQUAL, &fail); | 2174 __ j(NOT_EQUAL, &fail); |
2172 __ pushq(RAX); | 2175 __ pushq(RAX); |
2173 __ StoreObject(Address(RSP, 0), obj); | 2176 __ StoreObject(Address(RSP, 0), obj); |
2174 __ popq(RCX); | 2177 __ popq(RCX); |
2175 __ CompareObject(RCX, obj); | 2178 __ CompareObject(RCX, obj); |
2176 __ j(NOT_EQUAL, &fail); | 2179 __ j(NOT_EQUAL, &fail); |
2177 __ pushq(RAX); | 2180 __ pushq(RAX); |
2178 __ StoreObject(Address(RSP, 0), smi); | 2181 __ StoreObject(Address(RSP, 0), smi); |
2179 __ popq(RCX); | 2182 __ popq(RCX); |
2180 __ CompareObject(RCX, smi); | 2183 __ CompareObject(RCX, smi); |
2181 __ j(NOT_EQUAL, &fail); | 2184 __ j(NOT_EQUAL, &fail); |
2182 __ movl(RAX, Immediate(1)); // OK | 2185 __ movl(RAX, Immediate(1)); // OK |
| 2186 __ LeaveFrameWithPP(); |
2183 __ ret(); | 2187 __ ret(); |
2184 __ Bind(&fail); | 2188 __ Bind(&fail); |
2185 __ movl(RAX, Immediate(0)); // Fail. | 2189 __ movl(RAX, Immediate(0)); // Fail. |
| 2190 __ LeaveFrameWithPP(); |
2186 __ ret(); | 2191 __ ret(); |
2187 } | 2192 } |
2188 | 2193 |
2189 | 2194 |
2190 ASSEMBLER_TEST_RUN(TestObjectCompare, test) { | 2195 ASSEMBLER_TEST_RUN(TestObjectCompare, test) { |
2191 typedef bool (*TestObjectCompare)(); | 2196 typedef bool (*TestObjectCompare)(); |
2192 bool res = reinterpret_cast<TestObjectCompare>(test->entry())(); | 2197 bool res = reinterpret_cast<TestObjectCompare>(test->entry())(); |
2193 EXPECT_EQ(true, res); | 2198 EXPECT_EQ(true, res); |
2194 } | 2199 } |
2195 | 2200 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2386 typedef double (*SquareRootDoubleCode)(double d); | 2391 typedef double (*SquareRootDoubleCode)(double d); |
2387 const double kDoubleConst = .7; | 2392 const double kDoubleConst = .7; |
2388 double res = | 2393 double res = |
2389 reinterpret_cast<SquareRootDoubleCode>(test->entry())(kDoubleConst); | 2394 reinterpret_cast<SquareRootDoubleCode>(test->entry())(kDoubleConst); |
2390 EXPECT_FLOAT_EQ(sqrt(kDoubleConst), res, 0.0001); | 2395 EXPECT_FLOAT_EQ(sqrt(kDoubleConst), res, 0.0001); |
2391 } | 2396 } |
2392 | 2397 |
2393 | 2398 |
2394 // Called from assembler_test.cc. | 2399 // Called from assembler_test.cc. |
2395 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { | 2400 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { |
| 2401 __ EnterDartFrame(0); |
2396 __ pushq(CTX); | 2402 __ pushq(CTX); |
2397 __ movq(CTX, RDI); | 2403 __ movq(CTX, RDI); |
2398 __ StoreIntoObject(RDX, | 2404 __ StoreIntoObject(RDX, |
2399 FieldAddress(RDX, GrowableObjectArray::data_offset()), | 2405 FieldAddress(RDX, GrowableObjectArray::data_offset()), |
2400 RSI); | 2406 RSI); |
2401 __ popq(CTX); | 2407 __ popq(CTX); |
| 2408 __ LeaveFrameWithPP(); |
2402 __ ret(); | 2409 __ ret(); |
2403 } | 2410 } |
2404 | 2411 |
2405 | 2412 |
2406 ASSEMBLER_TEST_GENERATE(DoubleFPUStackMoves, assembler) { | 2413 ASSEMBLER_TEST_GENERATE(DoubleFPUStackMoves, assembler) { |
2407 int64_t l = bit_cast<int64_t, double>(1024.67); | 2414 int64_t l = bit_cast<int64_t, double>(1024.67); |
2408 __ movq(RAX, Immediate(l)); | 2415 __ movq(RAX, Immediate(l)); |
2409 __ pushq(RAX); | 2416 __ pushq(RAX); |
2410 __ fldl(Address(RSP, 0)); | 2417 __ fldl(Address(RSP, 0)); |
2411 __ movq(Address(RSP, 0), Immediate(0)); | 2418 __ movq(Address(RSP, 0), Immediate(0)); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2609 EXPECT_EQ(1, res); // Greater equal. | 2616 EXPECT_EQ(1, res); // Greater equal. |
2610 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(5, 5); | 2617 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(5, 5); |
2611 EXPECT_EQ(1, res); // Greater equal. | 2618 EXPECT_EQ(1, res); // Greater equal. |
2612 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(2, 5); | 2619 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(2, 5); |
2613 EXPECT_EQ(-1, res); // Less. | 2620 EXPECT_EQ(-1, res); // Less. |
2614 } | 2621 } |
2615 | 2622 |
2616 } // namespace dart | 2623 } // namespace dart |
2617 | 2624 |
2618 #endif // defined TARGET_ARCH_X64 | 2625 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |