| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |