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" // Needed here to get TARGET_ARCH_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
9 | 9 |
10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 *StubCode::CallStaticFunction_entry(), | 1349 *StubCode::CallStaticFunction_entry(), |
1350 RawPcDescriptors::kOther, locs, function); | 1350 RawPcDescriptors::kOther, locs, function); |
1351 __ Drop(argument_count, RCX); | 1351 __ Drop(argument_count, RCX); |
1352 } | 1352 } |
1353 | 1353 |
1354 | 1354 |
1355 Condition FlowGraphCompiler::EmitEqualityRegConstCompare( | 1355 Condition FlowGraphCompiler::EmitEqualityRegConstCompare( |
1356 Register reg, | 1356 Register reg, |
1357 const Object& obj, | 1357 const Object& obj, |
1358 bool needs_number_check, | 1358 bool needs_number_check, |
1359 TokenPosition token_pos) { | 1359 TokenPosition token_pos, |
| 1360 intptr_t deopt_id) { |
1360 ASSERT(!needs_number_check || | 1361 ASSERT(!needs_number_check || |
1361 (!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint())); | 1362 (!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint())); |
1362 | 1363 |
1363 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { | 1364 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { |
1364 ASSERT(!needs_number_check); | 1365 ASSERT(!needs_number_check); |
1365 __ testq(reg, reg); | 1366 __ testq(reg, reg); |
1366 return EQUAL; | 1367 return EQUAL; |
1367 } | 1368 } |
1368 | 1369 |
1369 if (needs_number_check) { | 1370 if (needs_number_check) { |
1370 __ pushq(reg); | 1371 __ pushq(reg); |
1371 __ PushObject(obj); | 1372 __ PushObject(obj); |
1372 if (is_optimizing()) { | 1373 if (is_optimizing()) { |
1373 __ CallPatchable(*StubCode::OptimizedIdenticalWithNumberCheck_entry()); | 1374 __ CallPatchable(*StubCode::OptimizedIdenticalWithNumberCheck_entry()); |
1374 } else { | 1375 } else { |
1375 __ CallPatchable(*StubCode::UnoptimizedIdenticalWithNumberCheck_entry()); | 1376 __ CallPatchable(*StubCode::UnoptimizedIdenticalWithNumberCheck_entry()); |
1376 } | 1377 } |
1377 if (token_pos.IsReal()) { | 1378 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, deopt_id, token_pos); |
1378 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, Thread::kNoDeoptId, | |
1379 token_pos); | |
1380 } | |
1381 // Stub returns result in flags (result of a cmpq, we need ZF computed). | 1379 // Stub returns result in flags (result of a cmpq, we need ZF computed). |
1382 __ popq(reg); // Discard constant. | 1380 __ popq(reg); // Discard constant. |
1383 __ popq(reg); // Restore 'reg'. | 1381 __ popq(reg); // Restore 'reg'. |
1384 } else { | 1382 } else { |
1385 __ CompareObject(reg, obj); | 1383 __ CompareObject(reg, obj); |
1386 } | 1384 } |
1387 return EQUAL; | 1385 return EQUAL; |
1388 } | 1386 } |
1389 | 1387 |
1390 | 1388 |
1391 Condition FlowGraphCompiler::EmitEqualityRegRegCompare( | 1389 Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, |
1392 Register left, | 1390 Register right, |
1393 Register right, | 1391 bool needs_number_check, |
1394 bool needs_number_check, | 1392 TokenPosition token_pos, |
1395 TokenPosition token_pos) { | 1393 intptr_t deopt_id) { |
1396 if (needs_number_check) { | 1394 if (needs_number_check) { |
1397 __ pushq(left); | 1395 __ pushq(left); |
1398 __ pushq(right); | 1396 __ pushq(right); |
1399 if (is_optimizing()) { | 1397 if (is_optimizing()) { |
1400 __ CallPatchable(*StubCode::OptimizedIdenticalWithNumberCheck_entry()); | 1398 __ CallPatchable(*StubCode::OptimizedIdenticalWithNumberCheck_entry()); |
1401 } else { | 1399 } else { |
1402 __ CallPatchable(*StubCode::UnoptimizedIdenticalWithNumberCheck_entry()); | 1400 __ CallPatchable(*StubCode::UnoptimizedIdenticalWithNumberCheck_entry()); |
1403 } | 1401 } |
1404 if (token_pos.IsReal()) { | 1402 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, deopt_id, token_pos); |
1405 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, Thread::kNoDeoptId, | |
1406 token_pos); | |
1407 } | |
1408 // Stub returns result in flags (result of a cmpq, we need ZF computed). | 1403 // Stub returns result in flags (result of a cmpq, we need ZF computed). |
1409 __ popq(right); | 1404 __ popq(right); |
1410 __ popq(left); | 1405 __ popq(left); |
1411 } else { | 1406 } else { |
1412 __ CompareRegisters(left, right); | 1407 __ CompareRegisters(left, right); |
1413 } | 1408 } |
1414 return EQUAL; | 1409 return EQUAL; |
1415 } | 1410 } |
1416 | 1411 |
1417 | 1412 |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 __ movups(reg, Address(RSP, 0)); | 1714 __ movups(reg, Address(RSP, 0)); |
1720 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); | 1715 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); |
1721 } | 1716 } |
1722 | 1717 |
1723 | 1718 |
1724 #undef __ | 1719 #undef __ |
1725 | 1720 |
1726 } // namespace dart | 1721 } // namespace dart |
1727 | 1722 |
1728 #endif // defined TARGET_ARCH_X64 | 1723 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |