v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 219 | skipping to change at line 219 | |||
P* parameter); | P* parameter); | |||
}; | }; | |||
// --- Handles --- | // --- Handles --- | |||
#define TYPE_CHECK(T, S) \ | #define TYPE_CHECK(T, S) \ | |||
while (false) { \ | while (false) { \ | |||
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \ | *(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \ | |||
} | } | |||
#define V8_USE_UNSAFE_HANDLES | ||||
/** | /** | |||
* An object reference managed by the v8 garbage collector. | * An object reference managed by the v8 garbage collector. | |||
* | * | |||
* All objects returned from v8 have to be tracked by the garbage | * All objects returned from v8 have to be tracked by the garbage | |||
* collector so that it knows that the objects are still alive. Also, | * collector so that it knows that the objects are still alive. Also, | |||
* because the garbage collector may move objects, it is unsafe to | * because the garbage collector may move objects, it is unsafe to | |||
* point directly to an object. Instead, all objects are stored in | * point directly to an object. Instead, all objects are stored in | |||
* handles which are known by the garbage collector and updated | * handles which are known by the garbage collector and updated | |||
* whenever an object moves. Handles should always be passed by value | * whenever an object moves. Handles should always be passed by value | |||
* (except in cases like out-parameters) and they should never be | * (except in cases like out-parameters) and they should never be | |||
skipping to change at line 489 | skipping to change at line 487 | |||
*/ | */ | |||
template <class T> class Persistent // NOLINT | template <class T> class Persistent // NOLINT | |||
#ifdef V8_USE_UNSAFE_HANDLES | #ifdef V8_USE_UNSAFE_HANDLES | |||
: public Handle<T> { | : public Handle<T> { | |||
#else | #else | |||
{ // NOLINT | { // NOLINT | |||
#endif | #endif | |||
public: | public: | |||
#ifndef V8_USE_UNSAFE_HANDLES | #ifndef V8_USE_UNSAFE_HANDLES | |||
V8_INLINE(Persistent()) : val_(0) { } | V8_INLINE(Persistent()) : val_(0) { } | |||
V8_INLINE(~Persistent()) { | // TODO(dcarney): add this back before cutover. | |||
// TODO(dcarney): add this back before cutover. | // V8_INLINE(~Persistent()) { | |||
// Dispose(); | // Dispose(); | |||
} | // } | |||
V8_INLINE(bool IsEmpty() const) { return val_ == 0; } | V8_INLINE(bool IsEmpty() const) { return val_ == 0; } | |||
// TODO(dcarney): remove somehow before cutover | // TODO(dcarney): remove somehow before cutover | |||
// The handle should either be 0, or a pointer to a live cell. | // The handle should either be 0, or a pointer to a live cell. | |||
V8_INLINE(void Clear()) { val_ = 0; } | V8_INLINE(void Clear()) { val_ = 0; } | |||
/** | /** | |||
* A constructor that creates a new global cell pointing to that. In cont rast | * A constructor that creates a new global cell pointing to that. In cont rast | |||
* to the copy constructor, this creates a new persistent handle which ne eds | * to the copy constructor, this creates a new persistent handle which ne eds | |||
* to be separately disposed. | * to be separately disposed. | |||
*/ | */ | |||
End of changes. 2 change blocks. | ||||
6 lines changed or deleted | 4 lines changed or added | |||