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

Unified Diff: test/mjsunit/getownprivateproperty.js

Issue 458813002: Prototype implementation of GET_OWN_PROPERTY intrinsic. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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
« no previous file with comments | « src/stub-cache.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/getownprivateproperty.js
diff --git a/test/mjsunit/getownprivateproperty.js b/test/mjsunit/getownprivateproperty.js
new file mode 100644
index 0000000000000000000000000000000000000000..056869fdfff8fe68617132746601a85c4437f7d9
--- /dev/null
+++ b/test/mjsunit/getownprivateproperty.js
@@ -0,0 +1,30 @@
+// Flags: --allow-natives-syntax
+
+
+var s1 = Symbol("s1");
+var s2 = Symbol("s2");
+
+var p = { xBase : 15 };
+p[s1] = "moo";
+var o = Object.create(p, { x : { value : 25 }});
+o[s2] = "bow-wow"
+
+assertEquals(25, %GET_OWN_PROPERTY(o, "x"));
+assertEquals(undefined, %GET_OWN_PROPERTY(o, "xBase"));
+assertEquals(undefined, %GET_OWN_PROPERTY(o, s1));
+assertEquals("bow-wow", %GET_OWN_PROPERTY(o, s2));
+
+function checkNonOwn(o) {
+ assertEquals(15, o["xBase"]);
+ assertEquals(undefined, %GET_OWN_PROPERTY(o, "xBase"));
+ assertEquals("moo", o[s1]);
+ assertEquals(undefined, %GET_OWN_PROPERTY(o, s1));
+}
+
+checkNonOwn(o);
+for (var i = 0; i < 1000; i++) {
+ var oNew = Object.create(p);
+ oNew["s" + i] = i;
+ checkNonOwn(oNew);
+}
+
« no previous file with comments | « src/stub-cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698