MCPcopy Create free account
hub / github.com/nodejs/node / TestAllScenarios

Function TestAllScenarios

deps/v8/test/mjsunit/readonly.js:185–221  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

183}
184
185function TestAllScenarios(f) {
186 for (var t = 0; t < 100; t = 2 * t + 1) {
187 print('t =', t);
188 f(function(strict, create, readonly) {
189 // Make sure that the assignments are monomorphic.
190 %DeoptimizeFunction(Assign);
191 %DeoptimizeFunction(AssignStrict);
192 %ClearFunctionFeedback(Assign);
193 %ClearFunctionFeedback(AssignStrict);
194 %PrepareFunctionForOptimization(Assign);
195 %PrepareFunctionForOptimization(AssignStrict);
196 for (var i = 0; i < t; ++i) {
197 var o = create();
198 assertFalse("a" in o && !("a" in o.__proto__));
199 if (strict === 0)
200 Assign(o, i);
201 else
202 AssignStrict(o, i);
203 assertEquals(i, o.a);
204 }
205 %OptimizeFunctionOnNextCall(Assign);
206 %OptimizeFunctionOnNextCall(AssignStrict);
207 var o = create();
208 assertFalse("a" in o && !("a" in o.__proto__));
209 readonly(o.up, "a");
210 assertTrue("a" in o);
211 if (strict === 0)
212 Assign(o, t + 1);
213 else
214
215 assertThrows(function() {
216 AssignStrict(o, t + 1);
217 }, TypeError);
218 assertTrue(o.a < 0);
219 });
220 }
221}
222
223
224// Runner.

Callers 1

readonly.jsFile · 0.85

Calls 10

AssignStrictFunction · 0.85
readonlyFunction · 0.85
fFunction · 0.70
AssignFunction · 0.70
assertTrueFunction · 0.70
printFunction · 0.50
createFunction · 0.50
assertFalseFunction · 0.50
assertEqualsFunction · 0.50
assertThrowsFunction · 0.50

Tested by

no test coverage detected