OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1768 case Token::BIT_AND: __ And(result, left, right); break; | 1768 case Token::BIT_AND: __ And(result, left, right); break; |
1769 case Token::BIT_OR: __ Orr(result, left, right); break; | 1769 case Token::BIT_OR: __ Orr(result, left, right); break; |
1770 case Token::BIT_XOR: __ Eor(result, left, right); break; | 1770 case Token::BIT_XOR: __ Eor(result, left, right); break; |
1771 default: | 1771 default: |
1772 UNREACHABLE(); | 1772 UNREACHABLE(); |
1773 break; | 1773 break; |
1774 } | 1774 } |
1775 } | 1775 } |
1776 | 1776 |
1777 | 1777 |
1778 void LCodeGen::ApplyCheckIf(Condition cc, LBoundsCheck* check) { | 1778 void LCodeGen::DoBoundsCheck(LBoundsCheck *instr) { |
1779 if (FLAG_debug_code && check->hydrogen()->skip_check()) { | 1779 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; |
| 1780 ASSERT(instr->hydrogen()->index()->representation().IsInteger32()); |
| 1781 ASSERT(instr->hydrogen()->length()->representation().IsInteger32()); |
| 1782 if (instr->index()->IsConstantOperand()) { |
| 1783 Operand index = ToOperand32I(instr->index()); |
| 1784 Register length = ToRegister32(instr->length()); |
| 1785 __ Cmp(length, index); |
| 1786 cc = ReverseConditionForCmp(cc); |
| 1787 } else { |
| 1788 Register index = ToRegister32(instr->index()); |
| 1789 Operand length = ToOperand32I(instr->length()); |
| 1790 __ Cmp(index, length); |
| 1791 } |
| 1792 if (FLAG_debug_code && instr->hydrogen()->skip_check()) { |
1780 __ Assert(InvertCondition(cc), kEliminatedBoundsCheckFailed); | 1793 __ Assert(InvertCondition(cc), kEliminatedBoundsCheckFailed); |
1781 } else { | 1794 } else { |
1782 DeoptimizeIf(cc, check->environment()); | 1795 DeoptimizeIf(cc, instr->environment()); |
1783 } | 1796 } |
1784 } | 1797 } |
1785 | 1798 |
1786 | 1799 |
1787 void LCodeGen::DoBoundsCheck(LBoundsCheck *instr) { | |
1788 if (instr->hydrogen()->skip_check()) return; | |
1789 | |
1790 ASSERT(instr->hydrogen()->length()->representation().IsInteger32()); | |
1791 Register length = ToRegister32(instr->length()); | |
1792 | |
1793 if (instr->index()->IsConstantOperand()) { | |
1794 int constant_index = | |
1795 ToInteger32(LConstantOperand::cast(instr->index())); | |
1796 | |
1797 if (instr->hydrogen()->length()->representation().IsSmi()) { | |
1798 __ Cmp(length, Smi::FromInt(constant_index)); | |
1799 } else { | |
1800 __ Cmp(length, constant_index); | |
1801 } | |
1802 } else { | |
1803 ASSERT(instr->hydrogen()->index()->representation().IsInteger32()); | |
1804 __ Cmp(length, ToRegister32(instr->index())); | |
1805 } | |
1806 Condition condition = instr->hydrogen()->allow_equality() ? lo : ls; | |
1807 ApplyCheckIf(condition, instr); | |
1808 } | |
1809 | |
1810 | |
1811 void LCodeGen::DoBranch(LBranch* instr) { | 1800 void LCodeGen::DoBranch(LBranch* instr) { |
1812 Representation r = instr->hydrogen()->value()->representation(); | 1801 Representation r = instr->hydrogen()->value()->representation(); |
1813 Label* true_label = instr->TrueLabel(chunk_); | 1802 Label* true_label = instr->TrueLabel(chunk_); |
1814 Label* false_label = instr->FalseLabel(chunk_); | 1803 Label* false_label = instr->FalseLabel(chunk_); |
1815 | 1804 |
1816 if (r.IsInteger32()) { | 1805 if (r.IsInteger32()) { |
1817 ASSERT(!info()->IsStub()); | 1806 ASSERT(!info()->IsStub()); |
1818 EmitCompareAndBranch(instr, ne, ToRegister32(instr->value()), 0); | 1807 EmitCompareAndBranch(instr, ne, ToRegister32(instr->value()), 0); |
1819 } else if (r.IsSmi()) { | 1808 } else if (r.IsSmi()) { |
1820 ASSERT(!info()->IsStub()); | 1809 ASSERT(!info()->IsStub()); |
(...skipping 4108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5929 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5918 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
5930 // Index is equal to negated out of object property index plus 1. | 5919 // Index is equal to negated out of object property index plus 1. |
5931 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5920 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
5932 __ Ldr(result, FieldMemOperand(result, | 5921 __ Ldr(result, FieldMemOperand(result, |
5933 FixedArray::kHeaderSize - kPointerSize)); | 5922 FixedArray::kHeaderSize - kPointerSize)); |
5934 __ Bind(deferred->exit()); | 5923 __ Bind(deferred->exit()); |
5935 __ Bind(&done); | 5924 __ Bind(&done); |
5936 } | 5925 } |
5937 | 5926 |
5938 } } // namespace v8::internal | 5927 } } // namespace v8::internal |
OLD | NEW |