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

Unified Diff: src/bootstrapper.cc

Issue 14195034: First cut at API for native Typed Arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Self-review Created 7 years, 8 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
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 85bf96e4d464bd1dd626e9d047364ef79143982b..bbb507e01a35d6a05a1d71c3ddff6a32bb1a8cd8 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -201,7 +201,7 @@ class Genesis BASE_EMBEDDED {
ElementsKind elements_kind);
bool InstallNatives();
- void InstallTypedArray(const char* name);
+ Handle<JSFunction> InstallTypedArray(const char* name);
bool InstallExperimentalNatives();
void InstallBuiltinFunctionIds();
void InstallJSFunctionResultCaches();
@@ -1270,11 +1270,11 @@ bool Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
}
-void Genesis::InstallTypedArray(const char* name) {
+Handle<JSFunction> Genesis::InstallTypedArray(const char* name) {
Handle<JSObject> global = Handle<JSObject>(native_context()->global_object());
- InstallFunction(global, name, JS_TYPED_ARRAY_TYPE,
- JSTypedArray::kSize, isolate()->initial_object_prototype(),
- Builtins::kIllegal, true);
+ return InstallFunction(global, name, JS_TYPED_ARRAY_TYPE,
+ JSTypedArray::kSize, isolate()->initial_object_prototype(),
+ Builtins::kIllegal, true);
}
@@ -1322,14 +1322,22 @@ void Genesis::InitializeExperimentalGlobal() {
}
{
// -- T y p e d A r r a y s
- InstallTypedArray("__Int8Array");
- InstallTypedArray("__Uint8Array");
- InstallTypedArray("__Int16Array");
- InstallTypedArray("__Uint16Array");
- InstallTypedArray("__Int32Array");
- InstallTypedArray("__Uint32Array");
- InstallTypedArray("__Float32Array");
- InstallTypedArray("__Float64Array");
+ native_context()->set_int8_array_fun(
+ *InstallTypedArray("__Int8Array"));
+ native_context()->set_uint8_array_fun(
+ *InstallTypedArray("__Uint8Array"));
+ native_context()->set_int16_array_fun(
+ *InstallTypedArray("__Int16Array"));
+ native_context()->set_uint16_array_fun(
+ *InstallTypedArray("__Uint16Array"));
+ native_context()->set_int32_array_fun(
+ *InstallTypedArray("__Int32Array"));
+ native_context()->set_uint32_array_fun(
+ *InstallTypedArray("__Uint32Array"));
+ native_context()->set_float_array_fun(
+ *InstallTypedArray("__Float32Array"));
+ native_context()->set_double_array_fun(
+ *InstallTypedArray("__Float64Array"));
}
}

Powered by Google App Engine
This is Rietveld 408576698