[Interpreter] Updates mjsunit/es6/mirror-collections to work with ignition

mjsunit/es6/mirror-collections fails with ignition because dead registers
may hold references to objects. This prevents GC from collecting
otherwise dead objects. Dead registers are not cleared because the cost
of clearing them outweighs its benefits. Hence, modifying this test to
work around this problem.

BUG=v8:4280,v8:4853
LOG=N

Review-Url: https://codereview.chromium.org/1945223002
Cr-Commit-Position: refs/heads/master@{#36098}
This commit is contained in:
mythria 2016-05-09 01:38:26 -07:00 committed by Commit bot
parent a156a05101
commit a64b1d8767
2 changed files with 28 additions and 26 deletions

View File

@ -88,16 +88,21 @@ assertEquals(1, setMirror.values(1).length);
assertSame(o2, values[0]);
assertEquals(undefined, values[1]);
function initWeakMap(weakMap) {
weakMap.set(o1, 11);
weakMap.set(new Object(), 22);
weakMap.set(o3, 33);
weakMap.set(new Object(), 44);
var weakMapMirror = debug.MakeMirror(weakMap);
testMapMirror(weakMapMirror);
weakMap.set(new Object(), 55);
assertTrue(weakMapMirror.entries().length <= 5);
return weakMapMirror;
}
// Test the mirror object for WeakMaps
var weakMap = new WeakMap();
weakMap.set(o1, 11);
weakMap.set(new Object(), 22);
weakMap.set(o3, 33);
weakMap.set(new Object(), 44);
var weakMapMirror = debug.MakeMirror(weakMap);
testMapMirror(weakMapMirror);
weakMap.set(new Object(), 55);
assertTrue(weakMapMirror.entries().length <= 5);
var weakMapMirror = initWeakMap(weakMap);
gc();
function testWeakMapEntries(weakMapMirror) {
@ -121,18 +126,23 @@ function testWeakMapEntries(weakMapMirror) {
testWeakMapEntries(weakMapMirror);
function initWeakSet(weakSet) {
weakSet.add(o1);
weakSet.add(new Object());
weakSet.add(o2);
weakSet.add(new Object());
weakSet.add(new Object());
weakSet.add(o3);
weakSet.delete(o2);
var weakSetMirror = debug.MakeMirror(weakSet);
testSetMirror(weakSetMirror);
assertTrue(weakSetMirror.values().length <= 5);
return weakSetMirror;
}
// Test the mirror object for WeakSets
var weakSet = new WeakSet();
weakSet.add(o1);
weakSet.add(new Object());
weakSet.add(o2);
weakSet.add(new Object());
weakSet.add(new Object());
weakSet.add(o3);
weakSet.delete(o2);
var weakSetMirror = debug.MakeMirror(weakSet);
testSetMirror(weakSetMirror);
assertTrue(weakSetMirror.values().length <= 5);
var weakSetMirror = initWeakSet(weakSet);
gc();
function testWeakSetValues(weakSetMirror) {

View File

@ -314,10 +314,6 @@
# till it is optimized. So test timeouts.
'array-literal-transitions': [PASS, NO_IGNITION],
# TODO(mythria, 4680): Relate to GC and ignition holding references to
# objects.
'es6/mirror-collections': [PASS, NO_IGNITION],
# TODO(rmcilroy, 4680): Script throws RangeError as expected, but does so during
# eager compile of the whole script instead of during lazy compile of the function
# f(), so we can't catch the exception in the try/catch. Skip because on some
@ -890,10 +886,6 @@
# till it is optimized. So test timeouts.
'array-literal-transitions': [SKIP],
# TODO(mythria, 4680): Relate to GC and ignition holding references to
# objects.
'es6/mirror-collections': [FAIL],
# TODO(rmcilroy, 4680): Script throws RangeError as expected, but does so during
# eager compile of the whole script instead of during lazy compile of the function
# f(), so we can't catch the exception in the try/catch. Skip because on some