Push version 2.1.3 to trunk.
Added API method for context-disposal notifications.
Added API method for accessing elements by integer index.
Added missing implementation of Uint32::Value and Value::IsUint32 API methods.
Added IsExecutionTerminating API method.
Disabled strict aliasing for GCC 4.4.
Fixed string-concatenation bug (issue 636).
Performance improvements on all platforms.
git-svn-id: http://v8.googlecode.com/svn/trunk@4079 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/include/v8.h b/include/v8.h
index 69b93c6..882eedd 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -261,6 +261,10 @@
return Handle<T>(T::Cast(*that));
}
+ template <class S> inline Handle<S> As() {
+ return Handle<S>::Cast(*this);
+ }
+
private:
T* val_;
};
@@ -295,6 +299,10 @@
return Local<T>(T::Cast(*that));
}
+ template <class S> inline Local<S> As() {
+ return Local<S>::Cast(*this);
+ }
+
/** Create a local handle for the content of another handle.
* The referee is kept alive by the local handle even when
* the original handle is destroyed/disposed.
@@ -368,6 +376,10 @@
return Persistent<T>(T::Cast(*that));
}
+ template <class S> inline Persistent<S> As() {
+ return Persistent<S>::Cast(*this);
+ }
+
/**
* Creates a new persistent handle for an existing local or
* persistent handle.
@@ -538,13 +550,13 @@
* Compiles the specified script (context-independent).
*
* \param source Script source code.
- * \param origin Script origin, owned by caller, no references are kept
+ * \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 script_data Arbitrary data associated with script. Using
- * this has same effect as calling SetData(), but allows data to be
+ * this has same effect as calling SetData(), but allows data to be
* available to compile event handlers.
* \return Compiled script object (context independent; when run it
* will use the currently entered context).
@@ -559,7 +571,7 @@
* object (typically a string) as the script's origin.
*
* \param source Script source code.
- * \patam file_name file name object (typically a string) to be used
+ * \param file_name file name object (typically a string) to be used
* as the script's origin.
* \return Compiled script object (context independent; when run it
* will use the currently entered context).
@@ -571,7 +583,7 @@
* Compiles the specified script (bound to current context).
*
* \param source Script source code.
- * \param origin Script origin, owned by caller, no references are kept
+ * \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.
@@ -755,6 +767,11 @@
bool IsInt32() const;
/**
+ * Returns true if this value is a 32-bit signed integer.
+ */
+ bool IsUint32() const;
+
+ /**
* Returns true if this value is a Date.
*/
bool IsDate() const;
@@ -1178,6 +1195,9 @@
Handle<Value> value,
PropertyAttribute attribs = None);
+ bool Set(uint32_t index,
+ Handle<Value> value);
+
// Sets a local property on this object bypassing interceptors and
// overriding accessors or read-only properties.
//
@@ -1192,6 +1212,8 @@
Local<Value> Get(Handle<Value> key);
+ Local<Value> Get(uint32_t index);
+
// TODO(1245389): Replace the type-specific versions of these
// functions with generic ones that accept a Handle<Value> key.
bool Has(Handle<String> key);
@@ -2485,9 +2507,11 @@
/**
* Optional notification that a context has been disposed. V8 uses
- * these notifications to guide the garbage collection heuristic.
+ * these notifications to guide the GC heuristic. Returns the number
+ * of context disposals - including this one - since the last time
+ * V8 had a chance to clean up.
*/
- static void ContextDisposedNotification();
+ static int ContextDisposedNotification();
private:
V8();