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 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1827 int LCodeGen::GetNextEmittedBlock() const { | 1827 int LCodeGen::GetNextEmittedBlock() const { |
1828 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { | 1828 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { |
1829 if (!chunk_->GetLabel(i)->HasReplacement()) return i; | 1829 if (!chunk_->GetLabel(i)->HasReplacement()) return i; |
1830 } | 1830 } |
1831 return -1; | 1831 return -1; |
1832 } | 1832 } |
1833 | 1833 |
1834 | 1834 |
1835 template<class InstrType> | 1835 template<class InstrType> |
1836 void LCodeGen::EmitBranch(InstrType instr, Condition cc) { | 1836 void LCodeGen::EmitBranch(InstrType instr, Condition cc) { |
| 1837 int left_block = instr->TrueDestination(chunk_); |
1837 int right_block = instr->FalseDestination(chunk_); | 1838 int right_block = instr->FalseDestination(chunk_); |
1838 int left_block = instr->TrueDestination(chunk_); | |
1839 | 1839 |
1840 int next_block = GetNextEmittedBlock(); | 1840 int next_block = GetNextEmittedBlock(); |
1841 | 1841 |
1842 if (right_block == left_block) { | 1842 if (right_block == left_block || cc == no_condition) { |
1843 EmitGoto(left_block); | 1843 EmitGoto(left_block); |
1844 } else if (left_block == next_block) { | 1844 } else if (left_block == next_block) { |
1845 __ j(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block)); | 1845 __ j(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block)); |
1846 } else if (right_block == next_block) { | 1846 } else if (right_block == next_block) { |
1847 __ j(cc, chunk_->GetAssemblyLabel(left_block)); | 1847 __ j(cc, chunk_->GetAssemblyLabel(left_block)); |
1848 } else { | 1848 } else { |
1849 __ j(cc, chunk_->GetAssemblyLabel(left_block)); | 1849 __ j(cc, chunk_->GetAssemblyLabel(left_block)); |
1850 if (cc != always) { | 1850 if (cc != always) { |
1851 __ jmp(chunk_->GetAssemblyLabel(right_block)); | 1851 __ jmp(chunk_->GetAssemblyLabel(right_block)); |
1852 } | 1852 } |
1853 } | 1853 } |
1854 } | 1854 } |
1855 | 1855 |
1856 | 1856 |
1857 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { | 1857 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { |
1858 __ int3(); | 1858 __ int3(); |
1859 } | 1859 } |
1860 | 1860 |
1861 | 1861 |
| 1862 void LCodeGen::DoIsNumberAndBranch(LIsNumberAndBranch* instr) { |
| 1863 Representation r = instr->hydrogen()->value()->representation(); |
| 1864 if (r.IsSmiOrInteger32() || r.IsDouble()) { |
| 1865 EmitBranch(instr, no_condition); |
| 1866 } else { |
| 1867 ASSERT(r.IsTagged()); |
| 1868 Register reg = ToRegister(instr->value()); |
| 1869 HType type = instr->hydrogen()->value()->type(); |
| 1870 if (type.IsTaggedNumber()) { |
| 1871 EmitBranch(instr, no_condition); |
| 1872 } |
| 1873 __ JumpIfSmi(reg, instr->TrueLabel(chunk_)); |
| 1874 __ CompareRoot(FieldOperand(reg, HeapObject::kMapOffset), |
| 1875 Heap::kHeapNumberMapRootIndex); |
| 1876 EmitBranch(instr, equal); |
| 1877 } |
| 1878 } |
| 1879 |
| 1880 |
1862 void LCodeGen::DoBranch(LBranch* instr) { | 1881 void LCodeGen::DoBranch(LBranch* instr) { |
1863 Representation r = instr->hydrogen()->value()->representation(); | 1882 Representation r = instr->hydrogen()->value()->representation(); |
1864 if (r.IsInteger32()) { | 1883 if (r.IsInteger32()) { |
1865 ASSERT(!info()->IsStub()); | 1884 ASSERT(!info()->IsStub()); |
1866 Register reg = ToRegister(instr->value()); | 1885 Register reg = ToRegister(instr->value()); |
1867 __ testl(reg, reg); | 1886 __ testl(reg, reg); |
1868 EmitBranch(instr, not_zero); | 1887 EmitBranch(instr, not_zero); |
1869 } else if (r.IsSmi()) { | 1888 } else if (r.IsSmi()) { |
1870 ASSERT(!info()->IsStub()); | 1889 ASSERT(!info()->IsStub()); |
1871 Register reg = ToRegister(instr->value()); | 1890 Register reg = ToRegister(instr->value()); |
(...skipping 3774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5646 FixedArray::kHeaderSize - kPointerSize)); | 5665 FixedArray::kHeaderSize - kPointerSize)); |
5647 __ bind(&done); | 5666 __ bind(&done); |
5648 } | 5667 } |
5649 | 5668 |
5650 | 5669 |
5651 #undef __ | 5670 #undef __ |
5652 | 5671 |
5653 } } // namespace v8::internal | 5672 } } // namespace v8::internal |
5654 | 5673 |
5655 #endif // V8_TARGET_ARCH_X64 | 5674 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |