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

Unified Diff: test/mjsunit/object-literal.js

Issue 2445333002: Ensure slow properties for simple {__proto__:null} literals. (Closed)
Patch Set: Created 4 years, 2 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
« src/ast/ast.h ('K') | « src/ast/ast.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/object-literal.js
diff --git a/test/mjsunit/object-literal.js b/test/mjsunit/object-literal.js
index b861d443c0cd0bc011bfcadc20e9a963f608fcd9..5769af8f4b716ff2c19f0d0b1426a9a29081558b 100644
--- a/test/mjsunit/object-literal.js
+++ b/test/mjsunit/object-literal.js
@@ -260,3 +260,18 @@ TestNumericNamesSetter(['1.2', '1.3'], {
set 1.2(_) {; },
set 1.30(_) {; }
});
+
+
+(function TestLiteralWithNullProto() {
+ // Assume dictionary usage for simple null prototype literal objects,
+ // this is equivalent to Object.create(null).
+ var obj = {__proto__:null};
+ assertFalse(%HasFastProperties(obj));
adamk 2016/10/25 11:14:24 You'll need --allow-natives-syntax in Flags
Camillo Bruni 2017/03/13 17:21:44 arg, bitten by my own smart aliases that add these
+ assertEquals(Object.getPrototypeOf(obj), null);
+ // Once we add inline properties we probably don't want slow properties
+ // anymore.
+ var obj2 = {__proto__:null, a:1, b:2};
adamk 2016/10/25 11:14:24 Please add a test with computed properties and non
Camillo Bruni 2017/03/13 17:21:44 done.
+ assertTrue(%HasFastProperties(obj2));
+ assertEquals(Object.getPrototypeOf(obj2), null);
+
+})()
« src/ast/ast.h ('K') | « src/ast/ast.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698