v8-debug.h | v8-debug.h | |||
---|---|---|---|---|
skipping to change at line 225 | skipping to change at line 225 | |||
* | * | |||
* This message handler is deprecated. Use MessageHandler2 instead. | * This message handler is deprecated. Use MessageHandler2 instead. | |||
*/ | */ | |||
typedef void (*MessageHandler)(const uint16_t* message, int length, | typedef void (*MessageHandler)(const uint16_t* message, int length, | |||
ClientData* client_data); | ClientData* client_data); | |||
/** | /** | |||
* Debug message callback function. | * Debug message callback function. | |||
* | * | |||
* \param message the debug message handler message object | * \param message the debug message handler message object | |||
* | ||||
* A MessageHandler does not take possession of the message data, | * A MessageHandler does not take possession of the message data, | |||
* and must not rely on the data persisting after the handler returns. | * and must not rely on the data persisting after the handler returns. | |||
*/ | */ | |||
typedef void (*MessageHandler2)(const Message& message); | typedef void (*MessageHandler2)(const Message& message); | |||
/** | /** | |||
* Debug host dispatch callback function. | * Debug host dispatch callback function. | |||
*/ | */ | |||
typedef void (*HostDispatchHandler)(); | typedef void (*HostDispatchHandler)(); | |||
skipping to change at line 251 | skipping to change at line 251 | |||
// Set a C debug event listener. | // Set a C debug event listener. | |||
static bool SetDebugEventListener(EventCallback that, | static bool SetDebugEventListener(EventCallback that, | |||
Handle<Value> data = Handle<Value>()); | Handle<Value> data = Handle<Value>()); | |||
static bool SetDebugEventListener2(EventCallback2 that, | static bool SetDebugEventListener2(EventCallback2 that, | |||
Handle<Value> data = Handle<Value>()); | Handle<Value> data = Handle<Value>()); | |||
// Set a JavaScript debug event listener. | // Set a JavaScript debug event listener. | |||
static bool SetDebugEventListener(v8::Handle<v8::Object> that, | static bool SetDebugEventListener(v8::Handle<v8::Object> that, | |||
Handle<Value> data = Handle<Value>()); | Handle<Value> data = Handle<Value>()); | |||
// Schedule a debugger break to happen when JavaScript code is run. | // Schedule a debugger break to happen when JavaScript code is run | |||
static void DebugBreak(); | // in the given isolate. If no isolate is provided the default | |||
// isolate is used. | ||||
static void DebugBreak(Isolate* isolate = NULL); | ||||
// Remove scheduled debugger break if it has not happened yet. | // Remove scheduled debugger break in given isolate if it has not | |||
static void CancelDebugBreak(); | // happened yet. If no isolate is provided the default isolate is | |||
// used. | ||||
static void CancelDebugBreak(Isolate* isolate = NULL); | ||||
// Break execution of JavaScript (this method can be invoked from a | // Break execution of JavaScript in the given isolate (this method | |||
// non-VM thread) for further client command execution on a VM | // can be invoked from a non-VM thread) for further client command | |||
// thread. Client data is then passed in EventDetails to | // execution on a VM thread. Client data is then passed in | |||
// EventCallback at the moment when the VM actually stops. | // EventDetails to EventCallback at the moment when the VM actually | |||
static void DebugBreakForCommand(ClientData* data = NULL); | // 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 messag e | // Message based interface. The message protocol is JSON. NOTE the messag e | |||
// handler thread is not supported any more parameter must be false. | // handler thread is not supported any more parameter must be false. | |||
static void SetMessageHandler(MessageHandler handler, | static void SetMessageHandler(MessageHandler handler, | |||
bool message_handler_thread = false); | bool message_handler_thread = false); | |||
static void SetMessageHandler2(MessageHandler2 handler); | static void SetMessageHandler2(MessageHandler2 handler); | |||
// If no isolate is provided the default isolate is | ||||
// used. | ||||
static void SendCommand(const uint16_t* command, int length, | static void SendCommand(const uint16_t* command, int length, | |||
ClientData* client_data = NULL); | ClientData* client_data = NULL, | |||
Isolate* isolate = NULL); | ||||
// Dispatch interface. | // Dispatch interface. | |||
static void SetHostDispatchHandler(HostDispatchHandler handler, | static void SetHostDispatchHandler(HostDispatchHandler handler, | |||
int period = 100); | int period = 100); | |||
/** | /** | |||
* Register a callback function to be called when a debug message has bee n | * Register a callback function to be called when a debug message has bee n | |||
* received and is ready to be processed. For the debug messages to be | * received and is ready to be processed. For the debug messages to be | |||
* processed V8 needs to be entered, and in certain embedding scenarios t his | * processed V8 needs to be entered, and in certain embedding scenarios t his | |||
* callback can be used to make sure V8 is entered for the debug message to | * callback can be used to make sure V8 is entered for the debug message to | |||
End of changes. 6 change blocks. | ||||
11 lines changed or deleted | 21 lines changed or added | |||
v8-profiler.h | v8-profiler.h | |||
---|---|---|---|---|
skipping to change at line 131 | skipping to change at line 131 | |||
unsigned GetUid() const; | 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 bottom up call tree. */ | /** Returns the root node of the bottom up call tree. */ | |||
const CpuProfileNode* GetBottomUpRoot() const; | const CpuProfileNode* GetBottomUpRoot() 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; | |||
/** | ||||
* Deletes the profile and removes it from CpuProfiler's list. | ||||
* All pointers to nodes previously returned become invalid. | ||||
* Profiles with the same uid but obtained using different | ||||
* security token are not deleted, but become inaccessible | ||||
* using FindProfile method. It is embedder's responsibility | ||||
* to call Delete on these profiles. | ||||
*/ | ||||
void Delete(); | ||||
}; | }; | |||
/** | /** | |||
* Interface for controlling CPU profiling. | * Interface for controlling CPU profiling. | |||
*/ | */ | |||
class V8EXPORT CpuProfiler { | class V8EXPORT CpuProfiler { | |||
public: | public: | |||
/** | /** | |||
* A note on security tokens usage. As scripts from different | * A note on security tokens usage. As scripts from different | |||
* origins can run inside a single V8 instance, it is possible to | * origins can run inside a single V8 instance, it is possible to | |||
skipping to change at line 180 | skipping to change at line 190 | |||
*/ | */ | |||
static void StartProfiling(Handle<String> title); | static void StartProfiling(Handle<String> title); | |||
/** | /** | |||
* 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. | |||
*/ | */ | |||
static const CpuProfile* StopProfiling( | static const CpuProfile* StopProfiling( | |||
Handle<String> title, | Handle<String> title, | |||
Handle<Value> security_token = Handle<Value>()); | Handle<Value> security_token = Handle<Value>()); | |||
/** | ||||
* Deletes all existing profiles, also cancelling all profiling | ||||
* activity. All previously returned pointers to profiles and their | ||||
* contents become invalid after this call. | ||||
*/ | ||||
static void DeleteAllProfiles(); | ||||
}; | }; | |||
class HeapGraphNode; | class HeapGraphNode; | |||
/** | /** | |||
* HeapSnapshotEdge represents a directed connection between heap | * HeapSnapshotEdge represents a directed connection between heap | |||
* graph nodes: from retaners to retained nodes. | * graph nodes: from retaners to retained nodes. | |||
*/ | */ | |||
class V8EXPORT HeapGraphEdge { | class V8EXPORT HeapGraphEdge { | |||
public: | public: | |||
skipping to change at line 361 | skipping to change at line 378 | |||
/** Returns a node by its id. */ | /** Returns a node by its id. */ | |||
const HeapGraphNode* GetNodeById(uint64_t id) const; | const HeapGraphNode* GetNodeById(uint64_t id) const; | |||
/** | /** | |||
* Returns a diff between this snapshot and another one. Only snapshots | * Returns a diff between this snapshot and another one. Only snapshots | |||
* of the same type can be compared. | * of the same type can be compared. | |||
*/ | */ | |||
const HeapSnapshotsDiff* CompareWith(const HeapSnapshot* snapshot) const; | const HeapSnapshotsDiff* CompareWith(const HeapSnapshot* snapshot) const; | |||
/** | /** | |||
* Deletes the snapshot and removes it from HeapProfiler's list. | ||||
* All pointers to nodes, edges and paths previously returned become | ||||
* invalid. | ||||
*/ | ||||
void Delete(); | ||||
/** | ||||
* Prepare a serialized representation of the snapshot. The result | * Prepare a serialized representation of the snapshot. The result | |||
* is written into the stream provided in chunks of specified size. | * is written into the stream provided in chunks of specified size. | |||
* The total length of the serialized snapshot is unknown in | * The total length of the serialized snapshot is unknown in | |||
* advance, it is can be roughly equal to JS heap size (that means, | * advance, it is can be roughly equal to JS heap size (that means, | |||
* it can be really big - tens of megabytes). | * it can be really big - tens of megabytes). | |||
* | * | |||
* For the JSON format, heap contents are represented as an object | * For the JSON format, heap contents are represented as an object | |||
* with the following structure: | * with the following structure: | |||
* | * | |||
* { | * { | |||
skipping to change at line 419 | skipping to change at line 443 | |||
/** | /** | |||
* Takes a heap snapshot and returns it. Title may be an empty string. | * Takes a heap snapshot and returns it. Title may be an empty string. | |||
* See HeapSnapshot::Type for types description. | * See HeapSnapshot::Type for types description. | |||
*/ | */ | |||
static const HeapSnapshot* TakeSnapshot( | static const HeapSnapshot* TakeSnapshot( | |||
Handle<String> title, | Handle<String> title, | |||
HeapSnapshot::Type type = HeapSnapshot::kFull, | HeapSnapshot::Type type = HeapSnapshot::kFull, | |||
ActivityControl* control = NULL); | ActivityControl* control = NULL); | |||
/** | ||||
* Deletes all snapshots taken. All previously returned pointers to | ||||
* snapshots and their contents become invalid after this call. | ||||
*/ | ||||
static void DeleteAllSnapshots(); | ||||
/** Binds a callback to embedder's class ID. */ | /** Binds a callback to embedder's class ID. */ | |||
static void DefineWrapperClass( | static void DefineWrapperClass( | |||
uint16_t class_id, | uint16_t class_id, | |||
WrapperInfoCallback callback); | WrapperInfoCallback callback); | |||
/** | /** | |||
* Default value of persistent handle class ID. Must not be used to | * Default value of persistent handle class ID. Must not be used to | |||
* define a class. Can be used to reset a class of a persistent | * define a class. Can be used to reset a class of a persistent | |||
* handle. | * handle. | |||
*/ | */ | |||
End of changes. 4 change blocks. | ||||
0 lines changed or deleted | 30 lines changed or added | |||
v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 113 | skipping to change at line 113 | |||
class Data; | class Data; | |||
class AccessorInfo; | class AccessorInfo; | |||
class StackTrace; | class StackTrace; | |||
class StackFrame; | class StackFrame; | |||
namespace internal { | namespace internal { | |||
class Arguments; | class Arguments; | |||
class Object; | class Object; | |||
class Heap; | class Heap; | |||
class Top; | class HeapObject; | |||
class Isolate; | ||||
} | } | |||
// --- W e a k H a n d l e s | // --- W e a k H a n d l e s | |||
/** | /** | |||
* A weak reference callback function. | * A weak reference callback function. | |||
* | * | |||
* This callback should either explicitly invoke Dispose on |object| if | * This callback should either explicitly invoke Dispose on |object| if | |||
* V8 wrapper is not needed anymore, or 'revive' it by invocation of MakeWe ak. | * V8 wrapper is not needed anymore, or 'revive' it by invocation of MakeWe ak. | |||
* | * | |||
skipping to change at line 440 | skipping to change at line 441 | |||
/** | /** | |||
* Counts the number of allocated handles. | * Counts the number of allocated handles. | |||
*/ | */ | |||
static int NumberOfHandles(); | static int NumberOfHandles(); | |||
/** | /** | |||
* Creates a new handle with the given value. | * Creates a new handle with the given value. | |||
*/ | */ | |||
static internal::Object** CreateHandle(internal::Object* value); | static internal::Object** CreateHandle(internal::Object* value); | |||
// Faster version, uses HeapObject to obtain the current Isolate. | ||||
static internal::Object** CreateHandle(internal::HeapObject* value); | ||||
private: | private: | |||
// Make it impossible to create heap-allocated or illegal handle | // Make it impossible to create heap-allocated or illegal handle | |||
// scopes by disallowing certain operations. | // scopes by disallowing certain operations. | |||
HandleScope(const HandleScope&); | HandleScope(const HandleScope&); | |||
void operator=(const HandleScope&); | void operator=(const HandleScope&); | |||
void* operator new(size_t size); | void* operator new(size_t size); | |||
void operator delete(void*, size_t); | void operator delete(void*, size_t); | |||
// This Data class is accessible internally as HandleScopeData through a | // This Data class is accessible internally as HandleScopeData through a | |||
skipping to change at line 456 | skipping to change at line 459 | |||
void* operator new(size_t size); | void* operator new(size_t size); | |||
void operator delete(void*, size_t); | void operator delete(void*, size_t); | |||
// This Data class is accessible internally as HandleScopeData through a | // This Data class is accessible internally as HandleScopeData through a | |||
// typedef in the ImplementationUtilities class. | // typedef in the ImplementationUtilities class. | |||
class V8EXPORT Data { | class V8EXPORT Data { | |||
public: | public: | |||
internal::Object** next; | internal::Object** next; | |||
internal::Object** limit; | internal::Object** limit; | |||
int level; | int level; | |||
inline void Initialize() { | inline void Initialize() { | |||
next = limit = NULL; | next = limit = NULL; | |||
level = 0; | level = 0; | |||
} | } | |||
}; | }; | |||
void Leave(); | void Leave(); | |||
internal::Isolate* isolate_; | ||||
internal::Object** prev_next_; | internal::Object** prev_next_; | |||
internal::Object** prev_limit_; | internal::Object** prev_limit_; | |||
// Allow for the active closing of HandleScopes which allows to pass a ha ndle | // 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. | // from the HandleScope being closed to the next top most HandleScope. | |||
bool is_closed_; | bool is_closed_; | |||
internal::Object** RawClose(internal::Object** value); | internal::Object** RawClose(internal::Object** value); | |||
friend class ImplementationUtilities; | friend class ImplementationUtilities; | |||
}; | }; | |||
skipping to change at line 2485 | skipping to change at line 2488 | |||
size_t total_heap_size_executable_; | size_t total_heap_size_executable_; | |||
size_t used_heap_size_; | size_t used_heap_size_; | |||
size_t heap_size_limit_; | size_t heap_size_limit_; | |||
friend class V8; | friend class V8; | |||
}; | }; | |||
class RetainedObjectInfo; | class RetainedObjectInfo; | |||
/** | /** | |||
* Isolate represents an isolated instance of the V8 engine. V8 | ||||
* isolates have completely separate states. Objects from one isolate | ||||
* must not be used in other isolates. When V8 is initialized a | ||||
* default isolate is implicitly created and entered. The embedder | ||||
* can create additional isolates and use them in parallel in multiple | ||||
* threads. An isolate can be entered by at most one thread at any | ||||
* given time. The Locker/Unlocker API can be used to synchronize. | ||||
*/ | ||||
class V8EXPORT Isolate { | ||||
public: | ||||
/** | ||||
* Stack-allocated class which sets the isolate for all operations | ||||
* executed within a local scope. | ||||
*/ | ||||
class V8EXPORT Scope { | ||||
public: | ||||
explicit Scope(Isolate* isolate) : isolate_(isolate) { | ||||
isolate->Enter(); | ||||
} | ||||
~Scope() { isolate_->Exit(); } | ||||
private: | ||||
Isolate* const isolate_; | ||||
// Prevent copying of Scope objects. | ||||
Scope(const Scope&); | ||||
Scope& operator=(const Scope&); | ||||
}; | ||||
/** | ||||
* Creates a new isolate. Does not change the currently entered | ||||
* isolate. | ||||
* | ||||
* When an isolate is no longer used its resources should be freed | ||||
* by calling Dispose(). Using the delete operator is not allowed. | ||||
*/ | ||||
static Isolate* New(); | ||||
/** | ||||
* Returns the entered isolate for the current thread or NULL in | ||||
* case there is no current isolate. | ||||
*/ | ||||
static Isolate* GetCurrent(); | ||||
/** | ||||
* Methods below this point require holding a lock (using Locker) in | ||||
* a multi-threaded environment. | ||||
*/ | ||||
/** | ||||
* Sets this isolate as the entered one for the current thread. | ||||
* Saves the previously entered one (if any), so that it can be | ||||
* restored when exiting. Re-entering an isolate is allowed. | ||||
*/ | ||||
void Enter(); | ||||
/** | ||||
* Exits this isolate by restoring the previously entered one in the | ||||
* current thread. The isolate may still stay the same, if it was | ||||
* entered more than once. | ||||
* | ||||
* Requires: this == Isolate::GetCurrent(). | ||||
*/ | ||||
void Exit(); | ||||
/** | ||||
* Disposes the isolate. The isolate must not be entered by any | ||||
* thread to be disposable. | ||||
*/ | ||||
void Dispose(); | ||||
private: | ||||
Isolate(); | ||||
Isolate(const Isolate&); | ||||
~Isolate(); | ||||
Isolate& operator=(const Isolate&); | ||||
void* operator new(size_t size); | ||||
void operator delete(void*, size_t); | ||||
}; | ||||
/** | ||||
* Container class for static utility functions. | * Container class for static utility functions. | |||
*/ | */ | |||
class V8EXPORT V8 { | class V8EXPORT V8 { | |||
public: | public: | |||
/** Set the callback to invoke in case of fatal errors. */ | /** Set the callback to invoke in case of fatal errors. */ | |||
static void SetFatalErrorHandler(FatalErrorCallback that); | static void SetFatalErrorHandler(FatalErrorCallback that); | |||
/** | /** | |||
* Ignore out-of-memory exceptions. | * Ignore out-of-memory exceptions. | |||
* | * | |||
skipping to change at line 2809 | skipping to change at line 2895 | |||
* continue the propagation of the termination exception if needed. | * continue the propagation of the termination exception if needed. | |||
* | * | |||
* The thread id passed to TerminateExecution must have been | * The thread id passed to TerminateExecution must have been | |||
* obtained by calling GetCurrentThreadId on the thread in question. | * obtained by calling GetCurrentThreadId on the thread in question. | |||
* | * | |||
* \param thread_id The thread id of the thread to terminate. | * \param thread_id The thread id of the thread to terminate. | |||
*/ | */ | |||
static void TerminateExecution(int thread_id); | static void TerminateExecution(int thread_id); | |||
/** | /** | |||
* 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 | ||||
* 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. | ||||
*/ | */ | |||
static void TerminateExecution(); | static void TerminateExecution(Isolate* isolate = NULL); | |||
/** | /** | |||
* Is V8 terminating JavaScript execution. | * Is V8 terminating JavaScript execution. | |||
* | * | |||
* Returns true if JavaScript execution is currently terminating | * Returns true if JavaScript execution is currently terminating | |||
* because of a call to TerminateExecution. In that case there are | * because of a call to TerminateExecution. In that case there are | |||
* still JavaScript frames on the stack and the termination | * still JavaScript frames on the stack and the termination | |||
* exception is still active. | * exception is still active. | |||
*/ | */ | |||
static bool IsExecutionTerminating(); | static bool IsExecutionTerminating(); | |||
skipping to change at line 2991 | skipping to change at line 3081 | |||
private: | private: | |||
void* next_; | void* next_; | |||
void* exception_; | void* exception_; | |||
void* message_; | void* message_; | |||
bool is_verbose_ : 1; | bool is_verbose_ : 1; | |||
bool can_continue_ : 1; | bool can_continue_ : 1; | |||
bool capture_message_ : 1; | bool capture_message_ : 1; | |||
bool rethrow_ : 1; | bool rethrow_ : 1; | |||
friend class v8::internal::Top; | friend class v8::internal::Isolate; | |||
}; | }; | |||
// --- C o n t e x t --- | // --- C o n t e x t --- | |||
/** | /** | |||
* Ignore | * Ignore | |||
*/ | */ | |||
class V8EXPORT ExtensionConfiguration { | class V8EXPORT ExtensionConfiguration { | |||
public: | public: | |||
ExtensionConfiguration(int name_count, const char* names[]) | ExtensionConfiguration(int name_count, const char* names[]) | |||
skipping to change at line 3150 | skipping to change at line 3240 | |||
private: | private: | |||
friend class Value; | friend class Value; | |||
friend class Script; | friend class Script; | |||
friend class Object; | friend class Object; | |||
friend class Function; | friend class Function; | |||
}; | }; | |||
/** | /** | |||
* Multiple threads in V8 are allowed, but only one thread at a time | * Multiple threads in V8 are allowed, but only one thread at a time | |||
* is allowed to use V8. The definition of 'using V8' includes | * is allowed to use any given V8 isolate. See Isolate class | |||
* accessing handles or holding onto object pointers obtained from V8 | * comments. The definition of 'using V8 isolate' includes | |||
* handles. It is up to the user of V8 to ensure (perhaps with | * accessing handles or holding onto object pointers obtained | |||
* locking) that this constraint is not violated. | * from V8 handles while in the particular V8 isolate. It is up | |||
* to the user of V8 to ensure (perhaps with locking) that this | ||||
* constraint is not violated. | ||||
* | * | |||
* If you wish to start using V8 in a thread you can do this by constructin | * More then one thread and multiple V8 isolates can be used | |||
g | * without any locking if each isolate is created and accessed | |||
* a v8::Locker object. After the code using V8 has completed for the | * by a single thread only. For example, one thread can use | |||
* current thread you can call the destructor. This can be combined | * multiple isolates or multiple threads can each create and run | |||
* with C++ scope-based construction as follows: | * their own isolate. | |||
* | ||||
* If you wish to start using V8 isolate in more then one thread | ||||
* you can do this by constructing a v8::Locker object to guard | ||||
* access to the isolate. After the code using V8 has completed | ||||
* for the current thread you can call the destructor. This can | ||||
* be combined with C++ scope-based construction as follows | ||||
* (assumes the default isolate that is used if not specified as | ||||
* a parameter for the Locker): | ||||
* | * | |||
* \code | * \code | |||
* ... | * ... | |||
* { | * { | |||
* v8::Locker locker; | * v8::Locker locker; | |||
* ... | * ... | |||
* // Code using V8 goes here. | * // Code using V8 goes here. | |||
* ... | * ... | |||
* } // Destructor called here | * } // Destructor called here | |||
* \endcode | * \endcode | |||
skipping to change at line 3395 | skipping to change at line 3496 | |||
* This class exports constants and functionality from within v8 that | * This class exports constants and functionality from within v8 that | |||
* is necessary to implement inline functions in the v8 api. Don't | * is necessary to implement inline functions in the v8 api. Don't | |||
* depend on functions and constants defined here. | * depend on functions and constants defined here. | |||
*/ | */ | |||
class Internals { | class Internals { | |||
public: | public: | |||
// These values match non-compiler-dependent values defined within | // These values match non-compiler-dependent values defined within | |||
// the implementation of v8. | // the implementation of v8. | |||
static const int kHeapObjectMapOffset = 0; | static const int kHeapObjectMapOffset = 0; | |||
static const int kMapInstanceTypeOffset = kApiPointerSize + kApiIntSize; | static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSi ze; | |||
static const int kStringResourceOffset = | static const int kStringResourceOffset = | |||
InternalConstants<kApiPointerSize>::kStringResourceOffset; | InternalConstants<kApiPointerSize>::kStringResourceOffset; | |||
static const int kProxyProxyOffset = kApiPointerSize; | static const int kProxyProxyOffset = kApiPointerSize; | |||
static const int kJSObjectHeaderSize = 3 * kApiPointerSize; | static const int kJSObjectHeaderSize = 3 * kApiPointerSize; | |||
static const int kFullStringRepresentationMask = 0x07; | static const int kFullStringRepresentationMask = 0x07; | |||
static const int kExternalTwoByteRepresentationTag = 0x02; | static const int kExternalTwoByteRepresentationTag = 0x02; | |||
static const int kJSObjectType = 0xa0; | static const int kJSObjectType = 0xa0; | |||
static const int kFirstNonstringType = 0x80; | static const int kFirstNonstringType = 0x80; | |||
skipping to change at line 3452 | skipping to change at line 3553 | |||
static inline bool IsExternalTwoByteString(int instance_type) { | static inline bool IsExternalTwoByteString(int instance_type) { | |||
int representation = (instance_type & kFullStringRepresentationMask); | int representation = (instance_type & kFullStringRepresentationMask); | |||
return representation == kExternalTwoByteRepresentationTag; | return representation == kExternalTwoByteRepresentationTag; | |||
} | } | |||
template <typename T> | template <typename T> | |||
static inline T ReadField(Object* ptr, int offset) { | static inline T ReadField(Object* ptr, int offset) { | |||
uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectT ag; | uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectT ag; | |||
return *reinterpret_cast<T*>(addr); | return *reinterpret_cast<T*>(addr); | |||
} | } | |||
static inline bool CanCastToHeapObject(void* o) { return false; } | ||||
static inline bool CanCastToHeapObject(Context* o) { return true; } | ||||
static inline bool CanCastToHeapObject(String* o) { return true; } | ||||
static inline bool CanCastToHeapObject(Object* o) { return true; } | ||||
static inline bool CanCastToHeapObject(Message* o) { return true; } | ||||
static inline bool CanCastToHeapObject(StackTrace* o) { return true; } | ||||
static inline bool CanCastToHeapObject(StackFrame* o) { return true; } | ||||
}; | }; | |||
} // namespace internal | } // namespace internal | |||
template <class T> | template <class T> | |||
Handle<T>::Handle() : val_(0) { } | Handle<T>::Handle() : val_(0) { } | |||
template <class T> | template <class T> | |||
Local<T>::Local() : Handle<T>() { } | Local<T>::Local() : Handle<T>() { } | |||
template <class T> | template <class T> | |||
Local<T> Local<T>::New(Handle<T> that) { | Local<T> Local<T>::New(Handle<T> that) { | |||
if (that.IsEmpty()) return Local<T>(); | if (that.IsEmpty()) return Local<T>(); | |||
internal::Object** p = reinterpret_cast<internal::Object**>(*that); | T* that_ptr = *that; | |||
internal::Object** p = reinterpret_cast<internal::Object**>(that_ptr); | ||||
if (internal::Internals::CanCastToHeapObject(that_ptr)) { | ||||
return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle( | ||||
reinterpret_cast<internal::HeapObject*>(*p)))); | ||||
} | ||||
return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(*p))); | return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(*p))); | |||
} | } | |||
template <class T> | template <class T> | |||
Persistent<T> Persistent<T>::New(Handle<T> that) { | Persistent<T> Persistent<T>::New(Handle<T> that) { | |||
if (that.IsEmpty()) return Persistent<T>(); | if (that.IsEmpty()) return Persistent<T>(); | |||
internal::Object** p = reinterpret_cast<internal::Object**>(*that); | internal::Object** p = reinterpret_cast<internal::Object**>(*that); | |||
return Persistent<T>(reinterpret_cast<T*>(V8::GlobalizeReference(p))); | return Persistent<T>(reinterpret_cast<T*>(V8::GlobalizeReference(p))); | |||
} | } | |||
End of changes. 14 change blocks. | ||||
16 lines changed or deleted | 130 lines changed or added | |||