Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1347)

Unified Diff: test/cctest/test-heap.cc

Issue 99193002: Remove all stuff marked as V8_DEPRECATED. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index 8a8df2990457f9d13ff95ea2ae3ee402d123452c..3b73ba744d084f2535a1a284af3edb35e8c34996 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -26,6 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdlib.h>
+#include <utility>
#include "v8.h"
@@ -382,22 +383,24 @@ TEST(GlobalHandles) {
CHECK((*h4)->IsHeapNumber());
CHECK_EQ(*h3, *h1);
- global_handles->Destroy(h1.location());
- global_handles->Destroy(h3.location());
+ GlobalHandles::Destroy(h1.location());
+ GlobalHandles::Destroy(h3.location());
CHECK_EQ(*h4, *h2);
- global_handles->Destroy(h2.location());
- global_handles->Destroy(h4.location());
+ GlobalHandles::Destroy(h2.location());
+ GlobalHandles::Destroy(h4.location());
}
static bool WeakPointerCleared = false;
-static void TestWeakGlobalHandleCallback(v8::Isolate* isolate,
- v8::Persistent<v8::Value>* handle,
- void* id) {
- if (1234 == reinterpret_cast<intptr_t>(id)) WeakPointerCleared = true;
- handle->Reset();
+static void TestWeakGlobalHandleCallback(
+ const v8::WeakCallbackData<v8::Value, void>& data) {
+ std::pair<v8::Persistent<v8::Value>*, int>* p =
+ reinterpret_cast<std::pair<v8::Persistent<v8::Value>*, int>*>(
+ data.GetParameter());
+ if (p->second == 1234) WeakPointerCleared = true;
+ p->first->Reset();
}
@@ -424,9 +427,10 @@ TEST(WeakGlobalHandlesScavenge) {
h2 = global_handles->Create(*u);
}
- global_handles->MakeWeak(h2.location(),
- reinterpret_cast<void*>(1234),
- &TestWeakGlobalHandleCallback);
+ std::pair<Handle<Object>*, int> handle_and_id(&h2, 1234);
+ GlobalHandles::MakeWeak(h2.location(),
+ reinterpret_cast<void*>(&handle_and_id),
+ &TestWeakGlobalHandleCallback);
// Scavenge treats weak pointers as normal roots.
heap->PerformScavenge();
@@ -438,8 +442,8 @@ TEST(WeakGlobalHandlesScavenge) {
CHECK(!global_handles->IsNearDeath(h2.location()));
CHECK(!global_handles->IsNearDeath(h1.location()));
- global_handles->Destroy(h1.location());
- global_handles->Destroy(h2.location());
+ GlobalHandles::Destroy(h1.location());
+ GlobalHandles::Destroy(h2.location());
}
@@ -470,9 +474,10 @@ TEST(WeakGlobalHandlesMark) {
heap->CollectGarbage(NEW_SPACE);
CHECK(!heap->InNewSpace(*h1) && !heap->InNewSpace(*h2));
- global_handles->MakeWeak(h2.location(),
- reinterpret_cast<void*>(1234),
- &TestWeakGlobalHandleCallback);
+ std::pair<Handle<Object>*, int> handle_and_id(&h2, 1234);
+ GlobalHandles::MakeWeak(h2.location(),
+ reinterpret_cast<void*>(&handle_and_id),
+ &TestWeakGlobalHandleCallback);
CHECK(!GlobalHandles::IsNearDeath(h1.location()));
CHECK(!GlobalHandles::IsNearDeath(h2.location()));
@@ -484,7 +489,7 @@ TEST(WeakGlobalHandlesMark) {
CHECK(WeakPointerCleared);
CHECK(!GlobalHandles::IsNearDeath(h1.location()));
- global_handles->Destroy(h1.location());
+ GlobalHandles::Destroy(h1.location());
}
@@ -507,9 +512,10 @@ TEST(DeleteWeakGlobalHandle) {
h = global_handles->Create(*i);
}
- global_handles->MakeWeak(h.location(),
- reinterpret_cast<void*>(1234),
- &TestWeakGlobalHandleCallback);
+ std::pair<Handle<Object>*, int> handle_and_id(&h, 1234);
+ GlobalHandles::MakeWeak(h.location(),
+ reinterpret_cast<void*>(&handle_and_id),
+ &TestWeakGlobalHandleCallback);
// Scanvenge does not recognize weak reference.
heap->PerformScavenge();
« no previous file with comments | « src/runtime.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698