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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 return *isolate->factory()->NewNumber(uint64_to_double(result)); | 45 return *isolate->factory()->NewNumber(uint64_to_double(result)); |
46 } | 46 } |
47 | 47 |
48 | 48 |
49 RUNTIME_FUNCTION(Runtime_RemPiO2) { | 49 RUNTIME_FUNCTION(Runtime_RemPiO2) { |
50 SealHandleScope shs(isolate); | 50 SealHandleScope shs(isolate); |
51 DisallowHeapAllocation no_gc; | 51 DisallowHeapAllocation no_gc; |
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 RUNTIME_ASSERT(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 static const double kPiDividedBy4 = 0.78539816339744830962; | 62 static const double kPiDividedBy4 = 0.78539816339744830962; |
63 | 63 |
64 | 64 |
65 RUNTIME_FUNCTION(Runtime_MathAtan2) { | 65 RUNTIME_FUNCTION(Runtime_MathAtan2) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 base::RandomNumberGenerator::XorShift128(&state0, &state1); | 187 base::RandomNumberGenerator::XorShift128(&state0, &state1); |
188 array[i] = base::RandomNumberGenerator::ToDouble(state0, state1); | 188 array[i] = base::RandomNumberGenerator::ToDouble(state0, state1); |
189 } | 189 } |
190 // Persist current state. | 190 // Persist current state. |
191 array[kState0Offset] = uint64_to_double(state0); | 191 array[kState0Offset] = uint64_to_double(state0); |
192 array[kState1Offset] = uint64_to_double(state1); | 192 array[kState1Offset] = uint64_to_double(state1); |
193 return *typed_array; | 193 return *typed_array; |
194 } | 194 } |
195 } // namespace internal | 195 } // namespace internal |
196 } // namespace v8 | 196 } // namespace v8 |
OLD | NEW |