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 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1722 EmitBranch(true_block, false_block, ne); | 1722 EmitBranch(true_block, false_block, ne); |
1723 } | 1723 } |
1724 } | 1724 } |
1725 | 1725 |
1726 | 1726 |
1727 Condition LCodeGen::EmitIsObject(Register input, | 1727 Condition LCodeGen::EmitIsObject(Register input, |
1728 Register temp1, | 1728 Register temp1, |
1729 Register temp2, | 1729 Register temp2, |
1730 Label* is_not_object, | 1730 Label* is_not_object, |
1731 Label* is_object) { | 1731 Label* is_object) { |
1732 Abort("EmitIsObject unimplemented."); | 1732 __ BranchOnSmi(input, is_not_object); |
1733 return ne; | 1733 |
1734 __ LoadRoot(temp1, Heap::kNullValueRootIndex); | |
1735 __ cmp(input, temp1); | |
1736 __ b(eq, is_object); | |
1737 | |
1738 __ ldr(temp1, FieldMemOperand(input, HeapObject::kMapOffset)); | |
1739 __ ldrb(temp2, FieldMemOperand(temp1, Map::kBitFieldOffset)); | |
1740 __ tst(temp2, Operand(1 << Map::kIsUndetectable)); | |
1741 __ b(ne, is_not_object); | |
1742 | |
1743 __ ldrb(temp2, FieldMemOperand(temp1, Map::kInstanceTypeOffset)); | |
1744 __ cmp(temp2, Operand(FIRST_JS_OBJECT_TYPE)); | |
1745 __ b(lt, is_not_object); | |
1746 __ cmp(temp2, Operand(LAST_JS_OBJECT_TYPE)); | |
1747 return gt; | |
Rodolph Perfetta
2011/01/21 09:26:21
Shouldn't it return le (lower or equal)?
Karl Klose
2011/01/21 18:04:09
Done.
| |
1734 } | 1748 } |
1735 | 1749 |
1736 | 1750 |
1737 void LCodeGen::DoIsObject(LIsObject* instr) { | 1751 void LCodeGen::DoIsObject(LIsObject* instr) { |
1738 Abort("DoIsObject unimplemented."); | 1752 Register reg = ToRegister(instr->input()); |
1753 Register result = ToRegister(instr->result()); | |
1754 Register temp = scratch0(); | |
1755 Label is_false, is_true, done; | |
1756 | |
1757 Condition true_cond = EmitIsObject(reg, result, temp, &is_false, &is_true); | |
1758 __ b(true_cond, &is_true); | |
1759 | |
1760 __ bind(&is_false); | |
1761 __ LoadRoot(result, Heap::kFalseValueRootIndex); | |
1762 __ b(al, &done); | |
1763 | |
1764 __ bind(&is_true); | |
1765 __ LoadRoot(result, Heap::kTrueValueRootIndex, true_cond); | |
Rodolph Perfetta
2011/01/21 09:26:21
The condition is unnecessary, you only jump here i
Karl Klose
2011/01/21 18:04:09
I removed the condition.
It was a leftover from w
| |
1766 | |
1767 __ bind(&done); | |
1739 } | 1768 } |
1740 | 1769 |
1741 | 1770 |
1742 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) { | 1771 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) { |
1743 Abort("DoIsObjectAndBranch unimplemented."); | 1772 Register reg = ToRegister(instr->input()); |
1773 Register temp1 = ToRegister(instr->temp()); | |
1774 Register temp2 = scratch0(); | |
1775 | |
1776 int true_block = chunk_->LookupDestination(instr->true_block_id()); | |
1777 int false_block = chunk_->LookupDestination(instr->false_block_id()); | |
1778 Label* true_label = chunk_->GetAssemblyLabel(true_block); | |
1779 Label* false_label = chunk_->GetAssemblyLabel(false_block); | |
1780 | |
1781 Condition true_cond = EmitIsObject(reg, temp1, temp2, false_label, true_label) ; | |
Søren Thygesen Gjesse
2011/01/21 07:38:13
Long line.
Karl Klose
2011/01/21 18:04:09
Done.
| |
1782 | |
1783 EmitBranch(true_block, false_block, true_cond); | |
1744 } | 1784 } |
1745 | 1785 |
1746 | 1786 |
1747 void LCodeGen::DoIsSmi(LIsSmi* instr) { | 1787 void LCodeGen::DoIsSmi(LIsSmi* instr) { |
1748 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); | 1788 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); |
1749 Register result = ToRegister(instr->result()); | 1789 Register result = ToRegister(instr->result()); |
1750 Register input_reg = EmitLoadRegister(instr->input(), ip); | 1790 Register input_reg = EmitLoadRegister(instr->input(), ip); |
1751 __ tst(input_reg, Operand(kSmiTagMask)); | 1791 __ tst(input_reg, Operand(kSmiTagMask)); |
1752 __ LoadRoot(result, Heap::kTrueValueRootIndex); | 1792 __ LoadRoot(result, Heap::kTrueValueRootIndex); |
1753 Label done; | 1793 Label done; |
(...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3632 | 3672 |
3633 | 3673 |
3634 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 3674 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
3635 Abort("DoOsrEntry unimplemented."); | 3675 Abort("DoOsrEntry unimplemented."); |
3636 } | 3676 } |
3637 | 3677 |
3638 | 3678 |
3639 #undef __ | 3679 #undef __ |
3640 | 3680 |
3641 } } // namespace v8::internal | 3681 } } // namespace v8::internal |
OLD | NEW |