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

Unified Diff: test/cctest/test-mark-compact.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 | « test/cctest/test-heap.cc ('k') | test/cctest/test-weakmaps.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-mark-compact.cc
diff --git a/test/cctest/test-mark-compact.cc b/test/cctest/test-mark-compact.cc
index a46343271a4c99de6b2cfd5f5efb083a4a80d5b3..1d8a0708f5cd87d48b2755ae6a04c5ed3f8c7d79 100644
--- a/test/cctest/test-mark-compact.cc
+++ b/test/cctest/test-mark-compact.cc
@@ -35,6 +35,7 @@
#include <errno.h>
#endif
+#include <utility>
#include "v8.h"
@@ -245,12 +246,14 @@ TEST(MapCompact) {
static int NumberOfWeakCalls = 0;
-static void WeakPointerCallback(v8::Isolate* isolate,
- v8::Persistent<v8::Value>* handle,
- void* id) {
- ASSERT(id == reinterpret_cast<void*>(1234));
+static void WeakPointerCallback(
+ 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());
+ ASSERT_EQ(1234, p->second);
NumberOfWeakCalls++;
- handle->Reset();
+ p->first->Reset();
}
@@ -268,15 +271,18 @@ TEST(ObjectGroups) {
global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g1c1 =
global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
- global_handles->MakeWeak(g1s1.location(),
- reinterpret_cast<void*>(1234),
- &WeakPointerCallback);
- global_handles->MakeWeak(g1s2.location(),
- reinterpret_cast<void*>(1234),
- &WeakPointerCallback);
- global_handles->MakeWeak(g1c1.location(),
- reinterpret_cast<void*>(1234),
- &WeakPointerCallback);
+ std::pair<Handle<Object>*, int> g1s1_and_id(&g1s1, 1234);
+ GlobalHandles::MakeWeak(g1s1.location(),
+ reinterpret_cast<void*>(&g1s1_and_id),
+ &WeakPointerCallback);
+ std::pair<Handle<Object>*, int> g1s2_and_id(&g1s2, 1234);
+ GlobalHandles::MakeWeak(g1s2.location(),
+ reinterpret_cast<void*>(&g1s2_and_id),
+ &WeakPointerCallback);
+ std::pair<Handle<Object>*, int> g1c1_and_id(&g1c1, 1234);
+ GlobalHandles::MakeWeak(g1c1.location(),
+ reinterpret_cast<void*>(&g1c1_and_id),
+ &WeakPointerCallback);
Handle<Object> g2s1 =
global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
@@ -284,15 +290,18 @@ TEST(ObjectGroups) {
global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
Handle<Object> g2c1 =
global_handles->Create(heap->AllocateFixedArray(1)->ToObjectChecked());
- global_handles->MakeWeak(g2s1.location(),
- reinterpret_cast<void*>(1234),
- &WeakPointerCallback);
- global_handles->MakeWeak(g2s2.location(),
- reinterpret_cast<void*>(1234),
- &WeakPointerCallback);
- global_handles->MakeWeak(g2c1.location(),
- reinterpret_cast<void*>(1234),
- &WeakPointerCallback);
+ std::pair<Handle<Object>*, int> g2s1_and_id(&g2s1, 1234);
+ GlobalHandles::MakeWeak(g2s1.location(),
+ reinterpret_cast<void*>(&g2s1_and_id),
+ &WeakPointerCallback);
+ std::pair<Handle<Object>*, int> g2s2_and_id(&g2s2, 1234);
+ GlobalHandles::MakeWeak(g2s2.location(),
+ reinterpret_cast<void*>(&g2s2_and_id),
+ &WeakPointerCallback);
+ std::pair<Handle<Object>*, int> g2c1_and_id(&g2c1, 1234);
+ GlobalHandles::MakeWeak(g2c1.location(),
+ reinterpret_cast<void*>(&g2c1_and_id),
+ &WeakPointerCallback);
Handle<Object> root = global_handles->Create(*g1s1); // make a root.
@@ -319,9 +328,10 @@ TEST(ObjectGroups) {
CHECK_EQ(0, NumberOfWeakCalls);
// Weaken the root.
- global_handles->MakeWeak(root.location(),
- reinterpret_cast<void*>(1234),
- &WeakPointerCallback);
+ std::pair<Handle<Object>*, int> root_and_id(&root, 1234);
+ GlobalHandles::MakeWeak(root.location(),
+ reinterpret_cast<void*>(&root_and_id),
+ &WeakPointerCallback);
// But make children strong roots---all the objects (except for children)
// should be collectable now.
global_handles->ClearWeakness(g1c1.location());
@@ -347,12 +357,12 @@ TEST(ObjectGroups) {
CHECK_EQ(5, NumberOfWeakCalls);
// And now make children weak again and collect them.
- global_handles->MakeWeak(g1c1.location(),
- reinterpret_cast<void*>(1234),
- &WeakPointerCallback);
- global_handles->MakeWeak(g2c1.location(),
- reinterpret_cast<void*>(1234),
- &WeakPointerCallback);
+ GlobalHandles::MakeWeak(g1c1.location(),
+ reinterpret_cast<void*>(&g1c1_and_id),
+ &WeakPointerCallback);
+ GlobalHandles::MakeWeak(g2c1.location(),
+ reinterpret_cast<void*>(&g2c1_and_id),
+ &WeakPointerCallback);
heap->CollectGarbage(OLD_POINTER_SPACE);
CHECK_EQ(7, NumberOfWeakCalls);
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-weakmaps.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698