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 3079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3090 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { | 3090 void LCodeGen::DoMathSqrt(LUnaryMathOperation* instr) { |
| 3091 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); | 3091 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); |
| 3092 DoubleRegister result = ToDoubleRegister(instr->result()); | 3092 DoubleRegister result = ToDoubleRegister(instr->result()); |
| 3093 __ vsqrt(result, input); | 3093 __ vsqrt(result, input); |
| 3094 } | 3094 } |
| 3095 | 3095 |
| 3096 | 3096 |
| 3097 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { | 3097 void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { |
| 3098 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); | 3098 DoubleRegister input = ToDoubleRegister(instr->InputAt(0)); |
| 3099 DoubleRegister result = ToDoubleRegister(instr->result()); | 3099 DoubleRegister result = ToDoubleRegister(instr->result()); |
| 3100 | |
| 3101 // Note that according to ECMA-262 15.8.2.13: | |
| 3102 // Math.pow(-Infinity, 0.5) == Infinity | |
| 3103 // Math.sqrt(-Infinity) == NaN | |
| 3104 Label done; | |
| 3105 __ VFPCompareAndSetFlags(input, -INFINITY); | |
|
Sven Panne
2011/12/06 08:23:12
I think we should use V8_INFINITY here, although I
| |
| 3106 __ vneg(result, input, eq); | |
| 3107 __ b(&done, eq); | |
| 3108 | |
| 3100 // Add +0 to convert -0 to +0. | 3109 // Add +0 to convert -0 to +0. |
| 3101 __ vadd(result, input, kDoubleRegZero); | 3110 __ vadd(result, input, kDoubleRegZero); |
| 3102 __ vsqrt(result, result); | 3111 __ vsqrt(result, result); |
| 3112 __ bind(&done); | |
| 3103 } | 3113 } |
| 3104 | 3114 |
| 3105 | 3115 |
| 3106 void LCodeGen::DoPower(LPower* instr) { | 3116 void LCodeGen::DoPower(LPower* instr) { |
| 3107 LOperand* left = instr->InputAt(0); | 3117 LOperand* left = instr->InputAt(0); |
| 3108 LOperand* right = instr->InputAt(1); | 3118 LOperand* right = instr->InputAt(1); |
| 3109 Register scratch = scratch0(); | 3119 Register scratch = scratch0(); |
| 3110 DoubleRegister result_reg = ToDoubleRegister(instr->result()); | 3120 DoubleRegister result_reg = ToDoubleRegister(instr->result()); |
| 3111 Representation exponent_type = instr->hydrogen()->right()->representation(); | 3121 Representation exponent_type = instr->hydrogen()->right()->representation(); |
| 3112 if (exponent_type.IsDouble()) { | 3122 if (exponent_type.IsDouble()) { |
| (...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4715 ASSERT(osr_pc_offset_ == -1); | 4725 ASSERT(osr_pc_offset_ == -1); |
| 4716 osr_pc_offset_ = masm()->pc_offset(); | 4726 osr_pc_offset_ = masm()->pc_offset(); |
| 4717 } | 4727 } |
| 4718 | 4728 |
| 4719 | 4729 |
| 4720 | 4730 |
| 4721 | 4731 |
| 4722 #undef __ | 4732 #undef __ |
| 4723 | 4733 |
| 4724 } } // namespace v8::internal | 4734 } } // namespace v8::internal |
| OLD | NEW |