Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1619 case Token::INSTANCEOF: | 1619 case Token::INSTANCEOF: |
| 1620 default: | 1620 default: |
| 1621 UNREACHABLE(); | 1621 UNREACHABLE(); |
| 1622 } | 1622 } |
| 1623 return cond; | 1623 return cond; |
| 1624 } | 1624 } |
| 1625 | 1625 |
| 1626 | 1626 |
| 1627 void LCodeGen::EmitCmpI(LOperand* left, LOperand* right) { | 1627 void LCodeGen::EmitCmpI(LOperand* left, LOperand* right) { |
| 1628 __ cmp(ToRegister(left), ToOperand(right)); | 1628 __ cmp(ToRegister(left), ToOperand(right)); |
| 1629 Abort("EmitCmpI untested."); | |
| 1630 } | 1629 } |
| 1631 | 1630 |
| 1632 | 1631 |
| 1633 void LCodeGen::DoCmpID(LCmpID* instr) { | 1632 void LCodeGen::DoCmpID(LCmpID* instr) { |
| 1634 Abort("DoCmpID unimplemented."); | 1633 LOperand* left = instr->InputAt(0); |
| 1634 LOperand* right = instr->InputAt(1); | |
| 1635 LOperand* result = instr->result(); | |
| 1636 Register scratch = scratch0(); | |
| 1637 | |
| 1638 Label unordered, done; | |
| 1639 if (instr->is_double()) { | |
| 1640 // Compare left and right as doubles and load the | |
| 1641 // resulting flags into the normal status register. | |
| 1642 __ vcmp(ToDoubleRegister(left), ToDoubleRegister(right)); | |
| 1643 __ vmrs(pc); | |
| 1644 // If a NaN is involved, i.e. the result is unordered (V set), | |
| 1645 // jump to unordered to return false. | |
| 1646 __ b(vs, &unordered); | |
| 1647 } else { | |
| 1648 EmitCmpI(left, right); | |
| 1649 } | |
| 1650 | |
| 1651 Condition cc = TokenToCondition(instr->op(), instr->is_double()); | |
| 1652 __ LoadRoot(ToRegister(result), Heap::kTrueValueRootIndex); | |
| 1653 __ b(cc, &done); | |
| 1654 | |
| 1655 __ bind(&unordered); | |
| 1656 __ LoadRoot(ToRegister(result), Heap::kFalseValueRootIndex); | |
| 1657 __ bind(&done); | |
| 1635 } | 1658 } |
| 1636 | 1659 |
| 1637 | 1660 |
| 1638 void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) { | 1661 void LCodeGen::DoCmpIDAndBranch(LCmpIDAndBranch* instr) { |
| 1639 Abort("DoCmpIDAndBranch unimplemented."); | 1662 LOperand* left = instr->InputAt(0); |
| 1663 LOperand* right = instr->InputAt(1); | |
| 1664 int false_block = chunk_->LookupDestination(instr->false_block_id()); | |
| 1665 int true_block = chunk_->LookupDestination(instr->true_block_id()); | |
| 1666 | |
| 1667 if (instr->is_double()) { | |
| 1668 // Compare left and right as doubles and load the | |
| 1669 // resulting flags into the normal status register. | |
| 1670 __ vcmp(ToDoubleRegister(left), ToDoubleRegister(right)); | |
| 1671 __ vmrs(pc); | |
| 1672 // If a NaN is involved, i.e. the result is unordered (V set), | |
|
Søren Thygesen Gjesse
2011/02/04 10:20:53
jump to unordered -> jump to false label.
| |
| 1673 // jump to unordered to return false. | |
| 1674 __ b(vs, chunk_->GetAssemblyLabel(false_block)); | |
| 1675 } else { | |
| 1676 EmitCmpI(left, right); | |
| 1677 } | |
| 1678 | |
| 1679 Condition cc = TokenToCondition(instr->op(), instr->is_double()); | |
| 1680 EmitBranch(true_block, false_block, cc); | |
| 1640 } | 1681 } |
| 1641 | 1682 |
| 1642 | 1683 |
| 1643 void LCodeGen::DoCmpJSObjectEq(LCmpJSObjectEq* instr) { | 1684 void LCodeGen::DoCmpJSObjectEq(LCmpJSObjectEq* instr) { |
| 1644 Register left = ToRegister(instr->InputAt(0)); | 1685 Register left = ToRegister(instr->InputAt(0)); |
| 1645 Register right = ToRegister(instr->InputAt(1)); | 1686 Register right = ToRegister(instr->InputAt(1)); |
| 1646 Register result = ToRegister(instr->result()); | 1687 Register result = ToRegister(instr->result()); |
| 1647 | 1688 |
| 1648 __ cmp(left, Operand(right)); | 1689 __ cmp(left, Operand(right)); |
| 1649 __ LoadRoot(result, Heap::kTrueValueRootIndex, eq); | 1690 __ LoadRoot(result, Heap::kTrueValueRootIndex, eq); |
| (...skipping 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3674 | 3715 |
| 3675 | 3716 |
| 3676 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 3717 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
| 3677 Abort("DoOsrEntry unimplemented."); | 3718 Abort("DoOsrEntry unimplemented."); |
| 3678 } | 3719 } |
| 3679 | 3720 |
| 3680 | 3721 |
| 3681 #undef __ | 3722 #undef __ |
| 3682 | 3723 |
| 3683 } } // namespace v8::internal | 3724 } } // namespace v8::internal |
| OLD | NEW |