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

Unified Diff: include/v8.h

Issue 11404: Add experimental support for external two-byte symbols.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years, 1 month 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 | « no previous file | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698