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

Unified Diff: src/bootstrapper.cc

Issue 1475493003: Revert of Implement xorshift128+ for Math.random. (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 | « src/base/utils/random-number-generator.cc ('k') | 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 8c17ae2b913ded0100b149ea60f5a7e186c68b6a..3db75a4dc048af5118017137ca510dbfdfdbe3ca 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1726,6 +1726,24 @@
Handle<Object> value =
Object::GetProperty(object, inner_string).ToHandleChecked();
return Handle<JSObject>::cast(value);
+}
+
+
+template <typename Data>
+Handle<JSTypedArray> CreateTypedArray(Isolate* isolate, ExternalArrayType type,
+ size_t num_elements, Data** data) {
+ size_t byte_length = num_elements * sizeof(**data);
+ Handle<JSArrayBuffer> buffer =
+ isolate->factory()->NewJSArrayBuffer(SharedFlag::kNotShared, TENURED);
+ bool is_external = (*data != nullptr);
+ if (!is_external) {
+ *data = reinterpret_cast<Data*>(
+ isolate->array_buffer_allocator()->Allocate(byte_length));
+ }
+ JSArrayBuffer::Setup(buffer, isolate, is_external, *data, byte_length,
+ SharedFlag::kNotShared);
+ return isolate->factory()->NewJSTypedArray(type, buffer, 0, num_elements,
+ TENURED);
}
« no previous file with comments | « src/base/utils/random-number-generator.cc ('k') | src/js/math.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698