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

Unified Diff: include/v8.h

Issue 181543003: Proof of concept: API for doing only one parsing pass instead of first preparsing and then parsing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased -- this applies to r19832 Created 6 years, 9 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 | « 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
diff --git a/include/v8.h b/include/v8.h
index 12a0b2894dd81d6145680dce990ec48821d23792..514568ed7b4d014911f4694e54419516037fc5b9 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1009,15 +1009,32 @@ class V8_EXPORT Script {
* \param source Script source code.
* \param origin Script origin, owned by caller, no references are kept
* when New() returns
- * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile()
- * using pre_data speeds compilation if it's done multiple times.
- * Owned by caller, no references are kept when New() returns.
+ * \param cached_data Cached ScriptData, as obtained from a previous
+ * compilation. Using cached_data speeds compilation if it's done multiple
+ * times. Owned by caller, no references are kept when New() returns.
* \return Compiled script object (context independent; when run it
* will use the currently entered context).
*/
static Local<Script> New(Handle<String> source,
ScriptOrigin* origin = NULL,
- ScriptData* pre_data = NULL);
+ ScriptData* cached_data = NULL);
+
+ /**
+ * Compiles the specified script (context-independent).
+ *
+ * \param source Script source code.
+ * \param origin Script origin, owned by caller, no references are kept
+ * when this function returns
+ * \param cached_data Cached ScriptData, as obtained from a previous run, or a
+ * pointer to where we should store it, or NULL if we shouldn't store it
+ * anywhere. Using cached_data speeds compilation if it's done multiple
+ * times. Owned by caller (ownership of the generated data will also be
+ * passed to the caller), no references are kept when this function returns.
+ * \return Compiled script object (context independent; when run it
+ * will use the currently entered context).
+ */
+ static Local<Script> NewAndGenerateScriptDataIfNeeded(
+ Handle<String> source, ScriptOrigin* origin, ScriptData** cached_data);
/**
* Compiles the specified script using the specified file name
@@ -1038,8 +1055,8 @@ class V8_EXPORT Script {
* \param source Script source code.
* \param origin Script origin, owned by caller, no references are kept
* when Compile() returns
- * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile()
- * using pre_data speeds compilation if it's done multiple times.
+ * \param cached_data Cached ScriptData, as obtained from a previous run.
+ * Using cached_data speeds compilation if it's done multiple times.
* Owned by caller, no references are kept when Compile() returns.
* \return Compiled script object, bound to the context that was active
* when this function was called. When run it will always use this
@@ -1047,9 +1064,31 @@ class V8_EXPORT Script {
*/
static Local<Script> Compile(Handle<String> source,
ScriptOrigin* origin = NULL,
- ScriptData* pre_data = NULL);
+ ScriptData* cached_data = NULL);
/**
+ * Compiles the specified script (bound to current context).
+ *
+ * \param source Script source code.
+ * \param origin Script origin, owned by caller, no references are kept
+ * when this function returns
+ * \param cached_data Cached ScriptData, as obtained from a previous run, or a
+ * pointer to where to store we don't have it yet, or NULL if we should not
+ * generate it. Using cached_data speeds compilation if it's done multiple
+ * times. Owned by caller (ownership of the generated data will also be
+ * passed to the caller), no references are kept when this function returns.
+ * \param extra_data Arbitrary data associated with script. Using
+ * this has same effect as calling SetData(), but makes data available
+ * earlier (i.e. to compile event handlers).
+ * \return Compiled script object, bound to the context that was active
+ * when this function was called. When run it will always use this
+ * context.
+ */
+ static Local<Script> CompileAndGenerateScriptDataIfNeeded(
+ Handle<String> source, ScriptOrigin* origin = NULL,
+ ScriptData** cached_data = NULL);
+
+ /**
* Compiles the specified script using the specified file name
* object (typically a string) as the script's origin.
*
« 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