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

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

Issue 10702164: Perform HasFastProperties check on prototypes when computing call targets in Crankshaft, part 2. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 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 | « src/hydrogen.cc ('k') | 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-125148.js
diff --git a/test/mjsunit/regress/regress-crbug-125148.js b/test/mjsunit/regress/regress-crbug-125148.js
index 025f9a5a4bd358cf71041254de202c4a28408e0d..142f14035c2f45dd53ce022893fe5649ee18aeb9 100644
--- a/test/mjsunit/regress/regress-crbug-125148.js
+++ b/test/mjsunit/regress/regress-crbug-125148.js
@@ -27,26 +27,42 @@
// Flags: --allow-natives-syntax
-var A = {
- foo: function() { assertUnreachable(); }
+function ToDictionaryMode(x) {
+ %OptimizeObjectForAddingMultipleProperties(x, 100);
}
-var B = {
- b: 2,
- foo: function() { return 1; }
-}
-B.__proto__ = A;
+var A, B, C;
-var C = {};
-C.__proto__ = B;
+// The initial bug report was about calling a know function...
+A = {};
+Object.defineProperty(A, "foo", { value: function() { assertUnreachable(); }});
-function bar(x) {
- return x.foo();
-}
+B = Object.create(A);
+Object.defineProperty(B, "foo", { value: function() { return 111; }});
-for (var i = 0; i < 3; i++) {
- assertEquals(1, bar(C));
-}
-%OptimizeObjectForAddingMultipleProperties(B, 100); // Force dictionary mode.
+C = Object.create(B);
+
+function bar(x) { return x.foo(); }
+
+assertEquals(111, bar(C));
+assertEquals(111, bar(C));
+ToDictionaryMode(B);
%OptimizeFunctionOnNextCall(bar);
-assertEquals(1, bar(C));
+assertEquals(111, bar(C));
+
+// Although this was not in the initial bug report: The same for getters...
+A = {};
+Object.defineProperty(A, "baz", { get: function() { assertUnreachable(); }});
+
+B = Object.create(A);
+Object.defineProperty(B, "baz", { get: function() { return 111; }});
+
+C = Object.create(B);
+
+function boo(x) { return x.baz; }
+
+assertEquals(111, boo(C));
+assertEquals(111, boo(C));
+ToDictionaryMode(B);
+%OptimizeFunctionOnNextCall(boo);
+assertEquals(111, boo(C));
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698