Revision: 20887
Author: [email protected]
Date: Tue Apr 22 12:24:28 2014 UTC
Log: Cache maps for externalized typed array objects.
After this, the maps do not garbage-collect, and typed array
constructors do not deopt.
[email protected]
BUG=363855
LOG=N
Review URL: https://codereview.chromium.org/247343002
http://code.google.com/p/v8/source/detail?r=20887
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/bootstrapper.cc
/branches/bleeding_edge/src/contexts.h
=======================================
--- /branches/bleeding_edge/include/v8.h Tue Apr 22 07:33:20 2014 UTC
+++ /branches/bleeding_edge/include/v8.h Tue Apr 22 12:24:28 2014 UTC
@@ -5533,7 +5533,7 @@
static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
static const int kFixedArrayHeaderSize = 2 * kApiPointerSize;
static const int kContextHeaderSize = 2 * kApiPointerSize;
- static const int kContextEmbedderDataIndex = 65;
+ static const int kContextEmbedderDataIndex = 74;
static const int kFullStringRepresentationMask = 0x07;
static const int kStringEncodingMask = 0x4;
static const int kExternalTwoByteRepresentationTag = 0x02;
=======================================
--- /branches/bleeding_edge/src/bootstrapper.cc Tue Apr 22 08:30:09 2014 UTC
+++ /branches/bleeding_edge/src/bootstrapper.cc Tue Apr 22 12:24:28 2014 UTC
@@ -207,8 +207,11 @@
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 @@
{ // -- 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 @@
}
-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);
}
=======================================
--- /branches/bleeding_edge/src/contexts.h Thu Apr 17 17:45:32 2014 UTC
+++ /branches/bleeding_edge/src/contexts.h Tue Apr 22 12:24:28 2014 UTC
@@ -134,6 +134,16 @@
V(FLOAT32_ARRAY_FUN_INDEX, JSFunction, float32_array_fun) \
V(FLOAT64_ARRAY_FUN_INDEX, JSFunction, float64_array_fun) \
V(UINT8_CLAMPED_ARRAY_FUN_INDEX, JSFunction, uint8_clamped_array_fun) \
+ V(INT8_ARRAY_EXTERNAL_MAP_INDEX, Map, int8_array_external_map) \
+ V(UINT8_ARRAY_EXTERNAL_MAP_INDEX, Map, uint8_array_external_map) \
+ V(INT16_ARRAY_EXTERNAL_MAP_INDEX, Map, int16_array_external_map) \
+ V(UINT16_ARRAY_EXTERNAL_MAP_INDEX, Map, uint16_array_external_map) \
+ V(INT32_ARRAY_EXTERNAL_MAP_INDEX, Map, int32_array_external_map) \
+ V(UINT32_ARRAY_EXTERNAL_MAP_INDEX, Map, uint32_array_external_map) \
+ V(FLOAT32_ARRAY_EXTERNAL_MAP_INDEX, Map, float32_array_external_map) \
+ V(FLOAT64_ARRAY_EXTERNAL_MAP_INDEX, Map, float64_array_external_map) \
+ V(UINT8_CLAMPED_ARRAY_EXTERNAL_MAP_INDEX, Map, \
+ uint8_clamped_array_external_map) \
V(DATA_VIEW_FUN_INDEX, JSFunction, data_view_fun) \
V(SLOPPY_FUNCTION_MAP_INDEX, Map, sloppy_function_map) \
V(STRICT_FUNCTION_MAP_INDEX, Map, strict_function_map) \
@@ -311,6 +321,15 @@
FLOAT32_ARRAY_FUN_INDEX,
FLOAT64_ARRAY_FUN_INDEX,
UINT8_CLAMPED_ARRAY_FUN_INDEX,
+ INT8_ARRAY_EXTERNAL_MAP_INDEX,
+ UINT8_ARRAY_EXTERNAL_MAP_INDEX,
+ INT16_ARRAY_EXTERNAL_MAP_INDEX,
+ UINT16_ARRAY_EXTERNAL_MAP_INDEX,
+ INT32_ARRAY_EXTERNAL_MAP_INDEX,
+ UINT32_ARRAY_EXTERNAL_MAP_INDEX,
+ FLOAT32_ARRAY_EXTERNAL_MAP_INDEX,
+ FLOAT64_ARRAY_EXTERNAL_MAP_INDEX,
+ UINT8_CLAMPED_ARRAY_EXTERNAL_MAP_INDEX,
DATA_VIEW_FUN_INDEX,
MESSAGE_LISTENERS_INDEX,
MAKE_MESSAGE_FUN_INDEX,
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.