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

Side by Side Diff: test/mjsunit/es6/mirror-collections.js

Issue 1945223002: [Interpreter] Updates mjsunit/es6/mirror-collections to work with ignition (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Updated as suggested by Ross. Created 4 years, 7 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --expose-debug-as debug --expose-gc 5 // Flags: --expose-debug-as debug --expose-gc
6 6
7 function testMapMirror(mirror) { 7 function testMapMirror(mirror) {
8 // Create JSON representation. 8 // Create JSON representation.
9 var serializer = debug.MakeMirrorSerializer(); 9 var serializer = debug.MakeMirrorSerializer();
10 var json = JSON.stringify(serializer.serializeValue(mirror)); 10 var json = JSON.stringify(serializer.serializeValue(mirror));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 set.delete(o1); 81 set.delete(o1);
82 set.add(undefined); 82 set.add(undefined);
83 var setMirror = debug.MakeMirror(set); 83 var setMirror = debug.MakeMirror(set);
84 testSetMirror(setMirror); 84 testSetMirror(setMirror);
85 var values = setMirror.values(); 85 var values = setMirror.values();
86 assertEquals(2, values.length); 86 assertEquals(2, values.length);
87 assertEquals(1, setMirror.values(1).length); 87 assertEquals(1, setMirror.values(1).length);
88 assertSame(o2, values[0]); 88 assertSame(o2, values[0]);
89 assertEquals(undefined, values[1]); 89 assertEquals(undefined, values[1]);
90 90
91 function initWeakMap(weakMap) {
92 weakMap.set(o1, 11);
93 weakMap.set(new Object(), 22);
94 weakMap.set(o3, 33);
95 weakMap.set(new Object(), 44);
96 var weakMapMirror = debug.MakeMirror(weakMap);
97 testMapMirror(weakMapMirror);
98 weakMap.set(new Object(), 55);
99 assertTrue(weakMapMirror.entries().length <= 5);
100 return weakMapMirror;
101 }
102
91 // Test the mirror object for WeakMaps 103 // Test the mirror object for WeakMaps
92 var weakMap = new WeakMap(); 104 var weakMap = new WeakMap();
93 weakMap.set(o1, 11); 105 var weakMapMirror = initWeakMap(weakMap);
94 weakMap.set(new Object(), 22);
95 weakMap.set(o3, 33);
96 weakMap.set(new Object(), 44);
97 var weakMapMirror = debug.MakeMirror(weakMap);
98 testMapMirror(weakMapMirror);
99 weakMap.set(new Object(), 55);
100 assertTrue(weakMapMirror.entries().length <= 5);
101 gc(); 106 gc();
102 107
103 function testWeakMapEntries(weakMapMirror) { 108 function testWeakMapEntries(weakMapMirror) {
104 var entries = weakMapMirror.entries(); 109 var entries = weakMapMirror.entries();
105 assertEquals(2, entries.length); 110 assertEquals(2, entries.length);
106 assertEquals(2, weakMapMirror.entries(0).length); 111 assertEquals(2, weakMapMirror.entries(0).length);
107 assertEquals(1, weakMapMirror.entries(1).length); 112 assertEquals(1, weakMapMirror.entries(1).length);
108 var found = 0; 113 var found = 0;
109 for (var i = 0; i < entries.length; i++) { 114 for (var i = 0; i < entries.length; i++) {
110 if (Object.is(entries[i].key, o1)) { 115 if (Object.is(entries[i].key, o1)) {
111 assertEquals(11, entries[i].value); 116 assertEquals(11, entries[i].value);
112 found++; 117 found++;
113 } 118 }
114 if (Object.is(entries[i].key, o3)) { 119 if (Object.is(entries[i].key, o3)) {
115 assertEquals(33, entries[i].value); 120 assertEquals(33, entries[i].value);
116 found++; 121 found++;
117 } 122 }
118 } 123 }
119 assertEquals(2, found); 124 assertEquals(2, found);
120 } 125 }
121 126
122 testWeakMapEntries(weakMapMirror); 127 testWeakMapEntries(weakMapMirror);
123 128
129 function initWeakSet(weakSet) {
130 weakSet.add(o1);
131 weakSet.add(new Object());
132 weakSet.add(o2);
133 weakSet.add(new Object());
134 weakSet.add(new Object());
135 weakSet.add(o3);
136 weakSet.delete(o2);
137 var weakSetMirror = debug.MakeMirror(weakSet);
138 testSetMirror(weakSetMirror);
139 assertTrue(weakSetMirror.values().length <= 5);
140 return weakSetMirror;
141 }
142
124 // Test the mirror object for WeakSets 143 // Test the mirror object for WeakSets
125 var weakSet = new WeakSet(); 144 var weakSet = new WeakSet();
126 weakSet.add(o1); 145 var weakSetMirror = initWeakSet(weakSet);
127 weakSet.add(new Object());
128 weakSet.add(o2);
129 weakSet.add(new Object());
130 weakSet.add(new Object());
131 weakSet.add(o3);
132 weakSet.delete(o2);
133 var weakSetMirror = debug.MakeMirror(weakSet);
134 testSetMirror(weakSetMirror);
135 assertTrue(weakSetMirror.values().length <= 5);
136 gc(); 146 gc();
137 147
138 function testWeakSetValues(weakSetMirror) { 148 function testWeakSetValues(weakSetMirror) {
139 var values = weakSetMirror.values(); 149 var values = weakSetMirror.values();
140 assertEquals(2, values.length); 150 assertEquals(2, values.length);
141 assertEquals(2, weakSetMirror.values(0).length); 151 assertEquals(2, weakSetMirror.values(0).length);
142 assertEquals(1, weakSetMirror.values(1).length); 152 assertEquals(1, weakSetMirror.values(1).length);
143 var found = 0; 153 var found = 0;
144 for (var i = 0; i < values.length; i++) { 154 for (var i = 0; i < values.length; i++) {
145 if (Object.is(values[i], o1)) { 155 if (Object.is(values[i], o1)) {
146 found++; 156 found++;
147 } 157 }
148 if (Object.is(values[i], o3)) { 158 if (Object.is(values[i], o3)) {
149 found++; 159 found++;
150 } 160 }
151 } 161 }
152 assertEquals(2, found); 162 assertEquals(2, found);
153 } 163 }
154 164
155 testWeakSetValues(weakSetMirror); 165 testWeakSetValues(weakSetMirror);
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698