summaryrefslogtreecommitdiff
path: root/deps/v8/include
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2013-10-22 15:14:25 -0700
committerTimothy J Fontaine <tjfontaine@gmail.com>2013-10-23 09:17:31 -0700
commita53c763c16eeabb0901a05dbcf38a72fa96d2f26 (patch)
tree309bf250e1521cedf0e945d7a7629db511e64498 /deps/v8/include
parent54910044b33a6405c72ad085915a55c575c027fc (diff)
downloadnode-new-a53c763c16eeabb0901a05dbcf38a72fa96d2f26.tar.gz
v8: upgrade 3.21.18.3
Diffstat (limited to 'deps/v8/include')
-rwxr-xr-xdeps/v8/include/v8-debug.h46
-rw-r--r--deps/v8/include/v8-profiler.h54
-rw-r--r--deps/v8/include/v8.h1519
-rw-r--r--deps/v8/include/v8config.h451
-rw-r--r--deps/v8/include/v8stdint.h6
5 files changed, 1164 insertions, 912 deletions
diff --git a/deps/v8/include/v8-debug.h b/deps/v8/include/v8-debug.h
index bacccb61dd..053b81d2c5 100755
--- a/deps/v8/include/v8-debug.h
+++ b/deps/v8/include/v8-debug.h
@@ -106,6 +106,8 @@ class V8_EXPORT Debug {
*/
virtual ClientData* GetClientData() const = 0;
+ virtual Isolate* GetIsolate() const = 0;
+
virtual ~Message() {}
};
@@ -150,21 +152,6 @@ class V8_EXPORT Debug {
virtual ~EventDetails() {}
};
-
- /**
- * Debug event callback function.
- *
- * \param event the type of the debug event that triggered the callback
- * (enum DebugEvent)
- * \param exec_state execution state (JavaScript object)
- * \param event_data event specific data (JavaScript object)
- * \param data value passed by the user to SetDebugEventListener
- */
- typedef void (*EventCallback)(DebugEvent event,
- Handle<Object> exec_state,
- Handle<Object> event_data,
- Handle<Value> data);
-
/**
* Debug event callback function.
*
@@ -179,23 +166,8 @@ class V8_EXPORT Debug {
* Debug message callback function.
*
* \param message the debug message handler message object
- * \param length length of the message
- * \param client_data the data value passed when registering the message handler
-
- * A MessageHandler does not take possession of the message string,
- * and must not rely on the data persisting after the handler returns.
- *
- * This message handler is deprecated. Use MessageHandler2 instead.
- */
- typedef void (*MessageHandler)(const uint16_t* message, int length,
- ClientData* client_data);
-
- /**
- * Debug message callback function.
- *
- * \param message the debug message handler message object
*
- * A MessageHandler does not take possession of the message data,
+ * A MessageHandler2 does not take possession of the message data,
* and must not rely on the data persisting after the handler returns.
*/
typedef void (*MessageHandler2)(const Message& message);
@@ -210,10 +182,6 @@ class V8_EXPORT Debug {
*/
typedef void (*DebugMessageDispatchHandler)();
- // Set a C debug event listener.
- V8_DEPRECATED(static bool SetDebugEventListener(
- EventCallback that,
- Handle<Value> data = Handle<Value>()));
static bool SetDebugEventListener2(EventCallback2 that,
Handle<Value> data = Handle<Value>());
@@ -234,16 +202,12 @@ class V8_EXPORT Debug {
// Break execution of JavaScript in the given isolate (this method
// can be invoked from a non-VM thread) for further client command
// execution on a VM thread. Client data is then passed in
- // EventDetails to EventCallback at the moment when the VM actually
+ // EventDetails to EventCallback2 at the moment when the VM actually
// stops. If no isolate is provided the default isolate is used.
static void DebugBreakForCommand(ClientData* data = NULL,
Isolate* isolate = NULL);
- // Message based interface. The message protocol is JSON. NOTE the message
- // handler thread is not supported any more parameter must be false.
- V8_DEPRECATED(static void SetMessageHandler(
- MessageHandler handler,
- bool message_handler_thread = false));
+ // Message based interface. The message protocol is JSON.
static void SetMessageHandler2(MessageHandler2 handler);
// If no isolate is provided the default isolate is
diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h
index e538f4a840..217a938329 100644
--- a/deps/v8/include/v8-profiler.h
+++ b/deps/v8/include/v8-profiler.h
@@ -57,25 +57,15 @@ class V8_EXPORT CpuProfileNode {
*/
int GetLineNumber() const;
- /**
- * Returns total (self + children) execution time of the function,
- * in milliseconds, estimated by samples count.
- */
- V8_DEPRECATED(double GetTotalTime() const);
-
- /**
- * Returns self execution time of the function, in milliseconds,
- * estimated by samples count.
- */
- V8_DEPRECATED(double GetSelfTime() const);
-
- /** Returns the count of samples where function exists. */
- V8_DEPRECATED(double GetTotalSamplesCount() const);
+ /** Returns bailout reason for the function
+ * if the optimization was disabled for it.
+ */
+ const char* GetBailoutReason() const;
/** DEPRECATED. Please use GetHitCount instead.
* Returns the count of samples where function was currently executing.
*/
- double GetSelfSamplesCount() const;
+ V8_DEPRECATED(double GetSelfSamplesCount() const);
/**
* Returns the count of samples where the function was currently executing.
@@ -156,13 +146,11 @@ class V8_EXPORT CpuProfile {
class V8_EXPORT CpuProfiler {
public:
/**
- * A note on security tokens usage. As scripts from different
- * origins can run inside a single V8 instance, it is possible to
- * have functions from different security contexts intermixed in a
- * single CPU profile. To avoid exposing function names belonging to
- * other contexts, filtering by security token is performed while
- * obtaining profiling results.
+ * Changes default CPU profiler sampling interval to the specified number
+ * of microseconds. Default interval is 1000us. This method must be called
+ * when there are no profiles being recorded.
*/
+ void SetSamplingInterval(int us);
/**
* Returns the number of profiles collected (doesn't include
@@ -258,17 +246,19 @@ class V8_EXPORT HeapGraphEdge {
class V8_EXPORT HeapGraphNode {
public:
enum Type {
- kHidden = 0, // Hidden node, may be filtered when shown to user.
- kArray = 1, // An array of elements.
- kString = 2, // A string.
- kObject = 3, // A JS object (except for arrays and strings).
- kCode = 4, // Compiled code.
- kClosure = 5, // Function closure.
- kRegExp = 6, // RegExp.
- kHeapNumber = 7, // Number stored in the heap.
- kNative = 8, // Native object (not from V8 heap).
- kSynthetic = 9 // Synthetic object, usualy used for grouping
- // snapshot items together.
+ kHidden = 0, // Hidden node, may be filtered when shown to user.
+ kArray = 1, // An array of elements.
+ kString = 2, // A string.
+ kObject = 3, // A JS object (except for arrays and strings).
+ kCode = 4, // Compiled code.
+ kClosure = 5, // Function closure.
+ kRegExp = 6, // RegExp.
+ kHeapNumber = 7, // Number stored in the heap.
+ kNative = 8, // Native object (not from V8 heap).
+ kSynthetic = 9, // Synthetic object, usualy used for grouping
+ // snapshot items together.
+ kConsString = 10, // Concatenated string. A pair of pointers to strings.
+ kSlicedString = 11 // Sliced string. A fragment of another string.
};
/** Returns node type (see HeapGraphNode::Type). */
diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h
index 3252602bcf..de2733838f 100644
--- a/deps/v8/include/v8.h
+++ b/deps/v8/include/v8.h
@@ -43,7 +43,7 @@
// We reserve the V8_* prefix for macros defined in V8 public API and
// assume there are no name conflicts with the embedder's code.
-#ifdef _WIN32
+#ifdef V8_OS_WIN
// Setup for Windows DLL export/import. When building the V8 DLL the
// BUILDING_V8_SHARED needs to be defined. When building a program which uses
@@ -56,59 +56,33 @@
#endif
#ifdef BUILDING_V8_SHARED
-#define V8_EXPORT __declspec(dllexport)
+# define V8_EXPORT __declspec(dllexport)
#elif USING_V8_SHARED
-#define V8_EXPORT __declspec(dllimport)
+# define V8_EXPORT __declspec(dllimport)
#else
-#define V8_EXPORT
+# define V8_EXPORT
#endif // BUILDING_V8_SHARED
-#else // _WIN32
+#else // V8_OS_WIN
// Setup for Linux shared library export.
-#if defined(__GNUC__) && ((__GNUC__ >= 4) || \
- (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED)
-#ifdef BUILDING_V8_SHARED
-#define V8_EXPORT __attribute__ ((visibility("default")))
-#else
-#define V8_EXPORT
-#endif
-#else
-#define V8_EXPORT
-#endif
-
-#endif // _WIN32
-
-#if defined(__GNUC__) && !defined(DEBUG)
-#define V8_INLINE(declarator) inline __attribute__((always_inline)) declarator
-#elif defined(_MSC_VER) && !defined(DEBUG)
-#define V8_INLINE(declarator) __forceinline declarator
-#else
-#define V8_INLINE(declarator) inline declarator
-#endif
-
-#if defined(__GNUC__) && !V8_DISABLE_DEPRECATIONS
-#define V8_DEPRECATED(declarator) declarator __attribute__ ((deprecated))
-#elif defined(_MSC_VER) && !V8_DISABLE_DEPRECATIONS
-#define V8_DEPRECATED(declarator) __declspec(deprecated) declarator
+#if V8_HAS_ATTRIBUTE_VISIBILITY && defined(V8_SHARED)
+# ifdef BUILDING_V8_SHARED
+# define V8_EXPORT __attribute__ ((visibility("default")))
+# else
+# define V8_EXPORT
+# endif
#else
-#define V8_DEPRECATED(declarator) declarator
+# define V8_EXPORT
#endif
-#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
- #define V8_UNLIKELY(condition) __builtin_expect((condition), 0)
- #define V8_LIKELY(condition) __builtin_expect((condition), 1)
-#else
- #define V8_UNLIKELY(condition) (condition)
- #define V8_LIKELY(condition) (condition)
-#endif
+#endif // V8_OS_WIN
/**
* The v8 JavaScript engine.
*/
namespace v8 {
-class AccessorInfo;
class AccessorSignature;
class Array;
class Boolean;
@@ -145,11 +119,14 @@ class Utils;
class Value;
template <class T> class Handle;
template <class T> class Local;
-template <class T> class Persistent;
+template <class T> class Eternal;
+template<class T> class NonCopyablePersistentTraits;
+template<class T,
+ class M = NonCopyablePersistentTraits<T> > class Persistent;
+template<class T, class P> class WeakCallbackObject;
class FunctionTemplate;
class ObjectTemplate;
class Data;
-class AccessorInfo;
template<typename T> class PropertyCallbackInfo;
class StackTrace;
class StackFrame;
@@ -168,6 +145,7 @@ class Object;
template<typename T> class CustomArguments;
class PropertyCallbackArguments;
class FunctionCallbackArguments;
+class GlobalHandles;
}
@@ -195,27 +173,6 @@ class UniqueId {
intptr_t data_;
};
-
-// --- Weak Handles ---
-
-
-/**
- * A weak reference callback function.
- *
- * This callback should either explicitly invoke Dispose on |object| if
- * V8 wrapper is not needed anymore, or 'revive' it by invocation of MakeWeak.
- *
- * \param object the weak global object to be reclaimed by the garbage collector
- * \param parameter the value passed in when making the weak global object
- */
-template<typename T, typename P>
-class WeakReferenceCallbacks {
- public:
- typedef void (*Revivable)(Isolate* isolate,
- Persistent<T>* object,
- P* parameter);
-};
-
// --- Handles ---
#define TYPE_CHECK(T, S) \
@@ -254,14 +211,7 @@ template <class T> class Handle {
/**
* Creates an empty handle.
*/
- V8_INLINE(Handle()) : val_(0) {}
-
-#ifdef V8_USE_UNSAFE_HANDLES
- /**
- * Creates a new handle for the specified value.
- */
- V8_INLINE(explicit Handle(T* val)) : val_(val) {}
-#endif
+ V8_INLINE Handle() : val_(0) {}
/**
* Creates a handle for the contents of the specified handle. This
@@ -273,7 +223,7 @@ template <class T> class Handle {
* Handle<String> to a variable declared as Handle<Value>, is legal
* because String is a subclass of Value.
*/
- template <class S> V8_INLINE(Handle(Handle<S> that))
+ template <class S> V8_INLINE Handle(Handle<S> that)
: val_(reinterpret_cast<T*>(*that)) {
/**
* This check fails when trying to convert between incompatible
@@ -286,16 +236,16 @@ template <class T> class Handle {
/**
* Returns true if the handle is empty.
*/
- V8_INLINE(bool IsEmpty() const) { return val_ == 0; }
+ V8_INLINE bool IsEmpty() const { return val_ == 0; }
/**
* Sets the handle to be empty. IsEmpty() will then return true.
*/
- V8_INLINE(void Clear()) { val_ = 0; }
+ V8_INLINE void Clear() { val_ = 0; }
- V8_INLINE(T* operator->() const) { return val_; }
+ V8_INLINE T* operator->() const { return val_; }
- V8_INLINE(T* operator*() const) { return val_; }
+ V8_INLINE T* operator*() const { return val_; }
/**
* Checks whether two handles are the same.
@@ -303,7 +253,7 @@ template <class T> class Handle {
* to which they refer are identical.
* The handles' references are not checked.
*/
- template <class S> V8_INLINE(bool operator==(const Handle<S> that) const) {
+ template <class S> V8_INLINE bool operator==(const Handle<S>& that) const {
internal::Object** a = reinterpret_cast<internal::Object**>(**this);
internal::Object** b = reinterpret_cast<internal::Object**>(*that);
if (a == 0) return b == 0;
@@ -311,16 +261,14 @@ template <class T> class Handle {
return *a == *b;
}
-#ifndef V8_USE_UNSAFE_HANDLES
- template <class S> V8_INLINE(
- bool operator==(const Persistent<S>& that) const) {
+ template <class S> V8_INLINE bool operator==(
+ const Persistent<S>& that) const {
internal::Object** a = reinterpret_cast<internal::Object**>(**this);
internal::Object** b = reinterpret_cast<internal::Object**>(*that);
if (a == 0) return b == 0;
if (b == 0) return false;
return *a == *b;
}
-#endif
/**
* Checks whether two handles are different.
@@ -328,11 +276,16 @@ template <class T> class Handle {
* the objects to which they refer are different.
* The handles' references are not checked.
*/
- template <class S> V8_INLINE(bool operator!=(Handle<S> that) const) {
+ template <class S> V8_INLINE bool operator!=(const Handle<S>& that) const {
return !operator==(that);
}
- template <class S> V8_INLINE(static Handle<T> Cast(Handle<S> that)) {
+ template <class S> V8_INLINE bool operator!=(
+ const Persistent<S>& that) const {
+ return !operator==(that);
+ }
+
+ template <class S> V8_INLINE static Handle<T> Cast(Handle<S> that) {
#ifdef V8_ENABLE_CHECKS
// If we're going to perform the type check then we have to check
// that the handle isn't empty before doing the checked cast.
@@ -341,16 +294,14 @@ template <class T> class Handle {
return Handle<T>(T::Cast(*that));
}
- template <class S> V8_INLINE(Handle<S> As()) {
+ template <class S> V8_INLINE Handle<S> As() {
return Handle<S>::Cast(*this);
}
-#ifndef V8_USE_UNSAFE_HANDLES
- V8_INLINE(static Handle<T> New(Isolate* isolate, Handle<T> that)) {
+ V8_INLINE static Handle<T> New(Isolate* isolate, Handle<T> that) {
return New(isolate, that.val_);
}
- // TODO(dcarney): remove before cutover
- V8_INLINE(static Handle<T> New(Isolate* isolate, const Persistent<T>& that)) {
+ V8_INLINE static Handle<T> New(Isolate* isolate, const Persistent<T>& that) {
return New(isolate, that.val_);
}
@@ -361,18 +312,15 @@ template <class T> class Handle {
/**
* Creates a new handle for the specified value.
*/
- V8_INLINE(explicit Handle(T* val)) : val_(val) {}
-#endif
+ V8_INLINE explicit Handle(T* val) : val_(val) {}
private:
friend class Utils;
- template<class F> friend class Persistent;
+ template<class F, class M> friend class Persistent;
template<class F> friend class Local;
- friend class Arguments;
template<class F> friend class FunctionCallbackInfo;
template<class F> friend class PropertyCallbackInfo;
template<class F> friend class internal::CustomArguments;
- friend class AccessorInfo;
friend Handle<Primitive> Undefined(Isolate* isolate);
friend Handle<Primitive> Null(Isolate* isolate);
friend Handle<Boolean> True(Isolate* isolate);
@@ -380,19 +328,12 @@ template <class T> class Handle {
friend class Context;
friend class HandleScope;
-#ifndef V8_USE_UNSAFE_HANDLES
- V8_INLINE(static Handle<T> New(Isolate* isolate, T* that));
-#endif
+ V8_INLINE static Handle<T> New(Isolate* isolate, T* that);
T* val_;
};
-// A value which will never be returned by Local::Eternalize
-// Useful for static initialization
-const int kUninitializedEternalIndex = -1;
-
-
/**
* A light-weight stack-allocated object handle. All operations
* that return objects from within v8 return them in local handles. They
@@ -400,11 +341,10 @@ const int kUninitializedEternalIndex = -1;
* handle scope are destroyed when the handle scope is destroyed. Hence it
* is not necessary to explicitly deallocate local handles.
*/
-// TODO(dcarney): deprecate entire class
template <class T> class Local : public Handle<T> {
public:
- V8_INLINE(Local());
- template <class S> V8_INLINE(Local(Local<S> that))
+ V8_INLINE Local();
+ template <class S> V8_INLINE Local(Local<S> that)
: Handle<T>(reinterpret_cast<T*>(*that)) {
/**
* This check fails when trying to convert between incompatible
@@ -415,11 +355,7 @@ template <class T> class Local : public Handle<T> {
}
-#ifdef V8_USE_UNSAFE_HANDLES
- template <class S> V8_INLINE(Local(S* that) : Handle<T>(that)) { }
-#endif
-
- template <class S> V8_INLINE(static Local<T> Cast(Local<S> that)) {
+ template <class S> V8_INLINE static Local<T> Cast(Local<S> that) {
#ifdef V8_ENABLE_CHECKS
// If we're going to perform the type check then we have to check
// that the handle isn't empty before doing the checked cast.
@@ -427,57 +363,122 @@ template <class T> class Local : public Handle<T> {
#endif
return Local<T>(T::Cast(*that));
}
-#ifndef V8_USE_UNSAFE_HANDLES
- template <class S> V8_INLINE(Local(Handle<S> that))
+ template <class S> V8_INLINE Local(Handle<S> that)
: Handle<T>(reinterpret_cast<T*>(*that)) {
TYPE_CHECK(T, S);
}
-#endif
- template <class S> V8_INLINE(Local<S> As()) {
+ template <class S> V8_INLINE Local<S> As() {
return Local<S>::Cast(*this);
}
- // Keep this Local alive for the lifetime of the Isolate.
- // It remains retrievable via the returned index,
- V8_INLINE(int Eternalize(Isolate* isolate));
- V8_INLINE(static Local<T> GetEternal(Isolate* isolate, int index));
-
/**
* 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.
*/
- V8_INLINE(static Local<T> New(Handle<T> that));
- V8_INLINE(static Local<T> New(Isolate* isolate, Handle<T> that));
-#ifndef V8_USE_UNSAFE_HANDLES
- // TODO(dcarney): remove before cutover
- V8_INLINE(static Local<T> New(Isolate* isolate, const Persistent<T>& that));
+ V8_INLINE static Local<T> New(Handle<T> that);
+ V8_INLINE static Local<T> New(Isolate* isolate, Handle<T> that);
+ template<class M>
+ V8_INLINE static Local<T> New(Isolate* isolate,
+ const Persistent<T, M>& that);
#ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR
private:
#endif
- template <class S> V8_INLINE(Local(S* that) : Handle<T>(that)) { }
-#endif
+ template <class S> V8_INLINE Local(S* that) : Handle<T>(that) { }
private:
friend class Utils;
- template<class F> friend class Persistent;
+ template<class F> friend class Eternal;
+ template<class F, class M> friend class Persistent;
template<class F> friend class Handle;
- friend class Arguments;
template<class F> friend class FunctionCallbackInfo;
template<class F> friend class PropertyCallbackInfo;
friend class String;
friend class Object;
- friend class AccessorInfo;
friend class Context;
template<class F> friend class internal::CustomArguments;
friend class HandleScope;
- V8_INLINE(static Local<T> New(Isolate* isolate, T* that));
+ V8_INLINE static Local<T> New(Isolate* isolate, T* that);
};
+
+// Eternal handles are set-once handles that live for the life of the isolate.
+template <class T> class Eternal {
+ public:
+ V8_INLINE Eternal() : index_(kInitialValue) { }
+ template<class S>
+ V8_INLINE Eternal(Isolate* isolate, Local<S> handle) : index_(kInitialValue) {
+ Set(isolate, handle);
+ }
+ // Can only be safely called if already set.
+ V8_INLINE Local<T> Get(Isolate* isolate);
+ V8_INLINE bool IsEmpty() { return index_ == kInitialValue; }
+ template<class S> V8_INLINE void Set(Isolate* isolate, Local<S> handle);
+
+ private:
+ static const int kInitialValue = -1;
+ int index_;
+};
+
+
+template<class T, class P>
+class WeakCallbackData {
+ public:
+ typedef void (*Callback)(const WeakCallbackData<T, P>& data);
+
+ V8_INLINE Isolate* GetIsolate() const { return isolate_; }
+ V8_INLINE Local<T> GetValue() const { return handle_; }
+ V8_INLINE P* GetParameter() const { return parameter_; }
+
+ private:
+ friend class internal::GlobalHandles;
+ WeakCallbackData(Isolate* isolate, Local<T> handle, P* parameter)
+ : isolate_(isolate), handle_(handle), parameter_(parameter) { }
+ Isolate* isolate_;
+ Local<T> handle_;
+ P* parameter_;
+};
+
+
+// TODO(dcarney): Remove this class.
+template<typename T,
+ typename P,
+ typename M = NonCopyablePersistentTraits<T> >
+class WeakReferenceCallbacks {
+ public:
+ typedef void (*Revivable)(Isolate* isolate,
+ Persistent<T, M>* object,
+ P* parameter);
+};
+
+
+/**
+ * Default traits for Persistent. This class does not allow
+ * use of the copy constructor or assignment operator.
+ * At present kResetInDestructor is not set, but that will change in a future
+ * version.
+ */
+template<class T>
+class NonCopyablePersistentTraits {
+ public:
+ typedef Persistent<T, NonCopyablePersistentTraits<T> > NonCopyablePersistent;
+ static const bool kResetInDestructor = false;
+ template<class S, class M>
+ V8_INLINE static void Copy(const Persistent<S, M>& source,
+ NonCopyablePersistent* dest) {
+ Uncompilable<Object>();
+ }
+ // TODO(dcarney): come up with a good compile error here.
+ template<class O> V8_INLINE static void Uncompilable() {
+ TYPE_CHECK(O, Primitive);
+ }
+};
+
+
/**
* An object reference that is independent of any handle scope. Where
* a Local handle only lives as long as the HandleScope in which it was
@@ -487,108 +488,94 @@ template <class T> class Local : public Handle<T> {
* A persistent handle contains a reference to a storage cell within
* the v8 engine which holds an object value and which is updated by
* the garbage collector whenever the object is moved. A new storage
- * cell can be created using Persistent::New and existing handles can
- * be disposed using Persistent::Dispose. Since persistent handles
- * are passed by value you may have many persistent handle objects
- * that point to the same storage cell. For instance, if you pass a
- * persistent handle as an argument to a function you will not get two
- * different storage cells but rather two references to the same
- * storage cell.
+ * cell can be created using the constructor or Persistent::Reset and
+ * existing handles can be disposed using Persistent::Reset.
+ *
+ * Copy, assignment and destructor bevavior is controlled by the traits
+ * class M.
*/
-template <class T> class Persistent // NOLINT
-#ifdef V8_USE_UNSAFE_HANDLES
- : public Handle<T> {
-#else
- { // NOLINT
-#endif
+template <class T, class M> class Persistent {
public:
-#ifndef V8_USE_UNSAFE_HANDLES
- V8_INLINE(Persistent()) : val_(0) { }
- // TODO(dcarney): add this back before cutover.
-// V8_INLINE(~Persistent()) {
-// Dispose();
-// }
- V8_INLINE(bool IsEmpty() const) { return val_ == 0; }
- // TODO(dcarney): remove somehow before cutover
- // The handle should either be 0, or a pointer to a live cell.
- V8_INLINE(void Clear()) { val_ = 0; }
-
/**
- * A constructor that creates a new global cell pointing to that. In contrast
- * to the copy constructor, this creates a new persistent handle which needs
- * to be separately disposed.
+ * A Persistent with no storage cell.
*/
- template <class S> V8_INLINE(Persistent(Isolate* isolate, Handle<S> that))
- : val_(New(isolate, *that)) { }
-
- template <class S> V8_INLINE(Persistent(Isolate* isolate,
- const Persistent<S>& that)) // NOLINT
- : val_(New(isolate, *that)) { }
-
-#else
+ V8_INLINE Persistent() : val_(0) { }
/**
- * Creates an empty persistent handle that doesn't point to any
- * storage cell.
+ * Construct a Persistent from a Handle.
+ * When the Handle is non-empty, a new storage cell is created
+ * pointing to the same object, and no flags are set.
*/
- V8_INLINE(Persistent()) : Handle<T>() { }
-
+ template <class S> V8_INLINE Persistent(Isolate* isolate, Handle<S> that)
+ : val_(New(isolate, *that)) {
+ TYPE_CHECK(T, S);
+ }
/**
- * Creates a persistent handle for the same storage cell as the
- * specified handle. This constructor allows you to pass persistent
- * handles as arguments by value and to assign between persistent
- * handles. However, attempting to assign between incompatible
- * persistent handles, for instance from a Persistent<String> to a
- * Persistent<Number> will cause a compile-time error. Assigning
- * between compatible persistent handles, for instance assigning a
- * Persistent<String> to a variable declared as Persistent<Value>,
- * is allowed as String is a subclass of Value.
+ * Construct a Persistent from a Persistent.
+ * When the Persistent is non-empty, a new storage cell is created
+ * pointing to the same object, and no flags are set.
*/
- template <class S> V8_INLINE(Persistent(Persistent<S> that))
- : Handle<T>(reinterpret_cast<T*>(*that)) {
- /**
- * This check fails when trying to convert between incompatible
- * handles. For example, converting from a Handle<String> to a
- * Handle<Number>.
- */
+ template <class S, class M2>
+ V8_INLINE Persistent(Isolate* isolate, const Persistent<S, M2>& that)
+ : val_(New(isolate, *that)) {
TYPE_CHECK(T, S);
}
-
- template <class S> V8_INLINE(Persistent(S* that)) : Handle<T>(that) { }
-
/**
- * A constructor that creates a new global cell pointing to that. In contrast
- * to the copy constructor, this creates a new persistent handle which needs
- * to be separately disposed.
+ * The copy constructors and assignment operator create a Persistent
+ * exactly as the Persistent constructor, but the Copy function from the
+ * traits class is called, allowing the setting of flags based on the
+ * copied Persistent.
*/
- template <class S> V8_INLINE(Persistent(Isolate* isolate, Handle<S> that))
- : Handle<T>(New(isolate, that)) { }
-
+ V8_INLINE Persistent(const Persistent& that) : val_(0) {
+ Copy(that);
+ }
+ template <class S, class M2>
+ V8_INLINE Persistent(const Persistent<S, M2>& that) : val_(0) {
+ Copy(that);
+ }
+ V8_INLINE Persistent& operator=(const Persistent& that) { // NOLINT
+ Copy(that);
+ return *this;
+ }
+ template <class S, class M2>
+ V8_INLINE Persistent& operator=(const Persistent<S, M2>& that) { // NOLINT
+ Copy(that);
+ return *this;
+ }
/**
- * "Casts" a plain handle which is known to be a persistent handle
- * to a persistent handle.
+ * The destructor will dispose the Persistent based on the
+ * kResetInDestructor flags in the traits class. Since not calling dispose
+ * can result in a memory leak, it is recommended to always set this flag.
*/
- template <class S> explicit V8_INLINE(Persistent(Handle<S> that))
- : Handle<T>(*that) { }
-
-#endif
-
-#ifdef V8_USE_UNSAFE_HANDLES
- template <class S> V8_INLINE(static Persistent<T> Cast(Persistent<S> that)) {
-#ifdef V8_ENABLE_CHECKS
- // If we're going to perform the type check then we have to check
- // that the handle isn't empty before doing the checked cast.
- if (that.IsEmpty()) return Persistent<T>();
-#endif
- return Persistent<T>(T::Cast(*that));
+ V8_INLINE ~Persistent() {
+ if (M::kResetInDestructor) Reset();
}
- template <class S> V8_INLINE(Persistent<S> As()) {
- return Persistent<S>::Cast(*this);
- }
+ /**
+ * If non-empty, destroy the underlying storage cell
+ * IsEmpty() will return true after this call.
+ */
+ V8_INLINE void Reset();
+ /**
+ * If non-empty, destroy the underlying storage cell
+ * and create a new one with the contents of other if other is non empty
+ */
+ template <class S>
+ V8_INLINE void Reset(Isolate* isolate, const Handle<S>& other);
+ /**
+ * If non-empty, destroy the underlying storage cell
+ * and create a new one with the contents of other if other is non empty
+ */
+ template <class S, class M2>
+ V8_INLINE void Reset(Isolate* isolate, const Persistent<S, M2>& other);
+ // TODO(dcarney): deprecate
+ V8_INLINE void Dispose() { Reset(); }
+ V8_DEPRECATED(V8_INLINE void Dispose(Isolate* isolate)) { Reset(); }
-#else
+ V8_INLINE bool IsEmpty() const { return val_ == 0; }
+
+ // TODO(dcarney): this is pretty useless, fix or remove
template <class S>
- V8_INLINE(static Persistent<T>& Cast(Persistent<S>& that)) { // NOLINT
+ V8_INLINE static Persistent<T>& Cast(Persistent<S>& that) { // NOLINT
#ifdef V8_ENABLE_CHECKS
// If we're going to perform the type check then we have to check
// that the handle isn't empty before doing the checked cast.
@@ -597,20 +584,13 @@ template <class T> class Persistent // NOLINT
return reinterpret_cast<Persistent<T>&>(that);
}
- template <class S> V8_INLINE(Persistent<S>& As()) { // NOLINT
+ // TODO(dcarney): this is pretty useless, fix or remove
+ template <class S> V8_INLINE Persistent<S>& As() { // NOLINT
return Persistent<S>::Cast(*this);
}
-#endif
-#ifdef V8_USE_UNSAFE_HANDLES
- V8_DEPRECATED(static Persistent<T> New(Handle<T> that));
- V8_INLINE(static Persistent<T> New(Isolate* isolate, Handle<T> that));
- V8_INLINE(static Persistent<T> New(Isolate* isolate, Persistent<T> that));
-#endif
-
-#ifndef V8_USE_UNSAFE_HANDLES
- template <class S> V8_INLINE(
- bool operator==(const Persistent<S>& that) const) {
+ template <class S, class M2>
+ V8_INLINE bool operator==(const Persistent<S, M2>& that) const {
internal::Object** a = reinterpret_cast<internal::Object**>(**this);
internal::Object** b = reinterpret_cast<internal::Object**>(*that);
if (a == 0) return b == 0;
@@ -618,58 +598,48 @@ template <class T> class Persistent // NOLINT
return *a == *b;
}
- template <class S> V8_INLINE(bool operator==(const Handle<S> that) const) {
+ template <class S> V8_INLINE bool operator==(const Handle<S>& that) const {
internal::Object** a = reinterpret_cast<internal::Object**>(**this);
internal::Object** b = reinterpret_cast<internal::Object**>(*that);
if (a == 0) return b == 0;
if (b == 0) return false;
return *a == *b;
}
-#endif
-
- V8_INLINE(void Dispose());
- /**
- * Releases the storage cell referenced by this persistent handle.
- * Does not remove the reference to the cell from any handles.
- * This handle's reference, and any other references to the storage
- * cell remain and IsEmpty will still return false.
- */
- // TODO(dcarney): deprecate
- V8_INLINE(void Dispose(Isolate* isolate)) { Dispose(); }
+ template <class S, class M2>
+ V8_INLINE bool operator!=(const Persistent<S, M2>& that) const {
+ return !operator==(that);
+ }
- /**
- * Make the reference to this object weak. When only weak handles
- * refer to the object, the garbage collector will perform a
- * callback to the given V8::NearDeathCallback function, passing
- * it the object reference and the given parameters.
- */
- template<typename S, typename P>
- V8_INLINE(void MakeWeak(
- P* parameters,
- typename WeakReferenceCallbacks<S, P>::Revivable callback));
+ template <class S> V8_INLINE bool operator!=(const Handle<S>& that) const {
+ return !operator==(that);
+ }
template<typename P>
- V8_INLINE(void MakeWeak(
- P* parameters,
- typename WeakReferenceCallbacks<T, P>::Revivable callback));
+ V8_INLINE void SetWeak(
+ P* parameter,
+ typename WeakCallbackData<T, P>::Callback callback);
template<typename S, typename P>
- V8_DEPRECATED(void MakeWeak(
- Isolate* isolate,
- P* parameters,
- typename WeakReferenceCallbacks<S, P>::Revivable callback));
+ V8_INLINE void SetWeak(
+ P* parameter,
+ typename WeakCallbackData<S, P>::Callback callback);
+
+ // TODO(dcarney): deprecate
+ template<typename S, typename P>
+ V8_INLINE void MakeWeak(
+ P* parameter,
+ typename WeakReferenceCallbacks<S, P>::Revivable callback);
+ // TODO(dcarney): deprecate
template<typename P>
- V8_DEPRECATED(void MakeWeak(
- Isolate* isolate,
- P* parameters,
- typename WeakReferenceCallbacks<T, P>::Revivable callback));
+ V8_INLINE void MakeWeak(
+ P* parameter,
+ typename WeakReferenceCallbacks<T, P>::Revivable callback);
- V8_INLINE(void ClearWeak());
+ V8_INLINE void ClearWeak();
- // TODO(dcarney): deprecate
- V8_INLINE(void ClearWeak(Isolate* isolate)) { ClearWeak(); }
+ V8_DEPRECATED(V8_INLINE void ClearWeak(Isolate* isolate)) { ClearWeak(); }
/**
* Marks the reference to this object independent. Garbage collector is free
@@ -677,10 +647,11 @@ template <class T> class Persistent // NOLINT
* independent handle should not assume that it will be preceded by a global
* GC prologue callback or followed by a global GC epilogue callback.
*/
- V8_INLINE(void MarkIndependent());
+ V8_INLINE void MarkIndependent();
- // TODO(dcarney): deprecate
- V8_INLINE(void MarkIndependent(Isolate* isolate)) { MarkIndependent(); }
+ V8_DEPRECATED(V8_INLINE void MarkIndependent(Isolate* isolate)) {
+ MarkIndependent();
+ }
/**
* Marks the reference to this object partially dependent. Partially dependent
@@ -690,40 +661,40 @@ template <class T> class Persistent // NOLINT
* external dependencies. This mark is automatically cleared after each
* garbage collection.
*/
- V8_INLINE(void MarkPartiallyDependent());
+ V8_INLINE void MarkPartiallyDependent();
- // TODO(dcarney): deprecate
- V8_INLINE(void MarkPartiallyDependent(Isolate* isolate)) {
+ V8_DEPRECATED(V8_INLINE void MarkPartiallyDependent(Isolate* isolate)) {
MarkPartiallyDependent();
}
- V8_INLINE(bool IsIndependent() const);
+ V8_INLINE bool IsIndependent() const;
- // TODO(dcarney): deprecate
- V8_INLINE(bool IsIndependent(Isolate* isolate) const) {
+ V8_DEPRECATED(V8_INLINE bool IsIndependent(Isolate* isolate) const) {
return IsIndependent();
}
/** Checks if the handle holds the only reference to an object. */
- V8_INLINE(bool IsNearDeath() const);
+ V8_INLINE bool IsNearDeath() const;
- // TODO(dcarney): deprecate
- V8_INLINE(bool IsNearDeath(Isolate* isolate) const) { return IsNearDeath(); }
+ V8_DEPRECATED(V8_INLINE bool IsNearDeath(Isolate* isolate) const) {
+ return IsNearDeath();
+ }
/** Returns true if the handle's reference is weak. */
- V8_INLINE(bool IsWeak() const);
+ V8_INLINE bool IsWeak() const;
- // TODO(dcarney): deprecate
- V8_INLINE(bool IsWeak(Isolate* isolate) const) { return IsWeak(); }
+ V8_DEPRECATED(V8_INLINE bool IsWeak(Isolate* isolate) const) {
+ return IsWeak();
+ }
/**
* Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface
* description in v8-profiler.h for details.
*/
- V8_INLINE(void SetWrapperClassId(uint16_t class_id));
+ V8_INLINE void SetWrapperClassId(uint16_t class_id);
- // TODO(dcarney): deprecate
- V8_INLINE(void SetWrapperClassId(Isolate* isolate, uint16_t class_id)) {
+ V8_DEPRECATED(
+ V8_INLINE void SetWrapperClassId(Isolate * isolate, uint16_t class_id)) {
SetWrapperClassId(class_id);
}
@@ -731,75 +702,41 @@ template <class T> class Persistent // NOLINT
* Returns the class ID previously assigned to this handle or 0 if no class ID
* was previously assigned.
*/
- V8_INLINE(uint16_t WrapperClassId() const);
+ V8_INLINE uint16_t WrapperClassId() const;
- // TODO(dcarney): deprecate
- V8_INLINE(uint16_t WrapperClassId(Isolate* isolate) const) {
+ V8_DEPRECATED(V8_INLINE uint16_t WrapperClassId(Isolate* isolate) const) {
return WrapperClassId();
}
- /**
- * Disposes the current contents of the handle and replaces it.
- */
- V8_INLINE(void Reset(Isolate* isolate, const Handle<T>& other));
+ // TODO(dcarney): remove
+ V8_INLINE T* ClearAndLeak();
-#ifndef V8_USE_UNSAFE_HANDLES
- V8_INLINE(void Reset(Isolate* isolate, const Persistent<T>& other));
-#endif
+ // TODO(dcarney): remove
+ V8_INLINE void Clear() { val_ = 0; }
- /**
- * Returns the underlying raw pointer and clears the handle. The caller is
- * responsible of eventually destroying the underlying object (by creating a
- * Persistent handle which points to it and Disposing it). In the future,
- * destructing a Persistent will also Dispose it. With this function, the
- * embedder can let the Persistent go out of scope without it getting
- * disposed.
- */
- V8_INLINE(T* ClearAndLeak());
-
-#ifndef V8_USE_UNSAFE_HANDLES
-
- private:
- // TODO(dcarney): make unlinkable before cutover
- V8_INLINE(Persistent(const Persistent& that)) : val_(that.val_) {}
- // TODO(dcarney): make unlinkable before cutover
- V8_INLINE(Persistent& operator=(const Persistent& that)) { // NOLINT
- this->val_ = that.val_;
- return *this;
- }
-
- public:
+ // TODO(dcarney): remove
#ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR
private:
#endif
- // TODO(dcarney): remove before cutover
- template <class S> V8_INLINE(Persistent(S* that)) : val_(that) { }
+ template <class S> V8_INLINE Persistent(S* that) : val_(that) { }
- // TODO(dcarney): remove before cutover
- V8_INLINE(T* operator*() const) { return val_; }
-
- private:
- // TODO(dcarney): remove before cutover
- V8_INLINE(T* operator->() const) { return val_; }
- public:
-#endif
+ V8_INLINE T* operator*() const { return val_; }
private:
friend class Utils;
template<class F> friend class Handle;
template<class F> friend class Local;
- template<class F> friend class Persistent;
+ template<class F1, class F2> friend class Persistent;
template<class F> friend class ReturnValue;
- V8_INLINE(static T* New(Isolate* isolate, T* that));
+ V8_INLINE static T* New(Isolate* isolate, T* that);
+ template<class S, class M2>
+ V8_INLINE void Copy(const Persistent<S, M2>& that);
-#ifndef V8_USE_UNSAFE_HANDLES
T* val_;
-#endif
};
-
/**
* A stack-allocated class that governs a number of local handles.
* After a handle scope has been created, all local handles will be
@@ -816,9 +753,6 @@ template <class T> class Persistent // NOLINT
*/
class V8_EXPORT HandleScope {
public:
- // TODO(svenpanne) Deprecate me when Chrome is fixed!
- HandleScope();
-
HandleScope(Isolate* isolate);
~HandleScope();
@@ -858,7 +792,7 @@ class V8_EXPORT HandleScope {
internal::Object** next;
internal::Object** limit;
int level;
- V8_INLINE(void Initialize()) {
+ V8_INLINE void Initialize() {
next = limit = NULL;
level = 0;
}
@@ -880,6 +814,21 @@ class V8_EXPORT HandleScope {
};
+/**
+ * A simple Maybe type, representing an object which may or may not have a
+ * value.
+ */
+template<class T>
+struct Maybe {
+ Maybe() : has_value(false) {}
+ explicit Maybe(T t) : has_value(true), value(t) {}
+ Maybe(bool has, T t) : has_value(has), value(t) {}
+
+ bool has_value;
+ T value;
+};
+
+
// --- Special objects ---
@@ -952,19 +901,19 @@ class V8_EXPORT ScriptData { // NOLINT
*/
class ScriptOrigin {
public:
- V8_INLINE(ScriptOrigin(
+ V8_INLINE ScriptOrigin(
Handle<Value> resource_name,
Handle<Integer> resource_line_offset = Handle<Integer>(),
Handle<Integer> resource_column_offset = Handle<Integer>(),
- Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>()))
+ Handle<Boolean> resource_is_shared_cross_origin = Handle<Boolean>())
: resource_name_(resource_name),
resource_line_offset_(resource_line_offset),
resource_column_offset_(resource_column_offset),
resource_is_shared_cross_origin_(resource_is_shared_cross_origin) { }
- V8_INLINE(Handle<Value> ResourceName() const);
- V8_INLINE(Handle<Integer> ResourceLineOffset() const);
- V8_INLINE(Handle<Integer> ResourceColumnOffset() const);
- V8_INLINE(Handle<Boolean> ResourceIsSharedCrossOrigin() const);
+ V8_INLINE Handle<Value> ResourceName() const;
+ V8_INLINE Handle<Integer> ResourceLineOffset() const;
+ V8_INLINE Handle<Integer> ResourceColumnOffset() const;
+ V8_INLINE Handle<Boolean> ResourceIsSharedCrossOrigin() const;
private:
Handle<Value> resource_name_;
Handle<Integer> resource_line_offset_;
@@ -1158,6 +1107,7 @@ class V8_EXPORT Message {
static const int kNoLineNumberInfo = 0;
static const int kNoColumnInfo = 0;
+ static const int kNoScriptIdInfo = 0;
};
@@ -1180,6 +1130,7 @@ class V8_EXPORT StackTrace {
kIsEval = 1 << 4,
kIsConstructor = 1 << 5,
kScriptNameOrSourceURL = 1 << 6,
+ kScriptId = 1 << 7,
kOverview = kLineNumber | kColumnOffset | kScriptName | kFunctionName,
kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL
};
@@ -1235,6 +1186,14 @@ class V8_EXPORT StackFrame {
int GetColumn() const;
/**
+ * Returns the id of the script for the function for this StackFrame.
+ * This method will return Message::kNoScriptIdInfo if it is unable to
+ * retrieve the script id, or if kScriptId was not passed as an option when
+ * capturing the StackTrace.
+ */
+ int GetScriptId() const;
+
+ /**
* Returns the name of the resource that contains the script for the
* function for this StackFrame.
*/
@@ -1295,13 +1254,13 @@ class V8_EXPORT Value : public Data {
* Returns true if this value is the undefined value. See ECMA-262
* 4.3.10.
*/
- V8_INLINE(bool IsUndefined() const);
+ V8_INLINE bool IsUndefined() const;
/**
* Returns true if this value is the null value. See ECMA-262
* 4.3.11.
*/
- V8_INLINE(bool IsNull() const);
+ V8_INLINE bool IsNull() const;
/**
* Returns true if this value is true.
@@ -1317,7 +1276,7 @@ class V8_EXPORT Value : public Data {
* Returns true if this value is an instance of the String type.
* See ECMA-262 8.4.
*/
- V8_INLINE(bool IsString() const);
+ V8_INLINE bool IsString() const;
/**
* Returns true if this value is a symbol.
@@ -1505,12 +1464,12 @@ class V8_EXPORT Value : public Data {
bool Equals(Handle<Value> that) const;
bool StrictEquals(Handle<Value> that) const;
- template <class T> V8_INLINE(static Value* Cast(T* value));
+ template <class T> V8_INLINE static Value* Cast(T* value);
private:
- V8_INLINE(bool QuickIsUndefined() const);
- V8_INLINE(bool QuickIsNull() const);
- V8_INLINE(bool QuickIsString() const);
+ V8_INLINE bool QuickIsUndefined() const;
+ V8_INLINE bool QuickIsNull() const;
+ V8_INLINE bool QuickIsString() const;
bool FullIsUndefined() const;
bool FullIsNull() const;
bool FullIsString() const;
@@ -1530,7 +1489,7 @@ class V8_EXPORT Primitive : public Value { };
class V8_EXPORT Boolean : public Primitive {
public:
bool Value() const;
- V8_INLINE(static Handle<Boolean> New(bool value));
+ V8_INLINE static Handle<Boolean> New(bool value);
};
@@ -1559,7 +1518,7 @@ class V8_EXPORT String : public Primitive {
/**
* This function is no longer useful.
*/
- V8_DEPRECATED(V8_INLINE(bool MayContainNonAscii()) const) { return true; }
+ V8_DEPRECATED(V8_INLINE bool MayContainNonAscii() const) { return true; }
/**
* Returns whether this string is known to contain only one byte data.
@@ -1631,7 +1590,7 @@ class V8_EXPORT String : public Primitive {
* A zero length string.
*/
static v8::Local<v8::String> Empty();
- V8_INLINE(static v8::Local<v8::String> Empty(Isolate* isolate));
+ V8_INLINE static v8::Local<v8::String> Empty(Isolate* isolate);
/**
* Returns true if the string is external
@@ -1729,14 +1688,14 @@ class V8_EXPORT String : public Primitive {
* regardless of the encoding, otherwise return NULL. The encoding of the
* string is returned in encoding_out.
*/
- V8_INLINE(ExternalStringResourceBase* GetExternalStringResourceBase(
- Encoding* encoding_out) const);
+ V8_INLINE ExternalStringResourceBase* GetExternalStringResourceBase(
+ Encoding* encoding_out) const;
/**
* Get the ExternalStringResource for an external string. Returns
* NULL if IsExternal() doesn't return true.
*/
- V8_INLINE(ExternalStringResource* GetExternalStringResource() const);
+ V8_INLINE ExternalStringResource* GetExternalStringResource() const;
/**
* Get the ExternalAsciiStringResource for an external ASCII string.
@@ -1744,7 +1703,7 @@ class V8_EXPORT String : public Primitive {
*/
const ExternalAsciiStringResource* GetExternalAsciiStringResource() const;
- V8_INLINE(static String* Cast(v8::Value* obj));
+ V8_INLINE static String* Cast(v8::Value* obj);
// TODO(dcarney): deprecate
/**
@@ -1752,18 +1711,18 @@ class V8_EXPORT String : public Primitive {
* The second parameter 'length' gives the buffer length. If omitted,
* the function calls 'strlen' to determine the buffer length.
*/
- V8_INLINE(static Local<String> New(const char* data, int length = -1));
+ V8_INLINE static Local<String> New(const char* data, int length = -1);
// TODO(dcarney): deprecate
/** Allocates a new string from 16-bit character codes.*/
- V8_INLINE(static Local<String> New(const uint16_t* data, int length = -1));
+ V8_INLINE static Local<String> New(const uint16_t* data, int length = -1);
// TODO(dcarney): deprecate
/**
* Creates an internalized string (historically called a "symbol",
* not to be confused with ES6 symbols). Returns one if it exists already.
*/
- V8_INLINE(static Local<String> NewSymbol(const char* data, int length = -1));
+ V8_INLINE static Local<String> NewSymbol(const char* data, int length = -1);
enum NewStringType {
kNormalString, kInternalizedString, kUndetectableString
@@ -1844,13 +1803,13 @@ class V8_EXPORT String : public Primitive {
// TODO(dcarney): deprecate
/** Creates an undetectable string from the supplied ASCII or UTF-8 data.*/
- V8_INLINE(
- static Local<String> NewUndetectable(const char* data, int length = -1));
+ V8_INLINE static Local<String> NewUndetectable(const char* data,
+ int length = -1);
// TODO(dcarney): deprecate
/** Creates an undetectable string from the supplied 16-bit character codes.*/
- V8_INLINE(static Local<String> NewUndetectable(
- const uint16_t* data, int length = -1));
+ V8_INLINE static Local<String> NewUndetectable(const uint16_t* data,
+ int length = -1);
/**
* Converts an object to a UTF-8-encoded character array. Useful if
@@ -1945,7 +1904,7 @@ class V8_EXPORT Symbol : public Primitive {
// Create a symbol with a print name.
static Local<Symbol> New(Isolate *isolate, const char* data, int length = -1);
- V8_INLINE(static Symbol* Cast(v8::Value* obj));
+ V8_INLINE static Symbol* Cast(v8::Value* obj);
private:
Symbol();
static void CheckCast(v8::Value* obj);
@@ -1960,7 +1919,7 @@ class V8_EXPORT Number : public Primitive {
double Value() const;
static Local<Number> New(double value);
static Local<Number> New(Isolate* isolate, double value);
- V8_INLINE(static Number* Cast(v8::Value* obj));
+ V8_INLINE static Number* Cast(v8::Value* obj);
private:
Number();
static void CheckCast(v8::Value* obj);
@@ -1977,7 +1936,7 @@ class V8_EXPORT Integer : public Number {
static Local<Integer> New(int32_t value, Isolate*);
static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*);
int64_t Value() const;
- V8_INLINE(static Integer* Cast(v8::Value* obj));
+ V8_INLINE static Integer* Cast(v8::Value* obj);
private:
Integer();
static void CheckCast(v8::Value* obj);
@@ -2030,16 +1989,11 @@ enum ExternalArrayType {
* setting|getting a particular property. See Object and ObjectTemplate's
* method SetAccessor.
*/
-typedef Handle<Value> (*AccessorGetter)(Local<String> property,
- const AccessorInfo& info);
typedef void (*AccessorGetterCallback)(
Local<String> property,
const PropertyCallbackInfo<Value>& info);
-typedef void (*AccessorSetter)(Local<String> property,
- Local<Value> value,
- const AccessorInfo& info);
typedef void (*AccessorSetterCallback)(
Local<String> property,
Local<Value> value,
@@ -2113,12 +2067,6 @@ class V8_EXPORT Object : public Value {
bool Delete(uint32_t index);
- V8_DEPRECATED(bool SetAccessor(Handle<String> name,
- AccessorGetter getter,
- AccessorSetter setter = 0,
- Handle<Value> data = Handle<Value>(),
- AccessControl settings = DEFAULT,
- PropertyAttribute attribute = None));
bool SetAccessor(Handle<String> name,
AccessorGetterCallback getter,
AccessorSetterCallback setter = 0,
@@ -2127,10 +2075,10 @@ class V8_EXPORT Object : public Value {
PropertyAttribute attribute = None);
// This function is not yet stable and should not be used at this time.
- bool SetAccessor(Handle<String> name,
- Handle<DeclaredAccessorDescriptor> descriptor,
- AccessControl settings = DEFAULT,
- PropertyAttribute attribute = None);
+ bool SetDeclaredAccessor(Local<String> name,
+ Local<DeclaredAccessorDescriptor> descriptor,
+ PropertyAttribute attribute = None,
+ AccessControl settings = DEFAULT);
/**
* Returns an array containing the names of the enumerable properties
@@ -2189,7 +2137,7 @@ class V8_EXPORT Object : public Value {
int InternalFieldCount();
/** Gets the value from an internal field. */
- V8_INLINE(Local<Value> GetInternalField(int index));
+ V8_INLINE Local<Value> GetInternalField(int index);
/** Sets the value in an internal field. */
void SetInternalField(int index, Handle<Value> value);
@@ -2199,7 +2147,7 @@ class V8_EXPORT Object : public Value {
* must have been set by SetAlignedPointerInInternalField, everything else
* leads to undefined behavior.
*/
- V8_INLINE(void* GetAlignedPointerFromInternalField(int index));
+ V8_INLINE void* GetAlignedPointerFromInternalField(int index);
/**
* Sets a 2-byte-aligned native pointer in an internal field. To retrieve such
@@ -2329,7 +2277,7 @@ class V8_EXPORT Object : public Value {
Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]);
static Local<Object> New();
- V8_INLINE(static Object* Cast(Value* obj));
+ V8_INLINE static Object* Cast(Value* obj);
private:
Object();
@@ -2358,18 +2306,135 @@ class V8_EXPORT Array : public Object {
*/
static Local<Array> New(int length = 0);
- V8_INLINE(static Array* Cast(Value* obj));
+ V8_INLINE static Array* Cast(Value* obj);
private:
Array();
static void CheckCast(Value* obj);
};
+template<typename T>
+class ReturnValue {
+ public:
+ template <class S> V8_INLINE ReturnValue(const ReturnValue<S>& that)
+ : value_(that.value_) {
+ TYPE_CHECK(T, S);
+ }
+ // Handle setters
+ template <typename S> V8_INLINE void Set(const Persistent<S>& handle);
+ template <typename S> V8_INLINE void Set(const Handle<S> handle);
+ // Fast primitive setters
+ V8_INLINE void Set(bool value);
+ V8_INLINE void Set(double i);
+ V8_INLINE void Set(int32_t i);
+ V8_INLINE void Set(uint32_t i);
+ // Fast JS primitive setters
+ V8_INLINE void SetNull();
+ V8_INLINE void SetUndefined();
+ V8_INLINE void SetEmptyString();
+ // Convenience getter for Isolate
+ V8_INLINE Isolate* GetIsolate();
+
+ private:
+ template<class F> friend class ReturnValue;
+ template<class F> friend class FunctionCallbackInfo;
+ template<class F> friend class PropertyCallbackInfo;
+ V8_INLINE internal::Object* GetDefaultValue();
+ V8_INLINE explicit ReturnValue(internal::Object** slot);
+ internal::Object** value_;
+};
+
+
+/**
+ * The argument information given to function call callbacks. This
+ * class provides access to information about the context of the call,
+ * including the receiver, the number and values of arguments, and
+ * the holder of the function.
+ */
+template<typename T>
+class FunctionCallbackInfo {
+ public:
+ V8_INLINE int Length() const;
+ V8_INLINE Local<Value> operator[](int i) const;
+ V8_INLINE Local<Function> Callee() const;
+ V8_INLINE Local<Object> This() const;
+ V8_INLINE Local<Object> Holder() const;
+ V8_INLINE bool IsConstructCall() const;
+ V8_INLINE Local<Value> Data() const;
+ V8_INLINE Isolate* GetIsolate() const;
+ V8_INLINE ReturnValue<T> GetReturnValue() const;
+ // This shouldn't be public, but the arm compiler needs it.
+ static const int kArgsLength = 6;
+
+ protected:
+ friend class internal::FunctionCallbackArguments;
+ friend class internal::CustomArguments<FunctionCallbackInfo>;
+ static const int kReturnValueIndex = 0;
+ static const int kReturnValueDefaultValueIndex = -1;
+ static const int kIsolateIndex = -2;
+ static const int kDataIndex = -3;
+ static const int kCalleeIndex = -4;
+ static const int kHolderIndex = -5;
+
+ V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args,
+ internal::Object** values,
+ int length,
+ bool is_construct_call);
+ internal::Object** implicit_args_;
+ internal::Object** values_;
+ int length_;
+ bool is_construct_call_;
+};
+
+
+/**
+ * The information passed to a property callback about the context
+ * of the property access.
+ */
+template<typename T>
+class PropertyCallbackInfo {
+ public:
+ V8_INLINE Isolate* GetIsolate() const;
+ V8_INLINE Local<Value> Data() const;
+ V8_INLINE Local<Object> This() const;
+ V8_INLINE Local<Object> Holder() const;
+ V8_INLINE ReturnValue<T> GetReturnValue() const;
+ // This shouldn't be public, but the arm compiler needs it.
+ static const int kArgsLength = 6;
+
+ protected:
+ friend class MacroAssembler;
+ friend class internal::PropertyCallbackArguments;
+ friend class internal::CustomArguments<PropertyCallbackInfo>;
+ static const int kThisIndex = 0;
+ static const int kDataIndex = -1;
+ static const int kReturnValueIndex = -2;
+ static const int kReturnValueDefaultValueIndex = -3;
+ static const int kIsolateIndex = -4;
+ static const int kHolderIndex = -5;
+
+ V8_INLINE PropertyCallbackInfo(internal::Object** args) : args_(args) {}
+ internal::Object** args_;
+};
+
+
+typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info);
+
+
/**
* A JavaScript function object (ECMA-262, 15.3).
*/
class V8_EXPORT Function : public Object {
public:
+ /**
+ * Create a function in the current execution context
+ * for a given FunctionCallback.
+ */
+ static Local<Function> New(Isolate* isolate,
+ FunctionCallback callback,
+ Local<Value> data = Local<Value>(),
+ int length = 0);
+
Local<Object> NewInstance() const;
Local<Object> NewInstance(int argc, Handle<Value> argv[]) const;
Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]);
@@ -2407,7 +2472,7 @@ class V8_EXPORT Function : public Object {
int ScriptId() const;
ScriptOrigin GetScriptOrigin() const;
- V8_INLINE(static Function* Cast(Value* obj));
+ V8_INLINE static Function* Cast(Value* obj);
static const int kLineOffsetNotFound;
private:
@@ -2447,27 +2512,12 @@ class V8_EXPORT ArrayBuffer : public Object {
* Allocate |length| bytes. Return NULL if allocation is not successful.
* Memory does not have to be initialized.
*/
- virtual void* AllocateUninitialized(size_t length) {
- // Override with call to |Allocate| for compatibility
- // with legacy version.
- return Allocate(length);
- }
-
+ virtual void* AllocateUninitialized(size_t length) = 0;
/**
* Free the memory block of size |length|, pointed to by |data|.
* That memory is guaranteed to be previously allocated by |Allocate|.
*/
- virtual void Free(void* data, size_t length) {
- // Override with call to |Free(void*)| for compatibility
- // with legacy version.
- Free(data);
- }
-
- /**
- * Deprecated. Never called directly by V8.
- * For compatibility with legacy version of this interface.
- */
- virtual void Free(void* data);
+ virtual void Free(void* data, size_t length) = 0;
};
/**
@@ -2541,7 +2591,7 @@ class V8_EXPORT ArrayBuffer : public Object {
*/
Contents Externalize();
- V8_INLINE(static ArrayBuffer* Cast(Value* obj));
+ V8_INLINE static ArrayBuffer* Cast(Value* obj);
static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
@@ -2582,7 +2632,7 @@ class V8_EXPORT ArrayBufferView : public Object {
*/
void* BaseAddress();
- V8_INLINE(static ArrayBufferView* Cast(Value* obj));
+ V8_INLINE static ArrayBufferView* Cast(Value* obj);
static const int kInternalFieldCount =
V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT;
@@ -2606,7 +2656,7 @@ class V8_EXPORT TypedArray : public ArrayBufferView {
*/
size_t Length();
- V8_INLINE(static TypedArray* Cast(Value* obj));
+ V8_INLINE static TypedArray* Cast(Value* obj);
private:
TypedArray();
@@ -2622,7 +2672,7 @@ class V8_EXPORT Uint8Array : public TypedArray {
public:
static Local<Uint8Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
- V8_INLINE(static Uint8Array* Cast(Value* obj));
+ V8_INLINE static Uint8Array* Cast(Value* obj);
private:
Uint8Array();
@@ -2638,7 +2688,7 @@ class V8_EXPORT Uint8ClampedArray : public TypedArray {
public:
static Local<Uint8ClampedArray> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
- V8_INLINE(static Uint8ClampedArray* Cast(Value* obj));
+ V8_INLINE static Uint8ClampedArray* Cast(Value* obj);
private:
Uint8ClampedArray();
@@ -2653,7 +2703,7 @@ class V8_EXPORT Int8Array : public TypedArray {
public:
static Local<Int8Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
- V8_INLINE(static Int8Array* Cast(Value* obj));
+ V8_INLINE static Int8Array* Cast(Value* obj);
private:
Int8Array();
@@ -2669,7 +2719,7 @@ class V8_EXPORT Uint16Array : public TypedArray {
public:
static Local<Uint16Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
- V8_INLINE(static Uint16Array* Cast(Value* obj));
+ V8_INLINE static Uint16Array* Cast(Value* obj);
private:
Uint16Array();
@@ -2685,7 +2735,7 @@ class V8_EXPORT Int16Array : public TypedArray {
public:
static Local<Int16Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
- V8_INLINE(static Int16Array* Cast(Value* obj));
+ V8_INLINE static Int16Array* Cast(Value* obj);
private:
Int16Array();
@@ -2701,7 +2751,7 @@ class V8_EXPORT Uint32Array : public TypedArray {
public:
static Local<Uint32Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
- V8_INLINE(static Uint32Array* Cast(Value* obj));
+ V8_INLINE static Uint32Array* Cast(Value* obj);
private:
Uint32Array();
@@ -2717,7 +2767,7 @@ class V8_EXPORT Int32Array : public TypedArray {
public:
static Local<Int32Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
- V8_INLINE(static Int32Array* Cast(Value* obj));
+ V8_INLINE static Int32Array* Cast(Value* obj);
private:
Int32Array();
@@ -2733,7 +2783,7 @@ class V8_EXPORT Float32Array : public TypedArray {
public:
static Local<Float32Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
- V8_INLINE(static Float32Array* Cast(Value* obj));
+ V8_INLINE static Float32Array* Cast(Value* obj);
private:
Float32Array();
@@ -2749,7 +2799,7 @@ class V8_EXPORT Float64Array : public TypedArray {
public:
static Local<Float64Array> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
- V8_INLINE(static Float64Array* Cast(Value* obj));
+ V8_INLINE static Float64Array* Cast(Value* obj);
private:
Float64Array();
@@ -2765,7 +2815,7 @@ class V8_EXPORT DataView : public ArrayBufferView {
public:
static Local<DataView> New(Handle<ArrayBuffer> array_buffer,
size_t byte_offset, size_t length);
- V8_INLINE(static DataView* Cast(Value* obj));
+ V8_INLINE static DataView* Cast(Value* obj);
private:
DataView();
@@ -2790,7 +2840,7 @@ class V8_EXPORT Date : public Object {
*/
double ValueOf() const;
- V8_INLINE(static Date* Cast(v8::Value* obj));
+ V8_INLINE static Date* Cast(v8::Value* obj);
/**
* Notification that the embedder has changed the time zone,
@@ -2827,7 +2877,7 @@ class V8_EXPORT NumberObject : public Object {
*/
double ValueOf() const;
- V8_INLINE(static NumberObject* Cast(v8::Value* obj));
+ V8_INLINE static NumberObject* Cast(v8::Value* obj);
private:
static void CheckCast(v8::Value* obj);
@@ -2850,7 +2900,7 @@ class V8_EXPORT BooleanObject : public Object {
*/
bool ValueOf() const;
- V8_INLINE(static BooleanObject* Cast(v8::Value* obj));
+ V8_INLINE static BooleanObject* Cast(v8::Value* obj);
private:
static void CheckCast(v8::Value* obj);
@@ -2873,7 +2923,7 @@ class V8_EXPORT StringObject : public Object {
*/
Local<String> ValueOf() const;
- V8_INLINE(static StringObject* Cast(v8::Value* obj));
+ V8_INLINE static StringObject* Cast(v8::Value* obj);
private:
static void CheckCast(v8::Value* obj);
@@ -2898,7 +2948,7 @@ class V8_EXPORT SymbolObject : public Object {
*/
Local<Symbol> ValueOf() const;
- V8_INLINE(static SymbolObject* Cast(v8::Value* obj));
+ V8_INLINE static SymbolObject* Cast(v8::Value* obj);
private:
static void CheckCast(v8::Value* obj);
@@ -2944,7 +2994,7 @@ class V8_EXPORT RegExp : public Object {
*/
Flags GetFlags() const;
- V8_INLINE(static RegExp* Cast(v8::Value* obj));
+ V8_INLINE static RegExp* Cast(v8::Value* obj);
private:
static void CheckCast(v8::Value* obj);
@@ -2958,7 +3008,7 @@ class V8_EXPORT RegExp : public Object {
class V8_EXPORT External : public Value {
public:
static Local<External> New(void* value);
- V8_INLINE(static External* Cast(Value* obj));
+ V8_INLINE static External* Cast(Value* obj);
void* Value() const;
private:
static void CheckCast(v8::Value* obj);
@@ -2976,147 +3026,72 @@ class V8_EXPORT Template : public Data {
/** Adds a property to each instance created by this template.*/
void Set(Handle<String> name, Handle<Data> value,
PropertyAttribute attributes = None);
- V8_INLINE(void Set(const char* name, Handle<Data> value));
- private:
- Template();
+ V8_INLINE void Set(const char* name, Handle<Data> value);
- friend class ObjectTemplate;
- friend class FunctionTemplate;
-};
-
-
-template<typename T>
-class ReturnValue {
- public:
- template <class S> V8_INLINE(ReturnValue(const ReturnValue<S>& that))
- : value_(that.value_) {
- TYPE_CHECK(T, S);
- }
- // Handle setters
- template <typename S> V8_INLINE(void Set(const Persistent<S>& handle));
- template <typename S> V8_INLINE(void Set(const Handle<S> handle));
- // Fast primitive setters
- V8_INLINE(void Set(bool value));
- V8_INLINE(void Set(double i));
- V8_INLINE(void Set(int32_t i));
- V8_INLINE(void Set(uint32_t i));
- // Fast JS primitive setters
- V8_INLINE(void SetNull());
- V8_INLINE(void SetUndefined());
- V8_INLINE(void SetEmptyString());
- // Convenience getter for Isolate
- V8_INLINE(Isolate* GetIsolate());
-
- private:
- template<class F> friend class ReturnValue;
- template<class F> friend class FunctionCallbackInfo;
- template<class F> friend class PropertyCallbackInfo;
- V8_INLINE(internal::Object* GetDefaultValue());
- V8_INLINE(explicit ReturnValue(internal::Object** slot));
- internal::Object** value_;
-};
-
-
-/**
- * The argument information given to function call callbacks. This
- * class provides access to information about the context of the call,
- * including the receiver, the number and values of arguments, and
- * the holder of the function.
- */
-template<typename T>
-class FunctionCallbackInfo {
- public:
- V8_INLINE(int Length() const);
- V8_INLINE(Local<Value> operator[](int i) const);
- V8_INLINE(Local<Function> Callee() const);
- V8_INLINE(Local<Object> This() const);
- V8_INLINE(Local<Object> Holder() const);
- V8_INLINE(bool IsConstructCall() const);
- V8_INLINE(Local<Value> Data() const);
- V8_INLINE(Isolate* GetIsolate() const);
- V8_INLINE(ReturnValue<T> GetReturnValue() const);
- // This shouldn't be public, but the arm compiler needs it.
- static const int kArgsLength = 6;
-
- protected:
- friend class internal::FunctionCallbackArguments;
- friend class internal::CustomArguments<FunctionCallbackInfo>;
- static const int kReturnValueIndex = 0;
- static const int kReturnValueDefaultValueIndex = -1;
- static const int kIsolateIndex = -2;
- static const int kDataIndex = -3;
- static const int kCalleeIndex = -4;
- static const int kHolderIndex = -5;
+ void SetAccessorProperty(
+ Local<String> name,
+ Local<FunctionTemplate> getter = Local<FunctionTemplate>(),
+ Local<FunctionTemplate> setter = Local<FunctionTemplate>(),
+ PropertyAttribute attribute = None,
+ AccessControl settings = DEFAULT);
- V8_INLINE(FunctionCallbackInfo(internal::Object** implicit_args,
- internal::Object** values,
- int length,
- bool is_construct_call));
- internal::Object** implicit_args_;
- internal::Object** values_;
- int length_;
- bool is_construct_call_;
-};
+ /**
+ * Whenever the property with the given name is accessed on objects
+ * created from this Template the getter and setter callbacks
+ * are called instead of getting and setting the property directly
+ * on the JavaScript object.
+ *
+ * \param name The name of the property for which an accessor is added.
+ * \param getter The callback to invoke when getting the property.
+ * \param setter The callback to invoke when setting the property.
+ * \param data A piece of data that will be passed to the getter and setter
+ * callbacks whenever they are invoked.
+ * \param settings Access control settings for the accessor. This is a bit
+ * field consisting of one of more of
+ * DEFAULT = 0, ALL_CAN_READ = 1, or ALL_CAN_WRITE = 2.
+ * The default is to not allow cross-context access.
+ * ALL_CAN_READ means that all cross-context reads are allowed.
+ * ALL_CAN_WRITE means that all cross-context writes are allowed.
+ * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all
+ * cross-context access.
+ * \param attribute The attributes of the property for which an accessor
+ * is added.
+ * \param signature The signature describes valid receivers for the accessor
+ * and is used to perform implicit instance checks against them. If the
+ * receiver is incompatible (i.e. is not an instance of the constructor as
+ * defined by FunctionTemplate::HasInstance()), an implicit TypeError is
+ * thrown and no callback is invoked.
+ */
+ void SetNativeDataProperty(Local<String> name,
+ AccessorGetterCallback getter,
+ AccessorSetterCallback setter = 0,
+ // TODO(dcarney): gcc can't handle Local below
+ Handle<Value> data = Handle<Value>(),
+ PropertyAttribute attribute = None,
+ Local<AccessorSignature> signature =
+ Local<AccessorSignature>(),
+ AccessControl settings = DEFAULT);
+ // This function is not yet stable and should not be used at this time.
+ bool SetDeclaredAccessor(Local<String> name,
+ Local<DeclaredAccessorDescriptor> descriptor,
+ PropertyAttribute attribute = None,
+ Local<AccessorSignature> signature =
+ Local<AccessorSignature>(),
+ AccessControl settings = DEFAULT);
-class V8_EXPORT Arguments : public FunctionCallbackInfo<Value> {
private:
- friend class internal::FunctionCallbackArguments;
- V8_INLINE(Arguments(internal::Object** implicit_args,
- internal::Object** values,
- int length,
- bool is_construct_call));
-};
-
-/**
- * The information passed to a property callback about the context
- * of the property access.
- */
-template<typename T>
-class PropertyCallbackInfo {
- public:
- V8_INLINE(Isolate* GetIsolate() const);
- V8_INLINE(Local<Value> Data() const);
- V8_INLINE(Local<Object> This() const);
- V8_INLINE(Local<Object> Holder() const);
- V8_INLINE(ReturnValue<T> GetReturnValue() const);
- // This shouldn't be public, but the arm compiler needs it.
- static const int kArgsLength = 6;
-
- protected:
- friend class MacroAssembler;
- friend class internal::PropertyCallbackArguments;
- friend class internal::CustomArguments<PropertyCallbackInfo>;
- static const int kThisIndex = 0;
- static const int kHolderIndex = -1;
- static const int kDataIndex = -2;
- static const int kReturnValueIndex = -3;
- static const int kReturnValueDefaultValueIndex = -4;
- static const int kIsolateIndex = -5;
-
- V8_INLINE(PropertyCallbackInfo(internal::Object** args))
- : args_(args) { }
- internal::Object** args_;
-};
-
+ Template();
-class V8_EXPORT AccessorInfo : public PropertyCallbackInfo<Value> {
- private:
- friend class internal::PropertyCallbackArguments;
- V8_INLINE(AccessorInfo(internal::Object** args))
- : PropertyCallbackInfo<Value>(args) { }
+ friend class ObjectTemplate;
+ friend class FunctionTemplate;
};
-typedef Handle<Value> (*InvocationCallback)(const Arguments& args);
-typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info);
-
/**
* NamedProperty[Getter|Setter] are used as interceptors on object.
* See ObjectTemplate::SetNamedPropertyHandler.
*/
-typedef Handle<Value> (*NamedPropertyGetter)(Local<String> property,
- const AccessorInfo& info);
typedef void (*NamedPropertyGetterCallback)(
Local<String> property,
const PropertyCallbackInfo<Value>& info);
@@ -3126,9 +3101,6 @@ typedef void (*NamedPropertyGetterCallback)(
* Returns the value if the setter intercepts the request.
* Otherwise, returns an empty handle.
*/
-typedef Handle<Value> (*NamedPropertySetter)(Local<String> property,
- Local<Value> value,
- const AccessorInfo& info);
typedef void (*NamedPropertySetterCallback)(
Local<String> property,
Local<Value> value,
@@ -3140,8 +3112,6 @@ typedef void (*NamedPropertySetterCallback)(
* The result is an integer encoding property attributes (like v8::None,
* v8::DontEnum, etc.)
*/
-typedef Handle<Integer> (*NamedPropertyQuery)(Local<String> property,
- const AccessorInfo& info);
typedef void (*NamedPropertyQueryCallback)(
Local<String> property,
const PropertyCallbackInfo<Integer>& info);
@@ -3152,8 +3122,6 @@ typedef void (*NamedPropertyQueryCallback)(
* The return value is true if the property could be deleted and false
* otherwise.
*/
-typedef Handle<Boolean> (*NamedPropertyDeleter)(Local<String> property,
- const AccessorInfo& info);
typedef void (*NamedPropertyDeleterCallback)(
Local<String> property,
const PropertyCallbackInfo<Boolean>& info);
@@ -3163,7 +3131,6 @@ typedef void (*NamedPropertyDeleterCallback)(
* Returns an array containing the names of the properties the named
* property getter intercepts.
*/
-typedef Handle<Array> (*NamedPropertyEnumerator)(const AccessorInfo& info);
typedef void (*NamedPropertyEnumeratorCallback)(
const PropertyCallbackInfo<Array>& info);
@@ -3172,8 +3139,6 @@ typedef void (*NamedPropertyEnumeratorCallback)(
* Returns the value of the property if the getter intercepts the
* request. Otherwise, returns an empty handle.
*/
-typedef Handle<Value> (*IndexedPropertyGetter)(uint32_t index,
- const AccessorInfo& info);
typedef void (*IndexedPropertyGetterCallback)(
uint32_t index,
const PropertyCallbackInfo<Value>& info);
@@ -3183,9 +3148,6 @@ typedef void (*IndexedPropertyGetterCallback)(
* Returns the value if the setter intercepts the request.
* Otherwise, returns an empty handle.
*/
-typedef Handle<Value> (*IndexedPropertySetter)(uint32_t index,
- Local<Value> value,
- const AccessorInfo& info);
typedef void (*IndexedPropertySetterCallback)(
uint32_t index,
Local<Value> value,
@@ -3196,8 +3158,6 @@ typedef void (*IndexedPropertySetterCallback)(
* Returns a non-empty handle if the interceptor intercepts the request.
* The result is an integer encoding property attributes.
*/
-typedef Handle<Integer> (*IndexedPropertyQuery)(uint32_t index,
- const AccessorInfo& info);
typedef void (*IndexedPropertyQueryCallback)(
uint32_t index,
const PropertyCallbackInfo<Integer>& info);
@@ -3208,8 +3168,6 @@ typedef void (*IndexedPropertyQueryCallback)(
* The return value is true if the property could be deleted and false
* otherwise.
*/
-typedef Handle<Boolean> (*IndexedPropertyDeleter)(uint32_t index,
- const AccessorInfo& info);
typedef void (*IndexedPropertyDeleterCallback)(
uint32_t index,
const PropertyCallbackInfo<Boolean>& info);
@@ -3219,7 +3177,6 @@ typedef void (*IndexedPropertyDeleterCallback)(
* Returns an array containing the indices of the properties the
* indexed property getter intercepts.
*/
-typedef Handle<Array> (*IndexedPropertyEnumerator)(const AccessorInfo& info);
typedef void (*IndexedPropertyEnumeratorCallback)(
const PropertyCallbackInfo<Array>& info);
@@ -3351,11 +3308,6 @@ typedef bool (*IndexedSecurityCallback)(Local<Object> host,
class V8_EXPORT FunctionTemplate : public Template {
public:
/** Creates a function template.*/
- V8_DEPRECATED(static Local<FunctionTemplate> New(
- InvocationCallback callback,
- Handle<Value> data = Handle<Value>(),
- Handle<Signature> signature = Handle<Signature>(),
- int length = 0));
static Local<FunctionTemplate> New(
FunctionCallback callback = 0,
Handle<Value> data = Handle<Value>(),
@@ -3370,8 +3322,6 @@ class V8_EXPORT FunctionTemplate : public Template {
* callback is called whenever the function created from this
* FunctionTemplate is called.
*/
- V8_DEPRECATED(void SetCallHandler(InvocationCallback callback,
- Handle<Value> data = Handle<Value>()));
void SetCallHandler(FunctionCallback callback,
Handle<Value> data = Handle<Value>());
@@ -3418,6 +3368,12 @@ class V8_EXPORT FunctionTemplate : public Template {
void ReadOnlyPrototype();
/**
+ * Removes the prototype property from functions created from this
+ * FunctionTemplate.
+ */
+ void RemovePrototype();
+
+ /**
* Returns true if the given object is an instance of this function
* template.
*/
@@ -3425,9 +3381,6 @@ class V8_EXPORT FunctionTemplate : public Template {
private:
FunctionTemplate();
- // TODO(dcarney): Remove with SetCallHandler.
- friend class v8::CallHandlerHelper;
- void SetCallHandlerInternal(InvocationCallback callback, Handle<Value> data);
friend class Context;
friend class ObjectTemplate;
};
@@ -3476,14 +3429,6 @@ class V8_EXPORT ObjectTemplate : public Template {
* defined by FunctionTemplate::HasInstance()), an implicit TypeError is
* thrown and no callback is invoked.
*/
- V8_DEPRECATED(void SetAccessor(Handle<String> name,
- AccessorGetter getter,
- AccessorSetter setter = 0,
- Handle<Value> data = Handle<Value>(),
- AccessControl settings = DEFAULT,
- PropertyAttribute attribute = None,
- Handle<AccessorSignature> signature =
- Handle<AccessorSignature>()));
void SetAccessor(Handle<String> name,
AccessorGetterCallback getter,
AccessorSetterCallback setter = 0,
@@ -3493,14 +3438,6 @@ class V8_EXPORT ObjectTemplate : public Template {
Handle<AccessorSignature> signature =
Handle<AccessorSignature>());
- // This function is not yet stable and should not be used at this time.
- bool SetAccessor(Handle<String> name,
- Handle<DeclaredAccessorDescriptor> descriptor,
- AccessControl settings = DEFAULT,
- PropertyAttribute attribute = None,
- Handle<AccessorSignature> signature =
- Handle<AccessorSignature>());
-
/**
* Sets a named property handler on the object template.
*
@@ -3518,13 +3455,6 @@ class V8_EXPORT ObjectTemplate : public Template {
* \param data A piece of data that will be passed to the callbacks
* whenever they are invoked.
*/
- V8_DEPRECATED(void SetNamedPropertyHandler(
- NamedPropertyGetter getter,
- NamedPropertySetter setter = 0,
- NamedPropertyQuery query = 0,
- NamedPropertyDeleter deleter = 0,
- NamedPropertyEnumerator enumerator = 0,
- Handle<Value> data = Handle<Value>()));
void SetNamedPropertyHandler(
NamedPropertyGetterCallback getter,
NamedPropertySetterCallback setter = 0,
@@ -3549,13 +3479,6 @@ class V8_EXPORT ObjectTemplate : public Template {
* \param data A piece of data that will be passed to the callbacks
* whenever they are invoked.
*/
- V8_DEPRECATED(void SetIndexedPropertyHandler(
- IndexedPropertyGetter getter,
- IndexedPropertySetter setter = 0,
- IndexedPropertyQuery query = 0,
- IndexedPropertyDeleter deleter = 0,
- IndexedPropertyEnumerator enumerator = 0,
- Handle<Value> data = Handle<Value>()));
void SetIndexedPropertyHandler(
IndexedPropertyGetterCallback getter,
IndexedPropertySetterCallback setter = 0,
@@ -3570,9 +3493,6 @@ class V8_EXPORT ObjectTemplate : public Template {
* behave like normal JavaScript objects that cannot be called as a
* function.
*/
- V8_DEPRECATED(void SetCallAsFunctionHandler(
- InvocationCallback callback,
- Handle<Value> data = Handle<Value>()));
void SetCallAsFunctionHandler(FunctionCallback callback,
Handle<Value> data = Handle<Value>());
@@ -3783,7 +3703,7 @@ void V8_EXPORT RegisterExtension(Extension* extension);
*/
class V8_EXPORT DeclareExtension {
public:
- V8_INLINE(DeclareExtension(Extension* extension)) {
+ V8_INLINE DeclareExtension(Extension* extension) {
RegisterExtension(extension);
}
};
@@ -3797,10 +3717,10 @@ Handle<Primitive> V8_EXPORT Null();
Handle<Boolean> V8_EXPORT True();
Handle<Boolean> V8_EXPORT False();
-V8_INLINE(Handle<Primitive> Undefined(Isolate* isolate));
-V8_INLINE(Handle<Primitive> Null(Isolate* isolate));
-V8_INLINE(Handle<Boolean> True(Isolate* isolate));
-V8_INLINE(Handle<Boolean> False(Isolate* isolate));
+V8_INLINE Handle<Primitive> Undefined(Isolate* isolate);
+V8_INLINE Handle<Primitive> Null(Isolate* isolate);
+V8_INLINE Handle<Boolean> True(Isolate* isolate);
+V8_INLINE Handle<Boolean> False(Isolate* isolate);
/**
@@ -3824,11 +3744,20 @@ class V8_EXPORT ResourceConstraints {
uint32_t* stack_limit() const { return stack_limit_; }
// Sets an address beyond which the VM's stack may not grow.
void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
+ Maybe<bool> is_memory_constrained() const { return is_memory_constrained_; }
+ // If set to true, V8 will limit it's memory usage, at the potential cost of
+ // lower performance. Note, this option is a tentative addition to the API
+ // and may be removed or modified without warning.
+ void set_memory_constrained(bool value) {
+ is_memory_constrained_ = Maybe<bool>(value);
+ }
+
private:
int max_young_space_size_;
int max_old_space_size_;
int max_executable_size_;
uint32_t* stack_limit_;
+ Maybe<bool> is_memory_constrained_;
};
@@ -4049,13 +3978,13 @@ class V8_EXPORT Isolate {
/**
* Associate embedder-specific data with the isolate
*/
- V8_INLINE(void SetData(void* data));
+ V8_INLINE void SetData(void* data);
/**
* Retrieve embedder-specific data from the isolate.
* Returns NULL if SetData has never been called.
*/
- V8_INLINE(void* GetData());
+ V8_INLINE void* GetData();
/**
* Get statistics about the heap memory usage.
@@ -4327,7 +4256,7 @@ class V8_EXPORT PersistentHandleVisitor { // NOLINT
class V8_EXPORT AssertNoGCScope {
#ifndef DEBUG
// TODO(yangguo): remove isolate argument.
- V8_INLINE(AssertNoGCScope(Isolate* isolate)) { }
+ V8_INLINE AssertNoGCScope(Isolate* isolate) {}
#else
AssertNoGCScope(Isolate* isolate);
~AssertNoGCScope();
@@ -4618,62 +4547,6 @@ class V8_EXPORT V8 {
intptr_t change_in_bytes);
/**
- * Suspends recording of tick samples in the profiler.
- * When the V8 profiling mode is enabled (usually via command line
- * switches) this function suspends recording of tick samples.
- * Profiling ticks are discarded until ResumeProfiler() is called.
- *
- * See also the --prof and --prof_auto command line switches to
- * enable V8 profiling.
- */
- V8_DEPRECATED(static void PauseProfiler());
-
- /**
- * Resumes recording of tick samples in the profiler.
- * See also PauseProfiler().
- */
- V8_DEPRECATED(static void ResumeProfiler());
-
- /**
- * Return whether profiler is currently paused.
- */
- V8_DEPRECATED(static bool IsProfilerPaused());
-
- /**
- * Retrieve the V8 thread id of the calling thread.
- *
- * The thread id for a thread should only be retrieved after the V8
- * lock has been acquired with a Locker object with that thread.
- */
- static int GetCurrentThreadId();
-
- /**
- * Forcefully terminate execution of a JavaScript thread. This can
- * be used to terminate long-running scripts.
- *
- * TerminateExecution should only be called when then V8 lock has
- * been acquired with a Locker object. Therefore, in order to be
- * able to terminate long-running threads, preemption must be
- * enabled to allow the user of TerminateExecution to acquire the
- * lock.
- *
- * The termination is achieved by throwing an exception that is
- * uncatchable by JavaScript exception handlers. Termination
- * exceptions act as if they were caught by a C++ TryCatch exception
- * handler. If forceful termination is used, any C++ TryCatch
- * exception handler that catches an exception should check if that
- * exception is a termination exception and immediately return if
- * that is the case. Returning immediately in that case will
- * continue the propagation of the termination exception if needed.
- *
- * The thread id passed to TerminateExecution must have been
- * obtained by calling GetCurrentThreadId on the thread in question.
- *
- * \param thread_id The thread id of the thread to terminate.
- */
- static void TerminateExecution(int thread_id);
-
- /**
* Forcefully terminate the current thread of JavaScript execution
* in the given isolate. If no isolate is provided, the default
* isolate is used.
@@ -4791,19 +4664,24 @@ class V8_EXPORT V8 {
static internal::Object** GlobalizeReference(internal::Isolate* isolate,
internal::Object** handle);
+ static internal::Object** CopyPersistent(internal::Object** handle);
static void DisposeGlobal(internal::Object** global_handle);
typedef WeakReferenceCallbacks<Value, void>::Revivable RevivableCallback;
+ typedef WeakCallbackData<Value, void>::Callback WeakCallback;
static void MakeWeak(internal::Object** global_handle,
void* data,
+ WeakCallback weak_callback,
RevivableCallback weak_reference_callback);
static void ClearWeak(internal::Object** global_handle);
- static int Eternalize(internal::Isolate* isolate,
- internal::Object** handle);
- static internal::Object** GetEternal(internal::Isolate* isolate, int index);
+ static void Eternalize(Isolate* isolate,
+ Value* handle,
+ int* index);
+ static Local<Value> GetEternal(Isolate* isolate, int index);
template <class T> friend class Handle;
template <class T> friend class Local;
- template <class T> friend class Persistent;
+ template <class T> friend class Eternal;
+ template <class T, class M> friend class Persistent;
friend class Context;
};
@@ -5081,7 +4959,7 @@ class V8_EXPORT Context {
* previous call to SetEmbedderData with the same index. Note that index 0
* currently has a special meaning for Chrome's debugger.
*/
- V8_INLINE(Local<Value> GetEmbedderData(int index));
+ V8_INLINE Local<Value> GetEmbedderData(int index);
/**
* Sets the embedder data with the given index, growing the data as
@@ -5096,7 +4974,7 @@ class V8_EXPORT Context {
* SetAlignedPointerInEmbedderData with the same index. Note that index 0
* currently has a special meaning for Chrome's debugger.
*/
- V8_INLINE(void* GetAlignedPointerFromEmbedderData(int index));
+ V8_INLINE void* GetAlignedPointerFromEmbedderData(int index);
/**
* Sets a 2-byte-aligned native pointer in the embedder data with the given
@@ -5139,19 +5017,15 @@ class V8_EXPORT Context {
*/
class Scope {
public:
- explicit V8_INLINE(Scope(Handle<Context> context)) : context_(context) {
+ explicit V8_INLINE Scope(Handle<Context> context) : context_(context) {
context_->Enter();
}
// TODO(dcarney): deprecate
- V8_INLINE(Scope(Isolate* isolate, Persistent<Context>& context)) // NOLINT
-#ifndef V8_USE_UNSAFE_HANDLES
+ V8_INLINE Scope(Isolate* isolate, Persistent<Context>& context) // NOLINT
: context_(Handle<Context>::New(isolate, context)) {
-#else
- : context_(Local<Context>::New(isolate, context)) {
-#endif
context_->Enter();
}
- V8_INLINE(~Scope()) { context_->Exit(); }
+ V8_INLINE ~Scope() { context_->Exit(); }
private:
Handle<Context> context_;
@@ -5249,7 +5123,7 @@ class V8_EXPORT Unlocker {
/**
* Initialize Unlocker for a given Isolate.
*/
- V8_INLINE(explicit Unlocker(Isolate* isolate)) { Initialize(isolate); }
+ V8_INLINE explicit Unlocker(Isolate* isolate) { Initialize(isolate); }
/** Deprecated. Use Isolate version instead. */
V8_DEPRECATED(Unlocker());
@@ -5267,7 +5141,7 @@ class V8_EXPORT Locker {
/**
* Initialize Locker for a given Isolate.
*/
- V8_INLINE(explicit Locker(Isolate* isolate)) { Initialize(isolate); }
+ V8_INLINE explicit Locker(Isolate* isolate) { Initialize(isolate); }
/** Deprecated. Use Isolate version instead. */
V8_DEPRECATED(Locker());
@@ -5396,7 +5270,7 @@ const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
template <size_t ptr_size> struct SmiTagging;
template<int kSmiShiftSize>
-V8_INLINE(internal::Object* IntToSmi(int value)) {
+V8_INLINE internal::Object* IntToSmi(int value) {
int smi_shift_bits = kSmiTagSize + kSmiShiftSize;
intptr_t tagged_value =
(static_cast<intptr_t>(value) << smi_shift_bits) | kSmiTag;
@@ -5407,15 +5281,15 @@ V8_INLINE(internal::Object* IntToSmi(int value)) {
template <> struct SmiTagging<4> {
static const int kSmiShiftSize = 0;
static const int kSmiValueSize = 31;
- V8_INLINE(static int SmiToInt(internal::Object* value)) {
+ V8_INLINE static int SmiToInt(internal::Object* value) {
int shift_bits = kSmiTagSize + kSmiShiftSize;
// Throw away top 32 bits and shift down (requires >> to be sign extending).
return static_cast<int>(reinterpret_cast<intptr_t>(value)) >> shift_bits;
}
- V8_INLINE(static internal::Object* IntToSmi(int value)) {
+ V8_INLINE static internal::Object* IntToSmi(int value) {
return internal::IntToSmi<kSmiShiftSize>(value);
}
- V8_INLINE(static bool IsValidSmi(intptr_t value)) {
+ V8_INLINE static bool IsValidSmi(intptr_t value) {
// To be representable as an tagged small integer, the two
// most-significant bits of 'value' must be either 00 or 11 due to
// sign-extension. To check this we add 01 to the two
@@ -5435,15 +5309,15 @@ template <> struct SmiTagging<4> {
template <> struct SmiTagging<8> {
static const int kSmiShiftSize = 31;
static const int kSmiValueSize = 32;
- V8_INLINE(static int SmiToInt(internal::Object* value)) {
+ V8_INLINE static int SmiToInt(internal::Object* value) {
int shift_bits = kSmiTagSize + kSmiShiftSize;
// Shift down and throw away top 32 bits.
return static_cast<int>(reinterpret_cast<intptr_t>(value) >> shift_bits);
}
- V8_INLINE(static internal::Object* IntToSmi(int value)) {
+ V8_INLINE static internal::Object* IntToSmi(int value) {
return internal::IntToSmi<kSmiShiftSize>(value);
}
- V8_INLINE(static bool IsValidSmi(intptr_t value)) {
+ V8_INLINE static bool IsValidSmi(intptr_t value) {
// To be representable as a long smi, the value must be a 32-bit integer.
return (value == static_cast<int32_t>(value));
}
@@ -5452,6 +5326,8 @@ template <> struct SmiTagging<8> {
typedef SmiTagging<kApiPointerSize> PlatformSmiTagging;
const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
+V8_INLINE static bool SmiValuesAre31Bits() { return kSmiValueSize == 31; }
+V8_INLINE static bool SmiValuesAre32Bits() { return kSmiValueSize == 32; }
/**
* This class exports constants and functionality from within v8 that
@@ -5483,7 +5359,7 @@ class Internals {
static const int kNullValueRootIndex = 7;
static const int kTrueValueRootIndex = 8;
static const int kFalseValueRootIndex = 9;
- static const int kEmptyStringRootIndex = 133;
+ static const int kEmptyStringRootIndex = 131;
static const int kNodeClassIdOffset = 1 * kApiPointerSize;
static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
@@ -5503,94 +5379,93 @@ class Internals {
static const int kNullOddballKind = 3;
static void CheckInitializedImpl(v8::Isolate* isolate);
- V8_INLINE(static void CheckInitialized(v8::Isolate* isolate)) {
+ V8_INLINE static void CheckInitialized(v8::Isolate* isolate) {
#ifdef V8_ENABLE_CHECKS
CheckInitializedImpl(isolate);
#endif
}
- V8_INLINE(static bool HasHeapObjectTag(internal::Object* value)) {
+ V8_INLINE static bool HasHeapObjectTag(internal::Object* value) {
return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
kHeapObjectTag);
}
- V8_INLINE(static int SmiValue(internal::Object* value)) {
+ V8_INLINE static int SmiValue(internal::Object* value) {
return PlatformSmiTagging::SmiToInt(value);
}
- V8_INLINE(static internal::Object* IntToSmi(int value)) {
+ V8_INLINE static internal::Object* IntToSmi(int value) {
return PlatformSmiTagging::IntToSmi(value);
}
- V8_INLINE(static bool IsValidSmi(intptr_t value)) {
+ V8_INLINE static bool IsValidSmi(intptr_t value) {
return PlatformSmiTagging::IsValidSmi(value);
}
- V8_INLINE(static int GetInstanceType(internal::Object* obj)) {
+ V8_INLINE static int GetInstanceType(internal::Object* obj) {
typedef internal::Object O;
O* map = ReadField<O*>(obj, kHeapObjectMapOffset);
return ReadField<uint8_t>(map, kMapInstanceTypeOffset);
}
- V8_INLINE(static int GetOddballKind(internal::Object* obj)) {
+ V8_INLINE static int GetOddballKind(internal::Object* obj) {
typedef internal::Object O;
return SmiValue(ReadField<O*>(obj, kOddballKindOffset));
}
- V8_INLINE(static bool IsExternalTwoByteString(int instance_type)) {
+ V8_INLINE static bool IsExternalTwoByteString(int instance_type) {
int representation = (instance_type & kFullStringRepresentationMask);
return representation == kExternalTwoByteRepresentationTag;
}
- V8_INLINE(static uint8_t GetNodeFlag(internal::Object** obj, int shift)) {
+ V8_INLINE static uint8_t GetNodeFlag(internal::Object** obj, int shift) {
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
return *addr & static_cast<uint8_t>(1U << shift);
}
- V8_INLINE(static void UpdateNodeFlag(internal::Object** obj,
- bool value, int shift)) {
+ V8_INLINE static void UpdateNodeFlag(internal::Object** obj,
+ bool value, int shift) {
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
uint8_t mask = static_cast<uint8_t>(1 << shift);
*addr = static_cast<uint8_t>((*addr & ~mask) | (value << shift));
}
- V8_INLINE(static uint8_t GetNodeState(internal::Object** obj)) {
+ V8_INLINE static uint8_t GetNodeState(internal::Object** obj) {
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
return *addr & kNodeStateMask;
}
- V8_INLINE(static void UpdateNodeState(internal::Object** obj,
- uint8_t value)) {
+ V8_INLINE static void UpdateNodeState(internal::Object** obj,
+ uint8_t value) {
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
*addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value);
}
- V8_INLINE(static void SetEmbedderData(v8::Isolate* isolate, void* data)) {
+ V8_INLINE static void SetEmbedderData(v8::Isolate* isolate, void* data) {
uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
kIsolateEmbedderDataOffset;
*reinterpret_cast<void**>(addr) = data;
}
- V8_INLINE(static void* GetEmbedderData(v8::Isolate* isolate)) {
+ V8_INLINE static void* GetEmbedderData(v8::Isolate* isolate) {
uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
kIsolateEmbedderDataOffset;
return *reinterpret_cast<void**>(addr);
}
- V8_INLINE(static internal::Object** GetRoot(v8::Isolate* isolate,
- int index)) {
+ V8_INLINE static internal::Object** GetRoot(v8::Isolate* isolate,
+ int index) {
uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffset;
return reinterpret_cast<internal::Object**>(addr + index * kApiPointerSize);
}
- template <typename T>
- V8_INLINE(static T ReadField(Object* ptr, int offset)) {
+ template <typename T> V8_INLINE static T ReadField(Object* ptr, int offset) {
uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectTag;
return *reinterpret_cast<T*>(addr);
}
template <typename T>
- V8_INLINE(static T ReadEmbedderData(Context* context, int index)) {
+ V8_INLINE static T ReadEmbedderData(Context* context, int index) {
typedef internal::Object O;
typedef internal::Internals I;
O* ctx = *reinterpret_cast<O**>(context);
@@ -5602,13 +5477,13 @@ class Internals {
return I::ReadField<T>(embedder_data, value_offset);
}
- V8_INLINE(static bool CanCastToHeapObject(void* o)) { return false; }
- V8_INLINE(static bool CanCastToHeapObject(Context* o)) { return true; }
- V8_INLINE(static bool CanCastToHeapObject(String* o)) { return true; }
- V8_INLINE(static bool CanCastToHeapObject(Object* o)) { return true; }
- V8_INLINE(static bool CanCastToHeapObject(Message* o)) { return true; }
- V8_INLINE(static bool CanCastToHeapObject(StackTrace* o)) { return true; }
- V8_INLINE(static bool CanCastToHeapObject(StackFrame* o)) { return true; }
+ V8_INLINE static bool CanCastToHeapObject(void* o) { return false; }
+ V8_INLINE static bool CanCastToHeapObject(Context* o) { return true; }
+ V8_INLINE static bool CanCastToHeapObject(String* o) { return true; }
+ V8_INLINE static bool CanCastToHeapObject(Object* o) { return true; }
+ V8_INLINE static bool CanCastToHeapObject(Message* o) { return true; }
+ V8_INLINE static bool CanCastToHeapObject(StackTrace* o) { return true; }
+ V8_INLINE static bool CanCastToHeapObject(StackFrame* o) { return true; }
};
} // namespace internal
@@ -5636,9 +5511,9 @@ Local<T> Local<T>::New(Isolate* isolate, Handle<T> that) {
return New(isolate, that.val_);
}
-#ifndef V8_USE_UNSAFE_HANDLES
template <class T>
-Local<T> Local<T>::New(Isolate* isolate, const Persistent<T>& that) {
+template <class M>
+Local<T> Local<T>::New(Isolate* isolate, const Persistent<T, M>& that) {
return New(isolate, that.val_);
}
@@ -5650,7 +5525,6 @@ Handle<T> Handle<T>::New(Isolate* isolate, T* that) {
return Handle<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(
reinterpret_cast<internal::Isolate*>(isolate), *p)));
}
-#endif
template <class T>
@@ -5664,41 +5538,21 @@ Local<T> Local<T>::New(Isolate* isolate, T* that) {
template<class T>
-int Local<T>::Eternalize(Isolate* isolate) {
- return V8::Eternalize(reinterpret_cast<internal::Isolate*>(isolate),
- reinterpret_cast<internal::Object**>(this->val_));
+template<class S>
+void Eternal<T>::Set(Isolate* isolate, Local<S> handle) {
+ TYPE_CHECK(T, S);
+ V8::Eternalize(isolate, reinterpret_cast<Value*>(*handle), &this->index_);
}
template<class T>
-Local<T> Local<T>::GetEternal(Isolate* isolate, int index) {
- internal::Object** handle =
- V8::GetEternal(reinterpret_cast<internal::Isolate*>(isolate), index);
- return Local<T>(T::Cast(reinterpret_cast<Value*>(handle)));
-}
-
-
-#ifdef V8_USE_UNSAFE_HANDLES
-template <class T>
-Persistent<T> Persistent<T>::New(Handle<T> that) {
- return New(Isolate::GetCurrent(), that.val_);
+Local<T> Eternal<T>::Get(Isolate* isolate) {
+ return Local<T>(reinterpret_cast<T*>(*V8::GetEternal(isolate, index_)));
}
-template <class T>
-Persistent<T> Persistent<T>::New(Isolate* isolate, Handle<T> that) {
- return New(Isolate::GetCurrent(), that.val_);
-}
-
-template <class T>
-Persistent<T> Persistent<T>::New(Isolate* isolate, Persistent<T> that) {
- return New(Isolate::GetCurrent(), that.val_);
-}
-#endif
-
-
-template <class T>
-T* Persistent<T>::New(Isolate* isolate, T* that) {
+template <class T, class M>
+T* Persistent<T, M>::New(Isolate* isolate, T* that) {
if (that == NULL) return NULL;
internal::Object** p = reinterpret_cast<internal::Object**>(that);
return reinterpret_cast<T*>(
@@ -5707,8 +5561,20 @@ T* Persistent<T>::New(Isolate* isolate, T* that) {
}
-template <class T>
-bool Persistent<T>::IsIndependent() const {
+template <class T, class M>
+template <class S, class M2>
+void Persistent<T, M>::Copy(const Persistent<S, M2>& that) {
+ TYPE_CHECK(T, S);
+ Reset();
+ if (that.IsEmpty()) return;
+ internal::Object** p = reinterpret_cast<internal::Object**>(that.val_);
+ this->val_ = reinterpret_cast<T*>(V8::CopyPersistent(p));
+ M::Copy(that, this);
+}
+
+
+template <class T, class M>
+bool Persistent<T, M>::IsIndependent() const {
typedef internal::Internals I;
if (this->IsEmpty()) return false;
return I::GetNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
@@ -5716,8 +5582,8 @@ bool Persistent<T>::IsIndependent() const {
}
-template <class T>
-bool Persistent<T>::IsNearDeath() const {
+template <class T, class M>
+bool Persistent<T, M>::IsNearDeath() const {
typedef internal::Internals I;
if (this->IsEmpty()) return false;
uint8_t node_state =
@@ -5727,8 +5593,8 @@ bool Persistent<T>::IsNearDeath() const {
}
-template <class T>
-bool Persistent<T>::IsWeak() const {
+template <class T, class M>
+bool Persistent<T, M>::IsWeak() const {
typedef internal::Internals I;
if (this->IsEmpty()) return false;
return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) ==
@@ -5736,66 +5602,89 @@ bool Persistent<T>::IsWeak() const {
}
-template <class T>
-void Persistent<T>::Dispose() {
+template <class T, class M>
+void Persistent<T, M>::Reset() {
if (this->IsEmpty()) return;
V8::DisposeGlobal(reinterpret_cast<internal::Object**>(this->val_));
-#ifndef V8_USE_UNSAFE_HANDLES
val_ = 0;
-#endif
}
-template <class T>
+template <class T, class M>
+template <class S>
+void Persistent<T, M>::Reset(Isolate* isolate, const Handle<S>& other) {
+ TYPE_CHECK(T, S);
+ Reset();
+ if (other.IsEmpty()) return;
+ this->val_ = New(isolate, other.val_);
+}
+
+
+template <class T, class M>
+template <class S, class M2>
+void Persistent<T, M>::Reset(Isolate* isolate,
+ const Persistent<S, M2>& other) {
+ TYPE_CHECK(T, S);
+ Reset();
+ if (other.IsEmpty()) return;
+ this->val_ = New(isolate, other.val_);
+}
+
+
+template <class T, class M>
template <typename S, typename P>
-void Persistent<T>::MakeWeak(
- P* parameters,
- typename WeakReferenceCallbacks<S, P>::Revivable callback) {
+void Persistent<T, M>::SetWeak(
+ P* parameter,
+ typename WeakCallbackData<S, P>::Callback callback) {
TYPE_CHECK(S, T);
- typedef typename WeakReferenceCallbacks<Value, void>::Revivable Revivable;
+ typedef typename WeakCallbackData<Value, void>::Callback Callback;
V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_),
- parameters,
- reinterpret_cast<Revivable>(callback));
+ parameter,
+ reinterpret_cast<Callback>(callback),
+ NULL);
}
-template <class T>
+template <class T, class M>
template <typename P>
-void Persistent<T>::MakeWeak(
- P* parameters,
- typename WeakReferenceCallbacks<T, P>::Revivable callback) {
- MakeWeak<T, P>(parameters, callback);
+void Persistent<T, M>::SetWeak(
+ P* parameter,
+ typename WeakCallbackData<T, P>::Callback callback) {
+ SetWeak<T, P>(parameter, callback);
}
-template <class T>
+template <class T, class M>
template <typename S, typename P>
-void Persistent<T>::MakeWeak(
- Isolate* isolate,
+void Persistent<T, M>::MakeWeak(
P* parameters,
typename WeakReferenceCallbacks<S, P>::Revivable callback) {
- MakeWeak<S, P>(parameters, callback);
+ TYPE_CHECK(S, T);
+ typedef typename WeakReferenceCallbacks<Value, void>::Revivable Revivable;
+ V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_),
+ parameters,
+ NULL,
+ reinterpret_cast<Revivable>(callback));
}
-template <class T>
-template<typename P>
-void Persistent<T>::MakeWeak(
- Isolate* isolate,
+template <class T, class M>
+template <typename P>
+void Persistent<T, M>::MakeWeak(
P* parameters,
typename WeakReferenceCallbacks<T, P>::Revivable callback) {
- MakeWeak<P>(parameters, callback);
+ MakeWeak<T, P>(parameters, callback);
}
-template <class T>
-void Persistent<T>::ClearWeak() {
+template <class T, class M>
+void Persistent<T, M>::ClearWeak() {
V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_));
}
-template <class T>
-void Persistent<T>::MarkIndependent() {
+template <class T, class M>
+void Persistent<T, M>::MarkIndependent() {
typedef internal::Internals I;
if (this->IsEmpty()) return;
I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
@@ -5804,8 +5693,8 @@ void Persistent<T>::MarkIndependent() {
}
-template <class T>
-void Persistent<T>::MarkPartiallyDependent() {
+template <class T, class M>
+void Persistent<T, M>::MarkPartiallyDependent() {
typedef internal::Internals I;
if (this->IsEmpty()) return;
I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
@@ -5814,54 +5703,17 @@ void Persistent<T>::MarkPartiallyDependent() {
}
-template <class T>
-void Persistent<T>::Reset(Isolate* isolate, const Handle<T>& other) {
- Dispose(isolate);
-#ifdef V8_USE_UNSAFE_HANDLES
- *this = *New(isolate, other);
-#else
- if (other.IsEmpty()) {
- this->val_ = NULL;
- return;
- }
- internal::Object** p = reinterpret_cast<internal::Object**>(other.val_);
- this->val_ = reinterpret_cast<T*>(
- V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate), p));
-#endif
-}
-
-
-#ifndef V8_USE_UNSAFE_HANDLES
-template <class T>
-void Persistent<T>::Reset(Isolate* isolate, const Persistent<T>& other) {
- Dispose(isolate);
- if (other.IsEmpty()) {
- this->val_ = NULL;
- return;
- }
- internal::Object** p = reinterpret_cast<internal::Object**>(other.val_);
- this->val_ = reinterpret_cast<T*>(
- V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate), p));
-}
-#endif
-
-
-template <class T>
-T* Persistent<T>::ClearAndLeak() {
+template <class T, class M>
+T* Persistent<T, M>::ClearAndLeak() {
T* old;
-#ifdef V8_USE_UNSAFE_HANDLES
- old = **this;
- *this = Persistent<T>();
-#else
old = val_;
val_ = NULL;
-#endif
return old;
}
-template <class T>
-void Persistent<T>::SetWrapperClassId(uint16_t class_id) {
+template <class T, class M>
+void Persistent<T, M>::SetWrapperClassId(uint16_t class_id) {
typedef internal::Internals I;
if (this->IsEmpty()) return;
internal::Object** obj = reinterpret_cast<internal::Object**>(this->val_);
@@ -5870,8 +5722,8 @@ void Persistent<T>::SetWrapperClassId(uint16_t class_id) {
}
-template <class T>
-uint16_t Persistent<T>::WrapperClassId() const {
+template <class T, class M>
+uint16_t Persistent<T, M>::WrapperClassId() const {
typedef internal::Internals I;
if (this->IsEmpty()) return 0;
internal::Object** obj = reinterpret_cast<internal::Object**>(this->val_);
@@ -5993,13 +5845,6 @@ FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Object** implicit_args,
is_construct_call_(is_construct_call) { }
-Arguments::Arguments(internal::Object** args,
- internal::Object** values,
- int length,
- bool is_construct_call)
- : FunctionCallbackInfo<Value>(args, values, length, is_construct_call) { }
-
-
template<typename T>
Local<Value> FunctionCallbackInfo<T>::operator[](int i) const {
if (i < 0 || length_ <= i) return Local<Value>(*Undefined());
diff --git a/deps/v8/include/v8config.h b/deps/v8/include/v8config.h
new file mode 100644
index 0000000000..6fe5c5aabc
--- /dev/null
+++ b/deps/v8/include/v8config.h
@@ -0,0 +1,451 @@
+// Copyright 2013 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef V8CONFIG_H_
+#define V8CONFIG_H_
+
+// Platform headers for feature detection below.
+#if defined(__ANDROID__)
+# include <sys/cdefs.h>
+#elif defined(__APPLE__)
+# include <TargetConditionals.h>
+#elif defined(__linux__)
+# include <features.h>
+#endif
+
+
+// This macro allows to test for the version of the GNU C library (or
+// a compatible C library that masquerades as glibc). It evaluates to
+// 0 if libc is not GNU libc or compatible.
+// Use like:
+// #if V8_GLIBC_PREREQ(2, 3)
+// ...
+// #endif
+#if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
+# define V8_GLIBC_PREREQ(major, minor) \
+ ((__GLIBC__ * 100 + __GLIBC_MINOR__) >= ((major) * 100 + (minor)))
+#else
+# define V8_GLIBC_PREREQ(major, minor) 0
+#endif
+
+
+// This macro allows to test for the version of the GNU C++ compiler.
+// Note that this also applies to compilers that masquerade as GCC,
+// for example clang and the Intel C++ compiler for Linux.
+// Use like:
+// #if V8_GNUC_PREREQ(4, 3, 1)
+// ...
+// #endif
+#if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
+# define V8_GNUC_PREREQ(major, minor, patchlevel) \
+ ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= \
+ ((major) * 10000 + (minor) * 100 + (patchlevel)))
+#elif defined(__GNUC__) && defined(__GNUC_MINOR__)
+# define V8_GNUC_PREREQ(major, minor, patchlevel) \
+ ((__GNUC__ * 10000 + __GNUC_MINOR__) >= \
+ ((major) * 10000 + (minor) * 100 + (patchlevel)))
+#else
+# define V8_GNUC_PREREQ(major, minor, patchlevel) 0
+#endif
+
+
+
+// -----------------------------------------------------------------------------
+// Operating system detection
+//
+// V8_OS_ANDROID - Android
+// V8_OS_BSD - BSDish (Mac OS X, Net/Free/Open/DragonFlyBSD)
+// V8_OS_CYGWIN - Cygwin
+// V8_OS_DRAGONFLYBSD - DragonFlyBSD
+// V8_OS_FREEBSD - FreeBSD
+// V8_OS_LINUX - Linux
+// V8_OS_MACOSX - Mac OS X
+// V8_OS_NACL - Native Client
+// V8_OS_NETBSD - NetBSD
+// V8_OS_OPENBSD - OpenBSD
+// V8_OS_POSIX - POSIX compatible (mostly everything except Windows)
+// V8_OS_SOLARIS - Sun Solaris and OpenSolaris
+// V8_OS_WIN - Microsoft Windows
+
+#if defined(__ANDROID__)
+# define V8_OS_ANDROID 1
+# define V8_OS_LINUX 1
+# define V8_OS_POSIX 1
+#elif defined(__APPLE__)
+# define V8_OS_BSD 1
+# define V8_OS_MACOSX 1
+# define V8_OS_POSIX 1
+#elif defined(__native_client__)
+# define V8_OS_NACL 1
+# define V8_OS_POSIX 1
+#elif defined(__CYGWIN__)
+# define V8_OS_CYGWIN 1
+# define V8_OS_POSIX 1
+#elif defined(__linux__)
+# define V8_OS_LINUX 1
+# define V8_OS_POSIX 1
+#elif defined(__sun)
+# define V8_OS_POSIX 1
+# define V8_OS_SOLARIS 1
+#elif defined(__FreeBSD__)
+# define V8_OS_BSD 1
+# define V8_OS_FREEBSD 1
+# define V8_OS_POSIX 1
+#elif defined(__DragonFly__)
+# define V8_OS_BSD 1
+# define V8_OS_DRAGONFLYBSD 1
+# define V8_OS_POSIX 1
+#elif defined(__NetBSD__)
+# define V8_OS_BSD 1
+# define V8_OS_NETBSD 1
+# define V8_OS_POSIX 1
+#elif defined(__OpenBSD__)
+# define V8_OS_BSD 1
+# define V8_OS_OPENBSD 1
+# define V8_OS_POSIX 1
+#elif defined(_WIN32)
+# define V8_OS_WIN 1
+#endif
+
+
+// -----------------------------------------------------------------------------
+// C library detection
+//
+// V8_LIBC_BIONIC - Bionic libc
+// V8_LIBC_BSD - BSD libc derivate
+// V8_LIBC_GLIBC - GNU C library
+// V8_LIBC_UCLIBC - uClibc
+//
+// Note that testing for libc must be done using #if not #ifdef. For example,
+// to test for the GNU C library, use:
+// #if V8_LIBC_GLIBC
+// ...
+// #endif
+
+#if defined(__BIONIC__)
+# define V8_LIBC_BIONIC 1
+# define V8_LIBC_BSD 1
+#elif defined(__UCLIBC__)
+# define V8_LIBC_UCLIBC 1
+#elif defined(__GLIBC__) || defined(__GNU_LIBRARY__)
+# define V8_LIBC_GLIBC 1
+#else
+# define V8_LIBC_BSD V8_OS_BSD
+#endif
+
+
+// -----------------------------------------------------------------------------
+// Compiler detection
+//
+// V8_CC_CLANG - Clang
+// V8_CC_GNU - GNU C++
+// V8_CC_INTEL - Intel C++
+// V8_CC_MINGW - Minimalist GNU for Windows
+// V8_CC_MINGW32 - Minimalist GNU for Windows (mingw32)
+// V8_CC_MINGW64 - Minimalist GNU for Windows (mingw-w64)
+// V8_CC_MSVC - Microsoft Visual C/C++
+//
+// C++11 feature detection
+//
+// V8_HAS_CXX11_ALIGNAS - alignas specifier supported
+// V8_HAS_CXX11_ALIGNOF - alignof(type) operator supported
+// V8_HAS_CXX11_STATIC_ASSERT - static_assert() supported
+// V8_HAS_CXX11_DELETE - deleted functions supported
+// V8_HAS_CXX11_FINAL - final marker supported
+// V8_HAS_CXX11_OVERRIDE - override marker supported
+//
+// Compiler-specific feature detection
+//
+// V8_HAS___ALIGNOF - __alignof(type) operator supported
+// V8_HAS___ALIGNOF__ - __alignof__(type) operator supported
+// V8_HAS_ATTRIBUTE_ALIGNED - __attribute__((aligned(n))) supported
+// V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline))
+// supported
+// V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported
+// V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
+// V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
+// V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result))
+// supported
+// V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported
+// V8_HAS_DECLSPEC_ALIGN - __declspec(align(n)) supported
+// V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported
+// V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
+// V8_HAS___FINAL - __final supported in non-C++11 mode
+// V8_HAS___FORCEINLINE - __forceinline supported
+// V8_HAS_SEALED - MSVC style sealed marker supported
+//
+// Note that testing for compilers and/or features must be done using #if
+// not #ifdef. For example, to test for Intel C++ Compiler, use:
+// #if V8_CC_INTEL
+// ...
+// #endif
+
+#if defined(__clang__)
+
+# define V8_CC_CLANG 1
+
+// Clang defines __alignof__ as alias for __alignof
+# define V8_HAS___ALIGNOF 1
+# define V8_HAS___ALIGNOF__ V8_HAS___ALIGNOF
+
+# define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned))
+# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
+# define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
+# define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
+# define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
+# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
+ (__has_attribute(warn_unused_result))
+
+# define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
+
+# define V8_HAS_CXX11_ALIGNAS (__has_feature(cxx_alignas))
+# define V8_HAS_CXX11_STATIC_ASSERT (__has_feature(cxx_static_assert))
+# define V8_HAS_CXX11_DELETE (__has_feature(cxx_deleted_functions))
+# define V8_HAS_CXX11_FINAL (__has_feature(cxx_override_control))
+# define V8_HAS_CXX11_OVERRIDE (__has_feature(cxx_override_control))
+
+#elif defined(__GNUC__)
+
+# define V8_CC_GNU 1
+// Intel C++ also masquerades as GCC 3.2.0
+# define V8_CC_INTEL (defined(__INTEL_COMPILER))
+# define V8_CC_MINGW32 (defined(__MINGW32__))
+# define V8_CC_MINGW64 (defined(__MINGW64__))
+# define V8_CC_MINGW (V8_CC_MINGW32 || V8_CC_MINGW64)
+
+# define V8_HAS___ALIGNOF__ (V8_GNUC_PREREQ(4, 3, 0))
+
+# define V8_HAS_ATTRIBUTE_ALIGNED (V8_GNUC_PREREQ(2, 95, 0))
+// always_inline is available in gcc 4.0 but not very reliable until 4.4.
+// Works around "sorry, unimplemented: inlining failed" build errors with
+// older compilers.
+# define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0))
+# define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
+# define V8_HAS_ATTRIBUTE_NOINLINE (V8_GNUC_PREREQ(3, 4, 0))
+# define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0))
+# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
+ (!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0))
+
+# define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0))
+
+// g++ requires -std=c++0x or -std=gnu++0x to support C++11 functionality
+// without warnings (functionality used by the macros below). These modes
+// are detectable by checking whether __GXX_EXPERIMENTAL_CXX0X__ is defined or,
+// more standardly, by checking whether __cplusplus has a C++11 or greater
+// value. Current versions of g++ do not correctly set __cplusplus, so we check
+// both for forward compatibility.
+# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
+# define V8_HAS_CXX11_ALIGNAS (V8_GNUC_PREREQ(4, 8, 0))
+# define V8_HAS_CXX11_ALIGNOF (V8_GNUC_PREREQ(4, 8, 0))
+# define V8_HAS_CXX11_STATIC_ASSERT (V8_GNUC_PREREQ(4, 3, 0))
+# define V8_HAS_CXX11_DELETE (V8_GNUC_PREREQ(4, 4, 0))
+# define V8_HAS_CXX11_OVERRIDE (V8_GNUC_PREREQ(4, 7, 0))
+# define V8_HAS_CXX11_FINAL (V8_GNUC_PREREQ(4, 7, 0))
+# else
+// '__final' is a non-C++11 GCC synonym for 'final', per GCC r176655.
+# define V8_HAS___FINAL (V8_GNUC_PREREQ(4, 7, 0))
+# endif
+
+#elif defined(_MSC_VER)
+
+# define V8_CC_MSVC 1
+
+# define V8_HAS___ALIGNOF 1
+
+// Override control was added with Visual Studio 2005, but
+// Visual Studio 2010 and earlier spell "final" as "sealed".
+# define V8_HAS_CXX11_FINAL (_MSC_VER >= 1700)
+# define V8_HAS_CXX11_OVERRIDE (_MSC_VER >= 1400)
+# define V8_HAS_SEALED (_MSC_VER >= 1400)
+
+# define V8_HAS_DECLSPEC_ALIGN 1
+# define V8_HAS_DECLSPEC_DEPRECATED (_MSC_VER >= 1300)
+# define V8_HAS_DECLSPEC_NOINLINE 1
+
+# define V8_HAS___FORCEINLINE 1
+
+#endif
+
+
+// -----------------------------------------------------------------------------
+// Helper macros
+
+// A macro used to make better inlining. Don't bother for debug builds.
+// Use like:
+// V8_INLINE int GetZero() { return 0; }
+#if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE
+# define V8_INLINE inline __attribute__((always_inline))
+#elif !defined(DEBUG) && V8_HAS___FORCEINLINE
+# define V8_INLINE __forceinline
+#else
+# define V8_INLINE inline
+#endif
+
+
+// A macro used to tell the compiler to never inline a particular function.
+// Don't bother for debug builds.
+// Use like:
+// V8_NOINLINE int GetMinusOne() { return -1; }
+#if !defined(DEBUG) && V8_HAS_ATTRIBUTE_NOINLINE
+# define V8_NOINLINE __attribute__((noinline))
+#elif !defined(DEBUG) && V8_HAS_DECLSPEC_NOINLINE
+# define V8_NOINLINE __declspec(noinline)
+#else
+# define V8_NOINLINE /* NOT SUPPORTED */
+#endif
+
+
+// A macro to mark classes or functions as deprecated.
+#if !V8_DISABLE_DEPRECATIONS && V8_HAS_ATTRIBUTE_DEPRECATED
+# define V8_DEPRECATED(declarator) declarator __attribute__((deprecated))
+#elif !V8_DISABLE_DEPRECATIONS && V8_HAS_DECLSPEC_DEPRECATED
+# define V8_DEPRECATED(declarator) __declspec(deprecated) declarator
+#else
+# define V8_DEPRECATED(declarator) declarator
+#endif
+
+
+// Annotate a function indicating the caller must examine the return value.
+// Use like:
+// int foo() V8_WARN_UNUSED_RESULT;
+#if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
+# define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#else
+# define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
+#endif
+
+
+// A macro to provide the compiler with branch prediction information.
+#if V8_HAS_BUILTIN_EXPECT
+# define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
+# define V8_LIKELY(condition) (__builtin_expect(!!(condition), 1))
+#else
+# define V8_UNLIKELY(condition) (condition)
+# define V8_LIKELY(condition) (condition)
+#endif
+
+
+// A macro to specify that a method is deleted from the corresponding class.
+// Any attempt to use the method will always produce an error at compile time
+// when this macro can be implemented (i.e. if the compiler supports C++11).
+// If the current compiler does not support C++11, use of the annotated method
+// will still cause an error, but the error will most likely occur at link time
+// rather than at compile time. As a backstop, method declarations using this
+// macro should be private.
+// Use like:
+// class A {
+// private:
+// A(const A& other) V8_DELETE;
+// A& operator=(const A& other) V8_DELETE;
+// };
+#if V8_HAS_CXX11_DELETE
+# define V8_DELETE = delete
+#else
+# define V8_DELETE /* NOT SUPPORTED */
+#endif
+
+
+// Annotate a virtual method indicating it must be overriding a virtual
+// method in the parent class.
+// Use like:
+// virtual void bar() V8_OVERRIDE;
+#if V8_HAS_CXX11_OVERRIDE
+# define V8_OVERRIDE override
+#else
+# define V8_OVERRIDE /* NOT SUPPORTED */
+#endif
+
+
+// Annotate a virtual method indicating that subclasses must not override it,
+// or annotate a class to indicate that it cannot be subclassed.
+// Use like:
+// class B V8_FINAL : public A {};
+// virtual void bar() V8_FINAL;
+#if V8_HAS_CXX11_FINAL
+# define V8_FINAL final
+#elif V8_HAS___FINAL
+# define V8_FINAL __final
+#elif V8_HAS_SEALED
+# define V8_FINAL sealed
+#else
+# define V8_FINAL /* NOT SUPPORTED */
+#endif
+
+
+// This macro allows to specify memory alignment for structs, classes, etc.
+// Use like:
+// class V8_ALIGNED(16) MyClass { ... };
+// V8_ALIGNED(32) int array[42];
+#if V8_HAS_CXX11_ALIGNAS
+# define V8_ALIGNED(n) alignas(n)
+#elif V8_HAS_ATTRIBUTE_ALIGNED
+# define V8_ALIGNED(n) __attribute__((aligned(n)))
+#elif V8_HAS_DECLSPEC_ALIGN
+# define V8_ALIGNED(n) __declspec(align(n))
+#else
+# define V8_ALIGNED(n) /* NOT SUPPORTED */
+#endif
+
+
+// This macro is similar to V8_ALIGNED(), but takes a type instead of size
+// in bytes. If the compiler does not supports using the alignment of the
+// |type|, it will align according to the |alignment| instead. For example,
+// Visual Studio C++ cannot combine __declspec(align) and __alignof. The
+// |alignment| must be a literal that is used as a kind of worst-case fallback
+// alignment.
+// Use like:
+// struct V8_ALIGNAS(AnotherClass, 16) NewClass { ... };
+// V8_ALIGNAS(double, 8) int array[100];
+#if V8_HAS_CXX11_ALIGNAS
+# define V8_ALIGNAS(type, alignment) alignas(type)
+#elif V8_HAS___ALIGNOF__ && V8_HAS_ATTRIBUTE_ALIGNED
+# define V8_ALIGNAS(type, alignment) __attribute__((aligned(__alignof__(type))))
+#else
+# define V8_ALIGNAS(type, alignment) V8_ALIGNED(alignment)
+#endif
+
+
+// This macro returns alignment in bytes (an integer power of two) required for
+// any instance of the given type, which is either complete type, an array type,
+// or a reference type.
+// Use like:
+// size_t alignment = V8_ALIGNOF(double);
+#if V8_HAS_CXX11_ALIGNOF
+# define V8_ALIGNOF(type) alignof(type)
+#elif V8_HAS___ALIGNOF
+# define V8_ALIGNOF(type) __alignof(type)
+#elif V8_HAS___ALIGNOF__
+# define V8_ALIGNOF(type) __alignof__(type)
+#else
+// Note that alignment of a type within a struct can be less than the
+// alignment of the type stand-alone (because of ancient ABIs), so this
+// should only be used as a last resort.
+namespace v8 { template <typename T> class AlignOfHelper { char c; T t; }; }
+# define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type))
+#endif
+
+#endif // V8CONFIG_H_
diff --git a/deps/v8/include/v8stdint.h b/deps/v8/include/v8stdint.h
index 7c12e1f490..0b49b37918 100644
--- a/deps/v8/include/v8stdint.h
+++ b/deps/v8/include/v8stdint.h
@@ -33,7 +33,9 @@
#include <stddef.h>
#include <stdio.h>
-#if defined(_WIN32) && !defined(__MINGW32__)
+#include "v8config.h"
+
+#if V8_OS_WIN && !V8_CC_MINGW
typedef signed char int8_t;
typedef unsigned char uint8_t;
@@ -47,7 +49,7 @@ typedef unsigned __int64 uint64_t;
#else
-#include <stdint.h>
+#include <stdint.h> // NOLINT
#endif