Chromium Code Reviews| 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 2978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2989 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { | 2989 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { |
| 2990 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); | 2990 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); |
| 2991 DoubleRegister result = ToDoubleRegister(instr->result()); | 2991 DoubleRegister result = ToDoubleRegister(instr->result()); |
| 2992 __ sqrt_d(result, input); | 2992 __ sqrt_d(result, input); |
| 2993 } | 2993 } |
| 2994 | 2994 |
| 2995 | 2995 |
| 2996 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { | 2996 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { |
| 2997 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); | 2997 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); |
| 2998 DoubleRegister result = ToDoubleRegister(instr->result()); | 2998 DoubleRegister result = ToDoubleRegister(instr->result()); |
| 2999 DoubleRegister double_scratch = double_scratch0(); | 2999 DoubleRegister temp = ToDoubleRegister(instr->TempAt(0)); |
| 3000 | |
|
Yang
2011/12/06 16:21:53
From what I can see, you don't need to reserve an
kalmard
2011/12/08 13:19:27
I generally try to stick close to the ARM version
| |
| 3001 ASSERT(!input.is(result)); | |
| 3002 | |
| 3003 // Note that according to ECMA-262 15.8.2.13: | |
| 3004 // Math.pow(-Infinity, 0.5) == Infinity | |
| 3005 // Math.sqrt(-Infinity) == NaN | |
| 3006 Label done; | |
| 3007 __ Move(temp, -V8_INFINITY); | |
| 3008 __ BranchF(USE_DELAY_SLOT, &done, NULL, eq, temp, input); | |
| 3009 // Set up Infinity in the delay slot. | |
| 3010 // result is overwritten if the branch is not taken. | |
| 3011 __ neg_d(result, temp); | |
| 3000 | 3012 |
| 3001 // Add +0 to convert -0 to +0. | 3013 // Add +0 to convert -0 to +0. |
| 3002 __ mtc1(zero_reg, double_scratch.low()); | 3014 __ add_d(result, input, kDoubleRegZero); |
| 3003 __ mtc1(zero_reg, double_scratch.high()); | |
| 3004 __ add_d(result, input, double_scratch); | |
| 3005 __ sqrt_d(result, result); | 3015 __ sqrt_d(result, result); |
| 3016 __ bind(&done); | |
| 3006 } | 3017 } |
| 3007 | 3018 |
| 3008 | 3019 |
| 3009 void LCodeGen::DoPower(LPower* instr) { | 3020 void LCodeGen::DoPower(LPower* instr) { |
| 3010 LOperand* left = instr->InputAt(0); | 3021 LOperand* left = instr->InputAt(0); |
| 3011 LOperand* right = instr->InputAt(1); | 3022 LOperand* right = instr->InputAt(1); |
| 3012 Register scratch = scratch0(); | 3023 Register scratch = scratch0(); |
| 3013 DoubleRegister result_reg = ToDoubleRegister(instr->result()); | 3024 DoubleRegister result_reg = ToDoubleRegister(instr->result()); |
| 3014 Representation exponent_type = instr->hydrogen()->right()->representation(); | 3025 Representation exponent_type = instr->hydrogen()->right()->representation(); |
| 3015 if (exponent_type.IsDouble()) { | 3026 if (exponent_type.IsDouble()) { |
| (...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4645 ASSERT(!environment->HasBeenRegistered()); | 4656 ASSERT(!environment->HasBeenRegistered()); |
| 4646 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4657 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
| 4647 ASSERT(osr_pc_offset_ == -1); | 4658 ASSERT(osr_pc_offset_ == -1); |
| 4648 osr_pc_offset_ = masm()->pc_offset(); | 4659 osr_pc_offset_ = masm()->pc_offset(); |
| 4649 } | 4660 } |
| 4650 | 4661 |
| 4651 | 4662 |
| 4652 #undef __ | 4663 #undef __ |
| 4653 | 4664 |
| 4654 } } // namespace v8::internal | 4665 } } // namespace v8::internal |
| OLD | NEW |