Index: test/mjsunit/regress/setter.js |
diff --git a/test/mjsunit/regress/regress-2565.js b/test/mjsunit/regress/setter.js |
similarity index 73% |
copy from test/mjsunit/regress/regress-2565.js |
copy to test/mjsunit/regress/setter.js |
index a77806a62e2209d355fce393b98797f1d20f40f8..e3a8000f2bc55c9ee09c483a1cc421305415b85d 100644 |
--- a/test/mjsunit/regress/regress-2565.js |
+++ b/test/mjsunit/regress/setter.js |
@@ -25,8 +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. |
-Object.freeze(Object.prototype); |
+function s(v) { |
+ v.x = 1; |
+} |
+ |
+function c(p) { |
+ return {__proto__: p}; |
+} |
+ |
var p = {}; |
-var o = Object.create(p); |
-assertSame(p, o.__proto__); |
-assertSame(p, Object.getPrototypeOf(o)); |
+ |
+var o1 = c(p); |
+var o2 = c(p); |
+var o3 = c(p); |
+var o4 = c(p); |
+var o5 = c(p); |
+ |
+// Initialize the store IC. |
+s(o1); |
+s(o2); |
+ |
+// Install a setter on p.x |
+var count = 0; |
+Object.defineProperty(p, "x", { |
+ set: function(x) { |
+ count += 1; |
+ } |
+}); |
+ |
+// Verify that the setter was called directly. |
+o3.x = 20; |
+assertEquals(1, count); |
+ |
+// Verify that monomorphic prototype failure is triggered in the IC. |
+s(o4); |
+assertEquals(2, count); |
+ |
+// Verify that the newly installed IC is correct. |
+s(o5); |
+assertEquals(3, count); |