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

Unified Diff: include/v8.h

Issue 7535004: Merge bleeding edge up to 8774 into the GC branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 5 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 | « build/all.gyp ('k') | preparser/preparser-process.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
===================================================================
--- include/v8.h (revision 8778)
+++ include/v8.h (working copy)
@@ -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;
@@ -1435,6 +1458,13 @@
V8EXPORT Local<Value> Get(uint32_t index);
+ /**
+ * Gets the property attributes of a property which can be None or
+ * any combination of ReadOnly, DontEnum and DontDelete. Returns
+ * None when the property doesn't exist.
+ */
+ V8EXPORT PropertyAttribute GetPropertyAttributes(Handle<Value> key);
+
// TODO(1245389): Replace the type-specific versions of these
// functions with generic ones that accept a Handle<Value> key.
V8EXPORT bool Has(Handle<String> key);
@@ -1745,6 +1775,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 {
@@ -2144,11 +2231,10 @@
void SetHiddenPrototype(bool value);
/**
- * Sets the property attributes of the 'prototype' property of functions
- * created from this FunctionTemplate. Can be any combination of ReadOnly,
- * DontEnum and DontDelete.
+ * Sets the ReadOnly flag in the attributes of the 'prototype' property
+ * of functions created from this FunctionTemplate to true.
*/
- void SetPrototypeAttributes(int attributes);
+ void ReadOnlyPrototype();
/**
* Returns true if the given object is an instance of this function
@@ -2721,7 +2807,14 @@
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.
*/
class V8EXPORT V8 {
@@ -2946,6 +3039,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
@@ -2984,31 +3083,6 @@
static bool IsProfilerPaused();
/**
- * If logging is performed into a memory buffer (via --logfile=*), allows to
- * retrieve previously written messages. This can be used for retrieving
- * profiler log data in the application. This function is thread-safe.
- *
- * Caller provides a destination buffer that must exist during GetLogLines
- * call. Only whole log lines are copied into the buffer.
- *
- * \param from_pos specified a point in a buffer to read from, 0 is the
- * beginning of a buffer. It is assumed that caller updates its current
- * position using returned size value from the previous call.
- * \param dest_buf destination buffer for log data.
- * \param max_size size of the destination buffer.
- * \returns actual size of log data copied into buffer.
- */
- static int GetLogLines(int from_pos, char* dest_buf, int max_size);
-
- /**
- * The minimum allowed size for a log lines buffer. If the size of
- * the buffer given will not be enough to hold a line of the maximum
- * length, an attempt to find a log line end in GetLogLines will
- * fail, and an empty result will be returned.
- */
- static const int kMinimumSizeForLogLinesBuffer = 2048;
-
- /**
* Retrieve the V8 thread id of the calling thread.
*
* The thread id for a thread should only be retrieved after the V8
@@ -4035,6 +4109,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);
« no previous file with comments | « build/all.gyp ('k') | preparser/preparser-process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698