Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index d8de00ceca2fd92c6829a36708bbcc7a086cdf5b..77223a0e4c52abc746f1c2c2614838efcc590d26 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -513,10 +513,36 @@ class V8EXPORT ScriptOrigin { |
class V8EXPORT Script { |
public: |
+ /** |
+ * Compiles the specified script. The ScriptOrigin* and ScriptData* |
+ * parameters are owned by the caller of Script::Compile. No |
+ * references to these objects are kept after compilation finishes. |
+ * |
+ * The script object returned is 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); |
+ |
+ /** |
+ * Compiles the specified script using the specified file name |
+ * object (typically a string) as the script's origin. |
+ * |
+ * The script object returned is context independent; when run it |
+ * will use the currently entered context. |
+ */ |
+ static Local<Script> New(Handle<String> source, |
+ Handle<Value> file_name); |
+ |
/** |
* Compiles the specified script. The ScriptOrigin* and ScriptData* |
* parameters are owned by the caller of Script::Compile. No |
* references to these objects are kept after compilation finishes. |
+ * |
+ * The script object returned is bound to the context that was active |
+ * when this function was called. When run it will always use this |
+ * context. |
*/ |
static Local<Script> Compile(Handle<String> source, |
ScriptOrigin* origin = NULL, |
@@ -525,12 +551,20 @@ class V8EXPORT Script { |
/** |
* Compiles the specified script using the specified file name |
* object (typically a string) as the script's origin. |
+ * |
+ * The script object returned is bound to the context that was active |
+ * when this function was called. When run it will always use this |
+ * context. |
*/ |
static Local<Script> Compile(Handle<String> source, |
Handle<Value> file_name); |
/** |
- * Runs the script returning the resulting value. |
+ * Runs the script returning the resulting value. If the script is |
+ * context independent (created using ::New) it will be run in the |
+ * currently entered context. If it is context specific (created |
+ * using ::Compile) it will be run in the context in which it was |
+ * compiled. |
*/ |
Local<Value> Run(); |