| Index: src/factory.cc
|
| diff --git a/src/factory.cc b/src/factory.cc
|
| index fca1e1c1ca8abc821566f8e697fd591c7705e098..234149f2589708f5aa9c3ae1b3b0ed28eb88cdf5 100644
|
| --- a/src/factory.cc
|
| +++ b/src/factory.cc
|
| @@ -1761,9 +1761,10 @@ Handle<JSGeneratorObject> Factory::NewJSGeneratorObject(
|
| }
|
|
|
|
|
| -Handle<JSArrayBuffer> Factory::NewJSArrayBuffer() {
|
| +Handle<JSArrayBuffer> Factory::NewJSArrayBuffer(SharedFlag is_shared) {
|
| Handle<JSFunction> array_buffer_fun(
|
| - isolate()->native_context()->array_buffer_fun());
|
| + is_shared ? isolate()->native_context()->shared_array_buffer_fun()
|
| + : isolate()->native_context()->array_buffer_fun());
|
| CALL_HEAP_FUNCTION(
|
| isolate(),
|
| isolate()->heap()->AllocateJSObject(*array_buffer_fun),
|
| @@ -1888,6 +1889,23 @@ JSFunction* GetTypedArrayFun(ElementsKind elements_kind, Isolate* isolate) {
|
| }
|
|
|
|
|
| +JSFunction* GetSharedTypedArrayFun(ExternalArrayType type, Isolate* isolate) {
|
| + Context* native_context = isolate->context()->native_context();
|
| + switch (type) {
|
| +#define SHARED_TYPED_ARRAY_FUN(Type, type, TYPE, ctype, size) \
|
| + case kExternal##Type##Array: \
|
| + return native_context->shared_##type##_array_fun();
|
| +
|
| + TYPED_ARRAYS(SHARED_TYPED_ARRAY_FUN)
|
| +#undef SHARED_TYPED_ARRAY_FUN
|
| +
|
| + default:
|
| + UNREACHABLE();
|
| + return NULL;
|
| + }
|
| +}
|
| +
|
| +
|
| void SetupArrayBufferView(i::Isolate* isolate,
|
| i::Handle<i::JSArrayBufferView> obj,
|
| i::Handle<i::JSArrayBuffer> buffer,
|
| @@ -1910,8 +1928,11 @@ void SetupArrayBufferView(i::Isolate* isolate,
|
| } // namespace
|
|
|
|
|
| -Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type) {
|
| - Handle<JSFunction> typed_array_fun_handle(GetTypedArrayFun(type, isolate()));
|
| +Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type,
|
| + SharedFlag is_shared) {
|
| + Handle<JSFunction> typed_array_fun_handle(
|
| + is_shared ? GetSharedTypedArrayFun(type, isolate())
|
| + : GetTypedArrayFun(type, isolate()));
|
|
|
| CALL_HEAP_FUNCTION(
|
| isolate(),
|
| @@ -1932,9 +1953,9 @@ Handle<JSTypedArray> Factory::NewJSTypedArray(ElementsKind elements_kind) {
|
|
|
| Handle<JSTypedArray> Factory::NewJSTypedArray(ExternalArrayType type,
|
| Handle<JSArrayBuffer> buffer,
|
| - size_t byte_offset,
|
| - size_t length) {
|
| - Handle<JSTypedArray> obj = NewJSTypedArray(type);
|
| + size_t byte_offset, size_t length,
|
| + SharedFlag is_shared) {
|
| + Handle<JSTypedArray> obj = NewJSTypedArray(type, is_shared);
|
|
|
| size_t element_size = GetExternalArrayElementSize(type);
|
| ElementsKind elements_kind = GetExternalArrayElementsKind(type);
|
|
|