Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: src/bootstrapper.cc

Issue 1219943002: Expose SIMD.Float32x4 type to Javascript. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Back out changes to include/v8.h Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/code-stubs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 2df9afc8b5e4e23a9d16ce064e336bba6acd25d7..350e7184bcebe00fa6c94f93fdc119a03917fbdb 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1877,6 +1877,7 @@ EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sharedarraybuffer)
EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_atomics)
EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_new_target)
EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_concat_spreadable)
+EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_simd)
void Genesis::InstallNativeFunctions_harmony_proxies() {
@@ -1985,6 +1986,32 @@ void Genesis::InitializeGlobal_harmony_sharedarraybuffer() {
}
+void Genesis::InitializeGlobal_harmony_simd() {
+ 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->SetInstanceClassName(*name);
+ Handle<JSObject> simd_object = factory->NewJSObject(cons, TENURED);
+ DCHECK(simd_object->IsJSObject());
+ JSObject::AddProperty(global, name, simd_object, DONT_ENUM);
+
+ Handle<JSFunction> float32x4_function =
+ InstallFunction(simd_object, "Float32x4", JS_VALUE_TYPE, JSValue::kSize,
+ isolate->initial_object_prototype(), Builtins::kIllegal);
+ // Set the instance class name since InstallFunction only does this when
+ // we install on the GlobalObject.
+ float32x4_function->SetInstanceClassName(*factory->Float32x4_string());
+ native_context()->set_float32x4_function(*float32x4_function);
+}
+
+
Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target,
const char* name,
ElementsKind elements_kind) {
@@ -2569,6 +2596,8 @@ bool Genesis::InstallExperimentalNatives() {
static const char* harmony_new_target_natives[] = {nullptr};
static const char* harmony_concat_spreadable_natives[] = {
"native harmony-concat-spreadable.js", nullptr};
+ static const char* harmony_simd_natives[] = {"native harmony-simd.js",
+ nullptr};
for (int i = ExperimentalNatives::GetDebuggerCount();
i < ExperimentalNatives::GetBuiltinsCount(); i++) {
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698