Reviewers: Toon Verwaest,
Description:
Add regression test for fix from r14732.
[email protected]
BUG=chromium:242502
TEST=mjsunit/regress/regress-crbug-242502
Please review this at https://codereview.chromium.org/15288008/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
A + test/mjsunit/regress/regress-crbug-242502.js
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..5b109f50941eee227ad8fca705c86ce3f7b38a94
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();
+
+// Fill stub cache again.
+var oboom = test();
+
+// Optimize with re-filled stub cache.
+%OptimizeFunctionOnNextCall(call);
+assertEquals(23, call(oboom));
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.