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

Side by Side Diff: src/bootstrapper.cc

Issue 1305383003: Move runtime helper for JSArrayBuffer onto objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-runtime-helpers-2
Patch Set: Self-nit. 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 | « src/api.cc ('k') | src/factory.cc » ('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 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 Data* SetBuiltinTypedArray(Isolate* isolate, Handle<JSBuiltinsObject> builtins, 1700 Data* SetBuiltinTypedArray(Isolate* isolate, Handle<JSBuiltinsObject> builtins,
1701 ExternalArrayType type, Data* data, 1701 ExternalArrayType type, Data* data,
1702 size_t num_elements, const char* name) { 1702 size_t num_elements, const char* name) {
1703 size_t byte_length = num_elements * sizeof(*data); 1703 size_t byte_length = num_elements * sizeof(*data);
1704 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer(); 1704 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer();
1705 bool is_external = data != nullptr; 1705 bool is_external = data != nullptr;
1706 if (!is_external) { 1706 if (!is_external) {
1707 data = reinterpret_cast<Data*>( 1707 data = reinterpret_cast<Data*>(
1708 isolate->array_buffer_allocator()->Allocate(byte_length)); 1708 isolate->array_buffer_allocator()->Allocate(byte_length));
1709 } 1709 }
1710 Runtime::SetupArrayBuffer(isolate, buffer, is_external, data, byte_length); 1710 JSArrayBuffer::Setup(buffer, isolate, is_external, data, byte_length);
1711 1711
1712 Handle<JSTypedArray> typed_array = 1712 Handle<JSTypedArray> typed_array =
1713 isolate->factory()->NewJSTypedArray(type, buffer, 0, num_elements); 1713 isolate->factory()->NewJSTypedArray(type, buffer, 0, num_elements);
1714 Handle<String> name_string = isolate->factory()->InternalizeUtf8String(name); 1714 Handle<String> name_string = isolate->factory()->InternalizeUtf8String(name);
1715 // Reset property cell type before (re)initializing. 1715 // Reset property cell type before (re)initializing.
1716 JSBuiltinsObject::InvalidatePropertyCell(builtins, name_string); 1716 JSBuiltinsObject::InvalidatePropertyCell(builtins, name_string);
1717 JSObject::SetOwnPropertyIgnoreAttributes(builtins, name_string, typed_array, 1717 JSObject::SetOwnPropertyIgnoreAttributes(builtins, name_string, typed_array,
1718 FROZEN) 1718 FROZEN)
1719 .Assert(); 1719 .Assert();
1720 return data; 1720 return data;
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after
3181 } 3181 }
3182 3182
3183 3183
3184 // Called when the top-level V8 mutex is destroyed. 3184 // Called when the top-level V8 mutex is destroyed.
3185 void Bootstrapper::FreeThreadResources() { 3185 void Bootstrapper::FreeThreadResources() {
3186 DCHECK(!IsActive()); 3186 DCHECK(!IsActive());
3187 } 3187 }
3188 3188
3189 } // namespace internal 3189 } // namespace internal
3190 } // namespace v8 3190 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698