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 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1721 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
1722 | 1722 |
1723 Condition true_cond = | 1723 Condition true_cond = |
1724 EmitIsObject(reg, temp1, false_label, true_label); | 1724 EmitIsObject(reg, temp1, false_label, true_label); |
1725 | 1725 |
1726 EmitBranch(true_block, false_block, true_cond, temp2, | 1726 EmitBranch(true_block, false_block, true_cond, temp2, |
1727 Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 1727 Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
1728 } | 1728 } |
1729 | 1729 |
1730 | 1730 |
| 1731 Condition LCodeGen::EmitIsString(Register input, |
| 1732 Register temp1, |
| 1733 Label* is_not_string) { |
| 1734 __ JumpIfSmi(input, is_not_string); |
| 1735 __ GetObjectType(input, temp1, temp1); |
| 1736 __ Branch(is_not_string, ge, temp1, Operand(FIRST_NONSTRING_TYPE)); |
| 1737 |
| 1738 return lt; |
| 1739 } |
| 1740 |
| 1741 |
| 1742 void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) { |
| 1743 Register reg = ToRegister(instr->InputAt(0)); |
| 1744 Register temp1 = ToRegister(instr->TempAt(0)); |
| 1745 Register temp2 = scratch0(); |
| 1746 |
| 1747 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 1748 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1749 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
| 1750 |
| 1751 Condition true_cond = |
| 1752 EmitIsString(reg, temp1, false_label); |
| 1753 |
| 1754 EmitBranch(true_block, false_block, true_cond, temp2, |
| 1755 Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
| 1756 } |
| 1757 |
| 1758 |
1731 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { | 1759 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { |
1732 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1760 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1733 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1761 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1734 | 1762 |
1735 Register input_reg = EmitLoadRegister(instr->InputAt(0), at); | 1763 Register input_reg = EmitLoadRegister(instr->InputAt(0), at); |
1736 __ And(at, input_reg, kSmiTagMask); | 1764 __ And(at, input_reg, kSmiTagMask); |
1737 EmitBranch(true_block, false_block, eq, at, Operand(zero_reg)); | 1765 EmitBranch(true_block, false_block, eq, at, Operand(zero_reg)); |
1738 } | 1766 } |
1739 | 1767 |
1740 | 1768 |
1741 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) { | 1769 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) { |
1742 Register input = ToRegister(instr->InputAt(0)); | 1770 Register input = ToRegister(instr->InputAt(0)); |
1743 Register temp = ToRegister(instr->TempAt(0)); | 1771 Register temp = ToRegister(instr->TempAt(0)); |
1744 | 1772 |
1745 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1773 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1746 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1774 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1747 | 1775 |
1748 __ JumpIfSmi(input, chunk_->GetAssemblyLabel(false_block)); | 1776 __ JumpIfSmi(input, chunk_->GetAssemblyLabel(false_block)); |
1749 __ lw(temp, FieldMemOperand(input, HeapObject::kMapOffset)); | 1777 __ lw(temp, FieldMemOperand(input, HeapObject::kMapOffset)); |
1750 __ lbu(temp, FieldMemOperand(temp, Map::kBitFieldOffset)); | 1778 __ lbu(temp, FieldMemOperand(temp, Map::kBitFieldOffset)); |
1751 __ And(at, temp, Operand(1 << Map::kIsUndetectable)); | 1779 __ And(at, temp, Operand(1 << Map::kIsUndetectable)); |
1752 EmitBranch(true_block, false_block, ne, at, Operand(zero_reg)); | 1780 EmitBranch(true_block, false_block, ne, at, Operand(zero_reg)); |
1753 } | 1781 } |
1754 | 1782 |
1755 | 1783 |
| 1784 static Condition ComputeCompareCondition(Token::Value op) { |
| 1785 switch (op) { |
| 1786 case Token::EQ_STRICT: |
| 1787 case Token::EQ: |
| 1788 return eq; |
| 1789 case Token::LT: |
| 1790 return lt; |
| 1791 case Token::GT: |
| 1792 return gt; |
| 1793 case Token::LTE: |
| 1794 return le; |
| 1795 case Token::GTE: |
| 1796 return ge; |
| 1797 default: |
| 1798 UNREACHABLE(); |
| 1799 return kNoCondition; |
| 1800 } |
| 1801 } |
| 1802 |
| 1803 |
| 1804 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { |
| 1805 Token::Value op = instr->op(); |
| 1806 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 1807 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1808 |
| 1809 Handle<Code> ic = CompareIC::GetUninitialized(op); |
| 1810 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 1811 // On MIPS there is no need for a "no inlined smi code" marker (nop). |
| 1812 |
| 1813 Condition condition = ComputeCompareCondition(op); |
| 1814 |
| 1815 EmitBranch(true_block, false_block, condition, at, |
| 1816 Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
| 1817 } |
| 1818 |
| 1819 |
1756 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { | 1820 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { |
1757 InstanceType from = instr->from(); | 1821 InstanceType from = instr->from(); |
1758 InstanceType to = instr->to(); | 1822 InstanceType to = instr->to(); |
1759 if (from == FIRST_TYPE) return to; | 1823 if (from == FIRST_TYPE) return to; |
1760 ASSERT(from == to || to == LAST_TYPE); | 1824 ASSERT(from == to || to == LAST_TYPE); |
1761 return from; | 1825 return from; |
1762 } | 1826 } |
1763 | 1827 |
1764 | 1828 |
1765 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) { | 1829 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) { |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2043 CallCodeGeneric(stub.GetCode(), | 2107 CallCodeGeneric(stub.GetCode(), |
2044 RelocInfo::CODE_TARGET, | 2108 RelocInfo::CODE_TARGET, |
2045 instr, | 2109 instr, |
2046 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 2110 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
2047 // Put the result value into the result register slot and | 2111 // Put the result value into the result register slot and |
2048 // restore all registers. | 2112 // restore all registers. |
2049 __ StoreToSafepointRegisterSlot(result, result); | 2113 __ StoreToSafepointRegisterSlot(result, result); |
2050 } | 2114 } |
2051 | 2115 |
2052 | 2116 |
2053 static Condition ComputeCompareCondition(Token::Value op) { | |
2054 switch (op) { | |
2055 case Token::EQ_STRICT: | |
2056 case Token::EQ: | |
2057 return eq; | |
2058 case Token::LT: | |
2059 return lt; | |
2060 case Token::GT: | |
2061 return gt; | |
2062 case Token::LTE: | |
2063 return le; | |
2064 case Token::GTE: | |
2065 return ge; | |
2066 default: | |
2067 UNREACHABLE(); | |
2068 return kNoCondition; | |
2069 } | |
2070 } | |
2071 | |
2072 | |
2073 void LCodeGen::DoCmpT(LCmpT* instr) { | 2117 void LCodeGen::DoCmpT(LCmpT* instr) { |
2074 Token::Value op = instr->op(); | 2118 Token::Value op = instr->op(); |
2075 | 2119 |
2076 Handle<Code> ic = CompareIC::GetUninitialized(op); | 2120 Handle<Code> ic = CompareIC::GetUninitialized(op); |
2077 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2121 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2078 // On MIPS there is no need for a "no inlined smi code" marker (nop). | 2122 // On MIPS there is no need for a "no inlined smi code" marker (nop). |
2079 | 2123 |
2080 Condition condition = ComputeCompareCondition(op); | 2124 Condition condition = ComputeCompareCondition(op); |
2081 // A minor optimization that relies on LoadRoot always emitting one | 2125 // A minor optimization that relies on LoadRoot always emitting one |
2082 // instruction. | 2126 // instruction. |
(...skipping 2539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4622 ASSERT(!environment->HasBeenRegistered()); | 4666 ASSERT(!environment->HasBeenRegistered()); |
4623 RegisterEnvironmentForDeoptimization(environment); | 4667 RegisterEnvironmentForDeoptimization(environment); |
4624 ASSERT(osr_pc_offset_ == -1); | 4668 ASSERT(osr_pc_offset_ == -1); |
4625 osr_pc_offset_ = masm()->pc_offset(); | 4669 osr_pc_offset_ = masm()->pc_offset(); |
4626 } | 4670 } |
4627 | 4671 |
4628 | 4672 |
4629 #undef __ | 4673 #undef __ |
4630 | 4674 |
4631 } } // namespace v8::internal | 4675 } } // namespace v8::internal |
OLD | NEW |