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

Unified Diff: test/mjsunit/regress/regress-2980.js

Issue 99923008: Merged r17459, r17462, r17474 into 3.20 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.20
Patch Set: Created 7 years 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
« no previous file with comments | « src/x64/stub-cache-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-2980.js
diff --git a/test/mjsunit/regress/readonly1.js b/test/mjsunit/regress/regress-2980.js
similarity index 68%
copy from test/mjsunit/regress/readonly1.js
copy to test/mjsunit/regress/regress-2980.js
index 366f432fbc4179e716834ca5622cd6bfba5ab7bd..071a73353a79aec11091cc97c117710d2fb36414 100644
--- a/test/mjsunit/regress/readonly1.js
+++ b/test/mjsunit/regress/regress-2980.js
@@ -25,47 +25,40 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-function s(v) {
- v.x = 1;
-}
-
-function s_strict(v) {
- "use strict";
- v.x = 1;
-}
-function c(p) {
- return {__proto__: p};
+function test(expected, holder) {
+ assertEquals(expected, holder.property);
}
-var p = {};
+var holder = {}
+holder.__proto__ = null;
+holder.property = "foo";
+delete holder.property;
+test(undefined, holder);
+test(undefined, holder);
+test(undefined, holder);
+holder.property = "bar";
+test("bar", holder);
+test("bar", holder);
-var o1 = c(p);
-var o2 = c(p);
-var o3 = c(p);
-var o4 = c(p);
+// Now the same thing with a nontrivial prototype chain.
-// Make p go slow.
-// Do this after using p as prototype, since using an object as prototype kicks
-// it back into fast mode.
-p.y = 1;
-delete p.y;
-p.x = 5;
-
-// Initialize the store IC.
-s(o1);
-s(o2);
-s_strict(o1);
-s_strict(o2);
+function test2(expected, holder) {
+ assertEquals(expected, holder.prop2);
+}
-// Make x non-writable.
-Object.defineProperty(p, "x", { writable: false });
+var holder2 = {}
+holder2.prop2 = "foo";
+holder2.__proto__ = null;
+function Receiver() {}
+Receiver.prototype = holder2;
-// Verify that direct setting fails.
-o3.x = 20;
-assertEquals(5, o3.x);
+var rec2 = new Receiver();
+delete holder2.prop2;
-// Verify that setting through the IC fails.
-s(o4);
-assertEquals(5, o4.x);
-assertThrows("s_strict(o4);", TypeError);
+test2(undefined, rec2);
+test2(undefined, rec2);
+test2(undefined, rec2);
+holder2.prop2 = "bar";
+test2("bar", rec2);
+test2("bar", rec2);
« no previous file with comments | « src/x64/stub-cache-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698