Revert of Simplify WeakMap and WeakSet tests slightly. (patchset #1 id:1 of https://codereview.chromium.org/903463002/)
Reason for revert: Revert this patch as the original CL has to be reverted to due to shared win build failure http://build.chromium.org/p/client.v8/builders/V8%20Win32%20-%20nosnap%20-%20shared/builds/5030/steps/compile/logs/stdio Original issue's description: > Simplify WeakMap and WeakSet tests slightly. > > R=rossberg@chromium.org > TEST=cctest/test-weakmaps,cctest/test-weaksets > > Committed: https://crrev.com/a90d7a871da19d33e93c8779186408c8d1615cac > Cr-Commit-Position: refs/heads/master@{#26428} TBR=rossberg@chromium.org,mstarzinger@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/899833003 Cr-Commit-Position: refs/heads/master@{#26429}
This commit is contained in:
parent
a90d7a871d
commit
e225675ea6
@ -52,6 +52,12 @@ static Handle<JSWeakMap> AllocateJSWeakMap(Isolate* isolate) {
|
||||
return weakmap;
|
||||
}
|
||||
|
||||
static void PutIntoWeakMap(Handle<JSWeakMap> weakmap,
|
||||
Handle<JSObject> key,
|
||||
Handle<Object> value) {
|
||||
Runtime::WeakCollectionSet(weakmap, key, value);
|
||||
}
|
||||
|
||||
static int NumberOfWeakCalls = 0;
|
||||
static void WeakPointerCallback(
|
||||
const v8::WeakCallbackData<v8::Value, void>& data) {
|
||||
@ -89,9 +95,8 @@ TEST(Weakness) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
|
||||
Handle<JSObject> object = factory->NewJSObjectFromMap(map);
|
||||
Handle<Smi> smi(Smi::FromInt(23), isolate);
|
||||
Runtime::WeakCollectionSet(weakmap, key, object);
|
||||
Runtime::WeakCollectionSet(weakmap, object, smi);
|
||||
PutIntoWeakMap(weakmap, Handle<JSObject>(JSObject::cast(*key)), object);
|
||||
PutIntoWeakMap(weakmap, object, Handle<Smi>(Smi::FromInt(23), isolate));
|
||||
}
|
||||
CHECK_EQ(2, ObjectHashTable::cast(weakmap->table())->NumberOfElements());
|
||||
|
||||
@ -145,8 +150,7 @@ TEST(Shrinking) {
|
||||
Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
|
||||
for (int i = 0; i < 32; i++) {
|
||||
Handle<JSObject> object = factory->NewJSObjectFromMap(map);
|
||||
Handle<Smi> smi(Smi::FromInt(i), isolate);
|
||||
Runtime::WeakCollectionSet(weakmap, object, smi);
|
||||
PutIntoWeakMap(weakmap, object, Handle<Smi>(Smi::FromInt(i), isolate));
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,7 +197,7 @@ TEST(Regress2060a) {
|
||||
Handle<JSObject> object = factory->NewJSObject(function, TENURED);
|
||||
CHECK(!heap->InNewSpace(object->address()));
|
||||
CHECK(!first_page->Contains(object->address()));
|
||||
Runtime::WeakCollectionSet(weakmap, key, object);
|
||||
PutIntoWeakMap(weakmap, key, object);
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,8 +237,9 @@ TEST(Regress2060b) {
|
||||
}
|
||||
Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate);
|
||||
for (int i = 0; i < 32; i++) {
|
||||
Handle<Smi> smi(Smi::FromInt(i), isolate);
|
||||
Runtime::WeakCollectionSet(weakmap, keys[i], smi);
|
||||
PutIntoWeakMap(weakmap,
|
||||
keys[i],
|
||||
Handle<Smi>(Smi::FromInt(i), isolate));
|
||||
}
|
||||
|
||||
// Force compacting garbage collection. The subsequent collections are used
|
||||
|
@ -55,6 +55,12 @@ static Handle<JSWeakSet> AllocateJSWeakSet(Isolate* isolate) {
|
||||
return weakset;
|
||||
}
|
||||
|
||||
static void PutIntoWeakSet(Handle<JSWeakSet> weakset,
|
||||
Handle<JSObject> key,
|
||||
Handle<Object> value) {
|
||||
Runtime::WeakCollectionSet(weakset, key, value);
|
||||
}
|
||||
|
||||
static int NumberOfWeakCalls = 0;
|
||||
static void WeakPointerCallback(
|
||||
const v8::WeakCallbackData<v8::Value, void>& data) {
|
||||
@ -90,8 +96,9 @@ TEST(WeakSet_Weakness) {
|
||||
// Put entry into weak set.
|
||||
{
|
||||
HandleScope scope(isolate);
|
||||
Handle<Smi> smi(Smi::FromInt(23), isolate);
|
||||
Runtime::WeakCollectionSet(weakset, key, smi);
|
||||
PutIntoWeakSet(weakset,
|
||||
Handle<JSObject>(JSObject::cast(*key)),
|
||||
Handle<Smi>(Smi::FromInt(23), isolate));
|
||||
}
|
||||
CHECK_EQ(1, ObjectHashTable::cast(weakset->table())->NumberOfElements());
|
||||
|
||||
@ -145,8 +152,7 @@ TEST(WeakSet_Shrinking) {
|
||||
Handle<Map> map = factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
|
||||
for (int i = 0; i < 32; i++) {
|
||||
Handle<JSObject> object = factory->NewJSObjectFromMap(map);
|
||||
Handle<Smi> smi(Smi::FromInt(i), isolate);
|
||||
Runtime::WeakCollectionSet(weakset, object, smi);
|
||||
PutIntoWeakSet(weakset, object, Handle<Smi>(Smi::FromInt(i), isolate));
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,7 +199,7 @@ TEST(WeakSet_Regress2060a) {
|
||||
Handle<JSObject> object = factory->NewJSObject(function, TENURED);
|
||||
CHECK(!heap->InNewSpace(object->address()));
|
||||
CHECK(!first_page->Contains(object->address()));
|
||||
Runtime::WeakCollectionSet(weakset, key, object);
|
||||
PutIntoWeakSet(weakset, key, object);
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,8 +239,9 @@ TEST(WeakSet_Regress2060b) {
|
||||
}
|
||||
Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate);
|
||||
for (int i = 0; i < 32; i++) {
|
||||
Handle<Smi> smi(Smi::FromInt(i), isolate);
|
||||
Runtime::WeakCollectionSet(weakset, keys[i], smi);
|
||||
PutIntoWeakSet(weakset,
|
||||
keys[i],
|
||||
Handle<Smi>(Smi::FromInt(i), isolate));
|
||||
}
|
||||
|
||||
// Force compacting garbage collection. The subsequent collections are used
|
||||
|
Loading…
Reference in New Issue
Block a user