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

Side by Side Diff: src/bootstrapper.cc

Issue 1464303002: Implement xorshift128+ for Math.random. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add missing include Created 5 years 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/extensions/externalize-string-extension.h" 10 #include "src/extensions/externalize-string-extension.h"
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 return Handle<JSObject>(JSObject::cast(function->prototype())); 1722 return Handle<JSObject>(JSObject::cast(function->prototype()));
1723 } 1723 }
1724 Handle<String> inner_string = factory->InternalizeUtf8String(inner); 1724 Handle<String> inner_string = factory->InternalizeUtf8String(inner);
1725 DCHECK(!inner_string.is_null()); 1725 DCHECK(!inner_string.is_null());
1726 Handle<Object> value = 1726 Handle<Object> value =
1727 Object::GetProperty(object, inner_string).ToHandleChecked(); 1727 Object::GetProperty(object, inner_string).ToHandleChecked();
1728 return Handle<JSObject>::cast(value); 1728 return Handle<JSObject>::cast(value);
1729 } 1729 }
1730 1730
1731 1731
1732 template <typename Data>
1733 Handle<JSTypedArray> CreateTypedArray(Isolate* isolate, ExternalArrayType type,
1734 size_t num_elements, Data** data) {
1735 size_t byte_length = num_elements * sizeof(**data);
1736 Handle<JSArrayBuffer> buffer =
1737 isolate->factory()->NewJSArrayBuffer(SharedFlag::kNotShared, TENURED);
1738 bool is_external = (*data != nullptr);
1739 if (!is_external) {
1740 *data = reinterpret_cast<Data*>(
1741 isolate->array_buffer_allocator()->Allocate(byte_length));
1742 }
1743 JSArrayBuffer::Setup(buffer, isolate, is_external, *data, byte_length,
1744 SharedFlag::kNotShared);
1745 return isolate->factory()->NewJSTypedArray(type, buffer, 0, num_elements,
1746 TENURED);
1747 }
1748
1749
1750 void Genesis::ConfigureUtilsObject(ContextType context_type) { 1732 void Genesis::ConfigureUtilsObject(ContextType context_type) {
1751 switch (context_type) { 1733 switch (context_type) {
1752 // We still need the utils object to find debug functions. 1734 // We still need the utils object to find debug functions.
1753 case DEBUG_CONTEXT: 1735 case DEBUG_CONTEXT:
1754 return; 1736 return;
1755 // Expose the natives in global if a valid name for it is specified. 1737 // Expose the natives in global if a valid name for it is specified.
1756 case FULL_CONTEXT: { 1738 case FULL_CONTEXT: {
1757 // We still need the utils object after deserialization. 1739 // We still need the utils object after deserialization.
1758 if (isolate()->serializer_enabled()) return; 1740 if (isolate()->serializer_enabled()) return;
1759 if (FLAG_expose_natives_as == NULL) break; 1741 if (FLAG_expose_natives_as == NULL) break;
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after
3277 } 3259 }
3278 3260
3279 3261
3280 // Called when the top-level V8 mutex is destroyed. 3262 // Called when the top-level V8 mutex is destroyed.
3281 void Bootstrapper::FreeThreadResources() { 3263 void Bootstrapper::FreeThreadResources() {
3282 DCHECK(!IsActive()); 3264 DCHECK(!IsActive());
3283 } 3265 }
3284 3266
3285 } // namespace internal 3267 } // namespace internal
3286 } // namespace v8 3268 } // namespace v8
OLDNEW
« 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