| 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/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 61 } |
| 62 | 62 |
| 63 | 63 |
| 64 RUNTIME_FUNCTION(Runtime_RemPiO2) { | 64 RUNTIME_FUNCTION(Runtime_RemPiO2) { |
| 65 SealHandleScope shs(isolate); | 65 SealHandleScope shs(isolate); |
| 66 DisallowHeapAllocation no_gc; | 66 DisallowHeapAllocation no_gc; |
| 67 DCHECK(args.length() == 2); | 67 DCHECK(args.length() == 2); |
| 68 CONVERT_DOUBLE_ARG_CHECKED(x, 0); | 68 CONVERT_DOUBLE_ARG_CHECKED(x, 0); |
| 69 CONVERT_ARG_CHECKED(JSTypedArray, result, 1); | 69 CONVERT_ARG_CHECKED(JSTypedArray, result, 1); |
| 70 RUNTIME_ASSERT(result->byte_length() == Smi::FromInt(2 * sizeof(double))); | 70 RUNTIME_ASSERT(result->byte_length() == Smi::FromInt(2 * sizeof(double))); |
| 71 void* backing_store = JSArrayBuffer::cast(result->buffer())->backing_store(); | 71 FixedFloat64Array* array = FixedFloat64Array::cast(result->elements()); |
| 72 double* y = static_cast<double*>(backing_store); | 72 double* y = static_cast<double*>(array->DataPtr()); |
| 73 return Smi::FromInt(fdlibm::rempio2(x, y)); | 73 return Smi::FromInt(fdlibm::rempio2(x, y)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 | 76 |
| 77 static const double kPiDividedBy4 = 0.78539816339744830962; | 77 static const double kPiDividedBy4 = 0.78539816339744830962; |
| 78 | 78 |
| 79 | 79 |
| 80 RUNTIME_FUNCTION(Runtime_MathAtan2) { | 80 RUNTIME_FUNCTION(Runtime_MathAtan2) { |
| 81 HandleScope scope(isolate); | 81 HandleScope scope(isolate); |
| 82 DCHECK(args.length() == 2); | 82 DCHECK(args.length() == 2); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 uint16_t seeds[kSize]; | 255 uint16_t seeds[kSize]; |
| 256 do { | 256 do { |
| 257 isolate->random_number_generator()->NextBytes(seeds, | 257 isolate->random_number_generator()->NextBytes(seeds, |
| 258 kSize * sizeof(*seeds)); | 258 kSize * sizeof(*seeds)); |
| 259 } while (!(seeds[0] && seeds[1] && seeds[2] && seeds[3])); | 259 } while (!(seeds[0] && seeds[1] && seeds[2] && seeds[3])); |
| 260 for (int i = 0; i < kSize; i++) array->set(i, Smi::FromInt(seeds[i])); | 260 for (int i = 0; i < kSize; i++) array->set(i, Smi::FromInt(seeds[i])); |
| 261 return *isolate->factory()->NewJSArrayWithElements(array); | 261 return *isolate->factory()->NewJSArrayWithElements(array); |
| 262 } | 262 } |
| 263 } // namespace internal | 263 } // namespace internal |
| 264 } // namespace v8 | 264 } // namespace v8 |
| OLD | NEW |