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

Unified Diff: test/mjsunit/regress/readonly2.js

Issue 12810006: Change LookupForWrite to always do a full lookup and check the result. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Negative lookup test on last prototype if in slow mode Created 7 years, 9 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
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);");

Powered by Google App Engine
This is Rietveld 408576698