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 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1749 InstanceType from = hydrogen()->from(); | 1749 InstanceType from = hydrogen()->from(); |
1750 InstanceType to = hydrogen()->to(); | 1750 InstanceType to = hydrogen()->to(); |
1751 if (from == to) return eq; | 1751 if (from == to) return eq; |
1752 if (to == LAST_TYPE) return hs; | 1752 if (to == LAST_TYPE) return hs; |
1753 if (from == FIRST_TYPE) return ls; | 1753 if (from == FIRST_TYPE) return ls; |
1754 UNREACHABLE(); | 1754 UNREACHABLE(); |
1755 return eq; | 1755 return eq; |
1756 } | 1756 } |
1757 | 1757 |
1758 | 1758 |
| 1759 static InstanceType TestType(HHasInstanceType* instr) { |
| 1760 InstanceType from = instr->from(); |
| 1761 InstanceType to = instr->to(); |
| 1762 if (from == FIRST_TYPE) return to; |
| 1763 ASSERT(from == to || to == LAST_TYPE); |
| 1764 return from; |
| 1765 } |
| 1766 |
| 1767 |
| 1768 static Condition BranchCondition(HHasInstanceType* instr) { |
| 1769 InstanceType from = instr->from(); |
| 1770 InstanceType to = instr->to(); |
| 1771 if (from == to) return eq; |
| 1772 if (to == LAST_TYPE) return hs; |
| 1773 if (from == FIRST_TYPE) return ls; |
| 1774 UNREACHABLE(); |
| 1775 return eq; |
| 1776 } |
| 1777 |
| 1778 |
1759 void LCodeGen::DoHasInstanceType(LHasInstanceType* instr) { | 1779 void LCodeGen::DoHasInstanceType(LHasInstanceType* instr) { |
1760 Abort("DoHasInstanceType unimplemented."); | 1780 Register input = ToRegister(instr->input()); |
| 1781 Register result = ToRegister(instr->result()); |
| 1782 |
| 1783 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); |
| 1784 Label done; |
| 1785 __ tst(input, Operand(kSmiTagMask)); |
| 1786 __ LoadRoot(result, Heap::kFalseValueRootIndex, eq); |
| 1787 __ b(eq, &done); |
| 1788 __ CompareObjectType(input, result, result, TestType(instr->hydrogen())); |
| 1789 Condition cond = BranchCondition(instr->hydrogen()); |
| 1790 __ LoadRoot(result, Heap::kTrueValueRootIndex, cond); |
| 1791 __ LoadRoot(result, Heap::kFalseValueRootIndex, NegateCondition(cond)); |
| 1792 __ bind(&done); |
1761 } | 1793 } |
1762 | 1794 |
1763 | 1795 |
1764 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) { | 1796 void LCodeGen::DoHasInstanceTypeAndBranch(LHasInstanceTypeAndBranch* instr) { |
1765 Register scratch = scratch0(); | 1797 Register scratch = scratch0(); |
1766 Register input = ToRegister(instr->input()); | 1798 Register input = ToRegister(instr->input()); |
1767 | 1799 |
1768 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1800 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1769 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1801 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1770 | 1802 |
(...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3220 | 3252 |
3221 | 3253 |
3222 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 3254 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
3223 Abort("DoOsrEntry unimplemented."); | 3255 Abort("DoOsrEntry unimplemented."); |
3224 } | 3256 } |
3225 | 3257 |
3226 | 3258 |
3227 #undef __ | 3259 #undef __ |
3228 | 3260 |
3229 } } // namespace v8::internal | 3261 } } // namespace v8::internal |
OLD | NEW |