Deprecate Persistent functions which were marked to be deprecated.
BUG= R=svenpanne@chromium.org Review URL: https://codereview.chromium.org/23707009 Patch from Marja Hölttä <marja@chromium.org>. git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16493 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
281de965a4
commit
625874a48c
38
include/v8.h
38
include/v8.h
@ -634,8 +634,7 @@ template <class T> class Persistent // NOLINT
|
||||
* 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
|
||||
@ -667,8 +666,7 @@ template <class T> class Persistent // NOLINT
|
||||
|
||||
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
|
||||
@ -678,8 +676,9 @@ template <class T> class Persistent // NOLINT
|
||||
*/
|
||||
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
|
||||
@ -691,29 +690,29 @@ template <class T> class Persistent // NOLINT
|
||||
*/
|
||||
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
|
||||
@ -721,8 +720,8 @@ template <class T> class Persistent // NOLINT
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@ -732,8 +731,7 @@ template <class T> class Persistent // NOLINT
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
@ -5736,7 +5734,7 @@ void Persistent<T>::MarkPartiallyDependent() {
|
||||
|
||||
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
|
||||
@ -5754,7 +5752,7 @@ void Persistent<T>::Reset(Isolate* isolate, const Handle<T>& other) {
|
||||
#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;
|
||||
|
@ -291,9 +291,8 @@ JsHttpRequestProcessor::~JsHttpRequestProcessor() {
|
||||
// Dispose the persistent handles. When noone else has any
|
||||
// references to the objects stored in the handles they will be
|
||||
// automatically reclaimed.
|
||||
Isolate* isolate = GetIsolate();
|
||||
context_.Dispose(isolate);
|
||||
process_.Dispose(isolate);
|
||||
context_.Dispose();
|
||||
process_.Dispose();
|
||||
}
|
||||
|
||||
|
||||
|
@ -271,10 +271,10 @@ PerIsolateData::RealmScope::RealmScope(PerIsolateData* data) : data_(data) {
|
||||
PerIsolateData::RealmScope::~RealmScope() {
|
||||
// Drop realms to avoid keeping them alive.
|
||||
for (int i = 0; i < data_->realm_count_; ++i)
|
||||
data_->realms_[i].Dispose(data_->isolate_);
|
||||
data_->realms_[i].Dispose();
|
||||
delete[] data_->realms_;
|
||||
if (!data_->realm_shared_.IsEmpty())
|
||||
data_->realm_shared_.Dispose(data_->isolate_);
|
||||
data_->realm_shared_.Dispose();
|
||||
}
|
||||
|
||||
|
||||
@ -361,7 +361,7 @@ void Shell::RealmDispose(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
Throw("Invalid realm index");
|
||||
return;
|
||||
}
|
||||
data->realms_[index].Dispose(isolate);
|
||||
data->realms_[index].Dispose();
|
||||
data->realms_[index].Clear();
|
||||
}
|
||||
|
||||
@ -420,7 +420,7 @@ void Shell::RealmSharedSet(Local<String> property,
|
||||
const PropertyCallbackInfo<void>& info) {
|
||||
Isolate* isolate = info.GetIsolate();
|
||||
PerIsolateData* data = PerIsolateData::Get(isolate);
|
||||
if (!data->realm_shared_.IsEmpty()) data->realm_shared_.Dispose(isolate);
|
||||
if (!data->realm_shared_.IsEmpty()) data->realm_shared_.Dispose();
|
||||
data->realm_shared_.Reset(isolate, value);
|
||||
}
|
||||
|
||||
|
@ -709,7 +709,7 @@ void ScriptCache::HandleWeakScript(v8::Isolate* isolate,
|
||||
script_cache->collected_scripts_.Add(id);
|
||||
|
||||
// Clear the weak handle.
|
||||
obj->Dispose(isolate);
|
||||
obj->Dispose();
|
||||
}
|
||||
|
||||
|
||||
|
@ -872,7 +872,7 @@ void DateFormat::DeleteDateFormat(v8::Isolate* isolate,
|
||||
v8::Utils::OpenPersistent(object))->GetInternalField(0));
|
||||
|
||||
// Then dispose of the persistent handle to JS object.
|
||||
object->Dispose(isolate);
|
||||
object->Dispose();
|
||||
}
|
||||
|
||||
|
||||
@ -936,7 +936,7 @@ void NumberFormat::DeleteNumberFormat(v8::Isolate* isolate,
|
||||
v8::Utils::OpenPersistent(object))->GetInternalField(0));
|
||||
|
||||
// Then dispose of the persistent handle to JS object.
|
||||
object->Dispose(isolate);
|
||||
object->Dispose();
|
||||
}
|
||||
|
||||
|
||||
@ -997,7 +997,7 @@ void Collator::DeleteCollator(v8::Isolate* isolate,
|
||||
v8::Utils::OpenPersistent(object))->GetInternalField(0));
|
||||
|
||||
// Then dispose of the persistent handle to JS object.
|
||||
object->Dispose(isolate);
|
||||
object->Dispose();
|
||||
}
|
||||
|
||||
|
||||
@ -1064,7 +1064,7 @@ void BreakIterator::DeleteBreakIterator(v8::Isolate* isolate,
|
||||
v8::Utils::OpenPersistent(object))->GetInternalField(1));
|
||||
|
||||
// Then dispose of the persistent handle to JS object.
|
||||
object->Dispose(isolate);
|
||||
object->Dispose();
|
||||
}
|
||||
|
||||
} } // namespace v8::internal
|
||||
|
@ -398,7 +398,7 @@ int main(int argc, char** argv) {
|
||||
// context even after we have disposed of the context.
|
||||
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags, "mksnapshot");
|
||||
i::Object* raw_context = *v8::Utils::OpenPersistent(context);
|
||||
context.Dispose(isolate);
|
||||
context.Dispose();
|
||||
CppByteSink sink(argv[1]);
|
||||
// This results in a somewhat smaller snapshot, probably because it gets rid
|
||||
// of some things that are cached between garbage collections.
|
||||
|
@ -3108,7 +3108,7 @@ THREADED_TEST(ResettingGlobalHandle) {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -3242,7 +3242,7 @@ static void WeakPointerCallback(v8::Isolate* isolate,
|
||||
WeakCallCounter* counter) {
|
||||
CHECK_EQ(1234, counter->id());
|
||||
counter->increment();
|
||||
handle->Dispose(isolate);
|
||||
handle->Dispose();
|
||||
}
|
||||
|
||||
|
||||
@ -3315,8 +3315,8 @@ THREADED_TEST(ApiObjectGroups) {
|
||||
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.
|
||||
{
|
||||
@ -3366,29 +3366,29 @@ THREADED_TEST(ApiObjectGroupsCycle) {
|
||||
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.
|
||||
@ -3490,19 +3490,19 @@ TEST(ApiObjectGroupsCycleForScavenger) {
|
||||
|
||||
// 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(
|
||||
@ -3526,18 +3526,17 @@ TEST(ApiObjectGroupsCycleForScavenger) {
|
||||
|
||||
// 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(
|
||||
@ -4895,7 +4894,7 @@ THREADED_TEST(Equality) {
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@ -5210,7 +5209,7 @@ THREADED_TEST(SimplePropertyWrite) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
@ -5227,7 +5226,7 @@ THREADED_TEST(SetterOnly) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
@ -6602,7 +6601,7 @@ class Snorkel {
|
||||
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_);
|
||||
@ -6620,7 +6619,7 @@ static void HandleWeakReference(v8::Isolate* isolate,
|
||||
v8::Persistent<v8::Value>* obj,
|
||||
Snorkel* snorkel) {
|
||||
delete snorkel;
|
||||
obj->ClearWeak(isolate);
|
||||
obj->ClearWeak();
|
||||
}
|
||||
|
||||
void WhammyPropertyGetter(Local<String> name,
|
||||
@ -6676,7 +6675,7 @@ THREADED_TEST(WeakReference) {
|
||||
static void DisposeAndSetFlag(v8::Isolate* isolate,
|
||||
v8::Persistent<v8::Object>* obj,
|
||||
bool* data) {
|
||||
obj->Dispose(isolate);
|
||||
obj->Dispose();
|
||||
*(data) = true;
|
||||
}
|
||||
|
||||
@ -6699,10 +6698,10 @@ THREADED_TEST(IndependentWeakHandle) {
|
||||
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);
|
||||
@ -6722,7 +6721,7 @@ static void InvokeMarkSweep() {
|
||||
static void ForceScavenge(v8::Isolate* isolate,
|
||||
v8::Persistent<v8::Object>* obj,
|
||||
bool* data) {
|
||||
obj->Dispose(isolate);
|
||||
obj->Dispose();
|
||||
*(data) = true;
|
||||
InvokeScavenge();
|
||||
}
|
||||
@ -6731,7 +6730,7 @@ static void ForceScavenge(v8::Isolate* isolate,
|
||||
static void ForceMarkSweep(v8::Isolate* isolate,
|
||||
v8::Persistent<v8::Object>* obj,
|
||||
bool* data) {
|
||||
obj->Dispose(isolate);
|
||||
obj->Dispose();
|
||||
*(data) = true;
|
||||
InvokeMarkSweep();
|
||||
}
|
||||
@ -6760,7 +6759,7 @@ THREADED_TEST(GCFromWeakCallbacks) {
|
||||
}
|
||||
bool disposed = false;
|
||||
object.MakeWeak(&disposed, gc_forcing_callback[inner_gc]);
|
||||
object.MarkIndependent(isolate);
|
||||
object.MarkIndependent();
|
||||
invoke_gc[outer_gc]();
|
||||
CHECK(disposed);
|
||||
}
|
||||
@ -6771,7 +6770,7 @@ THREADED_TEST(GCFromWeakCallbacks) {
|
||||
static void RevivingCallback(v8::Isolate* isolate,
|
||||
v8::Persistent<v8::Object>* obj,
|
||||
bool* data) {
|
||||
obj->ClearWeak(isolate);
|
||||
obj->ClearWeak();
|
||||
*(data) = true;
|
||||
}
|
||||
|
||||
@ -6793,7 +6792,7 @@ THREADED_TEST(IndependentHandleRevival) {
|
||||
}
|
||||
bool revived = false;
|
||||
object.MakeWeak(&revived, &RevivingCallback);
|
||||
object.MarkIndependent(isolate);
|
||||
object.MarkIndependent();
|
||||
HEAP->PerformScavenge();
|
||||
CHECK(revived);
|
||||
HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
|
||||
@ -12598,7 +12597,7 @@ void NewPersistentHandleCallback(v8::Isolate* isolate,
|
||||
void*) {
|
||||
v8::HandleScope scope(isolate);
|
||||
bad_handle.Reset(isolate, some_object);
|
||||
handle->Dispose(isolate);
|
||||
handle->Dispose();
|
||||
}
|
||||
|
||||
|
||||
@ -12618,7 +12617,7 @@ THREADED_TEST(NewPersistentHandleFromWeakCallback) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
@ -12628,9 +12627,9 @@ v8::Persistent<v8::Object> to_be_disposed;
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@ -12652,7 +12651,7 @@ THREADED_TEST(DoNotUseDeletedNodesInSecondLevelGc) {
|
||||
void DisposingCallback(v8::Isolate* isolate,
|
||||
v8::Persistent<v8::Value>* handle,
|
||||
void*) {
|
||||
handle->Dispose(isolate);
|
||||
handle->Dispose();
|
||||
}
|
||||
|
||||
void HandleCreatingCallback(v8::Isolate* isolate,
|
||||
@ -12660,7 +12659,7 @@ void HandleCreatingCallback(v8::Isolate* isolate,
|
||||
void*) {
|
||||
v8::HandleScope scope(isolate);
|
||||
v8::Persistent<v8::Object>(isolate, v8::Object::New());
|
||||
handle->Dispose(isolate);
|
||||
handle->Dispose();
|
||||
}
|
||||
|
||||
|
||||
@ -18590,15 +18589,15 @@ TEST(PersistentHandleVisitor) {
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@ -18607,10 +18606,10 @@ TEST(WrapperClassId) {
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@ -18619,23 +18618,23 @@ TEST(PersistentHandleInNewSpaceVisitor) {
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -6635,7 +6635,7 @@ TEST(ScriptCollectedEventContext) {
|
||||
v8::Local<v8::Context>::New(isolate, context);
|
||||
local_context->Exit();
|
||||
}
|
||||
context.Dispose(isolate);
|
||||
context.Dispose();
|
||||
|
||||
// Do garbage collection to collect the script above which is no longer
|
||||
// referenced.
|
||||
|
@ -38,11 +38,11 @@ class HandleArray : public Malloced {
|
||||
public:
|
||||
static const unsigned kArraySize = 200;
|
||||
explicit HandleArray() {}
|
||||
~HandleArray() { Reset(v8::Isolate::GetCurrent()); }
|
||||
void Reset(v8::Isolate* isolate) {
|
||||
~HandleArray() { Reset(); }
|
||||
void Reset() {
|
||||
for (unsigned i = 0; i < kArraySize; i++) {
|
||||
if (handles_[i].IsEmpty()) continue;
|
||||
handles_[i].Dispose(isolate);
|
||||
handles_[i].Dispose();
|
||||
handles_[i].Clear();
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class DeclarationContext {
|
||||
HandleScope scope(isolate);
|
||||
Local<Context> context = Local<Context>::New(isolate, context_);
|
||||
context->Exit();
|
||||
context_.Dispose(isolate);
|
||||
context_.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1201,11 +1201,11 @@ TEST(HeapSnapshotRetainedObjectInfo) {
|
||||
heap_profiler->SetWrapperClassInfoProvider(
|
||||
2, TestRetainedObjectInfo::WrapperInfoCallback);
|
||||
v8::Persistent<v8::String> p_AAA(isolate, v8_str("AAA"));
|
||||
p_AAA.SetWrapperClassId(isolate, 1);
|
||||
p_AAA.SetWrapperClassId(1);
|
||||
v8::Persistent<v8::String> p_BBB(isolate, v8_str("BBB"));
|
||||
p_BBB.SetWrapperClassId(isolate, 1);
|
||||
p_BBB.SetWrapperClassId(1);
|
||||
v8::Persistent<v8::String> p_CCC(isolate, v8_str("CCC"));
|
||||
p_CCC.SetWrapperClassId(isolate, 2);
|
||||
p_CCC.SetWrapperClassId(2);
|
||||
CHECK_EQ(0, TestRetainedObjectInfo::instances.length());
|
||||
const v8::HeapSnapshot* snapshot =
|
||||
heap_profiler->TakeHeapSnapshot(v8_str("retained"));
|
||||
@ -1711,7 +1711,7 @@ bool HasWeakGlobalHandle() {
|
||||
static void PersistentHandleCallback(v8::Isolate* isolate,
|
||||
v8::Persistent<v8::Value>* handle,
|
||||
void*) {
|
||||
handle->Dispose(isolate);
|
||||
handle->Dispose();
|
||||
}
|
||||
|
||||
|
||||
|
@ -401,7 +401,7 @@ static void TestWeakGlobalHandleCallback(v8::Isolate* isolate,
|
||||
v8::Persistent<v8::Value>* handle,
|
||||
void* id) {
|
||||
if (1234 == reinterpret_cast<intptr_t>(id)) WeakPointerCleared = true;
|
||||
handle->Dispose(isolate);
|
||||
handle->Dispose();
|
||||
}
|
||||
|
||||
|
||||
@ -1723,12 +1723,12 @@ TEST(LeakNativeContextViaMap) {
|
||||
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0));
|
||||
ctx2->Exit();
|
||||
v8::Local<v8::Context>::New(isolate, ctx1)->Exit();
|
||||
ctx1p.Dispose(isolate);
|
||||
ctx1p.Dispose();
|
||||
v8::V8::ContextDisposedNotification();
|
||||
}
|
||||
HEAP->CollectAllAvailableGarbage();
|
||||
CHECK_EQ(2, NumberOfGlobalObjects());
|
||||
ctx2p.Dispose(isolate);
|
||||
ctx2p.Dispose();
|
||||
HEAP->CollectAllAvailableGarbage();
|
||||
CHECK_EQ(0, NumberOfGlobalObjects());
|
||||
}
|
||||
@ -1769,12 +1769,12 @@ TEST(LeakNativeContextViaFunction) {
|
||||
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0));
|
||||
ctx2->Exit();
|
||||
ctx1->Exit();
|
||||
ctx1p.Dispose(ctx1->GetIsolate());
|
||||
ctx1p.Dispose();
|
||||
v8::V8::ContextDisposedNotification();
|
||||
}
|
||||
HEAP->CollectAllAvailableGarbage();
|
||||
CHECK_EQ(2, NumberOfGlobalObjects());
|
||||
ctx2p.Dispose(isolate);
|
||||
ctx2p.Dispose();
|
||||
HEAP->CollectAllAvailableGarbage();
|
||||
CHECK_EQ(0, NumberOfGlobalObjects());
|
||||
}
|
||||
@ -1813,12 +1813,12 @@ TEST(LeakNativeContextViaMapKeyed) {
|
||||
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0));
|
||||
ctx2->Exit();
|
||||
ctx1->Exit();
|
||||
ctx1p.Dispose(ctx1->GetIsolate());
|
||||
ctx1p.Dispose();
|
||||
v8::V8::ContextDisposedNotification();
|
||||
}
|
||||
HEAP->CollectAllAvailableGarbage();
|
||||
CHECK_EQ(2, NumberOfGlobalObjects());
|
||||
ctx2p.Dispose(isolate);
|
||||
ctx2p.Dispose();
|
||||
HEAP->CollectAllAvailableGarbage();
|
||||
CHECK_EQ(0, NumberOfGlobalObjects());
|
||||
}
|
||||
@ -1861,12 +1861,12 @@ TEST(LeakNativeContextViaMapProto) {
|
||||
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0));
|
||||
ctx2->Exit();
|
||||
ctx1->Exit();
|
||||
ctx1p.Dispose(isolate);
|
||||
ctx1p.Dispose();
|
||||
v8::V8::ContextDisposedNotification();
|
||||
}
|
||||
HEAP->CollectAllAvailableGarbage();
|
||||
CHECK_EQ(2, NumberOfGlobalObjects());
|
||||
ctx2p.Dispose(isolate);
|
||||
ctx2p.Dispose();
|
||||
HEAP->CollectAllAvailableGarbage();
|
||||
CHECK_EQ(0, NumberOfGlobalObjects());
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ static void WeakPointerCallback(v8::Isolate* isolate,
|
||||
void* id) {
|
||||
ASSERT(id == reinterpret_cast<void*>(1234));
|
||||
NumberOfWeakCalls++;
|
||||
handle->Dispose(isolate);
|
||||
handle->Dispose();
|
||||
}
|
||||
|
||||
|
||||
|
@ -412,7 +412,7 @@ TEST(PartialSerialization) {
|
||||
v8::HandleScope handle_scope(v8_isolate);
|
||||
v8::Local<v8::Context>::New(v8_isolate, env)->Exit();
|
||||
}
|
||||
env.Dispose(v8_isolate);
|
||||
env.Dispose();
|
||||
|
||||
FileByteSink startup_sink(startup_name.start());
|
||||
StartupSerializer startup_serializer(&startup_sink);
|
||||
@ -558,7 +558,7 @@ TEST(ContextSerialization) {
|
||||
|
||||
i::Object* raw_context = *v8::Utils::OpenPersistent(env);
|
||||
|
||||
env.Dispose(v8_isolate);
|
||||
env.Dispose();
|
||||
|
||||
FileByteSink startup_sink(startup_name.start());
|
||||
StartupSerializer startup_serializer(&startup_sink);
|
||||
|
@ -69,7 +69,7 @@ static void WeakPointerCallback(v8::Isolate* isolate,
|
||||
void* id) {
|
||||
ASSERT(id == reinterpret_cast<void*>(1234));
|
||||
NumberOfWeakCalls++;
|
||||
handle->Dispose(isolate);
|
||||
handle->Dispose();
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,7 +69,7 @@ static void WeakPointerCallback(v8::Isolate* isolate,
|
||||
void* id) {
|
||||
ASSERT(id == reinterpret_cast<void*>(1234));
|
||||
NumberOfWeakCalls++;
|
||||
handle->Dispose(isolate);
|
||||
handle->Dispose();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user