| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 &StubCode::CallStaticFunctionLabel(), | 1430 &StubCode::CallStaticFunctionLabel(), |
| 1431 PcDescriptors::kFuncCall, | 1431 PcDescriptors::kFuncCall, |
| 1432 locs); | 1432 locs); |
| 1433 AddStaticCallTarget(function); | 1433 AddStaticCallTarget(function); |
| 1434 __ Drop(argument_count); | 1434 __ Drop(argument_count); |
| 1435 } | 1435 } |
| 1436 | 1436 |
| 1437 | 1437 |
| 1438 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, | 1438 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, |
| 1439 const Object& obj, | 1439 const Object& obj, |
| 1440 bool needs_number_check) { | 1440 bool needs_number_check, |
| 1441 intptr_t token_pos) { |
| 1441 if (needs_number_check) { | 1442 if (needs_number_check) { |
| 1442 if (!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint()) { | 1443 if (!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint()) { |
| 1443 needs_number_check = false; | 1444 needs_number_check = false; |
| 1444 } | 1445 } |
| 1445 } | 1446 } |
| 1446 | 1447 |
| 1447 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { | 1448 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { |
| 1448 ASSERT(!needs_number_check); | 1449 ASSERT(!needs_number_check); |
| 1449 __ testq(reg, reg); | 1450 __ testq(reg, reg); |
| 1450 return; | 1451 return; |
| 1451 } | 1452 } |
| 1452 | 1453 |
| 1453 if (needs_number_check) { | 1454 if (needs_number_check) { |
| 1454 __ pushq(reg); | 1455 __ pushq(reg); |
| 1455 __ PushObject(obj); | 1456 __ PushObject(obj); |
| 1456 __ call(&StubCode::IdenticalWithNumberCheckLabel()); | 1457 __ call(&StubCode::IdenticalWithNumberCheckLabel()); |
| 1458 AddCurrentDescriptor(PcDescriptors::kRuntimeCall, |
| 1459 Isolate::kNoDeoptId, |
| 1460 token_pos); |
| 1457 __ popq(reg); // Discard constant. | 1461 __ popq(reg); // Discard constant. |
| 1458 __ popq(reg); // Restore 'reg'. | 1462 __ popq(reg); // Restore 'reg'. |
| 1459 return; | 1463 return; |
| 1460 } | 1464 } |
| 1461 | 1465 |
| 1462 __ CompareObject(reg, obj); | 1466 __ CompareObject(reg, obj); |
| 1463 } | 1467 } |
| 1464 | 1468 |
| 1465 | 1469 |
| 1466 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, | 1470 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, |
| 1467 Register right, | 1471 Register right, |
| 1468 bool needs_number_check) { | 1472 bool needs_number_check, |
| 1473 intptr_t token_pos) { |
| 1469 if (needs_number_check) { | 1474 if (needs_number_check) { |
| 1470 __ pushq(left); | 1475 __ pushq(left); |
| 1471 __ pushq(right); | 1476 __ pushq(right); |
| 1472 __ call(&StubCode::IdenticalWithNumberCheckLabel()); | 1477 __ call(&StubCode::IdenticalWithNumberCheckLabel()); |
| 1478 AddCurrentDescriptor(PcDescriptors::kRuntimeCall, |
| 1479 Isolate::kNoDeoptId, |
| 1480 token_pos); |
| 1473 // Stub returns result in flags (result of a cmpl, we need ZF computed). | 1481 // Stub returns result in flags (result of a cmpl, we need ZF computed). |
| 1474 __ popq(right); | 1482 __ popq(right); |
| 1475 __ popq(left); | 1483 __ popq(left); |
| 1476 } else { | 1484 } else { |
| 1477 __ cmpl(left, right); | 1485 __ cmpl(left, right); |
| 1478 } | 1486 } |
| 1479 } | 1487 } |
| 1480 | 1488 |
| 1481 | 1489 |
| 1482 // Implement equality spec: if any of the arguments is null do identity check. | 1490 // Implement equality spec: if any of the arguments is null do identity check. |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1931 __ movups(reg, Address(RSP, 0)); | 1939 __ movups(reg, Address(RSP, 0)); |
| 1932 __ addq(RSP, Immediate(kFpuRegisterSize)); | 1940 __ addq(RSP, Immediate(kFpuRegisterSize)); |
| 1933 } | 1941 } |
| 1934 | 1942 |
| 1935 | 1943 |
| 1936 #undef __ | 1944 #undef __ |
| 1937 | 1945 |
| 1938 } // namespace dart | 1946 } // namespace dart |
| 1939 | 1947 |
| 1940 #endif // defined TARGET_ARCH_X64 | 1948 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |