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 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 1805 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
1806 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1806 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
1807 | 1807 |
1808 Condition true_cond = | 1808 Condition true_cond = |
1809 EmitIsObject(reg, temp1, false_label, true_label); | 1809 EmitIsObject(reg, temp1, false_label, true_label); |
1810 | 1810 |
1811 EmitBranch(true_block, false_block, true_cond); | 1811 EmitBranch(true_block, false_block, true_cond); |
1812 } | 1812 } |
1813 | 1813 |
1814 | 1814 |
| 1815 Condition LCodeGen::EmitIsString(Register input, |
| 1816 Register temp1, |
| 1817 Label* is_not_string) { |
| 1818 __ JumpIfSmi(input, is_not_string); |
| 1819 __ CompareObjectType(input, temp1, temp1, FIRST_NONSTRING_TYPE); |
| 1820 |
| 1821 return lt; |
| 1822 } |
| 1823 |
| 1824 |
| 1825 void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) { |
| 1826 Register reg = ToRegister(instr->InputAt(0)); |
| 1827 Register temp1 = ToRegister(instr->TempAt(0)); |
| 1828 |
| 1829 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 1830 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1831 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
| 1832 |
| 1833 Condition true_cond = |
| 1834 EmitIsString(reg, temp1, false_label); |
| 1835 |
| 1836 EmitBranch(true_block, false_block, true_cond); |
| 1837 } |
| 1838 |
| 1839 |
1815 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { | 1840 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { |
1816 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1841 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1817 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1842 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1818 | 1843 |
1819 Register input_reg = EmitLoadRegister(instr->InputAt(0), ip); | 1844 Register input_reg = EmitLoadRegister(instr->InputAt(0), ip); |
1820 __ tst(input_reg, Operand(kSmiTagMask)); | 1845 __ tst(input_reg, Operand(kSmiTagMask)); |
1821 EmitBranch(true_block, false_block, eq); | 1846 EmitBranch(true_block, false_block, eq); |
1822 } | 1847 } |
1823 | 1848 |
1824 | 1849 |
1825 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) { | 1850 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) { |
1826 Register input = ToRegister(instr->InputAt(0)); | 1851 Register input = ToRegister(instr->InputAt(0)); |
1827 Register temp = ToRegister(instr->TempAt(0)); | 1852 Register temp = ToRegister(instr->TempAt(0)); |
1828 | 1853 |
1829 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1854 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1830 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1855 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1831 | 1856 |
1832 __ JumpIfSmi(input, chunk_->GetAssemblyLabel(false_block)); | 1857 __ JumpIfSmi(input, chunk_->GetAssemblyLabel(false_block)); |
1833 __ ldr(temp, FieldMemOperand(input, HeapObject::kMapOffset)); | 1858 __ ldr(temp, FieldMemOperand(input, HeapObject::kMapOffset)); |
1834 __ ldrb(temp, FieldMemOperand(temp, Map::kBitFieldOffset)); | 1859 __ ldrb(temp, FieldMemOperand(temp, Map::kBitFieldOffset)); |
1835 __ tst(temp, Operand(1 << Map::kIsUndetectable)); | 1860 __ tst(temp, Operand(1 << Map::kIsUndetectable)); |
1836 EmitBranch(true_block, false_block, ne); | 1861 EmitBranch(true_block, false_block, ne); |
1837 } | 1862 } |
1838 | 1863 |
1839 | 1864 |
| 1865 static Condition ComputeCompareCondition(Token::Value op) { |
| 1866 switch (op) { |
| 1867 case Token::EQ_STRICT: |
| 1868 case Token::EQ: |
| 1869 return eq; |
| 1870 case Token::LT: |
| 1871 return lt; |
| 1872 case Token::GT: |
| 1873 return gt; |
| 1874 case Token::LTE: |
| 1875 return le; |
| 1876 case Token::GTE: |
| 1877 return ge; |
| 1878 default: |
| 1879 UNREACHABLE(); |
| 1880 return kNoCondition; |
| 1881 } |
| 1882 } |
| 1883 |
| 1884 |
| 1885 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { |
| 1886 Token::Value op = instr->op(); |
| 1887 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 1888 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1889 |
| 1890 Handle<Code> ic = CompareIC::GetUninitialized(op); |
| 1891 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 1892 __ cmp(r0, Operand(0)); // This instruction also signals no smi code inlined. |
| 1893 |
| 1894 Condition condition = ComputeCompareCondition(op); |
| 1895 |
| 1896 EmitBranch(true_block, false_block, condition); |
| 1897 } |
| 1898 |
| 1899 |
1840 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { | 1900 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { |
1841 InstanceType from = instr->from(); | 1901 InstanceType from = instr->from(); |
1842 InstanceType to = instr->to(); | 1902 InstanceType to = instr->to(); |
1843 if (from == FIRST_TYPE) return to; | 1903 if (from == FIRST_TYPE) return to; |
1844 ASSERT(from == to || to == LAST_TYPE); | 1904 ASSERT(from == to || to == LAST_TYPE); |
1845 return from; | 1905 return from; |
1846 } | 1906 } |
1847 | 1907 |
1848 | 1908 |
1849 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) { | 1909 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) { |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 2178 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
2119 ASSERT(instr->HasDeoptimizationEnvironment()); | 2179 ASSERT(instr->HasDeoptimizationEnvironment()); |
2120 LEnvironment* env = instr->deoptimization_environment(); | 2180 LEnvironment* env = instr->deoptimization_environment(); |
2121 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 2181 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
2122 // Put the result value into the result register slot and | 2182 // Put the result value into the result register slot and |
2123 // restore all registers. | 2183 // restore all registers. |
2124 __ StoreToSafepointRegisterSlot(result, result); | 2184 __ StoreToSafepointRegisterSlot(result, result); |
2125 } | 2185 } |
2126 | 2186 |
2127 | 2187 |
2128 static Condition ComputeCompareCondition(Token::Value op) { | |
2129 switch (op) { | |
2130 case Token::EQ_STRICT: | |
2131 case Token::EQ: | |
2132 return eq; | |
2133 case Token::LT: | |
2134 return lt; | |
2135 case Token::GT: | |
2136 return gt; | |
2137 case Token::LTE: | |
2138 return le; | |
2139 case Token::GTE: | |
2140 return ge; | |
2141 default: | |
2142 UNREACHABLE(); | |
2143 return kNoCondition; | |
2144 } | |
2145 } | |
2146 | |
2147 | |
2148 void LCodeGen::DoCmpT(LCmpT* instr) { | 2188 void LCodeGen::DoCmpT(LCmpT* instr) { |
2149 Token::Value op = instr->op(); | 2189 Token::Value op = instr->op(); |
2150 | 2190 |
2151 Handle<Code> ic = CompareIC::GetUninitialized(op); | 2191 Handle<Code> ic = CompareIC::GetUninitialized(op); |
2152 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2192 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2153 __ cmp(r0, Operand(0)); // This instruction also signals no smi code inlined. | 2193 __ cmp(r0, Operand(0)); // This instruction also signals no smi code inlined. |
2154 | 2194 |
2155 Condition condition = ComputeCompareCondition(op); | 2195 Condition condition = ComputeCompareCondition(op); |
2156 __ LoadRoot(ToRegister(instr->result()), | 2196 __ LoadRoot(ToRegister(instr->result()), |
2157 Heap::kTrueValueRootIndex, | 2197 Heap::kTrueValueRootIndex, |
(...skipping 2484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4642 ASSERT(osr_pc_offset_ == -1); | 4682 ASSERT(osr_pc_offset_ == -1); |
4643 osr_pc_offset_ = masm()->pc_offset(); | 4683 osr_pc_offset_ = masm()->pc_offset(); |
4644 } | 4684 } |
4645 | 4685 |
4646 | 4686 |
4647 | 4687 |
4648 | 4688 |
4649 #undef __ | 4689 #undef __ |
4650 | 4690 |
4651 } } // namespace v8::internal | 4691 } } // namespace v8::internal |
OLD | NEW |