| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "src/crankshaft/mips64/lithium-codegen-mips64.h" | 5 #include "src/crankshaft/mips64/lithium-codegen-mips64.h" | 
| 6 | 6 | 
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" | 
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" | 
| 9 #include "src/crankshaft/hydrogen-osr.h" | 9 #include "src/crankshaft/hydrogen-osr.h" | 
| 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" | 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" | 
| (...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1839     DeoptimizeIf(al, instr); | 1839     DeoptimizeIf(al, instr); | 
| 1840     __ bind(&no_overflow_label); | 1840     __ bind(&no_overflow_label); | 
| 1841   } | 1841   } | 
| 1842 } | 1842 } | 
| 1843 | 1843 | 
| 1844 | 1844 | 
| 1845 void LCodeGen::DoMathMinMax(LMathMinMax* instr) { | 1845 void LCodeGen::DoMathMinMax(LMathMinMax* instr) { | 
| 1846   LOperand* left = instr->left(); | 1846   LOperand* left = instr->left(); | 
| 1847   LOperand* right = instr->right(); | 1847   LOperand* right = instr->right(); | 
| 1848   HMathMinMax::Operation operation = instr->hydrogen()->operation(); | 1848   HMathMinMax::Operation operation = instr->hydrogen()->operation(); | 
| 1849   Condition condition = (operation == HMathMinMax::kMathMin) ? le : ge; | 1849   Register scratch = scratch1(); | 
| 1850   if (instr->hydrogen()->representation().IsSmiOrInteger32()) { | 1850   if (instr->hydrogen()->representation().IsSmiOrInteger32()) { | 
|  | 1851     Condition condition = (operation == HMathMinMax::kMathMin) ? le : ge; | 
| 1851     Register left_reg = ToRegister(left); | 1852     Register left_reg = ToRegister(left); | 
| 1852     Register right_reg = EmitLoadRegister(right, scratch0()); | 1853     Register right_reg = EmitLoadRegister(right, scratch0()); | 
| 1853     Register result_reg = ToRegister(instr->result()); | 1854     Register result_reg = ToRegister(instr->result()); | 
| 1854     Label return_right, done; | 1855     Label return_right, done; | 
| 1855     Register scratch = scratch1(); |  | 
| 1856     __ Slt(scratch, left_reg, Operand(right_reg)); | 1856     __ Slt(scratch, left_reg, Operand(right_reg)); | 
| 1857     if (condition == ge) { | 1857     if (condition == ge) { | 
| 1858      __  Movz(result_reg, left_reg, scratch); | 1858      __  Movz(result_reg, left_reg, scratch); | 
| 1859      __  Movn(result_reg, right_reg, scratch); | 1859      __  Movn(result_reg, right_reg, scratch); | 
| 1860     } else { | 1860     } else { | 
| 1861      DCHECK(condition == le); | 1861      DCHECK(condition == le); | 
| 1862      __  Movn(result_reg, left_reg, scratch); | 1862      __  Movn(result_reg, left_reg, scratch); | 
| 1863      __  Movz(result_reg, right_reg, scratch); | 1863      __  Movz(result_reg, right_reg, scratch); | 
| 1864     } | 1864     } | 
| 1865   } else { | 1865   } else { | 
| 1866     DCHECK(instr->hydrogen()->representation().IsDouble()); | 1866     DCHECK(instr->hydrogen()->representation().IsDouble()); | 
| 1867     FPURegister left_reg = ToDoubleRegister(left); | 1867     FPURegister left_reg = ToDoubleRegister(left); | 
| 1868     FPURegister right_reg = ToDoubleRegister(right); | 1868     FPURegister right_reg = ToDoubleRegister(right); | 
| 1869     FPURegister result_reg = ToDoubleRegister(instr->result()); | 1869     FPURegister result_reg = ToDoubleRegister(instr->result()); | 
| 1870     Label check_nan_left, check_zero, return_left, return_right, done; | 1870     Label nan, done; | 
| 1871     __ BranchF(&check_zero, &check_nan_left, eq, left_reg, right_reg); | 1871     if (operation == HMathMinMax::kMathMax) { | 
| 1872     __ BranchF(&return_left, NULL, condition, left_reg, right_reg); | 1872       __ MaxNaNCheck_d(result_reg, left_reg, right_reg, &nan); | 
| 1873     __ Branch(&return_right); |  | 
| 1874 |  | 
| 1875     __ bind(&check_zero); |  | 
| 1876     // left == right != 0. |  | 
| 1877     __ BranchF(&return_left, NULL, ne, left_reg, kDoubleRegZero); |  | 
| 1878     // At this point, both left and right are either 0 or -0. |  | 
| 1879     if (operation == HMathMinMax::kMathMin) { |  | 
| 1880       // The algorithm is: -((-L) + (-R)), which in case of L and R being |  | 
| 1881       // different registers is most efficiently expressed as -((-L) - R). |  | 
| 1882       __ neg_d(left_reg, left_reg); |  | 
| 1883       if (left_reg.is(right_reg)) { |  | 
| 1884         __ add_d(result_reg, left_reg, right_reg); |  | 
| 1885       } else { |  | 
| 1886         __ sub_d(result_reg, left_reg, right_reg); |  | 
| 1887       } |  | 
| 1888       __ neg_d(result_reg, result_reg); |  | 
| 1889     } else { | 1873     } else { | 
| 1890       __ add_d(result_reg, left_reg, right_reg); | 1874       DCHECK(operation == HMathMinMax::kMathMin); | 
|  | 1875       __ MinNaNCheck_d(result_reg, left_reg, right_reg, &nan); | 
| 1891     } | 1876     } | 
| 1892     __ Branch(&done); | 1877     __ Branch(&done); | 
| 1893 | 1878 | 
| 1894     __ bind(&check_nan_left); | 1879     __ bind(&nan); | 
| 1895     // left == NaN. | 1880     __ LoadRoot(scratch, Heap::kNanValueRootIndex); | 
| 1896     __ BranchF(NULL, &return_left, eq, left_reg, left_reg); | 1881     __ ldc1(result_reg, FieldMemOperand(scratch, HeapNumber::kValueOffset)); | 
| 1897     __ bind(&return_right); |  | 
| 1898     if (!right_reg.is(result_reg)) { |  | 
| 1899       __ mov_d(result_reg, right_reg); |  | 
| 1900     } |  | 
| 1901     __ Branch(&done); |  | 
| 1902 | 1882 | 
| 1903     __ bind(&return_left); |  | 
| 1904     if (!left_reg.is(result_reg)) { |  | 
| 1905       __ mov_d(result_reg, left_reg); |  | 
| 1906     } |  | 
| 1907     __ bind(&done); | 1883     __ bind(&done); | 
| 1908   } | 1884   } | 
| 1909 } | 1885 } | 
| 1910 | 1886 | 
| 1911 | 1887 | 
| 1912 void LCodeGen::DoArithmeticD(LArithmeticD* instr) { | 1888 void LCodeGen::DoArithmeticD(LArithmeticD* instr) { | 
| 1913   DoubleRegister left = ToDoubleRegister(instr->left()); | 1889   DoubleRegister left = ToDoubleRegister(instr->left()); | 
| 1914   DoubleRegister right = ToDoubleRegister(instr->right()); | 1890   DoubleRegister right = ToDoubleRegister(instr->right()); | 
| 1915   DoubleRegister result = ToDoubleRegister(instr->result()); | 1891   DoubleRegister result = ToDoubleRegister(instr->result()); | 
| 1916   switch (instr->op()) { | 1892   switch (instr->op()) { | 
| (...skipping 3847 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5764   __ ld(result, FieldMemOperand(scratch, | 5740   __ ld(result, FieldMemOperand(scratch, | 
| 5765                                 FixedArray::kHeaderSize - kPointerSize)); | 5741                                 FixedArray::kHeaderSize - kPointerSize)); | 
| 5766   __ bind(deferred->exit()); | 5742   __ bind(deferred->exit()); | 
| 5767   __ bind(&done); | 5743   __ bind(&done); | 
| 5768 } | 5744 } | 
| 5769 | 5745 | 
| 5770 #undef __ | 5746 #undef __ | 
| 5771 | 5747 | 
| 5772 }  // namespace internal | 5748 }  // namespace internal | 
| 5773 }  // namespace v8 | 5749 }  // namespace v8 | 
| OLD | NEW | 
|---|