| Index: test/mjsunit/regress/regress-crbug-242502.js
|
| diff --git a/test/mjsunit/regress/regress-2470.js b/test/mjsunit/regress/regress-crbug-242502.js
|
| similarity index 61%
|
| copy from test/mjsunit/regress/regress-2470.js
|
| copy to test/mjsunit/regress/regress-crbug-242502.js
|
| index 29a0b250acb2e10919e9a8de8b3b73c57ba3cd7d..8ee764029d4c2f0b71ef2d6911ae3cfbb41bee9d 100644
|
| --- a/test/mjsunit/regress/regress-2470.js
|
| +++ b/test/mjsunit/regress/regress-crbug-242502.js
|
| @@ -25,23 +25,42 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Test whether the opening parenthesis can be eaten up by a comment.
|
| -assertThrows('Function("/*", "*/){");', SyntaxError);
|
| -
|
| -// Test whether the function literal can be closed prematurely.
|
| -assertThrows('Function("});(function(){");', SyntaxError);
|
| -
|
| -// Test whether block comments are handled correctly.
|
| -assertDoesNotThrow('Function("/*", "*/", "/**/");');
|
| -assertDoesNotThrow('Function("/*", "a", "*/", "/**/");');
|
| -assertThrows('Function("a", "/*", "*/", "/**/");', SyntaxError);
|
| -
|
| -// Test whether line comments are handled correctly.
|
| -assertDoesNotThrow('Function("//", "//")');
|
| -assertDoesNotThrow('Function("//", "//", "//")');
|
| -assertThrows('Function("a", "//", "//")', SyntaxError);
|
| -
|
| -// Some embedders rely on the string representation of the resulting
|
| -// function in cases where no formal parameters are specified.
|
| -var asString = Function("return 23").toString();
|
| -assertSame("function anonymous() {\nreturn 23\n}", asString);
|
| +// Flags: --expose-gc --allow-natives-syntax
|
| +
|
| +function f() {
|
| + return 23;
|
| +}
|
| +
|
| +function call(o) {
|
| + return o['']();
|
| +}
|
| +
|
| +function test() {
|
| + var o1 = %ToFastProperties(Object.create({ foo:1 }, { '': { value:f }}));
|
| + var o2 = %ToFastProperties(Object.create({ bar:1 }, { '': { value:f }}));
|
| + var o3 = %ToFastProperties(Object.create({ baz:1 }, { '': { value:f }}));
|
| + var o4 = %ToFastProperties(Object.create({ qux:1 }, { '': { value:f }}));
|
| + var o5 = %ToFastProperties(Object.create({ loo:1 }, { '': { value:f }}));
|
| + // Called twice on o1 to turn monomorphic.
|
| + assertEquals(23, call(o1));
|
| + assertEquals(23, call(o1));
|
| + // Called on four other objects to turn megamorphic.
|
| + assertEquals(23, call(o2));
|
| + assertEquals(23, call(o3));
|
| + assertEquals(23, call(o4));
|
| + assertEquals(23, call(o5));
|
| + return o1;
|
| +}
|
| +
|
| +// Fill stub cache with entries.
|
| +test();
|
| +
|
| +// Clear stub cache during GC.
|
| +gc();
|
| +
|
| +// Turn IC megamorphic again.
|
| +var oboom = test();
|
| +
|
| +// Optimize with previously cleared stub cache.
|
| +%OptimizeFunctionOnNextCall(call);
|
| +assertEquals(23, call(oboom));
|
|
|