* This handle's reference, and any other references to the storage
* cell remain and IsEmpty will still return false.
*/
- // TODO(dcarney): deprecate
- V8_INLINE(void Dispose(Isolate* isolate)) { Dispose(); }
+ V8_DEPRECATED(V8_INLINE(void Dispose(Isolate* isolate))) { Dispose(); }
/**
* Make the reference to this object weak. When only weak handles
V8_INLINE(void ClearWeak());
- // TODO(dcarney): deprecate
- V8_INLINE(void ClearWeak(Isolate* isolate)) { ClearWeak(); }
+ V8_DEPRECATED(V8_INLINE(void ClearWeak(Isolate* isolate))) { ClearWeak(); }
/**
* Marks the reference to this object independent. Garbage collector is free
*/
V8_INLINE(void MarkIndependent());
- // TODO(dcarney): deprecate
- V8_INLINE(void MarkIndependent(Isolate* isolate)) { MarkIndependent(); }
+ V8_DEPRECATED(V8_INLINE(void MarkIndependent(Isolate* isolate))) {
+ MarkIndependent();
+ }
/**
* Marks the reference to this object partially dependent. Partially dependent
*/
V8_INLINE(void MarkPartiallyDependent());
- // TODO(dcarney): deprecate
- V8_INLINE(void MarkPartiallyDependent(Isolate* isolate)) {
+ V8_DEPRECATED(V8_INLINE(void MarkPartiallyDependent(Isolate* isolate))) {
MarkPartiallyDependent();
}
V8_INLINE(bool IsIndependent() const);
- // TODO(dcarney): deprecate
- V8_INLINE(bool IsIndependent(Isolate* isolate) const) {
+ V8_DEPRECATED(V8_INLINE(bool IsIndependent(Isolate* isolate)) const) {
return IsIndependent();
}
/** Checks if the handle holds the only reference to an object. */
V8_INLINE(bool IsNearDeath() const);
- // TODO(dcarney): deprecate
- V8_INLINE(bool IsNearDeath(Isolate* isolate) const) { return IsNearDeath(); }
+ V8_DEPRECATED(V8_INLINE(bool IsNearDeath(Isolate* isolate)) const) {
+ return IsNearDeath();
+ }
/** Returns true if the handle's reference is weak. */
V8_INLINE(bool IsWeak() const);
- // TODO(dcarney): deprecate
- V8_INLINE(bool IsWeak(Isolate* isolate) const) { return IsWeak(); }
+ V8_DEPRECATED(V8_INLINE(bool IsWeak(Isolate* isolate)) const) {
+ return IsWeak();
+ }
/**
* Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface
*/
V8_INLINE(void SetWrapperClassId(uint16_t class_id));
- // TODO(dcarney): deprecate
- V8_INLINE(void SetWrapperClassId(Isolate* isolate, uint16_t class_id)) {
+ V8_DEPRECATED(
+ V8_INLINE(void SetWrapperClassId(Isolate * isolate, uint16_t class_id))) {
SetWrapperClassId(class_id);
}
*/
V8_INLINE(uint16_t WrapperClassId() const);
- // TODO(dcarney): deprecate
- V8_INLINE(uint16_t WrapperClassId(Isolate* isolate) const) {
+ V8_DEPRECATED(V8_INLINE(uint16_t WrapperClassId(Isolate* isolate)) const) {
return WrapperClassId();
}
template <class T>
void Persistent<T>::Reset(Isolate* isolate, const Handle<T>& other) {
- Dispose(isolate);
+ Dispose();
#ifdef V8_USE_UNSAFE_HANDLES
*this = *New(isolate, other);
#else
#ifndef V8_USE_UNSAFE_HANDLES
template <class T>
void Persistent<T>::Reset(Isolate* isolate, const Persistent<T>& other) {
- Dispose(isolate);
+ Dispose();
if (other.IsEmpty()) {
this->val_ = NULL;
return;
v8::HandleScope scope(isolate);
CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 6);
}
- global.Dispose(isolate);
+ global.Dispose();
CHECK_EQ(global_handles->global_handles_count(), initial_handle_count - 1);
}
WeakCallCounter* counter) {
CHECK_EQ(1234, counter->id());
counter->increment();
- handle->Dispose(isolate);
+ handle->Dispose();
}
root.MakeWeak(&counter, &WeakPointerCallback);
// But make children strong roots---all the objects (except for children)
// should be collectable now.
- g1c1.ClearWeak(iso);
- g2c1.ClearWeak(iso);
+ g1c1.ClearWeak();
+ g2c1.ClearWeak();
// Groups are deleted, rebuild groups.
{
g1s2.Reset(iso, Object::New());
g1s1.MakeWeak(&counter, &WeakPointerCallback);
g1s2.MakeWeak(&counter, &WeakPointerCallback);
- CHECK(g1s1.IsWeak(iso));
- CHECK(g1s2.IsWeak(iso));
+ CHECK(g1s1.IsWeak());
+ CHECK(g1s2.IsWeak());
g2s1.Reset(iso, Object::New());
g2s2.Reset(iso, Object::New());
g2s1.MakeWeak(&counter, &WeakPointerCallback);
g2s2.MakeWeak(&counter, &WeakPointerCallback);
- CHECK(g2s1.IsWeak(iso));
- CHECK(g2s2.IsWeak(iso));
+ CHECK(g2s1.IsWeak());
+ CHECK(g2s2.IsWeak());
g3s1.Reset(iso, Object::New());
g3s2.Reset(iso, Object::New());
g3s1.MakeWeak(&counter, &WeakPointerCallback);
g3s2.MakeWeak(&counter, &WeakPointerCallback);
- CHECK(g3s1.IsWeak(iso));
- CHECK(g3s2.IsWeak(iso));
+ CHECK(g3s1.IsWeak());
+ CHECK(g3s2.IsWeak());
g4s1.Reset(iso, Object::New());
g4s2.Reset(iso, Object::New());
g4s1.MakeWeak(&counter, &WeakPointerCallback);
g4s2.MakeWeak(&counter, &WeakPointerCallback);
- CHECK(g4s1.IsWeak(iso));
- CHECK(g4s2.IsWeak(iso));
+ CHECK(g4s1.IsWeak());
+ CHECK(g4s2.IsWeak());
}
Persistent<Value> root(iso, g1s1); // make a root.
// Make a root.
Persistent<Value> root(iso, g1s1);
- root.MarkPartiallyDependent(iso);
+ root.MarkPartiallyDependent();
// Connect groups. We're building the following cycle:
// G1: { g1s1, g2s1 }, g1s1 implicitly references g2s1, ditto for other
// groups.
{
HandleScope handle_scope(iso);
- g1s1.MarkPartiallyDependent(iso);
- g1s2.MarkPartiallyDependent(iso);
- g2s1.MarkPartiallyDependent(iso);
- g2s2.MarkPartiallyDependent(iso);
- g3s1.MarkPartiallyDependent(iso);
- g3s2.MarkPartiallyDependent(iso);
+ g1s1.MarkPartiallyDependent();
+ g1s2.MarkPartiallyDependent();
+ g2s1.MarkPartiallyDependent();
+ g2s2.MarkPartiallyDependent();
+ g3s1.MarkPartiallyDependent();
+ g3s2.MarkPartiallyDependent();
iso->SetObjectGroupId(g1s1, UniqueId(1));
iso->SetObjectGroupId(g1s2, UniqueId(1));
Local<Object>::New(iso, g1s1.As<Object>())->Set(
// Weaken the root.
root.MakeWeak(&counter, &WeakPointerCallback);
- root.MarkPartiallyDependent(iso);
+ root.MarkPartiallyDependent();
- v8::Isolate* isolate = v8::Isolate::GetCurrent();
// Groups are deleted, rebuild groups.
{
HandleScope handle_scope(iso);
- g1s1.MarkPartiallyDependent(isolate);
- g1s2.MarkPartiallyDependent(isolate);
- g2s1.MarkPartiallyDependent(isolate);
- g2s2.MarkPartiallyDependent(isolate);
- g3s1.MarkPartiallyDependent(isolate);
- g3s2.MarkPartiallyDependent(isolate);
+ g1s1.MarkPartiallyDependent();
+ g1s2.MarkPartiallyDependent();
+ g2s1.MarkPartiallyDependent();
+ g2s2.MarkPartiallyDependent();
+ g3s1.MarkPartiallyDependent();
+ g3s2.MarkPartiallyDependent();
iso->SetObjectGroupId(g1s1, UniqueId(1));
iso->SetObjectGroupId(g1s2, UniqueId(1));
Local<Object>::New(iso, g1s1.As<Object>())->Set(
v8::Handle<v8::Object> obj = v8::Object::New();
v8::Persistent<v8::Object> alias(isolate, obj);
CHECK(v8::Local<v8::Object>::New(isolate, alias)->StrictEquals(obj));
- alias.Dispose(isolate);
+ alias.Dispose();
}
CHECK(xValue.IsEmpty());
script->Run();
CHECK_EQ(v8_num(4), Local<Value>::New(v8::Isolate::GetCurrent(), xValue));
- xValue.Dispose(context->GetIsolate());
+ xValue.Dispose();
xValue.Clear();
}
}
CHECK(xValue.IsEmpty());
script->Run();
CHECK_EQ(v8_num(4), Local<Value>::New(v8::Isolate::GetCurrent(), xValue));
- xValue.Dispose(context->GetIsolate());
+ xValue.Dispose();
xValue.Clear();
}
}
class Whammy {
public:
explicit Whammy(v8::Isolate* isolate) : cursor_(0), isolate_(isolate) { }
- ~Whammy() { script_.Dispose(isolate_); }
+ ~Whammy() { script_.Dispose(); }
v8::Handle<Script> getScript() {
if (script_.IsEmpty()) script_.Reset(isolate_, v8_compile("({}).blammo"));
return Local<Script>::New(isolate_, script_);
v8::Persistent<v8::Value>* obj,
Snorkel* snorkel) {
delete snorkel;
- obj->ClearWeak(isolate);
+ obj->ClearWeak();
}
void WhammyPropertyGetter(Local<String> name,
static void DisposeAndSetFlag(v8::Isolate* isolate,
v8::Persistent<v8::Object>* obj,
bool* data) {
- obj->Dispose(isolate);
+ obj->Dispose();
*(data) = true;
}
bool object_b_disposed = false;
object_a.MakeWeak(&object_a_disposed, &DisposeAndSetFlag);
object_b.MakeWeak(&object_b_disposed, &DisposeAndSetFlag);
- CHECK(!object_b.IsIndependent(iso));
- object_a.MarkIndependent(iso);
- object_b.MarkIndependent(iso);
- CHECK(object_b.IsIndependent(iso));
+ CHECK(!object_b.IsIndependent());
+ object_a.MarkIndependent();
+ object_b.MarkIndependent();
+ CHECK(object_b.IsIndependent());
HEAP->PerformScavenge();
CHECK(object_a_disposed);
CHECK(object_b_disposed);
static void ForceScavenge(v8::Isolate* isolate,
v8::Persistent<v8::Object>* obj,
bool* data) {
- obj->Dispose(isolate);
+ obj->Dispose();
*(data) = true;
InvokeScavenge();
}
static void ForceMarkSweep(v8::Isolate* isolate,
v8::Persistent<v8::Object>* obj,
bool* data) {
- obj->Dispose(isolate);
+ obj->Dispose();
*(data) = true;
InvokeMarkSweep();
}
}
bool disposed = false;
object.MakeWeak(&disposed, gc_forcing_callback[inner_gc]);
- object.MarkIndependent(isolate);
+ object.MarkIndependent();
invoke_gc[outer_gc]();
CHECK(disposed);
}
static void RevivingCallback(v8::Isolate* isolate,
v8::Persistent<v8::Object>* obj,
bool* data) {
- obj->ClearWeak(isolate);
+ obj->ClearWeak();
*(data) = true;
}
}
bool revived = false;
object.MakeWeak(&revived, &RevivingCallback);
- object.MarkIndependent(isolate);
+ object.MarkIndependent();
HEAP->PerformScavenge();
CHECK(revived);
HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
void*) {
v8::HandleScope scope(isolate);
bad_handle.Reset(isolate, some_object);
- handle->Dispose(isolate);
+ handle->Dispose();
}
// in reverse allocation order, so if second allocated handle is deleted,
// weak callback of the first handle would be able to 'reallocate' it.
handle1.MakeWeak<v8::Value, void>(NULL, NewPersistentHandleCallback);
- handle2.Dispose(isolate);
+ handle2.Dispose();
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
}
void DisposeAndForceGcCallback(v8::Isolate* isolate,
v8::Persistent<v8::Value>* handle,
void*) {
- to_be_disposed.Dispose(isolate);
+ to_be_disposed.Dispose();
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
- handle->Dispose(isolate);
+ handle->Dispose();
}
void DisposingCallback(v8::Isolate* isolate,
v8::Persistent<v8::Value>* handle,
void*) {
- handle->Dispose(isolate);
+ handle->Dispose();
}
void HandleCreatingCallback(v8::Isolate* isolate,
void*) {
v8::HandleScope scope(isolate);
v8::Persistent<v8::Object>(isolate, v8::Object::New());
- handle->Dispose(isolate);
+ handle->Dispose();
}
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
v8::Persistent<v8::Object> object(isolate, v8::Object::New());
- CHECK_EQ(0, object.WrapperClassId(isolate));
- object.SetWrapperClassId(isolate, 42);
- CHECK_EQ(42, object.WrapperClassId(isolate));
+ CHECK_EQ(0, object.WrapperClassId());
+ object.SetWrapperClassId(42);
+ CHECK_EQ(42, object.WrapperClassId());
Visitor42 visitor(&object);
v8::V8::VisitHandlesWithClassIds(&visitor);
CHECK_EQ(1, visitor.counter_);
- object.Dispose(isolate);
+ object.Dispose();
}
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
v8::Persistent<v8::Object> object(isolate, v8::Object::New());
- CHECK_EQ(0, object.WrapperClassId(isolate));
- object.SetWrapperClassId(isolate, 65535);
- CHECK_EQ(65535, object.WrapperClassId(isolate));
- object.Dispose(isolate);
+ CHECK_EQ(0, object.WrapperClassId());
+ object.SetWrapperClassId(65535);
+ CHECK_EQ(65535, object.WrapperClassId());
+ object.Dispose();
}
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
v8::Persistent<v8::Object> object1(isolate, v8::Object::New());
- CHECK_EQ(0, object1.WrapperClassId(isolate));
- object1.SetWrapperClassId(isolate, 42);
- CHECK_EQ(42, object1.WrapperClassId(isolate));
+ CHECK_EQ(0, object1.WrapperClassId());
+ object1.SetWrapperClassId(42);
+ CHECK_EQ(42, object1.WrapperClassId());
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
v8::Persistent<v8::Object> object2(isolate, v8::Object::New());
- CHECK_EQ(0, object2.WrapperClassId(isolate));
- object2.SetWrapperClassId(isolate, 42);
- CHECK_EQ(42, object2.WrapperClassId(isolate));
+ CHECK_EQ(0, object2.WrapperClassId());
+ object2.SetWrapperClassId(42);
+ CHECK_EQ(42, object2.WrapperClassId());
Visitor42 visitor(&object2);
v8::V8::VisitHandlesForPartialDependence(isolate, &visitor);
CHECK_EQ(1, visitor.counter_);
- object1.Dispose(isolate);
- object2.Dispose(isolate);
+ object1.Dispose();
+ object2.Dispose();
}