Index: test/mjsunit/regress/readonly2.js |
diff --git a/test/mjsunit/regress/regress-2539.js b/test/mjsunit/regress/readonly2.js |
similarity index 73% |
copy from test/mjsunit/regress/regress-2539.js |
copy to test/mjsunit/regress/readonly2.js |
index 5d263f8912bb7f44083d159cfead81ba33a3a3b4..4e539250d55cd7656c70d2fa0bd8ef7a97527db0 100644 |
--- a/test/mjsunit/regress/regress-2539.js |
+++ b/test/mjsunit/regress/readonly2.js |
@@ -25,31 +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"; |
-var dispatcher = {}; |
-dispatcher.func = C; |
- |
-function A() { |
- B(10, 11); |
+function s(v) { |
+ v.x = 1; |
} |
-function B(x,y) { |
- x = 0; y = 0; |
- dispatcher.func.apply(this, arguments); |
- assertSame(2, arguments.length); |
- assertSame(10, arguments[0]); |
- assertSame(11, arguments[1]); |
+function s_strict(v) { |
+ "use strict"; |
+ v.x = 1; |
} |
-function C(x,y) { |
- assertSame(2, arguments.length); |
- assertSame(10, arguments[0]); |
- assertSame(11, arguments[1]); |
+function c(p) { |
+ return {__proto__: p}; |
} |
-A(); |
-A(); |
-%OptimizeFunctionOnNextCall(A); |
-A(); |
+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);", TypeError); |