summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/element-read-only.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/mjsunit/element-read-only.js')
-rw-r--r--deps/v8/test/mjsunit/element-read-only.js47
1 files changed, 46 insertions, 1 deletions
diff --git a/deps/v8/test/mjsunit/element-read-only.js b/deps/v8/test/mjsunit/element-read-only.js
index 9ec027f6cc..dcc7e421b6 100644
--- a/deps/v8/test/mjsunit/element-read-only.js
+++ b/deps/v8/test/mjsunit/element-read-only.js
@@ -2,17 +2,23 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Flags: --allow-natives-syntax
+
function f(a, b, c, d) { return arguments; }
// Ensure non-configurable argument elements stay non-configurable.
(function () {
var args = f(1);
Object.defineProperty(args, "0", {value: 10, configurable: false});
+ %HeapObjectVerify(args);
assertFalse(Object.getOwnPropertyDescriptor(args, "0").configurable);
+ %HeapObjectVerify(args);
for (var i = 0; i < 10; i++) {
args[i] = 1;
}
+ %HeapObjectVerify(args);
assertFalse(Object.getOwnPropertyDescriptor(args, "0").configurable);
+ %HeapObjectVerify(args);
})();
// Ensure read-only properties on the prototype chain cause TypeError.
@@ -27,7 +33,11 @@ function f(a, b, c, d) { return arguments; }
for (var i = 0; i < index; i++) {
store(o, i, 0);
}
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
Object.defineProperty(proto, index, {value: 100, writable: false});
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
assertThrows(function() { store(o, index, 0); });
assertEquals(100, o[index]);
})();
@@ -42,7 +52,11 @@ function f(a, b, c, d) { return arguments; }
for (var i = 0; i < index; i++) {
store(o, i, 0);
}
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
Object.defineProperty(proto, index, {value: 100, writable: false});
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
assertThrows(function() { store(o, index, 0); });
assertEquals(100, o[index]);
})();
@@ -57,7 +71,11 @@ function f(a, b, c, d) { return arguments; }
for (var i = 0; i < index; i++) {
store(o, i, 0);
}
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
Object.defineProperty(proto, index, {value: 100, writable: false});
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
assertThrows(function() { store(o, index, 0); });
assertEquals(100, o[index]);
})();
@@ -72,7 +90,11 @@ function f(a, b, c, d) { return arguments; }
for (var i = 0; i < index; i++) {
store(o, i, 0);
}
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
Object.defineProperty(proto, index, {value: 100, writable: false});
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
assertThrows(function() { store(o, index, 0); });
assertEquals(100, o[index]);
})();
@@ -87,12 +109,17 @@ function f(a, b, c, d) { return arguments; }
for (var i = 0; i < index; i++) {
store(o, i, 0);
}
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
Object.preventExtensions(proto);
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
Object.defineProperty(proto, index, {value: 100, writable: false});
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
assertThrows(function() { store(o, index, 0); });
assertEquals(100, o[index]);
})();
-
// Extensions prevented arguments object.
(function () {
var o = [];
@@ -103,8 +130,14 @@ function f(a, b, c, d) { return arguments; }
for (var i = 0; i < index; i++) {
store(o, i, 0);
}
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
Object.preventExtensions(proto);
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
Object.defineProperty(proto, index, {value: 100, writable: false});
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
assertThrows(function() { store(o, index, 0); });
assertEquals(100, o[index]);
})();
@@ -120,7 +153,11 @@ function f(a, b, c, d) { return arguments; }
store(o, i, 0);
}
proto[1 << 30] = 1;
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
Object.defineProperty(proto, index, {value: 100, writable: false});
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
assertThrows(function() { store(o, index, 0); });
assertEquals(100, o[index]);
})();
@@ -134,7 +171,11 @@ function f(a, b, c, d) { return arguments; }
for (var i = 0; i < 3; i++) {
store(o, i, 0);
}
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
Object.freeze(proto);
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
assertThrows(function() { store(o, 3, 0); });
assertEquals(3, o[3]);
})();
@@ -148,7 +189,11 @@ function f(a, b, c, d) { return arguments; }
for (var i = 0; i < 3; i++) {
store(o, i, 0);
}
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
Object.freeze(proto);
+ %HeapObjectVerify(proto);
+ %HeapObjectVerify(o);
assertThrows(function() { store(o, 3, 0); });
assertEquals(3, o[3]);
})();