Index: include/v8.h |
=================================================================== |
--- include/v8.h (revision 766) |
+++ include/v8.h (working copy) |
@@ -1811,7 +1811,7 @@ |
}; |
-// --- C o u n t e r s C a l l b a c k s |
+// --- C o u n t e r s C a l l b a c k s --- |
typedef int* (*CounterLookupCallback)(const wchar_t* name); |
@@ -1832,9 +1832,24 @@ |
typedef void (*GCCallback)(); |
-// --- C o n t e x t G e n e r a t o r |
+// --- E x t e r n a l S y m b o l C a l l b a c k --- |
/** |
+ * Callback used to allocate certain V8 symbols as external strings. |
+ * |
+ * Allocations are not allowed in the callback function, you therefore |
+ * cannot manipulate objects (set or delete properties for example) |
+ * since it is possible such operations will result in the allocation |
+ * of objects. |
+ */ |
+typedef String::ExternalStringResource* (*ExternalSymbolCallback)( |
+ const char* chars, |
+ size_t length); |
+ |
+ |
+// --- C o n t e x t G e n e r a t o r --- |
+ |
+/** |
* Applications must provide a callback function which is called to generate |
* a context if a context was not deserialized from the snapshot. |
*/ |
@@ -1932,6 +1947,20 @@ |
static void SetGlobalGCEpilogueCallback(GCCallback); |
/** |
+ * Applications can register a callback that will be used when |
+ * allocating most of the V8 symbols. The callback must return an |
+ * external string resource that represents the symbols. |
+ * |
+ * Most often when performing a property lookup the key will be a |
+ * symbol. Allocating symbols as external strings can reduce the |
+ * amount of string conversions needed when using interceptors and |
+ * accessors. |
+ * |
+ * \note This is an experimental feature and it might be removed. |
+ */ |
+ static void SetExternalSymbolCallback(ExternalSymbolCallback); |
+ |
+ /** |
* Allows the host application to group objects together. If one |
* object in the group is alive, all objects in the group are alive. |
* After each garbage collection, object groups are removed. It is |