Version 3.3.4
Implemented API to disallow code generation from strings for a context (issue 1258).
Fixed bug with whitespaces in parseInt (issue 955).
Fixed bug with == comparison of Date objects (issue 1356).
Added GYP variables for ARM code generation: v8_can_use_vfp_instructions, v8_can_use_unaligned_accesses and v8_use_arm_eabi_hardfloat.
git-svn-id: http://v8.googlecode.com/svn/trunk@7779 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/include/v8.h b/include/v8.h
index b621f01..4dcbf28 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -115,7 +115,7 @@
}
-// --- W e a k H a n d l e s
+// --- Weak Handles ---
/**
@@ -131,7 +131,7 @@
void* parameter);
-// --- H a n d l e s ---
+// --- Handles ---
#define TYPE_CHECK(T, S) \
while (false) { \
@@ -483,7 +483,7 @@
};
-// --- S p e c i a l o b j e c t s ---
+// --- Special objects ---
/**
@@ -841,7 +841,7 @@
};
-// --- V a l u e ---
+// --- Value ---
/**
@@ -1349,87 +1349,6 @@
};
-/**
- * An instance of the built-in Date constructor (ECMA-262, 15.9).
- */
-class Date : public Value {
- public:
- V8EXPORT static Local<Value> New(double time);
-
- /**
- * A specialization of Value::NumberValue that is more efficient
- * because we know the structure of this object.
- */
- V8EXPORT double NumberValue() const;
-
- static inline Date* Cast(v8::Value* obj);
-
- /**
- * Notification that the embedder has changed the time zone,
- * daylight savings time, or other date / time configuration
- * parameters. V8 keeps a cache of various values used for
- * date / time computation. This notification will reset
- * those cached values for the current context so that date /
- * time configuration changes would be reflected in the Date
- * object.
- *
- * This API should not be called more than needed as it will
- * negatively impact the performance of date operations.
- */
- V8EXPORT static void DateTimeConfigurationChangeNotification();
-
- private:
- V8EXPORT static void CheckCast(v8::Value* obj);
-};
-
-
-/**
- * An instance of the built-in RegExp constructor (ECMA-262, 15.10).
- */
-class RegExp : public Value {
- public:
- /**
- * Regular expression flag bits. They can be or'ed to enable a set
- * of flags.
- */
- enum Flags {
- kNone = 0,
- kGlobal = 1,
- kIgnoreCase = 2,
- kMultiline = 4
- };
-
- /**
- * Creates a regular expression from the given pattern string and
- * the flags bit field. May throw a JavaScript exception as
- * described in ECMA-262, 15.10.4.1.
- *
- * For example,
- * RegExp::New(v8::String::New("foo"),
- * static_cast<RegExp::Flags>(kGlobal | kMultiline))
- * is equivalent to evaluating "/foo/gm".
- */
- V8EXPORT static Local<RegExp> New(Handle<String> pattern,
- Flags flags);
-
- /**
- * Returns the value of the source property: a string representing
- * the regular expression.
- */
- V8EXPORT Local<String> GetSource() const;
-
- /**
- * Returns the flags bit field.
- */
- V8EXPORT Flags GetFlags() const;
-
- static inline RegExp* Cast(v8::Value* obj);
-
- private:
- V8EXPORT static void CheckCast(v8::Value* obj);
-};
-
-
enum PropertyAttribute {
None = 0,
ReadOnly = 1 << 0,
@@ -1757,6 +1676,87 @@
/**
+ * An instance of the built-in Date constructor (ECMA-262, 15.9).
+ */
+class Date : public Object {
+ public:
+ V8EXPORT static Local<Value> New(double time);
+
+ /**
+ * A specialization of Value::NumberValue that is more efficient
+ * because we know the structure of this object.
+ */
+ V8EXPORT double NumberValue() const;
+
+ static inline Date* Cast(v8::Value* obj);
+
+ /**
+ * Notification that the embedder has changed the time zone,
+ * daylight savings time, or other date / time configuration
+ * parameters. V8 keeps a cache of various values used for
+ * date / time computation. This notification will reset
+ * those cached values for the current context so that date /
+ * time configuration changes would be reflected in the Date
+ * object.
+ *
+ * This API should not be called more than needed as it will
+ * negatively impact the performance of date operations.
+ */
+ V8EXPORT static void DateTimeConfigurationChangeNotification();
+
+ private:
+ V8EXPORT static void CheckCast(v8::Value* obj);
+};
+
+
+/**
+ * An instance of the built-in RegExp constructor (ECMA-262, 15.10).
+ */
+class RegExp : public Object {
+ public:
+ /**
+ * Regular expression flag bits. They can be or'ed to enable a set
+ * of flags.
+ */
+ enum Flags {
+ kNone = 0,
+ kGlobal = 1,
+ kIgnoreCase = 2,
+ kMultiline = 4
+ };
+
+ /**
+ * Creates a regular expression from the given pattern string and
+ * the flags bit field. May throw a JavaScript exception as
+ * described in ECMA-262, 15.10.4.1.
+ *
+ * For example,
+ * RegExp::New(v8::String::New("foo"),
+ * static_cast<RegExp::Flags>(kGlobal | kMultiline))
+ * is equivalent to evaluating "/foo/gm".
+ */
+ V8EXPORT static Local<RegExp> New(Handle<String> pattern,
+ Flags flags);
+
+ /**
+ * Returns the value of the source property: a string representing
+ * the regular expression.
+ */
+ V8EXPORT Local<String> GetSource() const;
+
+ /**
+ * Returns the flags bit field.
+ */
+ V8EXPORT Flags GetFlags() const;
+
+ static inline RegExp* Cast(v8::Value* obj);
+
+ private:
+ V8EXPORT static void CheckCast(v8::Value* obj);
+};
+
+
+/**
* A JavaScript value that wraps a C++ void*. This type of value is
* mainly used to associate C++ data structures with JavaScript
* objects.
@@ -1783,7 +1783,7 @@
};
-// --- T e m p l a t e s ---
+// --- Templates ---
/**
@@ -2317,7 +2317,7 @@
};
-// --- E x t e n s i o n s ---
+// --- Extensions ---
/**
@@ -2369,7 +2369,7 @@
};
-// --- S t a t i c s ---
+// --- Statics ---
Handle<Primitive> V8EXPORT Undefined();
@@ -2410,7 +2410,7 @@
bool V8EXPORT SetResourceConstraints(ResourceConstraints* constraints);
-// --- E x c e p t i o n s ---
+// --- Exceptions ---
typedef void (*FatalErrorCallback)(const char* location, const char* message);
@@ -2441,7 +2441,7 @@
};
-// --- C o u n t e r s C a l l b a c k s ---
+// --- Counters Callbacks ---
typedef int* (*CounterLookupCallback)(const char* name);
@@ -2452,7 +2452,7 @@
typedef void (*AddHistogramSampleCallback)(void* histogram, int sample);
-// --- M e m o r y A l l o c a t i o n C a l l b a c k ---
+// --- Memory Allocation Callback ---
enum ObjectSpace {
kObjectSpaceNewSpace = 1 << 0,
kObjectSpaceOldPointerSpace = 1 << 1,
@@ -2476,12 +2476,20 @@
AllocationAction action,
int size);
-// --- F a i l e d A c c e s s C h e c k C a l l b a c k ---
+// --- Failed Access Check Callback ---
typedef void (*FailedAccessCheckCallback)(Local<Object> target,
AccessType type,
Local<Value> data);
-// --- G a r b a g e C o l l e c t i o n C a l l b a c k s
+// --- AllowCodeGenerationFromStrings callbacks ---
+
+/**
+ * Callback to check if code generation from strings is allowed. See
+ * Context::AllowCodeGenerationFromStrings.
+ */
+typedef bool (*AllowCodeGenerationFromStringsCallback)(Local<Context> context);
+
+// --- Garbage Collection Callbacks ---
/**
* Applications can register callback functions which will be called
@@ -2662,6 +2670,13 @@
static void SetFatalErrorHandler(FatalErrorCallback that);
/**
+ * Set the callback to invoke to check if code generation from
+ * strings should be allowed.
+ */
+ static void SetAllowCodeGenerationFromStringsCallback(
+ AllowCodeGenerationFromStringsCallback that);
+
+ /**
* Ignore out-of-memory exceptions.
*
* V8 running out of memory is treated as a fatal error by default.
@@ -3189,7 +3204,7 @@
};
-// --- C o n t e x t ---
+// --- Context ---
/**
@@ -3325,6 +3340,21 @@
Local<Value> GetData();
/**
+ * Control whether code generation from strings is allowed. Calling
+ * this method with false will disable 'eval' and the 'Function'
+ * constructor for code running in this context. If 'eval' or the
+ * 'Function' constructor are used an exception will be thrown.
+ *
+ * If code generation from strings is not allowed the
+ * V8::AllowCodeGenerationFromStrings callback will be invoked if
+ * set before blocking the call to 'eval' or the 'Function'
+ * constructor. If that callback returns true, the call will be
+ * allowed, otherwise an exception will be thrown. If no callback is
+ * set an exception will be thrown.
+ */
+ void AllowCodeGenerationFromStrings(bool allow);
+
+ /**
* Stack-allocated class which sets the execution context for all
* operations executed within a local scope.
*/
@@ -3520,7 +3550,7 @@
};
-// --- I m p l e m e n t a t i o n ---
+// --- Implementation ---
namespace internal {