| Index: src/bootstrapper.cc
|
| diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
|
| index f2e51960fd962f849f114b31314e82d60873ceaf..a5277e1494dd68b312bd199a8f1c8db13752a70b 100644
|
| --- a/src/bootstrapper.cc
|
| +++ b/src/bootstrapper.cc
|
| @@ -222,11 +222,9 @@ class Genesis BASE_EMBEDDED {
|
| ElementsKind elements_kind);
|
| bool InstallNatives();
|
|
|
| - void InstallTypedArray(
|
| - const char* name,
|
| - ElementsKind elements_kind,
|
| - Handle<JSFunction>* fun,
|
| - Handle<Map>* external_map);
|
| + void InstallTypedArray(const char* name, ElementsKind elements_kind,
|
| + Handle<JSFunction>* fun, Handle<Map>* external_map,
|
| + SharedFlag is_shared);
|
| bool InstallExperimentalNatives();
|
| bool InstallExtraNatives();
|
| void InstallBuiltinFunctionIds();
|
| @@ -1186,17 +1184,15 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> global_object,
|
| }
|
|
|
| { // -- T y p e d A r r a y s
|
| -#define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
|
| - { \
|
| - Handle<JSFunction> fun; \
|
| - Handle<Map> external_map; \
|
| - InstallTypedArray(#Type "Array", \
|
| - TYPE##_ELEMENTS, \
|
| - &fun, \
|
| - &external_map); \
|
| - native_context()->set_##type##_array_fun(*fun); \
|
| - native_context()->set_##type##_array_external_map(*external_map); \
|
| - }
|
| +#define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
|
| + { \
|
| + Handle<JSFunction> fun; \
|
| + Handle<Map> external_map; \
|
| + InstallTypedArray(#Type "Array", TYPE##_ELEMENTS, &fun, &external_map, \
|
| + NOT_SHARED); \
|
| + native_context()->set_##type##_array_fun(*fun); \
|
| + native_context()->set_##type##_array_external_map(*external_map); \
|
| + }
|
| TYPED_ARRAYS(INSTALL_TYPED_ARRAY)
|
| #undef INSTALL_TYPED_ARRAY
|
|
|
| @@ -1404,20 +1400,20 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> global_object,
|
| }
|
|
|
|
|
| -void Genesis::InstallTypedArray(
|
| - const char* name,
|
| - ElementsKind elements_kind,
|
| - Handle<JSFunction>* fun,
|
| - Handle<Map>* external_map) {
|
| +void Genesis::InstallTypedArray(const char* name, ElementsKind elements_kind,
|
| + Handle<JSFunction>* fun,
|
| + Handle<Map>* external_map,
|
| + SharedFlag is_shared) {
|
| + DCHECK(is_shared == NOT_SHARED || FLAG_harmony_shared_typed_arrays);
|
| + InstanceType type =
|
| + is_shared == SHARED ? JS_SHARED_TYPED_ARRAY_TYPE : JS_TYPED_ARRAY_TYPE;
|
| Handle<JSObject> global = Handle<JSObject>(native_context()->global_object());
|
| Handle<JSFunction> result = InstallFunction(
|
| - global, name, JS_TYPED_ARRAY_TYPE, JSTypedArray::kSize,
|
| + global, name, type, JSTypedArray::kSize,
|
| isolate()->initial_object_prototype(), Builtins::kIllegal);
|
|
|
| Handle<Map> initial_map = isolate()->factory()->NewMap(
|
| - JS_TYPED_ARRAY_TYPE,
|
| - JSTypedArray::kSizeWithInternalFields,
|
| - elements_kind);
|
| + type, JSTypedArray::kSizeWithInternalFields, elements_kind);
|
| JSFunction::SetInitialMap(result, initial_map,
|
| handle(initial_map->prototype(), isolate()));
|
| *fun = result;
|
| @@ -1728,6 +1724,7 @@ EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_reflect)
|
| EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_spreadcalls)
|
| EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_destructuring)
|
| EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_object)
|
| +EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_shared_typed_arrays)
|
|
|
|
|
| void Genesis::InstallNativeFunctions_harmony_proxies() {
|
| @@ -1820,6 +1817,32 @@ void Genesis::InitializeGlobal_harmony_tostring() {
|
| }
|
|
|
|
|
| +void Genesis::InitializeGlobal_harmony_shared_typed_arrays() {
|
| + if (!FLAG_harmony_shared_typed_arrays) return;
|
| +
|
| + Handle<JSGlobalObject> global(
|
| + JSGlobalObject::cast(native_context()->global_object()));
|
| +
|
| + Handle<JSFunction> shared_array_buffer_fun = InstallFunction(
|
| + global, "SharedArrayBuffer", JS_SHARED_ARRAY_BUFFER_TYPE,
|
| + JSArrayBuffer::kSizeWithInternalFields,
|
| + isolate()->initial_object_prototype(), Builtins::kIllegal);
|
| + native_context()->set_shared_array_buffer_fun(*shared_array_buffer_fun);
|
| +
|
| +#define INSTALL_SHARED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
|
| + { \
|
| + Handle<JSFunction> fun; \
|
| + Handle<Map> external_map; \
|
| + InstallTypedArray("Shared" #Type "Array", TYPE##_ELEMENTS, &fun, \
|
| + &external_map, SHARED); \
|
| + native_context()->set_shared_##type##_array_fun(*fun); \
|
| + native_context()->set_shared_##type##_array_external_map(*external_map); \
|
| + }
|
| + TYPED_ARRAYS(INSTALL_SHARED_TYPED_ARRAY)
|
| +#undef INSTALL_SHARED_TYPED_ARRAY
|
| +}
|
| +
|
| +
|
| Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target,
|
| const char* name,
|
| ElementsKind elements_kind) {
|
| @@ -2378,6 +2401,9 @@ bool Genesis::InstallExperimentalNatives() {
|
| static const char* harmony_destructuring_natives[] = {nullptr};
|
| static const char* harmony_object_natives[] = {"native harmony-object.js",
|
| NULL};
|
| + static const char* harmony_shared_typed_arrays_natives[] = {
|
| + "native harmony-sharedarraybuffer.js",
|
| + "native harmony-sharedtypedarray.js", NULL};
|
|
|
| for (int i = ExperimentalNatives::GetDebuggerCount();
|
| i < ExperimentalNatives::GetBuiltinsCount(); i++) {
|
|
|