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

Side by Side Diff: src/bootstrapper.cc

Issue 1347263003: Pretenure builtin typed arrays. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months 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 | « no previous file | src/factory.h » ('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/base/utils/random-number-generator.h" 9 #include "src/base/utils/random-number-generator.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 DCHECK(!inner_string.is_null()); 1723 DCHECK(!inner_string.is_null());
1724 Handle<Object> value = 1724 Handle<Object> value =
1725 Object::GetProperty(object, inner_string).ToHandleChecked(); 1725 Object::GetProperty(object, inner_string).ToHandleChecked();
1726 return Handle<JSObject>::cast(value); 1726 return Handle<JSObject>::cast(value);
1727 } 1727 }
1728 1728
1729 1729
1730 template <typename Data> 1730 template <typename Data>
1731 Data* SetBuiltinTypedArray(Isolate* isolate, Handle<JSBuiltinsObject> builtins, 1731 Data* SetBuiltinTypedArray(Isolate* isolate, Handle<JSBuiltinsObject> builtins,
1732 ExternalArrayType type, Data* data, 1732 ExternalArrayType type, Data* data,
1733 size_t num_elements, const char* name) { 1733 size_t num_elements, const char* name,
1734 const SharedFlag shared = SharedFlag::kNotShared,
1735 const PretenureFlag pretenure = TENURED) {
1734 size_t byte_length = num_elements * sizeof(*data); 1736 size_t byte_length = num_elements * sizeof(*data);
1735 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer(); 1737 Handle<JSArrayBuffer> buffer =
1738 isolate->factory()->NewJSArrayBuffer(shared, pretenure);
1736 bool is_external = data != nullptr; 1739 bool is_external = data != nullptr;
1737 if (!is_external) { 1740 if (!is_external) {
1738 data = reinterpret_cast<Data*>( 1741 data = reinterpret_cast<Data*>(
1739 isolate->array_buffer_allocator()->Allocate(byte_length)); 1742 isolate->array_buffer_allocator()->Allocate(byte_length));
1740 } 1743 }
1741 JSArrayBuffer::Setup(buffer, isolate, is_external, data, byte_length); 1744 JSArrayBuffer::Setup(buffer, isolate, is_external, data, byte_length, shared);
1742 1745
1743 Handle<JSTypedArray> typed_array = 1746 Handle<JSTypedArray> typed_array = isolate->factory()->NewJSTypedArray(
1744 isolate->factory()->NewJSTypedArray(type, buffer, 0, num_elements); 1747 type, buffer, 0, num_elements, pretenure);
1745 Handle<String> name_string = isolate->factory()->InternalizeUtf8String(name); 1748 Handle<String> name_string = isolate->factory()->InternalizeUtf8String(name);
1746 // Reset property cell type before (re)initializing. 1749 // Reset property cell type before (re)initializing.
1747 JSBuiltinsObject::InvalidatePropertyCell(builtins, name_string); 1750 JSBuiltinsObject::InvalidatePropertyCell(builtins, name_string);
1748 JSObject::SetOwnPropertyIgnoreAttributes(builtins, name_string, typed_array, 1751 JSObject::SetOwnPropertyIgnoreAttributes(builtins, name_string, typed_array,
1749 FROZEN) 1752 FROZEN)
1750 .Assert(); 1753 .Assert();
1751 return data; 1754 return data;
1752 } 1755 }
1753 1756
1754 1757
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
3258 } 3261 }
3259 3262
3260 3263
3261 // Called when the top-level V8 mutex is destroyed. 3264 // Called when the top-level V8 mutex is destroyed.
3262 void Bootstrapper::FreeThreadResources() { 3265 void Bootstrapper::FreeThreadResources() {
3263 DCHECK(!IsActive()); 3266 DCHECK(!IsActive());
3264 } 3267 }
3265 3268
3266 } // namespace internal 3269 } // namespace internal
3267 } // namespace v8 3270 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698