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 right_block = instr->FalseDestination(chunk_); |
1837 int left_block = instr->TrueDestination(chunk_); | 1838 int left_block = instr->TrueDestination(chunk_); |
1838 int right_block = instr->FalseDestination(chunk_); | |
1839 | 1839 |
1840 int next_block = GetNextEmittedBlock(); | 1840 int next_block = GetNextEmittedBlock(); |
1841 | 1841 |
1842 if (right_block == left_block || cc == no_condition) { | 1842 if (right_block == left_block) { |
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 | |
1881 void LCodeGen::DoBranch(LBranch* instr) { | 1862 void LCodeGen::DoBranch(LBranch* instr) { |
1882 Representation r = instr->hydrogen()->value()->representation(); | 1863 Representation r = instr->hydrogen()->value()->representation(); |
1883 if (r.IsInteger32()) { | 1864 if (r.IsInteger32()) { |
1884 ASSERT(!info()->IsStub()); | 1865 ASSERT(!info()->IsStub()); |
1885 Register reg = ToRegister(instr->value()); | 1866 Register reg = ToRegister(instr->value()); |
1886 __ testl(reg, reg); | 1867 __ testl(reg, reg); |
1887 EmitBranch(instr, not_zero); | 1868 EmitBranch(instr, not_zero); |
1888 } else if (r.IsSmi()) { | 1869 } else if (r.IsSmi()) { |
1889 ASSERT(!info()->IsStub()); | 1870 ASSERT(!info()->IsStub()); |
1890 Register reg = ToRegister(instr->value()); | 1871 Register reg = ToRegister(instr->value()); |
(...skipping 3774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5665 FixedArray::kHeaderSize - kPointerSize)); | 5646 FixedArray::kHeaderSize - kPointerSize)); |
5666 __ bind(&done); | 5647 __ bind(&done); |
5667 } | 5648 } |
5668 | 5649 |
5669 | 5650 |
5670 #undef __ | 5651 #undef __ |
5671 | 5652 |
5672 } } // namespace v8::internal | 5653 } } // namespace v8::internal |
5673 | 5654 |
5674 #endif // V8_TARGET_ARCH_X64 | 5655 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |