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

Unified Diff: src/bootstrapper.cc

Issue 247343002: Cache maps for externalized typed array objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
« no previous file with comments | « include/v8.h ('k') | src/contexts.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 edef616436b2990d40c25cf4a3b6b20d451b1cf9..6c6e6b361150707da995ca6d9fe7e52f122d198b 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -207,8 +207,11 @@ class Genesis BASE_EMBEDDED {
ElementsKind elements_kind);
bool InstallNatives();
- Handle<JSFunction> InstallTypedArray(const char* name,
- ElementsKind elementsKind);
+ void InstallTypedArray(
+ const char* name,
+ ElementsKind elements_kind,
+ Handle<JSFunction>* fun,
+ Handle<Map>* external_map);
bool InstallExperimentalNatives();
void InstallBuiltinFunctionIds();
void InstallJSFunctionResultCaches();
@@ -1039,9 +1042,14 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
{ // -- T y p e d A r r a y s
#define INSTALL_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
{ \
- Handle<JSFunction> fun = InstallTypedArray(#Type "Array", \
- TYPE##_ELEMENTS); \
+ 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); \
}
TYPED_ARRAYS(INSTALL_TYPED_ARRAY)
#undef INSTALL_TYPED_ARRAY
@@ -1252,18 +1260,26 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
}
-Handle<JSFunction> Genesis::InstallTypedArray(
- const char* name, ElementsKind elementsKind) {
+void Genesis::InstallTypedArray(
+ const char* name,
+ ElementsKind elements_kind,
+ Handle<JSFunction>* fun,
+ Handle<Map>* external_map) {
Handle<JSObject> global = Handle<JSObject>(native_context()->global_object());
Handle<JSFunction> result = InstallFunction(global, name, JS_TYPED_ARRAY_TYPE,
JSTypedArray::kSize, isolate()->initial_object_prototype(),
Builtins::kIllegal, false, true);
Handle<Map> initial_map = isolate()->factory()->NewMap(
- JS_TYPED_ARRAY_TYPE, JSTypedArray::kSizeWithInternalFields, elementsKind);
+ JS_TYPED_ARRAY_TYPE,
+ JSTypedArray::kSizeWithInternalFields,
+ elements_kind);
result->set_initial_map(*initial_map);
initial_map->set_constructor(*result);
- return result;
+ *fun = result;
+
+ ElementsKind external_kind = GetNextTransitionElementsKind(elements_kind);
+ *external_map = Map::AsElementsKind(initial_map, external_kind);
}
« no previous file with comments | « include/v8.h ('k') | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698