Index: src/bootstrapper.cc |
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
index 8b1c88bf6d0b97e772f2b0285cdbd9b46d796a6f..dbc7f928e8c6a0958b78f9f6bf3add886d6be14a 100644 |
--- a/src/bootstrapper.cc |
+++ b/src/bootstrapper.cc |
@@ -3600,6 +3600,38 @@ |
Builtins::kAtomicsStore, 3, true); |
} |
+ |
+void Genesis::InitializeGlobal_harmony_simd() { |
+ if (!FLAG_harmony_simd) return; |
+ |
+ Handle<JSGlobalObject> global( |
+ JSGlobalObject::cast(native_context()->global_object())); |
+ Isolate* isolate = global->GetIsolate(); |
+ Factory* factory = isolate->factory(); |
+ |
+ Handle<String> name = factory->InternalizeUtf8String("SIMD"); |
+ Handle<JSFunction> cons = factory->NewFunction(name); |
+ JSFunction::SetInstancePrototype( |
+ cons, |
+ Handle<Object>(native_context()->initial_object_prototype(), isolate)); |
+ cons->shared()->set_instance_class_name(*name); |
+ Handle<JSObject> simd_object = factory->NewJSObject(cons, TENURED); |
+ DCHECK(simd_object->IsJSObject()); |
+ JSObject::AddProperty(global, name, simd_object, DONT_ENUM); |
+ |
+// Install SIMD type functions. Set the instance class names since |
+// InstallFunction only does this when we install on the JSGlobalObject. |
+#define SIMD128_INSTALL_FUNCTION(TYPE, Type, type, lane_count, lane_type) \ |
+ Handle<JSFunction> type##_function = InstallFunction( \ |
+ simd_object, #Type, JS_VALUE_TYPE, JSValue::kSize, \ |
+ isolate->initial_object_prototype(), Builtins::kIllegal); \ |
+ native_context()->set_##type##_function(*type##_function); \ |
+ type##_function->shared()->set_instance_class_name(*factory->Type##_string()); |
+ SIMD128_TYPES(SIMD128_INSTALL_FUNCTION) |
+#undef SIMD128_INSTALL_FUNCTION |
+} |
+ |
+ |
void Genesis::InitializeGlobal_harmony_array_prototype_values() { |
if (!FLAG_harmony_array_prototype_values) return; |
Handle<JSFunction> array_constructor(native_context()->array_function()); |
@@ -4076,6 +4108,8 @@ |
static const char* harmony_tailcalls_natives[] = {nullptr}; |
static const char* harmony_sharedarraybuffer_natives[] = { |
"native harmony-atomics.js", NULL}; |
+ static const char* harmony_simd_natives[] = {"native harmony-simd.js", |
+ nullptr}; |
static const char* harmony_do_expressions_natives[] = {nullptr}; |
static const char* harmony_regexp_lookbehind_natives[] = {nullptr}; |
static const char* harmony_regexp_named_captures_natives[] = {nullptr}; |