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 __ vmov(result, -INFINITY); | |
3106 __ vcmp(input, result); | |
Rodolph Perfetta
2011/12/05 17:38:36
Confusingly on ARM vcmp does no set the flags! you
| |
3107 __ vneg(result, input, eq); | |
3108 __ b(&done, eq); | |
3109 | |
3100 // Add +0 to convert -0 to +0. | 3110 // Add +0 to convert -0 to +0. |
3101 __ vadd(result, input, kDoubleRegZero); | 3111 __ vadd(result, input, kDoubleRegZero); |
3102 __ vsqrt(result, result); | 3112 __ vsqrt(result, result); |
3113 __ bind(&done); | |
3103 } | 3114 } |
3104 | 3115 |
3105 | 3116 |
3106 void LCodeGen::DoPower(LPower* instr) { | 3117 void LCodeGen::DoPower(LPower* instr) { |
3107 LOperand* left = instr->InputAt(0); | 3118 LOperand* left = instr->InputAt(0); |
3108 LOperand* right = instr->InputAt(1); | 3119 LOperand* right = instr->InputAt(1); |
3109 Register scratch = scratch0(); | 3120 Register scratch = scratch0(); |
3110 DoubleRegister result_reg = ToDoubleRegister(instr->result()); | 3121 DoubleRegister result_reg = ToDoubleRegister(instr->result()); |
3111 Representation exponent_type = instr->hydrogen()->right()->representation(); | 3122 Representation exponent_type = instr->hydrogen()->right()->representation(); |
3112 if (exponent_type.IsDouble()) { | 3123 if (exponent_type.IsDouble()) { |
(...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4715 ASSERT(osr_pc_offset_ == -1); | 4726 ASSERT(osr_pc_offset_ == -1); |
4716 osr_pc_offset_ = masm()->pc_offset(); | 4727 osr_pc_offset_ = masm()->pc_offset(); |
4717 } | 4728 } |
4718 | 4729 |
4719 | 4730 |
4720 | 4731 |
4721 | 4732 |
4722 #undef __ | 4733 #undef __ |
4723 | 4734 |
4724 } } // namespace v8::internal | 4735 } } // namespace v8::internal |
OLD | NEW |