Index: test/mjsunit/regress/readonly2.js |
diff --git a/test/mjsunit/regress/regress-2489.js b/test/mjsunit/regress/readonly2.js |
similarity index 74% |
copy from test/mjsunit/regress/regress-2489.js |
copy to test/mjsunit/regress/readonly2.js |
index 882c4f794a88e24d1d64e86a466b27c39f51e625..88ac535904e8f0081e6dd3851d321646e28a8e31 100644 |
--- a/test/mjsunit/regress/regress-2489.js |
+++ b/test/mjsunit/regress/readonly2.js |
@@ -25,26 +25,38 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Flags: --allow-natives-syntax |
+Object.defineProperty(this, "x", { writable:true }); |
-"use strict"; |
- |
-function f(a, b) { |
- return g("c", "d"); |
+function s(v) { |
+ v.x = 1; |
} |
-function g(a, b) { |
- g.constructor.apply(this, arguments); |
+function s_strict(v) { |
+ "use strict"; |
+ v.x = 1; |
} |
-g.constructor = function(a, b) { |
- assertEquals("c", a); |
- assertEquals("d", b); |
+function c(p) { |
+ return {__proto__: p}; |
} |
-f("a", "b"); |
-f("a", "b"); |
-%OptimizeFunctionOnNextCall(f); |
-f("a", "b"); |
-g.x = "deopt"; |
-f("a", "b"); |
+var o1 = c(this); |
+var o2 = c(this); |
+ |
+// Initialize the store IC. |
+s(c(this)); |
+s(c(this)); |
+s_strict(c(this)); |
+s_strict(c(this)); |
+ |
+// Make x non-writable. |
+Object.defineProperty(this, "x", { writable:false, value:5 }); |
+ |
+// Verify that direct setting fails. |
+o1.x = 20; |
+assertEquals(5, o1.x); |
+ |
+// Verify that setting through the IC fails. |
+s(o2); |
+assertEquals(5, o2.x); |
+assertThrows("s_strict(o2);"); |