| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1433 &StubCode::CallStaticFunctionLabel(), | 1433 &StubCode::CallStaticFunctionLabel(), |
| 1434 PcDescriptors::kFuncCall, | 1434 PcDescriptors::kFuncCall, |
| 1435 locs); | 1435 locs); |
| 1436 AddStaticCallTarget(function); | 1436 AddStaticCallTarget(function); |
| 1437 __ Drop(argument_count); | 1437 __ Drop(argument_count); |
| 1438 } | 1438 } |
| 1439 | 1439 |
| 1440 | 1440 |
| 1441 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, | 1441 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, |
| 1442 const Object& obj, | 1442 const Object& obj, |
| 1443 bool needs_number_check) { | 1443 bool needs_number_check, |
| 1444 intptr_t token_pos) { |
| 1444 if (needs_number_check) { | 1445 if (needs_number_check) { |
| 1445 if (!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint()) { | 1446 if (!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint()) { |
| 1446 needs_number_check = false; | 1447 needs_number_check = false; |
| 1447 } | 1448 } |
| 1448 } | 1449 } |
| 1449 | 1450 |
| 1450 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { | 1451 if (obj.IsSmi() && (Smi::Cast(obj).Value() == 0)) { |
| 1451 ASSERT(!needs_number_check); | 1452 ASSERT(!needs_number_check); |
| 1452 __ testl(reg, reg); | 1453 __ testl(reg, reg); |
| 1453 return; | 1454 return; |
| 1454 } | 1455 } |
| 1455 | 1456 |
| 1456 if (needs_number_check) { | 1457 if (needs_number_check) { |
| 1457 __ pushl(reg); | 1458 __ pushl(reg); |
| 1458 __ PushObject(obj); | 1459 __ PushObject(obj); |
| 1459 __ call(&StubCode::IdenticalWithNumberCheckLabel()); | 1460 __ call(&StubCode::IdenticalWithNumberCheckLabel()); |
| 1461 AddCurrentDescriptor(PcDescriptors::kRuntimeCall, |
| 1462 Isolate::kNoDeoptId, |
| 1463 token_pos); |
| 1460 __ popl(reg); // Discard constant. | 1464 __ popl(reg); // Discard constant. |
| 1461 __ popl(reg); // Restore 'reg'. | 1465 __ popl(reg); // Restore 'reg'. |
| 1462 return; | 1466 return; |
| 1463 } | 1467 } |
| 1464 | 1468 |
| 1465 __ CompareObject(reg, obj); | 1469 __ CompareObject(reg, obj); |
| 1466 } | 1470 } |
| 1467 | 1471 |
| 1468 | 1472 |
| 1469 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, | 1473 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, |
| 1470 Register right, | 1474 Register right, |
| 1471 bool needs_number_check) { | 1475 bool needs_number_check, |
| 1476 intptr_t token_pos) { |
| 1472 if (needs_number_check) { | 1477 if (needs_number_check) { |
| 1473 __ pushl(left); | 1478 __ pushl(left); |
| 1474 __ pushl(right); | 1479 __ pushl(right); |
| 1475 __ call(&StubCode::IdenticalWithNumberCheckLabel()); | 1480 __ call(&StubCode::IdenticalWithNumberCheckLabel()); |
| 1481 AddCurrentDescriptor(PcDescriptors::kRuntimeCall, |
| 1482 Isolate::kNoDeoptId, |
| 1483 token_pos); |
| 1476 // Stub returns result in flags (result of a cmpl, we need ZF computed). | 1484 // Stub returns result in flags (result of a cmpl, we need ZF computed). |
| 1477 __ popl(right); | 1485 __ popl(right); |
| 1478 __ popl(left); | 1486 __ popl(left); |
| 1479 } else { | 1487 } else { |
| 1480 __ cmpl(left, right); | 1488 __ cmpl(left, right); |
| 1481 } | 1489 } |
| 1482 } | 1490 } |
| 1483 | 1491 |
| 1484 | 1492 |
| 1485 // Implement equality spec: if any of the arguments is null do identity check. | 1493 // Implement equality spec: if any of the arguments is null do identity check. |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1950 __ movups(reg, Address(ESP, 0)); | 1958 __ movups(reg, Address(ESP, 0)); |
| 1951 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1959 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1952 } | 1960 } |
| 1953 | 1961 |
| 1954 | 1962 |
| 1955 #undef __ | 1963 #undef __ |
| 1956 | 1964 |
| 1957 } // namespace dart | 1965 } // namespace dart |
| 1958 | 1966 |
| 1959 #endif // defined TARGET_ARCH_IA32 | 1967 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |