v8-profiler.h   v8-profiler.h 
skipping to change at line 98 skipping to change at line 98
static const int kNoLineNumberInfo = Message::kNoLineNumberInfo; static const int kNoLineNumberInfo = Message::kNoLineNumberInfo;
static const int kNoColumnNumberInfo = Message::kNoColumnInfo; static const int kNoColumnNumberInfo = Message::kNoColumnInfo;
}; };
/** /**
* CpuProfile contains a CPU profile in a form of top-down call tree * CpuProfile contains a CPU profile in a form of top-down call tree
* (from main() down to functions that do all the work). * (from main() down to functions that do all the work).
*/ */
class V8_EXPORT CpuProfile { class V8_EXPORT CpuProfile {
public: public:
/** Returns CPU profile UID (assigned by the profiler.) */
unsigned GetUid() const;
/** Returns CPU profile title. */ /** Returns CPU profile title. */
Handle<String> GetTitle() const; Handle<String> GetTitle() const;
/** Returns the root node of the top down call tree. */ /** Returns the root node of the top down call tree. */
const CpuProfileNode* GetTopDownRoot() const; const CpuProfileNode* GetTopDownRoot() const;
/** /**
* Returns number of samples recorded. The samples are not recorded unle ss * Returns number of samples recorded. The samples are not recorded unle ss
* |record_samples| parameter of CpuProfiler::StartCpuProfiling is true. * |record_samples| parameter of CpuProfiler::StartCpuProfiling is true.
*/ */
skipping to change at line 152 skipping to change at line 149
class V8_EXPORT CpuProfiler { class V8_EXPORT CpuProfiler {
public: public:
/** /**
* Changes default CPU profiler sampling interval to the specified number * Changes default CPU profiler sampling interval to the specified number
* of microseconds. Default interval is 1000us. This method must be calle d * of microseconds. Default interval is 1000us. This method must be calle d
* when there are no profiles being recorded. * when there are no profiles being recorded.
*/ */
void SetSamplingInterval(int us); void SetSamplingInterval(int us);
/** /**
* Returns the number of profiles collected (doesn't include
* profiles that are being collected at the moment of call.)
*/
int GetProfileCount();
/** Returns a profile by index. */
const CpuProfile* GetCpuProfile(int index);
/**
* Starts collecting CPU profile. Title may be an empty string. It * Starts collecting CPU profile. Title may be an empty string. It
* is allowed to have several profiles being collected at * is allowed to have several profiles being collected at
* once. Attempts to start collecting several profiles with the same * once. Attempts to start collecting several profiles with the same
* title are silently ignored. While collecting a profile, functions * title are silently ignored. While collecting a profile, functions
* from all security contexts are included in it. The token-based * from all security contexts are included in it. The token-based
* filtering is only performed when querying for a profile. * filtering is only performed when querying for a profile.
* *
* |record_samples| parameter controls whether individual samples should * |record_samples| parameter controls whether individual samples should
* be recorded in addition to the aggregated tree. * be recorded in addition to the aggregated tree.
*/ */
void StartCpuProfiling(Handle<String> title, bool record_samples = false) ; void StartCpuProfiling(Handle<String> title, bool record_samples = false) ;
/** /**
* Stops collecting CPU profile with a given title and returns it. * Stops collecting CPU profile with a given title and returns it.
* If the title given is empty, finishes the last profile started. * If the title given is empty, finishes the last profile started.
*/ */
const CpuProfile* StopCpuProfiling(Handle<String> title); const CpuProfile* StopCpuProfiling(Handle<String> title);
/** /**
* Deletes all existing profiles, also cancelling all profiling
* activity. All previously returned pointers to profiles and their
* contents become invalid after this call.
*/
void DeleteAllCpuProfiles();
/**
* Tells the profiler whether the embedder is idle. * Tells the profiler whether the embedder is idle.
*/ */
void SetIdle(bool is_idle); void SetIdle(bool is_idle);
private: private:
CpuProfiler(); CpuProfiler();
~CpuProfiler(); ~CpuProfiler();
CpuProfiler(const CpuProfiler&); CpuProfiler(const CpuProfiler&);
CpuProfiler& operator=(const CpuProfiler&); CpuProfiler& operator=(const CpuProfiler&);
}; };
skipping to change at line 385 skipping to change at line 366
/** Returns a snapshot by index. */ /** Returns a snapshot by index. */
const HeapSnapshot* GetHeapSnapshot(int index); const HeapSnapshot* GetHeapSnapshot(int index);
/** /**
* Returns SnapshotObjectId for a heap object referenced by |value| if * Returns SnapshotObjectId for a heap object referenced by |value| if
* it has been seen by the heap profiler, kUnknownObjectId otherwise. * it has been seen by the heap profiler, kUnknownObjectId otherwise.
*/ */
SnapshotObjectId GetObjectId(Handle<Value> value); SnapshotObjectId GetObjectId(Handle<Value> value);
/** /**
* Returns heap object with given SnapshotObjectId if the object is alive
,
* otherwise empty handle is returned.
*/
Handle<Value> FindObjectById(SnapshotObjectId id);
/**
* Clears internal map from SnapshotObjectId to heap object. The new obje
cts
* will not be added into it unless a heap snapshot is taken or heap obje
ct
* tracking is kicked off.
*/
void ClearObjectIds();
/**
* A constant for invalid SnapshotObjectId. GetSnapshotObjectId will retu rn * A constant for invalid SnapshotObjectId. GetSnapshotObjectId will retu rn
* it in case heap profiler cannot find id for the object passed as * it in case heap profiler cannot find id for the object passed as
* parameter. HeapSnapshot::GetNodeById will always return NULL for such id. * parameter. HeapSnapshot::GetNodeById will always return NULL for such id.
*/ */
static const SnapshotObjectId kUnknownObjectId = 0; static const SnapshotObjectId kUnknownObjectId = 0;
/** /**
* Callback interface for retrieving user friendly names of global object s. * Callback interface for retrieving user friendly names of global object s.
*/ */
class ObjectNameResolver { class ObjectNameResolver {
skipping to change at line 471 skipping to change at line 465
static const uint16_t kPersistentHandleNoClassId = 0; static const uint16_t kPersistentHandleNoClassId = 0;
/** Returns memory used for profiler internal data and snapshots. */ /** Returns memory used for profiler internal data and snapshots. */
size_t GetProfilerMemorySize(); size_t GetProfilerMemorySize();
/** /**
* Sets a RetainedObjectInfo for an object group (see V8::SetObjectGroupI d). * Sets a RetainedObjectInfo for an object group (see V8::SetObjectGroupI d).
*/ */
void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info); void SetRetainedObjectInfo(UniqueId id, RetainedObjectInfo* info);
/**
* Starts recording JS allocations immediately as they arrive and trackin
g of
* heap objects population statistics.
*/
V8_DEPRECATED("Use StartTrackingHeapObjects instead",
void StartRecordingHeapAllocations());
/**
* Stops recording JS allocations and tracking of heap objects population
* statistics, cleans all collected heap objects population statistics da
ta.
*/
V8_DEPRECATED("Use StopTrackingHeapObjects instead",
void StopRecordingHeapAllocations());
private: private:
HeapProfiler(); HeapProfiler();
~HeapProfiler(); ~HeapProfiler();
HeapProfiler(const HeapProfiler&); HeapProfiler(const HeapProfiler&);
HeapProfiler& operator=(const HeapProfiler&); HeapProfiler& operator=(const HeapProfiler&);
}; };
/** /**
* Interface for providing information about embedder's objects * Interface for providing information about embedder's objects
* held by global handles. This information is reported in two ways: * held by global handles. This information is reported in two ways:
 End of changes. 5 change blocks. 
35 lines changed or deleted 16 lines changed or added


 v8.h   v8.h 
skipping to change at line 451 skipping to change at line 451
private: private:
friend class internal::GlobalHandles; friend class internal::GlobalHandles;
WeakCallbackData(Isolate* isolate, Local<T> handle, P* parameter) WeakCallbackData(Isolate* isolate, Local<T> handle, P* parameter)
: isolate_(isolate), handle_(handle), parameter_(parameter) { } : isolate_(isolate), handle_(handle), parameter_(parameter) { }
Isolate* isolate_; Isolate* isolate_;
Local<T> handle_; Local<T> handle_;
P* parameter_; 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);
};
/** /**
* An object reference that is independent of any handle scope. Where * 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 * a Local handle only lives as long as the HandleScope in which it was
* allocated, a PersistentBase handle remains valid until it is explicitly * allocated, a PersistentBase handle remains valid until it is explicitly
* disposed. * disposed.
* *
* A persistent handle contains a reference to a storage cell within * 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 v8 engine which holds an object value and which is updated by
* the garbage collector whenever the object is moved. A new storage * the garbage collector whenever the object is moved. A new storage
* cell can be created using the constructor or PersistentBase::Reset and * cell can be created using the constructor or PersistentBase::Reset and
skipping to change at line 693 skipping to change at line 682
} }
/** /**
* The destructor will dispose the Persistent based on the * The destructor will dispose the Persistent based on the
* kResetInDestructor flags in the traits class. Since not calling dispo se * kResetInDestructor flags in the traits class. Since not calling dispo se
* can result in a memory leak, it is recommended to always set this flag . * can result in a memory leak, it is recommended to always set this flag .
*/ */
V8_INLINE ~Persistent() { V8_INLINE ~Persistent() {
if (M::kResetInDestructor) this->Reset(); if (M::kResetInDestructor) this->Reset();
} }
V8_DEPRECATED("Use Reset instead",
V8_INLINE void Dispose()) { this->Reset(); }
// TODO(dcarney): this is pretty useless, fix or remove // TODO(dcarney): this is pretty useless, fix or remove
template <class S> 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 #ifdef V8_ENABLE_CHECKS
// If we're going to perform the type check then we have to check // 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. // that the handle isn't empty before doing the checked cast.
if (!that.IsEmpty()) T::Cast(*that); if (!that.IsEmpty()) T::Cast(*that);
#endif #endif
return reinterpret_cast<Persistent<T>&>(that); return reinterpret_cast<Persistent<T>&>(that);
} }
// TODO(dcarney): this is pretty useless, fix or remove // TODO(dcarney): this is pretty useless, fix or remove
template <class S> V8_INLINE Persistent<S>& As() { // NOLINT template <class S> V8_INLINE Persistent<S>& As() { // NOLINT
return Persistent<S>::Cast(*this); return Persistent<S>::Cast(*this);
} }
template<typename S, typename P>
V8_DEPRECATED(
"Use SetWeak instead",
V8_INLINE void MakeWeak(
P* parameter,
typename WeakReferenceCallbacks<S, P>::Revivable callback));
template<typename P>
V8_DEPRECATED(
"Use SetWeak instead",
V8_INLINE void MakeWeak(
P* parameter,
typename WeakReferenceCallbacks<T, P>::Revivable callback));
// This will be removed. // This will be removed.
V8_INLINE T* ClearAndLeak(); V8_INLINE T* ClearAndLeak();
V8_DEPRECATED("This will be removed",
V8_INLINE void Clear()) { this->val_ = 0; }
// TODO(dcarney): remove // TODO(dcarney): remove
#ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR
private: private:
#endif #endif
template <class S> V8_INLINE Persistent(S* that) : PersistentBase<T>(that ) { } template <class S> V8_INLINE Persistent(S* that) : PersistentBase<T>(that ) { }
V8_INLINE T* operator*() const { return this->val_; } V8_INLINE T* operator*() const { return this->val_; }
private: private:
skipping to change at line 842 skipping to change at line 811
* garbage collector will no longer track the object stored in the * garbage collector will no longer track the object stored in the
* handle and may deallocate it. The behavior of accessing a handle * handle and may deallocate it. The behavior of accessing a handle
* for which the handle scope has been deleted is undefined. * for which the handle scope has been deleted is undefined.
*/ */
class V8_EXPORT HandleScope { class V8_EXPORT HandleScope {
public: public:
HandleScope(Isolate* isolate); HandleScope(Isolate* isolate);
~HandleScope(); ~HandleScope();
template <class T>
V8_DEPRECATED("Use EscapableHandleScope::Escape instead",
Local<T> Close(Handle<T> value));
/** /**
* Counts the number of allocated handles. * Counts the number of allocated handles.
*/ */
static int NumberOfHandles(); static int NumberOfHandles();
private: private:
/** /**
* Creates a new handle with the given value. * Creates a new handle with the given value.
*/ */
static internal::Object** CreateHandle(internal::Isolate* isolate, static internal::Object** CreateHandle(internal::Isolate* isolate,
skipping to change at line 884 skipping to change at line 849
public: public:
internal::Object** next; internal::Object** next;
internal::Object** limit; internal::Object** limit;
int level; int level;
V8_INLINE void Initialize() { V8_INLINE void Initialize() {
next = limit = NULL; next = limit = NULL;
level = 0; level = 0;
} }
}; };
void Leave();
internal::Isolate* isolate_; internal::Isolate* isolate_;
internal::Object** prev_next_; internal::Object** prev_next_;
internal::Object** prev_limit_; internal::Object** prev_limit_;
// TODO(dcarney): remove this field
// Allow for the active closing of HandleScopes which allows to pass a ha
ndle
// from the HandleScope being closed to the next top most HandleScope.
bool is_closed_;
internal::Object** RawClose(internal::Object** value);
friend class ImplementationUtilities; friend class ImplementationUtilities;
friend class EscapableHandleScope; friend class EscapableHandleScope;
template<class F> friend class Handle; template<class F> friend class Handle;
template<class F> friend class Local; template<class F> friend class Local;
friend class Object; friend class Object;
friend class Context; friend class Context;
}; };
/** /**
* A HandleScope which first allocates a handle in the current scope * A HandleScope which first allocates a handle in the current scope
skipping to change at line 1128 skipping to change at line 1085
/** /**
* Runs the script returning the resulting value. If the script is * Runs the script returning the resulting value. If the script is
* context independent (created using ::New) it will be run in the * context independent (created using ::New) it will be run in the
* currently entered context. If it is context specific (created * currently entered context. If it is context specific (created
* using ::Compile) it will be run in the context in which it was * using ::Compile) it will be run in the context in which it was
* compiled. * compiled.
*/ */
Local<Value> Run(); Local<Value> Run();
/** /**
* Returns the script id value.
*/
V8_DEPRECATED("Use GetId instead", Local<Value> Id());
/**
* Returns the script id. * Returns the script id.
*/ */
int GetId(); int GetId();
/** /**
* Associate an additional data object with the script. This is mainly us ed * Associate an additional data object with the script. This is mainly us ed
* with the debugger as this data object is only available through the * with the debugger as this data object is only available through the
* debugger API. * debugger API.
*/ */
void SetData(Handle<String> data); void SetData(Handle<String> data);
skipping to change at line 1222 skipping to change at line 1174
int GetEndColumn() const; int GetEndColumn() const;
/** /**
* Passes on the value set by the embedder when it fed the script from wh ich * Passes on the value set by the embedder when it fed the script from wh ich
* this Message was generated to V8. * this Message was generated to V8.
*/ */
bool IsSharedCrossOrigin() const; bool IsSharedCrossOrigin() const;
// TODO(1245381): Print to a string instead of on a FILE. // TODO(1245381): Print to a string instead of on a FILE.
static void PrintCurrentStackTrace(Isolate* isolate, FILE* out); static void PrintCurrentStackTrace(Isolate* isolate, FILE* out);
V8_DEPRECATED("Will be removed",
static void PrintCurrentStackTrace(FILE* out));
static const int kNoLineNumberInfo = 0; static const int kNoLineNumberInfo = 0;
static const int kNoColumnInfo = 0; static const int kNoColumnInfo = 0;
static const int kNoScriptIdInfo = 0; static const int kNoScriptIdInfo = 0;
}; };
/** /**
* Representation of a JavaScript stack trace. The information collected is a * Representation of a JavaScript stack trace. The information collected is a
* snapshot of the execution stack and the information remains valid after * snapshot of the execution stack and the information remains valid after
* execution continues. * execution continues.
skipping to change at line 1280 skipping to change at line 1230
* Grab a snapshot of the current JavaScript execution stack. * Grab a snapshot of the current JavaScript execution stack.
* *
* \param frame_limit The maximum number of stack frames we want to captu re. * \param frame_limit The maximum number of stack frames we want to captu re.
* \param options Enumerates the set of things we will capture for each * \param options Enumerates the set of things we will capture for each
* StackFrame. * StackFrame.
*/ */
static Local<StackTrace> CurrentStackTrace( static Local<StackTrace> CurrentStackTrace(
Isolate* isolate, Isolate* isolate,
int frame_limit, int frame_limit,
StackTraceOptions options = kOverview); StackTraceOptions options = kOverview);
V8_DEPRECATED("Will be removed",
static Local<StackTrace> CurrentStackTrace(
int frame_limit, StackTraceOptions options = kOverview)
);
}; };
/** /**
* A single JavaScript stack frame. * A single JavaScript stack frame.
*/ */
class V8_EXPORT StackFrame { class V8_EXPORT StackFrame {
public: public:
/** /**
* Returns the number, 1-based, of the line for the associate function ca ll. * Returns the number, 1-based, of the line for the associate function ca ll.
* This method will return Message::kNoLineNumberInfo if it is unable to * This method will return Message::kNoLineNumberInfo if it is unable to
skipping to change at line 1607 skipping to change at line 1554
class V8_EXPORT Primitive : public Value { }; class V8_EXPORT Primitive : public Value { };
/** /**
* A primitive boolean value (ECMA-262, 4.3.14). Either the true * A primitive boolean value (ECMA-262, 4.3.14). Either the true
* or false value. * or false value.
*/ */
class V8_EXPORT Boolean : public Primitive { class V8_EXPORT Boolean : public Primitive {
public: public:
bool Value() const; bool Value() const;
V8_INLINE static Handle<Boolean> New(Isolate* isolate, bool value); V8_INLINE static Handle<Boolean> New(Isolate* isolate, bool value);
V8_DEPRECATED("Will be removed",
V8_INLINE static Handle<Boolean> New(bool value));
}; };
/** /**
* A JavaScript string value (ECMA-262, 4.3.17). * A JavaScript string value (ECMA-262, 4.3.17).
*/ */
class V8_EXPORT String : public Primitive { class V8_EXPORT String : public Primitive {
public: public:
enum Encoding { enum Encoding {
UNKNOWN_ENCODING = 0x1, UNKNOWN_ENCODING = 0x1,
TWO_BYTE_ENCODING = 0x0, TWO_BYTE_ENCODING = 0x0,
skipping to change at line 1813 skipping to change at line 1758
V8_INLINE ExternalStringResource* GetExternalStringResource() const; V8_INLINE ExternalStringResource* GetExternalStringResource() const;
/** /**
* Get the ExternalAsciiStringResource for an external ASCII string. * Get the ExternalAsciiStringResource for an external ASCII string.
* Returns NULL if IsExternalAscii() doesn't return true. * Returns NULL if IsExternalAscii() doesn't return true.
*/ */
const ExternalAsciiStringResource* GetExternalAsciiStringResource() const ; const ExternalAsciiStringResource* GetExternalAsciiStringResource() const ;
V8_INLINE static String* Cast(v8::Value* obj); V8_INLINE static String* Cast(v8::Value* obj);
/**
* Allocates a new string from either UTF-8 encoded or ASCII data.
* The second parameter 'length' gives the buffer length. If omitted,
* the function calls 'strlen' to determine the buffer length.
*/
V8_DEPRECATED(
"Use NewFromUtf8 instead",
V8_INLINE static Local<String> New(const char* data, int length = -1)
);
/** Allocates a new string from 16-bit character codes.*/
V8_DEPRECATED(
"Use NewFromTwoByte instead",
V8_INLINE static Local<String> New(
const uint16_t* data, int length = -1));
/**
* Creates an internalized string (historically called a "symbol",
* not to be confused with ES6 symbols). Returns one if it exists already
.
*/
V8_DEPRECATED(
"Use NewFromUtf8 instead",
V8_INLINE static Local<String> NewSymbol(
const char* data, int length = -1));
enum NewStringType { enum NewStringType {
kNormalString, kInternalizedString, kUndetectableString kNormalString, kInternalizedString, kUndetectableString
}; };
/** Allocates a new string from UTF-8 data.*/ /** Allocates a new string from UTF-8 data.*/
static Local<String> NewFromUtf8(Isolate* isolate, static Local<String> NewFromUtf8(Isolate* isolate,
const char* data, const char* data,
NewStringType type = kNormalString, NewStringType type = kNormalString,
int length = -1); int length = -1);
skipping to change at line 1877 skipping to change at line 1798
/** /**
* Creates a new external string using the data defined in the given * Creates a new external string using the data defined in the given
* resource. When the external string is no longer live on V8's heap the * resource. When the external string is no longer live on V8's heap the
* resource will be disposed by calling its Dispose method. The caller of * resource will be disposed by calling its Dispose method. The caller of
* this function should not otherwise delete or modify the resource. Neit her * this function should not otherwise delete or modify the resource. Neit her
* should the underlying buffer be deallocated or modified except through the * should the underlying buffer be deallocated or modified except through the
* destructor of the external string resource. * destructor of the external string resource.
*/ */
static Local<String> NewExternal(Isolate* isolate, static Local<String> NewExternal(Isolate* isolate,
ExternalStringResource* resource); ExternalStringResource* resource);
V8_DEPRECATED("Will be removed", static Local<String> NewExternal(
ExternalStringResource* resource));
/** /**
* Associate an external string resource with this string by transforming it * Associate an external string resource with this string by transforming it
* in place so that existing references to this string in the JavaScript heap * in place so that existing references to this string in the JavaScript heap
* will use the external string resource. The external string resource's * will use the external string resource. The external string resource's
* character contents need to be equivalent to this string. * character contents need to be equivalent to this string.
* Returns true if the string has been changed to be an external string. * Returns true if the string has been changed to be an external string.
* The string is not modified if the operation fails. See NewExternal for * The string is not modified if the operation fails. See NewExternal for
* information on the lifetime of the resource. * information on the lifetime of the resource.
*/ */
skipping to change at line 1901 skipping to change at line 1820
/** /**
* Creates a new external string using the ASCII data defined in the give n * Creates a new external string using the ASCII data defined in the give n
* resource. When the external string is no longer live on V8's heap the * resource. When the external string is no longer live on V8's heap the
* resource will be disposed by calling its Dispose method. The caller of * resource will be disposed by calling its Dispose method. The caller of
* this function should not otherwise delete or modify the resource. Neit her * this function should not otherwise delete or modify the resource. Neit her
* should the underlying buffer be deallocated or modified except through the * should the underlying buffer be deallocated or modified except through the
* destructor of the external string resource. * destructor of the external string resource.
*/ */
static Local<String> NewExternal(Isolate* isolate, static Local<String> NewExternal(Isolate* isolate,
ExternalAsciiStringResource* resource); ExternalAsciiStringResource* resource);
V8_DEPRECATED("Will be removed", static Local<String> NewExternal(
ExternalAsciiStringResource* resour
ce));
/** /**
* Associate an external string resource with this string by transforming it * Associate an external string resource with this string by transforming it
* in place so that existing references to this string in the JavaScript heap * in place so that existing references to this string in the JavaScript heap
* will use the external string resource. The external string resource's * will use the external string resource. The external string resource's
* character contents need to be equivalent to this string. * character contents need to be equivalent to this string.
* Returns true if the string has been changed to be an external string. * Returns true if the string has been changed to be an external string.
* The string is not modified if the operation fails. See NewExternal for * The string is not modified if the operation fails. See NewExternal for
* information on the lifetime of the resource. * information on the lifetime of the resource.
*/ */
bool MakeExternal(ExternalAsciiStringResource* resource); bool MakeExternal(ExternalAsciiStringResource* resource);
/** /**
* Returns true if this string can be made external. * Returns true if this string can be made external.
*/ */
bool CanMakeExternal(); bool CanMakeExternal();
/** Creates an undetectable string from the supplied ASCII or UTF-8 data.
*/
V8_DEPRECATED(
"Use NewFromUtf8 instead",
V8_INLINE static Local<String> NewUndetectable(const char* data,
int length = -1));
/** Creates an undetectable string from the supplied 16-bit character cod
es.*/
V8_DEPRECATED(
"Use NewFromTwoByte instead",
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 * Converts an object to a UTF-8-encoded character array. Useful if
* you want to print the object. If conversion to a string fails * you want to print the object. If conversion to a string fails
* (e.g. due to an exception in the toString() method of the object) * (e.g. due to an exception in the toString() method of the object)
* then the length() method returns 0 and the * operator returns * then the length() method returns 0 and the * operator returns
* NULL. * NULL.
*/ */
class V8_EXPORT Utf8Value { class V8_EXPORT Utf8Value {
public: public:
explicit Utf8Value(Handle<v8::Value> obj); explicit Utf8Value(Handle<v8::Value> obj);
skipping to change at line 1956 skipping to change at line 1861
private: private:
char* str_; char* str_;
int length_; int length_;
// Disallow copying and assigning. // Disallow copying and assigning.
Utf8Value(const Utf8Value&); Utf8Value(const Utf8Value&);
void operator=(const Utf8Value&); void operator=(const Utf8Value&);
}; };
/** /**
* Converts an object to an ASCII string.
* Useful if you want to print the object.
* If conversion to a string fails (eg. due to an exception in the toStri
ng()
* method of the object) then the length() method returns 0 and the * ope
rator
* returns NULL.
*/
class V8_EXPORT AsciiValue {
public:
V8_DEPRECATED("Use Utf8Value instead",
explicit AsciiValue(Handle<v8::Value> obj));
~AsciiValue();
char* operator*() { return str_; }
const char* operator*() const { return str_; }
int length() const { return length_; }
private:
char* str_;
int length_;
// Disallow copying and assigning.
AsciiValue(const AsciiValue&);
void operator=(const AsciiValue&);
};
/**
* Converts an object to a two-byte string. * Converts an object to a two-byte string.
* If conversion to a string fails (eg. due to an exception in the toStri ng() * If conversion to a string fails (eg. due to an exception in the toStri ng()
* method of the object) then the length() method returns 0 and the * ope rator * method of the object) then the length() method returns 0 and the * ope rator
* returns NULL. * returns NULL.
*/ */
class V8_EXPORT Value { class V8_EXPORT Value {
public: public:
explicit Value(Handle<v8::Value> obj); explicit Value(Handle<v8::Value> obj);
~Value(); ~Value();
uint16_t* operator*() { return str_; } uint16_t* operator*() { return str_; }
skipping to change at line 2449 skipping to change at line 2330
* Clones an element at index |index|. Returns an empty * Clones an element at index |index|. Returns an empty
* handle if cloning fails (for any reason). * handle if cloning fails (for any reason).
*/ */
Local<Object> CloneElementAt(uint32_t index); Local<Object> CloneElementAt(uint32_t index);
/** /**
* Creates a JavaScript array with the given length. If the length * Creates a JavaScript array with the given length. If the length
* is negative the returned array will have length 0. * is negative the returned array will have length 0.
*/ */
static Local<Array> New(Isolate* isolate, int length = 0); static Local<Array> New(Isolate* isolate, int length = 0);
V8_DEPRECATED("Will be removed", static Local<Array> New(int length = 0)) ;
V8_INLINE static Array* Cast(Value* obj); V8_INLINE static Array* Cast(Value* obj);
private: private:
Array(); Array();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
template<typename T> template<typename T>
class ReturnValue { class ReturnValue {
public: public:
skipping to change at line 2613 skipping to change at line 2493
* kLineOffsetNotFound if no information available. * kLineOffsetNotFound if no information available.
*/ */
int GetScriptColumnNumber() const; int GetScriptColumnNumber() const;
/** /**
* Tells whether this function is builtin. * Tells whether this function is builtin.
*/ */
bool IsBuiltin() const; bool IsBuiltin() const;
/** /**
* Returns scriptId object.
*/
V8_DEPRECATED("Use ScriptId instead", Handle<Value> GetScriptId() const);
/**
* Returns scriptId. * Returns scriptId.
*/ */
int ScriptId() const; int ScriptId() const;
ScriptOrigin GetScriptOrigin() const; ScriptOrigin GetScriptOrigin() const;
V8_INLINE static Function* Cast(Value* obj); V8_INLINE static Function* Cast(Value* obj);
static const int kLineOffsetNotFound; static const int kLineOffsetNotFound;
private: private:
Function(); Function();
skipping to change at line 2707 skipping to change at line 2582
*/ */
size_t ByteLength() const; size_t ByteLength() const;
/** /**
* Create a new ArrayBuffer. Allocate |byte_length| bytes. * Create a new ArrayBuffer. Allocate |byte_length| bytes.
* Allocated memory will be owned by a created ArrayBuffer and * Allocated memory will be owned by a created ArrayBuffer and
* will be deallocated when it is garbage-collected, * will be deallocated when it is garbage-collected,
* unless the object is externalized. * unless the object is externalized.
*/ */
static Local<ArrayBuffer> New(Isolate* isolate, size_t byte_length); static Local<ArrayBuffer> New(Isolate* isolate, size_t byte_length);
V8_DEPRECATED("Will be removed",
static Local<ArrayBuffer> New(size_t byte_length));
/** /**
* Create a new ArrayBuffer over an existing memory block. * Create a new ArrayBuffer over an existing memory block.
* The created array buffer is immediately in externalized state. * The created array buffer is immediately in externalized state.
* The memory block will not be reclaimed when a created ArrayBuffer * The memory block will not be reclaimed when a created ArrayBuffer
* is garbage-collected. * is garbage-collected.
*/ */
static Local<ArrayBuffer> New(Isolate* isolate, void* data, static Local<ArrayBuffer> New(Isolate* isolate, void* data,
size_t byte_length); size_t byte_length);
V8_DEPRECATED("Will be removed",
static Local<ArrayBuffer> New(void* data, size_t byte_lengt
h));
/** /**
* Returns true if ArrayBuffer is extrenalized, that is, does not * Returns true if ArrayBuffer is extrenalized, that is, does not
* own its memory block. * own its memory block.
*/ */
bool IsExternal() const; bool IsExternal() const;
/** /**
* Neuters this ArrayBuffer and all its views (typed arrays). * Neuters this ArrayBuffer and all its views (typed arrays).
* Neutering sets the byte length of the buffer and all typed arrays to z ero, * Neutering sets the byte length of the buffer and all typed arrays to z ero,
skipping to change at line 2967 skipping to change at line 2838
DataView(); DataView();
static void CheckCast(Value* obj); static void CheckCast(Value* obj);
}; };
/** /**
* An instance of the built-in Date constructor (ECMA-262, 15.9). * An instance of the built-in Date constructor (ECMA-262, 15.9).
*/ */
class V8_EXPORT Date : public Object { class V8_EXPORT Date : public Object {
public: public:
static Local<Value> New(Isolate* isolate, double time); static Local<Value> New(Isolate* isolate, double time);
V8_DEPRECATED("Will be removed", static Local<Value> New(double time));
V8_DEPRECATED(
"Use ValueOf instead",
double NumberValue() const) { return ValueOf(); }
/** /**
* A specialization of Value::NumberValue that is more efficient * A specialization of Value::NumberValue that is more efficient
* because we know the structure of this object. * because we know the structure of this object.
*/ */
double ValueOf() const; double ValueOf() const;
V8_INLINE static Date* Cast(v8::Value* obj); V8_INLINE static Date* Cast(v8::Value* obj);
/** /**
skipping to change at line 2994 skipping to change at line 2860
* parameters. V8 keeps a cache of various values used for * parameters. V8 keeps a cache of various values used for
* date / time computation. This notification will reset * date / time computation. This notification will reset
* those cached values for the current context so that date / * those cached values for the current context so that date /
* time configuration changes would be reflected in the Date * time configuration changes would be reflected in the Date
* object. * object.
* *
* This API should not be called more than needed as it will * This API should not be called more than needed as it will
* negatively impact the performance of date operations. * negatively impact the performance of date operations.
*/ */
static void DateTimeConfigurationChangeNotification(Isolate* isolate); static void DateTimeConfigurationChangeNotification(Isolate* isolate);
V8_DEPRECATED("Will be removed",
static void DateTimeConfigurationChangeNotification());
private: private:
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* A Number object (ECMA-262, 4.3.21). * A Number object (ECMA-262, 4.3.21).
*/ */
class V8_EXPORT NumberObject : public Object { class V8_EXPORT NumberObject : public Object {
public: public:
static Local<Value> New(Isolate* isolate, double value); static Local<Value> New(Isolate* isolate, double value);
V8_DEPRECATED("Will be removed", static Local<Value> New(double value));
V8_DEPRECATED(
"Use ValueOf instead",
double NumberValue() const) { return ValueOf(); }
/**
* Returns the Number held by the object.
*/
double ValueOf() const; double ValueOf() const;
V8_INLINE static NumberObject* Cast(v8::Value* obj); V8_INLINE static NumberObject* Cast(v8::Value* obj);
private: private:
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* A Boolean object (ECMA-262, 4.3.15). * A Boolean object (ECMA-262, 4.3.15).
*/ */
class V8_EXPORT BooleanObject : public Object { class V8_EXPORT BooleanObject : public Object {
public: public:
static Local<Value> New(bool value); static Local<Value> New(bool value);
V8_DEPRECATED(
"Use ValueOf instead",
bool BooleanValue() const) { return ValueOf(); }
/**
* Returns the Boolean held by the object.
*/
bool ValueOf() const; bool ValueOf() const;
V8_INLINE static BooleanObject* Cast(v8::Value* obj); V8_INLINE static BooleanObject* Cast(v8::Value* obj);
private: private:
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* A String object (ECMA-262, 4.3.18). * A String object (ECMA-262, 4.3.18).
*/ */
class V8_EXPORT StringObject : public Object { class V8_EXPORT StringObject : public Object {
public: public:
static Local<Value> New(Handle<String> value); static Local<Value> New(Handle<String> value);
V8_DEPRECATED(
"Use ValueOf instead",
Local<String> StringValue() const) { return ValueOf(); }
/**
* Returns the String held by the object.
*/
Local<String> ValueOf() const; Local<String> ValueOf() const;
V8_INLINE static StringObject* Cast(v8::Value* obj); V8_INLINE static StringObject* Cast(v8::Value* obj);
private: private:
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* A Symbol object (ECMA-262 edition 6). * A Symbol object (ECMA-262 edition 6).
* *
* This is an experimental feature. Use at your own risk. * This is an experimental feature. Use at your own risk.
*/ */
class V8_EXPORT SymbolObject : public Object { class V8_EXPORT SymbolObject : public Object {
public: public:
static Local<Value> New(Isolate* isolate, Handle<Symbol> value); static Local<Value> New(Isolate* isolate, Handle<Symbol> value);
V8_DEPRECATED(
"Use ValueOf instead",
Local<Symbol> SymbolValue() const) { return ValueOf(); }
/**
* Returns the Symbol held by the object.
*/
Local<Symbol> ValueOf() const; Local<Symbol> ValueOf() const;
V8_INLINE static SymbolObject* Cast(v8::Value* obj); V8_INLINE static SymbolObject* Cast(v8::Value* obj);
private: private:
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* An instance of the built-in RegExp constructor (ECMA-262, 15.10). * An instance of the built-in RegExp constructor (ECMA-262, 15.10).
skipping to change at line 3144 skipping to change at line 2979
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
/** /**
* A JavaScript value that wraps a C++ void*. This type of value is mainly used * A JavaScript value that wraps a C++ void*. This type of value is mainly used
* to associate C++ data structures with JavaScript objects. * to associate C++ data structures with JavaScript objects.
*/ */
class V8_EXPORT External : public Value { class V8_EXPORT External : public Value {
public: public:
static Local<External> New(Isolate* isolate, void* value); static Local<External> New(Isolate* isolate, void* value);
V8_DEPRECATED("Will be removed", static Local<External> New(void *value)) ;
V8_INLINE static External* Cast(Value* obj); V8_INLINE static External* Cast(Value* obj);
void* Value() const; void* Value() const;
private: private:
static void CheckCast(v8::Value* obj); static void CheckCast(v8::Value* obj);
}; };
// --- Templates --- // --- Templates ---
/** /**
* The superclass of object and function templates. * The superclass of object and function templates.
*/ */
class V8_EXPORT Template : public Data { class V8_EXPORT Template : public Data {
public: public:
/** Adds a property to each instance created by this template.*/ /** Adds a property to each instance created by this template.*/
void Set(Handle<String> name, Handle<Data> value, void Set(Handle<String> name, Handle<Data> value,
PropertyAttribute attributes = None); PropertyAttribute attributes = None);
V8_INLINE void Set(Isolate* isolate, const char* name, Handle<Data> value ); V8_INLINE void Set(Isolate* isolate, const char* name, Handle<Data> value );
V8_DEPRECATED("Will be removed",
V8_INLINE void Set(const char* name, Handle<Data> value));
void SetAccessorProperty( void SetAccessorProperty(
Local<String> name, Local<String> name,
Local<FunctionTemplate> getter = Local<FunctionTemplate>(), Local<FunctionTemplate> getter = Local<FunctionTemplate>(),
Local<FunctionTemplate> setter = Local<FunctionTemplate>(), Local<FunctionTemplate> setter = Local<FunctionTemplate>(),
PropertyAttribute attribute = None, PropertyAttribute attribute = None,
AccessControl settings = DEFAULT); AccessControl settings = DEFAULT);
/** /**
* Whenever the property with the given name is accessed on objects * Whenever the property with the given name is accessed on objects
skipping to change at line 3683 skipping to change at line 3515
* A Signature specifies which receivers and arguments are valid * A Signature specifies which receivers and arguments are valid
* parameters to a function. * parameters to a function.
*/ */
class V8_EXPORT Signature : public Data { class V8_EXPORT Signature : public Data {
public: public:
static Local<Signature> New(Isolate* isolate, static Local<Signature> New(Isolate* isolate,
Handle<FunctionTemplate> receiver = Handle<FunctionTemplate> receiver =
Handle<FunctionTemplate>(), Handle<FunctionTemplate>(),
int argc = 0, int argc = 0,
Handle<FunctionTemplate> argv[] = 0); Handle<FunctionTemplate> argv[] = 0);
V8_DEPRECATED("Will be removed",
static Local<Signature> New(Handle<FunctionTemplate> receiv
er =
Handle<FunctionTemplate>(),
int argc = 0,
Handle<FunctionTemplate> argv[]
=
0));
private: private:
Signature(); Signature();
}; };
/** /**
* An AccessorSignature specifies which receivers are valid parameters * An AccessorSignature specifies which receivers are valid parameters
* to an accessor callback. * to an accessor callback.
*/ */
class V8_EXPORT AccessorSignature : public Data { class V8_EXPORT AccessorSignature : public Data {
public: public:
static Local<AccessorSignature> New(Isolate* isolate, static Local<AccessorSignature> New(Isolate* isolate,
Handle<FunctionTemplate> receiver = Handle<FunctionTemplate> receiver =
Handle<FunctionTemplate>()); Handle<FunctionTemplate>());
V8_DEPRECATED("Will be removed", static Local<AccessorSignature> New(
Handle<FunctionTemplate> receiver =
Handle<FunctionTemplate>()));
private: private:
AccessorSignature(); AccessorSignature();
}; };
class V8_EXPORT DeclaredAccessorDescriptor : public Data { class V8_EXPORT DeclaredAccessorDescriptor : public Data {
private: private:
DeclaredAccessorDescriptor(); DeclaredAccessorDescriptor();
}; };
skipping to change at line 3806 skipping to change at line 3629
// Note that the strings passed into this constructor must live as long // Note that the strings passed into this constructor must live as long
// as the Extension itself. // as the Extension itself.
Extension(const char* name, Extension(const char* name,
const char* source = 0, const char* source = 0,
int dep_count = 0, int dep_count = 0,
const char** deps = 0, const char** deps = 0,
int source_length = -1); int source_length = -1);
virtual ~Extension() { } virtual ~Extension() { }
virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate( virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Handle<v8::String> name) { v8::Isolate* isolate, v8::Handle<v8::String> name) {
#if defined(V8_DEPRECATION_WARNINGS)
return v8::Handle<v8::FunctionTemplate>();
#else
return GetNativeFunction(name);
#endif
}
V8_DEPRECATED("Will be removed",
virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(
v8::Handle<v8::String> name)) {
return v8::Handle<v8::FunctionTemplate>(); return v8::Handle<v8::FunctionTemplate>();
} }
const char* name() const { return name_; } const char* name() const { return name_; }
size_t source_length() const { return source_length_; } size_t source_length() const { return source_length_; }
const String::ExternalAsciiStringResource* source() const { const String::ExternalAsciiStringResource* source() const {
return &source_; } return &source_; }
int dependency_count() { return dep_count_; } int dependency_count() { return dep_count_; }
const char** dependencies() { return deps_; } const char** dependencies() { return deps_; }
void set_auto_enable(bool value) { auto_enable_ = value; } void set_auto_enable(bool value) { auto_enable_ = value; }
skipping to change at line 3860 skipping to change at line 3673
} }
}; };
// --- Statics --- // --- Statics ---
V8_INLINE Handle<Primitive> Undefined(Isolate* isolate); V8_INLINE Handle<Primitive> Undefined(Isolate* isolate);
V8_INLINE Handle<Primitive> Null(Isolate* isolate); V8_INLINE Handle<Primitive> Null(Isolate* isolate);
V8_INLINE Handle<Boolean> True(Isolate* isolate); V8_INLINE Handle<Boolean> True(Isolate* isolate);
V8_INLINE Handle<Boolean> False(Isolate* isolate); V8_INLINE Handle<Boolean> False(Isolate* isolate);
V8_DEPRECATED("Will be removed", Handle<Primitive> V8_EXPORT Undefined());
V8_DEPRECATED("Will be removed", Handle<Primitive> V8_EXPORT Null());
V8_DEPRECATED("Will be removed", Handle<Boolean> V8_EXPORT True());
V8_DEPRECATED("Will be removed", Handle<Boolean> V8_EXPORT False());
/** /**
* A set of constraints that specifies the limits of the runtime's memory u se. * A set of constraints that specifies the limits of the runtime's memory u se.
* You must set the heap size before initializing the VM - the size cannot be * You must set the heap size before initializing the VM - the size cannot be
* adjusted after the VM is initialized. * adjusted after the VM is initialized.
* *
* If you are using threads then you should hold the V8::Locker lock while * If you are using threads then you should hold the V8::Locker lock while
* setting the stack limit and you must set a non-default stack limit separ ately * setting the stack limit and you must set a non-default stack limit separ ately
* for each thread. * for each thread.
*/ */
class V8_EXPORT ResourceConstraints { class V8_EXPORT ResourceConstraints {
skipping to change at line 3889 skipping to change at line 3697
* Configures the constraints with reasonable default values based on the * Configures the constraints with reasonable default values based on the
* capabilities of the current device the VM is running on. * capabilities of the current device the VM is running on.
* *
* \param physical_memory The total amount of physical memory on the curr ent * \param physical_memory The total amount of physical memory on the curr ent
* device, in bytes. * device, in bytes.
* \param number_of_processors The number of CPUs available on the curren t * \param number_of_processors The number of CPUs available on the curren t
* device. * device.
*/ */
void ConfigureDefaults(uint64_t physical_memory, void ConfigureDefaults(uint64_t physical_memory,
uint32_t number_of_processors); uint32_t number_of_processors);
V8_DEPRECATED("Will be removed",
void ConfigureDefaults(uint64_t physical_memory));
int max_young_space_size() const { return max_young_space_size_; } int max_young_space_size() const { return max_young_space_size_; }
void set_max_young_space_size(int value) { max_young_space_size_ = value; } void set_max_young_space_size(int value) { max_young_space_size_ = value; }
int max_old_space_size() const { return max_old_space_size_; } int max_old_space_size() const { return max_old_space_size_; }
void set_max_old_space_size(int value) { max_old_space_size_ = value; } void set_max_old_space_size(int value) { max_old_space_size_ = value; }
int max_executable_size() const { return max_executable_size_; } int max_executable_size() const { return max_executable_size_; }
void set_max_executable_size(int value) { max_executable_size_ = value; } void set_max_executable_size(int value) { max_executable_size_ = value; }
uint32_t* stack_limit() const { return stack_limit_; } uint32_t* stack_limit() const { return stack_limit_; }
// Sets an address beyond which the VM's stack may not grow. // Sets an address beyond which the VM's stack may not grow.
void set_stack_limit(uint32_t* value) { stack_limit_ = value; } void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
skipping to change at line 3927 skipping to change at line 3733
*/ */
bool V8_EXPORT SetResourceConstraints(Isolate* isolate, bool V8_EXPORT SetResourceConstraints(Isolate* isolate,
ResourceConstraints* constraints); ResourceConstraints* constraints);
// --- Exceptions --- // --- Exceptions ---
typedef void (*FatalErrorCallback)(const char* location, const char* messag e); typedef void (*FatalErrorCallback)(const char* location, const char* messag e);
typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> erro r); typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> erro r);
V8_DEPRECATED(
"Use Isolate::ThrowException instead",
Handle<Value> V8_EXPORT ThrowException(Handle<Value> exception));
/** /**
* Create new error objects by calling the corresponding error object * Create new error objects by calling the corresponding error object
* constructor with the message. * constructor with the message.
*/ */
class V8_EXPORT Exception { class V8_EXPORT Exception {
public: public:
static Local<Value> RangeError(Handle<String> message); static Local<Value> RangeError(Handle<String> message);
static Local<Value> ReferenceError(Handle<String> message); static Local<Value> ReferenceError(Handle<String> message);
static Local<Value> SyntaxError(Handle<String> message); static Local<Value> SyntaxError(Handle<String> message);
static Local<Value> TypeError(Handle<String> message); static Local<Value> TypeError(Handle<String> message);
skipping to change at line 4120 skipping to change at line 3922
* Requires: this == Isolate::GetCurrent(). * Requires: this == Isolate::GetCurrent().
*/ */
void Exit(); void Exit();
/** /**
* Disposes the isolate. The isolate must not be entered by any * Disposes the isolate. The isolate must not be entered by any
* thread to be disposable. * thread to be disposable.
*/ */
void Dispose(); void Dispose();
V8_DEPRECATED("Use SetData(0, data) instead.",
V8_INLINE void SetData(void* data));
V8_DEPRECATED("Use GetData(0) instead.", V8_INLINE void* GetData());
/** /**
* Associate embedder-specific data with the isolate. |slot| has to be * Associate embedder-specific data with the isolate. |slot| has to be
* between 0 and GetNumberOfDataSlots() - 1. * between 0 and GetNumberOfDataSlots() - 1.
*/ */
V8_INLINE void SetData(uint32_t slot, void* data); V8_INLINE void SetData(uint32_t slot, void* data);
/** /**
* Retrieve embedder-specific data from the isolate. * Retrieve embedder-specific data from the isolate.
* Returns NULL if SetData has never been called for the given |slot|. * Returns NULL if SetData has never been called for the given |slot|.
*/ */
skipping to change at line 4731 skipping to change at line 4529
* are not guaranteed to live past each call. The \p event_handler mu st * are not guaranteed to live past each call. The \p event_handler mu st
* copy strings and other parameters it needs to keep around. * copy strings and other parameters it needs to keep around.
* \note the set of events declared in JitCodeEvent::EventType is expecte d to * \note the set of events declared in JitCodeEvent::EventType is expecte d to
* grow over time, and the JitCodeEvent structure is expected to accr ue * grow over time, and the JitCodeEvent structure is expected to accr ue
* new members. The \p event_handler function must ignore event codes * new members. The \p event_handler function must ignore event codes
* it does not recognize to maintain future compatibility. * it does not recognize to maintain future compatibility.
*/ */
static void SetJitCodeEventHandler(JitCodeEventOptions options, static void SetJitCodeEventHandler(JitCodeEventOptions options,
JitCodeEventHandler event_handler); JitCodeEventHandler event_handler);
V8_DEPRECATED(
"Use Isolate::AdjustAmountOfExternalAllocatedMemory instead",
static int64_t AdjustAmountOfExternalAllocatedMemory(
int64_t change_in_bytes));
/** /**
* Forcefully terminate the current thread of JavaScript execution * Forcefully terminate the current thread of JavaScript execution
* in the given isolate. If no isolate is provided, the default * in the given isolate. If no isolate is provided, the default
* isolate is used. * isolate is used.
* *
* This method can be used by any thread even if that thread has not * This method can be used by any thread even if that thread has not
* acquired the V8 lock with a Locker object. * acquired the V8 lock with a Locker object.
* *
* \param isolate The isolate in which to terminate the current JS execut ion. * \param isolate The isolate in which to terminate the current JS execut ion.
*/ */
skipping to change at line 4865 skipping to change at line 4658
*/ */
static void ShutdownPlatform(); static void ShutdownPlatform();
private: private:
V8(); V8();
static internal::Object** GlobalizeReference(internal::Isolate* isolate, static internal::Object** GlobalizeReference(internal::Isolate* isolate,
internal::Object** handle); internal::Object** handle);
static internal::Object** CopyPersistent(internal::Object** handle); static internal::Object** CopyPersistent(internal::Object** handle);
static void DisposeGlobal(internal::Object** global_handle); static void DisposeGlobal(internal::Object** global_handle);
typedef WeakReferenceCallbacks<Value, void>::Revivable RevivableCallback;
typedef WeakCallbackData<Value, void>::Callback WeakCallback; typedef WeakCallbackData<Value, void>::Callback WeakCallback;
static void MakeWeak(internal::Object** global_handle, static void MakeWeak(internal::Object** global_handle,
void* data, void* data,
WeakCallback weak_callback, WeakCallback weak_callback);
RevivableCallback weak_reference_callback);
static void ClearWeak(internal::Object** global_handle); static void ClearWeak(internal::Object** global_handle);
static void Eternalize(Isolate* isolate, static void Eternalize(Isolate* isolate,
Value* handle, Value* handle,
int* index); int* index);
static Local<Value> GetEternal(Isolate* isolate, int index); static Local<Value> GetEternal(Isolate* isolate, int index);
template <class T> friend class Handle; template <class T> friend class Handle;
template <class T> friend class Local; template <class T> friend class Local;
template <class T> friend class Eternal; template <class T> friend class Eternal;
template <class T> friend class PersistentBase; template <class T> friend class PersistentBase;
skipping to change at line 5079 skipping to change at line 4870
* created by a previous call to Context::New with the same global * created by a previous call to Context::New with the same global
* template. The state of the global object will be completely reset * template. The state of the global object will be completely reset
* and only object identify will remain. * and only object identify will remain.
*/ */
static Local<Context> New( static Local<Context> New(
Isolate* isolate, Isolate* isolate,
ExtensionConfiguration* extensions = NULL, ExtensionConfiguration* extensions = NULL,
Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(), Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(),
Handle<Value> global_object = Handle<Value>()); Handle<Value> global_object = Handle<Value>());
V8_DEPRECATED("Use Isolate::GetEnteredContext instead",
static Local<Context> GetEntered());
V8_DEPRECATED("Use Isolate::GetCurrentContext instead",
static Local<Context> GetCurrent());
V8_DEPRECATED("Use Isolate::GetCallingContext instead",
static Local<Context> GetCalling());
/** /**
* Sets the security token for the context. To access an object in * Sets the security token for the context. To access an object in
* another context, the security tokens must match. * another context, the security tokens must match.
*/ */
void SetSecurityToken(Handle<Value> token); void SetSecurityToken(Handle<Value> token);
/** Restores the security token to the default value. */ /** Restores the security token to the default value. */
void UseDefaultSecurityToken(); void UseDefaultSecurityToken();
/** Returns the security token of this context.*/ /** Returns the security token of this context.*/
skipping to change at line 5117 skipping to change at line 4899
/** /**
* Exit this context. Exiting the current context restores the * Exit this context. Exiting the current context restores the
* context that was in place when entering the current context. * context that was in place when entering the current context.
*/ */
void Exit(); void Exit();
/** Returns true if the context has experienced an out of memory situatio n. */ /** Returns true if the context has experienced an out of memory situatio n. */
bool HasOutOfMemoryException(); bool HasOutOfMemoryException();
V8_DEPRECATED("Use Isolate::InContext instead",
static bool InContext());
/** Returns an isolate associated with a current context. */ /** Returns an isolate associated with a current context. */
v8::Isolate* GetIsolate(); v8::Isolate* GetIsolate();
/** /**
* Gets the embedder data with the given index, which must have been set by a * Gets the embedder data with the given index, which must have been set by a
* previous call to SetEmbedderData with the same index. Note that index 0 * previous call to SetEmbedderData with the same index. Note that index 0
* currently has a special meaning for Chrome's debugger. * currently has a special meaning for Chrome's debugger.
*/ */
V8_INLINE Local<Value> GetEmbedderData(int index); V8_INLINE Local<Value> GetEmbedderData(int index);
skipping to change at line 5189 skipping to change at line 4968
/** /**
* Stack-allocated class which sets the execution context for all * Stack-allocated class which sets the execution context for all
* operations executed within a local scope. * operations executed within a local scope.
*/ */
class Scope { class Scope {
public: public:
explicit V8_INLINE Scope(Handle<Context> context) : context_(context) { explicit V8_INLINE Scope(Handle<Context> context) : context_(context) {
context_->Enter(); context_->Enter();
} }
V8_DEPRECATED(
"Use Handle version instead",
V8_INLINE Scope(Isolate* isolate, Persistent<Context>& context)) //
NOLINT
: context_(Handle<Context>::New(isolate, context)) {
context_->Enter();
}
V8_INLINE ~Scope() { context_->Exit(); } V8_INLINE ~Scope() { context_->Exit(); }
private: private:
Handle<Context> context_; Handle<Context> context_;
}; };
private: private:
friend class Value; friend class Value;
friend class Script; friend class Script;
friend class Object; friend class Object;
skipping to change at line 5759 skipping to change at line 5532
template <class T> template <class T>
template <typename S, typename P> template <typename S, typename P>
void PersistentBase<T>::SetWeak( void PersistentBase<T>::SetWeak(
P* parameter, P* parameter,
typename WeakCallbackData<S, P>::Callback callback) { typename WeakCallbackData<S, P>::Callback callback) {
TYPE_CHECK(S, T); TYPE_CHECK(S, T);
typedef typename WeakCallbackData<Value, void>::Callback Callback; typedef typename WeakCallbackData<Value, void>::Callback Callback;
V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_), V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_),
parameter, parameter,
reinterpret_cast<Callback>(callback), reinterpret_cast<Callback>(callback));
NULL);
} }
template <class T> template <class T>
template <typename P> template <typename P>
void PersistentBase<T>::SetWeak( void PersistentBase<T>::SetWeak(
P* parameter, P* parameter,
typename WeakCallbackData<T, P>::Callback callback) { typename WeakCallbackData<T, P>::Callback callback) {
SetWeak<T, P>(parameter, callback); SetWeak<T, P>(parameter, callback);
} }
template <class T, class M>
template <typename S, typename P>
void Persistent<T, M>::MakeWeak(
P* parameters,
typename WeakReferenceCallbacks<S, P>::Revivable 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, class M>
template <typename P>
void Persistent<T, M>::MakeWeak(
P* parameters,
typename WeakReferenceCallbacks<T, P>::Revivable callback) {
MakeWeak<T, P>(parameters, callback);
}
template <class T> template <class T>
void PersistentBase<T>::ClearWeak() { void PersistentBase<T>::ClearWeak() {
V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_)); V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_));
} }
template <class T> template <class T>
void PersistentBase<T>::MarkIndependent() { void PersistentBase<T>::MarkIndependent() {
typedef internal::Internals I; typedef internal::Internals I;
if (this->IsEmpty()) return; if (this->IsEmpty()) return;
I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_), I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
skipping to change at line 5999 skipping to change at line 5750
template<typename T> template<typename T>
bool FunctionCallbackInfo<T>::IsConstructCall() const { bool FunctionCallbackInfo<T>::IsConstructCall() const {
return is_construct_call_; return is_construct_call_;
} }
template<typename T> template<typename T>
int FunctionCallbackInfo<T>::Length() const { int FunctionCallbackInfo<T>::Length() const {
return length_; return length_;
} }
template <class T>
Local<T> HandleScope::Close(Handle<T> value) {
internal::Object** before = reinterpret_cast<internal::Object**>(*value);
internal::Object** after = RawClose(before);
return Local<T>(reinterpret_cast<T*>(after));
}
Handle<Value> ScriptOrigin::ResourceName() const { Handle<Value> ScriptOrigin::ResourceName() const {
return resource_name_; return resource_name_;
} }
Handle<Integer> ScriptOrigin::ResourceLineOffset() const { Handle<Integer> ScriptOrigin::ResourceLineOffset() const {
return resource_line_offset_; return resource_line_offset_;
} }
Handle<Integer> ScriptOrigin::ResourceColumnOffset() const { Handle<Integer> ScriptOrigin::ResourceColumnOffset() const {
return resource_column_offset_; return resource_column_offset_;
} }
Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const { Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const {
return resource_is_shared_cross_origin_; return resource_is_shared_cross_origin_;
} }
Handle<Boolean> Boolean::New(Isolate* isolate, bool value) { Handle<Boolean> Boolean::New(Isolate* isolate, bool value) {
return value ? True(isolate) : False(isolate); return value ? True(isolate) : False(isolate);
} }
Handle<Boolean> Boolean::New(bool value) {
return Boolean::New(Isolate::GetCurrent(), value);
}
void Template::Set(Isolate* isolate, const char* name, v8::Handle<Data> val ue) { void Template::Set(Isolate* isolate, const char* name, v8::Handle<Data> val ue) {
Set(v8::String::NewFromUtf8(isolate, name), value); Set(v8::String::NewFromUtf8(isolate, name), value);
} }
void Template::Set(const char* name, v8::Handle<Data> value) {
Set(Isolate::GetCurrent(), name, value);
}
Local<Value> Object::GetInternalField(int index) { Local<Value> Object::GetInternalField(int index) {
#ifndef V8_ENABLE_CHECKS #ifndef V8_ENABLE_CHECKS
typedef internal::Object O; typedef internal::Object O;
typedef internal::HeapObject HO; typedef internal::HeapObject HO;
typedef internal::Internals I; typedef internal::Internals I;
O* obj = *reinterpret_cast<O**>(this); O* obj = *reinterpret_cast<O**>(this);
// Fast path: If the object is a plain JSObject, which is the common case , we // Fast path: If the object is a plain JSObject, which is the common case , we
// know where to find the internal fields and can return the value direct ly. // know where to find the internal fields and can return the value direct ly.
if (I::GetInstanceType(obj) == I::kJSObjectType) { if (I::GetInstanceType(obj) == I::kJSObjectType) {
int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * inde x); int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * inde x);
skipping to change at line 6086 skipping to change at line 5822
} }
Local<String> String::Empty(Isolate* isolate) { Local<String> String::Empty(Isolate* isolate) {
typedef internal::Object* S; typedef internal::Object* S;
typedef internal::Internals I; typedef internal::Internals I;
I::CheckInitialized(isolate); I::CheckInitialized(isolate);
S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex); S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex);
return Local<String>(reinterpret_cast<String*>(slot)); return Local<String>(reinterpret_cast<String*>(slot));
} }
Local<String> String::New(const char* data, int length) {
return NewFromUtf8(Isolate::GetCurrent(), data, kNormalString, length);
}
Local<String> String::New(const uint16_t* data, int length) {
return NewFromTwoByte(Isolate::GetCurrent(), data, kNormalString, length)
;
}
Local<String> String::NewSymbol(const char* data, int length) {
return NewFromUtf8(Isolate::GetCurrent(), data, kInternalizedString, leng
th);
}
Local<String> String::NewUndetectable(const char* data, int length) {
return NewFromUtf8(Isolate::GetCurrent(), data, kUndetectableString, leng
th);
}
Local<String> String::NewUndetectable(const uint16_t* data, int length) {
return NewFromTwoByte(
Isolate::GetCurrent(), data, kUndetectableString, length);
}
String::ExternalStringResource* String::GetExternalStringResource() const { String::ExternalStringResource* String::GetExternalStringResource() const {
typedef internal::Object O; typedef internal::Object O;
typedef internal::Internals I; typedef internal::Internals I;
O* obj = *reinterpret_cast<O**>(const_cast<String*>(this)); O* obj = *reinterpret_cast<O**>(const_cast<String*>(this));
String::ExternalStringResource* result; String::ExternalStringResource* result;
if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) { if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) {
void* value = I::ReadField<void*>(obj, I::kStringResourceOffset); void* value = I::ReadField<void*>(obj, I::kStringResourceOffset);
result = reinterpret_cast<String::ExternalStringResource*>(value); result = reinterpret_cast<String::ExternalStringResource*>(value);
} else { } else {
result = NULL; result = NULL;
skipping to change at line 6436 skipping to change at line 6151
} }
Handle<Boolean> False(Isolate* isolate) { Handle<Boolean> False(Isolate* isolate) {
typedef internal::Object* S; typedef internal::Object* S;
typedef internal::Internals I; typedef internal::Internals I;
I::CheckInitialized(isolate); I::CheckInitialized(isolate);
S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex); S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
return Handle<Boolean>(reinterpret_cast<Boolean*>(slot)); return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
} }
void Isolate::SetData(void* data) {
typedef internal::Internals I;
I::SetEmbedderData(this, 0, data);
}
void* Isolate::GetData() {
typedef internal::Internals I;
return I::GetEmbedderData(this, 0);
}
void Isolate::SetData(uint32_t slot, void* data) { void Isolate::SetData(uint32_t slot, void* data) {
typedef internal::Internals I; typedef internal::Internals I;
I::SetEmbedderData(this, slot, data); I::SetEmbedderData(this, slot, data);
} }
void* Isolate::GetData(uint32_t slot) { void* Isolate::GetData(uint32_t slot) {
typedef internal::Internals I; typedef internal::Internals I;
return I::GetEmbedderData(this, slot); return I::GetEmbedderData(this, slot);
} }
 End of changes. 49 change blocks. 
314 lines changed or deleted 2 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/