| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
| 9 #include "src/base/utils/random-number-generator.h" | 9 #include "src/base/utils/random-number-generator.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 DCHECK(args.length() == 2); | 52 DCHECK(args.length() == 2); |
| 53 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 53 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 54 CONVERT_ARG_CHECKED(JSTypedArray, result, 1); | 54 CONVERT_ARG_CHECKED(JSTypedArray, result, 1); |
| 55 CHECK(result->byte_length() == Smi::FromInt(2 * sizeof(double))); | 55 CHECK(result->byte_length() == Smi::FromInt(2 * sizeof(double))); |
| 56 FixedFloat64Array* array = FixedFloat64Array::cast(result->elements()); | 56 FixedFloat64Array* array = FixedFloat64Array::cast(result->elements()); |
| 57 double* y = static_cast<double*>(array->DataPtr()); | 57 double* y = static_cast<double*>(array->DataPtr()); |
| 58 return Smi::FromInt(fdlibm::rempio2(x, y)); | 58 return Smi::FromInt(fdlibm::rempio2(x, y)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 | 61 |
| 62 RUNTIME_FUNCTION(Runtime_MathExpRT) { |
| 63 HandleScope scope(isolate); |
| 64 DCHECK(args.length() == 1); |
| 65 isolate->counters()->math_exp_runtime()->Increment(); |
| 66 |
| 67 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 68 lazily_initialize_fast_exp(isolate); |
| 69 return *isolate->factory()->NewNumber(fast_exp(x, isolate)); |
| 70 } |
| 71 |
| 72 |
| 62 // Slow version of Math.pow. We check for fast paths for special cases. | 73 // Slow version of Math.pow. We check for fast paths for special cases. |
| 63 // Used if VFP3 is not available. | 74 // Used if VFP3 is not available. |
| 64 RUNTIME_FUNCTION(Runtime_MathPow) { | 75 RUNTIME_FUNCTION(Runtime_MathPow) { |
| 65 HandleScope scope(isolate); | 76 HandleScope scope(isolate); |
| 66 DCHECK(args.length() == 2); | 77 DCHECK(args.length() == 2); |
| 67 isolate->counters()->math_pow_runtime()->Increment(); | 78 isolate->counters()->math_pow_runtime()->Increment(); |
| 68 | 79 |
| 69 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 80 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 70 | 81 |
| 71 // If the second argument is a smi, it is much faster to call the | 82 // If the second argument is a smi, it is much faster to call the |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 base::RandomNumberGenerator::XorShift128(&state0, &state1); | 162 base::RandomNumberGenerator::XorShift128(&state0, &state1); |
| 152 array[i] = base::RandomNumberGenerator::ToDouble(state0, state1); | 163 array[i] = base::RandomNumberGenerator::ToDouble(state0, state1); |
| 153 } | 164 } |
| 154 // Persist current state. | 165 // Persist current state. |
| 155 array[kState0Offset] = uint64_to_double(state0); | 166 array[kState0Offset] = uint64_to_double(state0); |
| 156 array[kState1Offset] = uint64_to_double(state1); | 167 array[kState1Offset] = uint64_to_double(state1); |
| 157 return *typed_array; | 168 return *typed_array; |
| 158 } | 169 } |
| 159 } // namespace internal | 170 } // namespace internal |
| 160 } // namespace v8 | 171 } // namespace v8 |
| OLD | NEW |