| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2513 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2524                                     Register input_low) { | 2524                                     Register input_low) { | 
| 2525   CpuFeatureScope scope(this, VFP2); | 2525   CpuFeatureScope scope(this, VFP2); | 
| 2526   ASSERT(!input_high.is(result)); | 2526   ASSERT(!input_high.is(result)); | 
| 2527   ASSERT(!input_low.is(result)); | 2527   ASSERT(!input_low.is(result)); | 
| 2528   ASSERT(!input_low.is(input_high)); | 2528   ASSERT(!input_low.is(input_high)); | 
| 2529   ASSERT(!scratch.is(result) && | 2529   ASSERT(!scratch.is(result) && | 
| 2530          !scratch.is(input_high) && | 2530          !scratch.is(input_high) && | 
| 2531          !scratch.is(input_low)); | 2531          !scratch.is(input_low)); | 
| 2532   ASSERT(!double_input.is(double_scratch)); | 2532   ASSERT(!double_input.is(double_scratch)); | 
| 2533 | 2533 | 
| 2534   Label overflow, out_of_range, negate, done; | 2534   Label out_of_range, negate, done; | 
|  | 2535 | 
|  | 2536   vcvt_s32_f64(double_scratch.low(), double_input); | 
|  | 2537   vmov(result, double_scratch.low()); | 
|  | 2538 | 
|  | 2539   // If result is not saturated (0x7fffffff or 0x80000000), we are done. | 
|  | 2540   sub(scratch, result, Operand(1)); | 
|  | 2541   cmp(scratch, Operand(0x7ffffffe)); | 
|  | 2542   b(lt, &done); | 
| 2535 | 2543 | 
| 2536   vmov(input_low, input_high, double_input); | 2544   vmov(input_low, input_high, double_input); | 
| 2537   Ubfx(scratch, input_high, | 2545   Ubfx(scratch, input_high, | 
| 2538        HeapNumber::kExponentShift, HeapNumber::kExponentBits); | 2546        HeapNumber::kExponentShift, HeapNumber::kExponentBits); | 
| 2539   // Load scratch with exponent - 1. This is faster than loading | 2547   // Load scratch with exponent - 1. This is faster than loading | 
| 2540   // with exponent because Bias + 1 = 1024 which is an *ARM* immediate value. | 2548   // with exponent because Bias + 1 = 1024 which is an *ARM* immediate value. | 
| 2541   sub(scratch, scratch, Operand(HeapNumber::kExponentBias + 1)); | 2549   sub(scratch, scratch, Operand(HeapNumber::kExponentBias + 1)); | 
| 2542   // Compare exponent with 31 (compare exponent - 1 with 30). |  | 
| 2543   cmp(scratch, Operand(30)); |  | 
| 2544   b(ge, &overflow); |  | 
| 2545   // Exponent is less than 31 so vcvt will never saturate. |  | 
| 2546   // So, just return the result. |  | 
| 2547   vcvt_s32_f64(double_scratch.low(), double_input); |  | 
| 2548   vmov(result, double_scratch.low()); |  | 
| 2549   b(&done); |  | 
| 2550 |  | 
| 2551   bind(&overflow); |  | 
| 2552   // If exponent is greater than or equal to 84, the 32 less significant | 2550   // If exponent is greater than or equal to 84, the 32 less significant | 
| 2553   // bits are 0s (2^84 = 1, 52 significant bits, 32 uncoded bits), | 2551   // bits are 0s (2^84 = 1, 52 significant bits, 32 uncoded bits), | 
| 2554   // the result is 0. | 2552   // the result is 0. | 
| 2555   // This test also catch Nan and infinities which also return 0. |  | 
| 2556   // Compare exponent with 84 (compare exponent - 1 with 83). | 2553   // Compare exponent with 84 (compare exponent - 1 with 83). | 
| 2557   cmp(scratch, Operand(83)); | 2554   cmp(scratch, Operand(83)); | 
| 2558   b(ge, &out_of_range); | 2555   b(ge, &out_of_range); | 
| 2559 | 2556 | 
| 2560   // If we reach this code, 31 <= exponent <= 83. | 2557   // If we reach this code, 31 <= exponent <= 83. | 
| 2561   // So, we don't have to handle cases where 0 <= exponent <= 20 for | 2558   // So, we don't have to handle cases where 0 <= exponent <= 20 for | 
| 2562   // which we would need to shift right the high part of the mantissa. | 2559   // which we would need to shift right the high part of the mantissa. | 
| 2563   ECMAToInt32Tail(result, scratch, input_high, input_low, | 2560   ECMAToInt32Tail(result, scratch, input_high, input_low, | 
| 2564                   &out_of_range, &negate, &done); | 2561                   &out_of_range, &negate, &done); | 
| 2565 } | 2562 } | 
| (...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3951 void CodePatcher::EmitCondition(Condition cond) { | 3948 void CodePatcher::EmitCondition(Condition cond) { | 
| 3952   Instr instr = Assembler::instr_at(masm_.pc_); | 3949   Instr instr = Assembler::instr_at(masm_.pc_); | 
| 3953   instr = (instr & ~kCondMask) | cond; | 3950   instr = (instr & ~kCondMask) | cond; | 
| 3954   masm_.emit(instr); | 3951   masm_.emit(instr); | 
| 3955 } | 3952 } | 
| 3956 | 3953 | 
| 3957 | 3954 | 
| 3958 } }  // namespace v8::internal | 3955 } }  // namespace v8::internal | 
| 3959 | 3956 | 
| 3960 #endif  // V8_TARGET_ARCH_ARM | 3957 #endif  // V8_TARGET_ARCH_ARM | 
| OLD | NEW | 
|---|