| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
| 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 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1914 } | 1914 } |
| 1915 | 1915 |
| 1916 | 1916 |
| 1917 void LCodeGen::DoMathMinMax(LMathMinMax* instr) { | 1917 void LCodeGen::DoMathMinMax(LMathMinMax* instr) { |
| 1918 LOperand* left = instr->left(); | 1918 LOperand* left = instr->left(); |
| 1919 LOperand* right = instr->right(); | 1919 LOperand* right = instr->right(); |
| 1920 HMathMinMax::Operation operation = instr->hydrogen()->operation(); | 1920 HMathMinMax::Operation operation = instr->hydrogen()->operation(); |
| 1921 Condition condition = (operation == HMathMinMax::kMathMin) ? le : ge; | 1921 Condition condition = (operation == HMathMinMax::kMathMin) ? le : ge; |
| 1922 if (instr->hydrogen()->representation().IsSmiOrInteger32()) { | 1922 if (instr->hydrogen()->representation().IsSmiOrInteger32()) { |
| 1923 Register left_reg = ToRegister(left); | 1923 Register left_reg = ToRegister(left); |
| 1924 Operand right_op = (right->IsRegister() || right->IsConstantOperand()) | 1924 Register right_reg = EmitLoadRegister(right, scratch0()); |
| 1925 ? ToOperand(right) | |
| 1926 : Operand(EmitLoadRegister(right, at)); | |
| 1927 Register result_reg = ToRegister(instr->result()); | 1925 Register result_reg = ToRegister(instr->result()); |
| 1928 Label return_right, done; | 1926 Label return_right, done; |
| 1929 if (!result_reg.is(left_reg)) { | 1927 Register scratch = scratch1(); |
| 1930 __ Branch(&return_right, NegateCondition(condition), left_reg, right_op); | 1928 __ Slt(scratch, left_reg, Operand(right_reg)); |
| 1931 __ mov(result_reg, left_reg); | 1929 if (condition == ge) { |
| 1932 __ Branch(&done); | 1930 __ Movz(result_reg, left_reg, scratch); |
| 1931 __ Movn(result_reg, right_reg, scratch); |
| 1932 } else { |
| 1933 ASSERT(condition == le); |
| 1934 __ Movn(result_reg, left_reg, scratch); |
| 1935 __ Movz(result_reg, right_reg, scratch); |
| 1933 } | 1936 } |
| 1934 __ Branch(&done, condition, left_reg, right_op); | |
| 1935 __ bind(&return_right); | |
| 1936 __ Addu(result_reg, zero_reg, right_op); | |
| 1937 __ bind(&done); | |
| 1938 } else { | 1937 } else { |
| 1939 ASSERT(instr->hydrogen()->representation().IsDouble()); | 1938 ASSERT(instr->hydrogen()->representation().IsDouble()); |
| 1940 FPURegister left_reg = ToDoubleRegister(left); | 1939 FPURegister left_reg = ToDoubleRegister(left); |
| 1941 FPURegister right_reg = ToDoubleRegister(right); | 1940 FPURegister right_reg = ToDoubleRegister(right); |
| 1942 FPURegister result_reg = ToDoubleRegister(instr->result()); | 1941 FPURegister result_reg = ToDoubleRegister(instr->result()); |
| 1943 Label check_nan_left, check_zero, return_left, return_right, done; | 1942 Label check_nan_left, check_zero, return_left, return_right, done; |
| 1944 __ BranchF(&check_zero, &check_nan_left, eq, left_reg, right_reg); | 1943 __ BranchF(&check_zero, &check_nan_left, eq, left_reg, right_reg); |
| 1945 __ BranchF(&return_left, NULL, condition, left_reg, right_reg); | 1944 __ BranchF(&return_left, NULL, condition, left_reg, right_reg); |
| 1946 __ Branch(&return_right); | 1945 __ Branch(&return_right); |
| 1947 | 1946 |
| (...skipping 3929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5877 __ lw(result, FieldMemOperand(scratch, | 5876 __ lw(result, FieldMemOperand(scratch, |
| 5878 FixedArray::kHeaderSize - kPointerSize)); | 5877 FixedArray::kHeaderSize - kPointerSize)); |
| 5879 __ bind(deferred->exit()); | 5878 __ bind(deferred->exit()); |
| 5880 __ bind(&done); | 5879 __ bind(&done); |
| 5881 } | 5880 } |
| 5882 | 5881 |
| 5883 | 5882 |
| 5884 #undef __ | 5883 #undef __ |
| 5885 | 5884 |
| 5886 } } // namespace v8::internal | 5885 } } // namespace v8::internal |
| OLD | NEW |