1 | // Copyright 2018 the V8 project authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. |
4 | |
5 | #ifndef V8_MATH_RANDOM_H_ |
6 | #define V8_MATH_RANDOM_H_ |
7 | |
8 | #include "src/contexts.h" |
9 | #include "src/globals.h" |
10 | |
11 | namespace v8 { |
12 | namespace internal { |
13 | |
14 | class MathRandom : public AllStatic { |
15 | public: |
16 | static void InitializeContext(Isolate* isolate, |
17 | Handle<Context> native_context); |
18 | |
19 | static void ResetContext(Context native_context); |
20 | // Takes native context as a raw Address for ExternalReference usage. |
21 | // Returns a tagged Smi as a raw Address. |
22 | static Address RefillCache(Isolate* isolate, Address raw_native_context); |
23 | |
24 | static const int kCacheSize = 64; |
25 | static const int kStateSize = 2 * kInt64Size; |
26 | |
27 | struct State { |
28 | uint64_t s0; |
29 | uint64_t s1; |
30 | }; |
31 | }; |
32 | |
33 | } // namespace internal |
34 | } // namespace v8 |
35 | #endif // V8_MATH_RANDOM_H_ |
36 | |