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