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 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1599 | 1599 |
1600 template <typename Data> | 1600 template <typename Data> |
1601 Data* SetBuiltinTypedArray(Isolate* isolate, Handle<JSBuiltinsObject> builtins, | 1601 Data* SetBuiltinTypedArray(Isolate* isolate, Handle<JSBuiltinsObject> builtins, |
1602 ExternalArrayType type, Data* data, | 1602 ExternalArrayType type, Data* data, |
1603 size_t num_elements, const char* name) { | 1603 size_t num_elements, const char* name) { |
1604 size_t byte_length = num_elements * sizeof(*data); | 1604 size_t byte_length = num_elements * sizeof(*data); |
1605 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer(); | 1605 Handle<JSArrayBuffer> buffer = isolate->factory()->NewJSArrayBuffer(); |
1606 bool is_external = data != nullptr; | 1606 bool is_external = data != nullptr; |
1607 if (!is_external) { | 1607 if (!is_external) { |
1608 data = reinterpret_cast<Data*>( | 1608 data = reinterpret_cast<Data*>( |
1609 V8::ArrayBufferAllocator()->Allocate(byte_length)); | 1609 isolate->array_buffer_allocator()->Allocate(byte_length)); |
1610 } | 1610 } |
1611 Runtime::SetupArrayBuffer(isolate, buffer, is_external, data, byte_length); | 1611 Runtime::SetupArrayBuffer(isolate, buffer, is_external, data, byte_length); |
1612 | 1612 |
1613 Handle<JSTypedArray> typed_array = | 1613 Handle<JSTypedArray> typed_array = |
1614 isolate->factory()->NewJSTypedArray(type, buffer, 0, num_elements); | 1614 isolate->factory()->NewJSTypedArray(type, buffer, 0, num_elements); |
1615 Handle<String> name_string = isolate->factory()->InternalizeUtf8String(name); | 1615 Handle<String> name_string = isolate->factory()->InternalizeUtf8String(name); |
1616 // Reset property cell type before (re)initializing. | 1616 // Reset property cell type before (re)initializing. |
1617 JSBuiltinsObject::InvalidatePropertyCell(builtins, name_string); | 1617 JSBuiltinsObject::InvalidatePropertyCell(builtins, name_string); |
1618 JSObject::SetOwnPropertyIgnoreAttributes(builtins, name_string, typed_array, | 1618 JSObject::SetOwnPropertyIgnoreAttributes(builtins, name_string, typed_array, |
1619 DONT_DELETE).Assert(); | 1619 DONT_DELETE).Assert(); |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2959 return from + sizeof(NestingCounterType); | 2959 return from + sizeof(NestingCounterType); |
2960 } | 2960 } |
2961 | 2961 |
2962 | 2962 |
2963 // Called when the top-level V8 mutex is destroyed. | 2963 // Called when the top-level V8 mutex is destroyed. |
2964 void Bootstrapper::FreeThreadResources() { | 2964 void Bootstrapper::FreeThreadResources() { |
2965 DCHECK(!IsActive()); | 2965 DCHECK(!IsActive()); |
2966 } | 2966 } |
2967 | 2967 |
2968 } } // namespace v8::internal | 2968 } } // namespace v8::internal |
OLD | NEW |