Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: src/bootstrapper.cc

Issue 1425693006: Store RNG state on function context. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/js/math.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 472dcb1ccb1df2a5aa37c1d690cc9955d9aa5ef8..9ba2db61c70db433a64b1d8959514b510f7a5710 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -6,7 +6,6 @@
#include "src/accessors.h"
#include "src/api-natives.h"
-#include "src/base/utils/random-number-generator.h"
#include "src/code-stubs.h"
#include "src/extensions/externalize-string-extension.h"
#include "src/extensions/free-buffer-extension.h"
@@ -1810,28 +1809,11 @@ Handle<JSTypedArray> CreateTypedArray(Isolate* isolate, ExternalArrayType type,
bool Genesis::InitializeBuiltinTypedArrays() {
HandleScope scope(isolate());
- Handle<JSTypedArray> rng_state;
- Handle<JSTypedArray> rempio2result;
-
- {
- // Seed the per-context RNG using the per-isolate RNG.
- const size_t num_elements = 2;
- const size_t num_bytes = num_elements * sizeof(uint32_t);
- uint32_t* state = NULL;
- rng_state =
- CreateTypedArray(isolate(), kExternalUint32Array, num_elements, &state);
- do {
- isolate()->random_number_generator()->NextBytes(state, num_bytes);
- } while (state[0] == 0 || state[1] == 0);
- }
-
- { // Initialize a result array for rempio2 calculation
- const size_t num_elements = 2;
- double* data = NULL;
- rempio2result =
- CreateTypedArray(isolate(), kExternalFloat64Array, num_elements, &data);
- for (size_t i = 0; i < num_elements; i++) data[i] = 0;
- }
+ const size_t num_elements = 2;
+ double* data = NULL;
+ Handle<JSTypedArray> rempio2result =
+ CreateTypedArray(isolate(), kExternalFloat64Array, num_elements, &data);
+ for (size_t i = 0; i < num_elements; i++) data[i] = 0;
Handle<JSObject> utils =
Handle<JSObject>::cast(isolate()->natives_utils_object());
@@ -1839,7 +1821,7 @@ bool Genesis::InitializeBuiltinTypedArrays() {
"InitializeBuiltinTypedArrays");
Handle<Object> fun = JSObject::GetDataProperty(utils, name_string);
Handle<Object> receiver = isolate()->factory()->undefined_value();
- Handle<Object> args[] = {utils, rng_state, rempio2result};
+ Handle<Object> args[] = {utils, rempio2result};
return !Execution::Call(isolate(), fun, receiver, arraysize(args), args)
.is_null();
}
« no previous file with comments | « no previous file | src/js/math.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698