Version 3.4.13
Improved debugger support to allow inspection of optimized frames (issue 1140).
Fixed a bug in prototype transitions cache clearing introduced by r8165.
Fixed shortcutting bug in HInferRepresentation. Patch by Andy Wingo.
Fixed a memory leak in sample/shell.cc (dispose semaphores).
Simplified HClampToUint8. Patch by Andy Wingo.
Exposed APIs for detecting boxed primitives, native errors. Patch by Luke Zarko.
Added map check for COW elements to crankshaft array handling code (issue 1560).
Sample shell and (a light version of) D8 links against a shared library now.
Fixed bug in array filter and reduce functions (issue 1559).
Avoid TLS load in AstNode constructor.
Introduced a random entropy source which can optionally be provided at initialization. (Chromium issue 89462).
git-svn-id: http://v8.googlecode.com/svn/trunk@8669 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/include/v8.h b/include/v8.h
index 0872411..ac26061 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -80,9 +80,11 @@
class Context;
class String;
+class StringObject;
class Value;
class Utils;
class Number;
+class NumberObject;
class Object;
class Array;
class Int32;
@@ -90,6 +92,7 @@
class External;
class Primitive;
class Boolean;
+class BooleanObject;
class Integer;
class Function;
class Date;
@@ -929,6 +932,26 @@
V8EXPORT bool IsDate() const;
/**
+ * Returns true if this value is a Boolean object.
+ */
+ V8EXPORT bool IsBooleanObject() const;
+
+ /**
+ * Returns true if this value is a Number object.
+ */
+ V8EXPORT bool IsNumberObject() const;
+
+ /**
+ * Returns true if this value is a String object.
+ */
+ V8EXPORT bool IsStringObject() const;
+
+ /**
+ * Returns true if this value is a NativeError.
+ */
+ V8EXPORT bool IsNativeError() const;
+
+ /**
* Returns true if this value is a RegExp.
*/
V8EXPORT bool IsRegExp() const;
@@ -1745,6 +1768,63 @@
/**
+ * A Number object (ECMA-262, 4.3.21).
+ */
+class NumberObject : public Object {
+ public:
+ V8EXPORT static Local<Value> New(double value);
+
+ /**
+ * Returns the Number held by the object.
+ */
+ V8EXPORT double NumberValue() const;
+
+ static inline NumberObject* Cast(v8::Value* obj);
+
+ private:
+ V8EXPORT static void CheckCast(v8::Value* obj);
+};
+
+
+/**
+ * A Boolean object (ECMA-262, 4.3.15).
+ */
+class BooleanObject : public Object {
+ public:
+ V8EXPORT static Local<Value> New(bool value);
+
+ /**
+ * Returns the Boolean held by the object.
+ */
+ V8EXPORT bool BooleanValue() const;
+
+ static inline BooleanObject* Cast(v8::Value* obj);
+
+ private:
+ V8EXPORT static void CheckCast(v8::Value* obj);
+};
+
+
+/**
+ * A String object (ECMA-262, 4.3.18).
+ */
+class StringObject : public Object {
+ public:
+ V8EXPORT static Local<Value> New(Handle<String> value);
+
+ /**
+ * Returns the String held by the object.
+ */
+ V8EXPORT Local<String> StringValue() const;
+
+ static inline StringObject* Cast(v8::Value* obj);
+
+ private:
+ V8EXPORT static void CheckCast(v8::Value* obj);
+};
+
+
+/**
* An instance of the built-in RegExp constructor (ECMA-262, 15.10).
*/
class RegExp : public Object {
@@ -2721,6 +2801,13 @@
char** raw_data;
};
+
+/**
+ * EntropySource is used as a callback function when v8 needs a source
+ * of entropy.
+ */
+typedef bool (*EntropySource)(unsigned char* buffer, size_t length);
+
/**
* Container class for static utility functions.
*/
@@ -2946,6 +3033,12 @@
static bool Initialize();
/**
+ * Allows the host application to provide a callback which can be used
+ * as a source of entropy for random number generators.
+ */
+ static void SetEntropySource(EntropySource source);
+
+ /**
* Adjusts the amount of registered external memory. Used to give
* V8 an indication of the amount of externally allocated memory
* that is kept alive by JavaScript objects. V8 uses this to decide
@@ -4010,6 +4103,30 @@
}
+StringObject* StringObject::Cast(v8::Value* value) {
+#ifdef V8_ENABLE_CHECKS
+ CheckCast(value);
+#endif
+ return static_cast<StringObject*>(value);
+}
+
+
+NumberObject* NumberObject::Cast(v8::Value* value) {
+#ifdef V8_ENABLE_CHECKS
+ CheckCast(value);
+#endif
+ return static_cast<NumberObject*>(value);
+}
+
+
+BooleanObject* BooleanObject::Cast(v8::Value* value) {
+#ifdef V8_ENABLE_CHECKS
+ CheckCast(value);
+#endif
+ return static_cast<BooleanObject*>(value);
+}
+
+
RegExp* RegExp::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS
CheckCast(value);