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

Unified Diff: test/mjsunit/regress/regress-crbug-242502.js

Issue 15288008: Add regression test for fix from r14732. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Improve comments. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698