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

Side by Side Diff: test/mjsunit/dictionary-properties.js

Issue 2843473002: Revert of [builtins] DeleteProperty: Handle last-added fast properties (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/regress/regress-252797.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --allow-natives-syntax 5 // Flags: --allow-natives-syntax
6 6
7 // Test loading existent and nonexistent properties from dictionary 7 // Test loading existent and nonexistent properties from dictionary
8 // mode objects. 8 // mode objects.
9 9
10 function SlowObject() { 10 function SlowObject() {
11 this.foo = 1; 11 this.foo = 1;
12 this.bar = 2; 12 this.bar = 2;
13 this.qux = 3; 13 this.qux = 3;
14 this.z = 4;
15 delete this.qux; 14 delete this.qux;
16 assertFalse(%HasFastProperties(this)); 15 assertFalse(%HasFastProperties(this));
17 } 16 }
18 function SlowObjectWithBaz() { 17 function SlowObjectWithBaz() {
19 var o = new SlowObject(); 18 var o = new SlowObject();
20 o.baz = 4; 19 o.baz = 4;
21 return o; 20 return o;
22 } 21 }
23 22
24 function Load(o) { 23 function Load(o) {
25 return o.baz; 24 return o.baz;
26 } 25 }
27 26
28 for (var i = 0; i < 10; i++) { 27 for (var i = 0; i < 10; i++) {
29 var o1 = new SlowObject(); 28 var o1 = new SlowObject();
30 var o2 = SlowObjectWithBaz(); 29 var o2 = SlowObjectWithBaz();
31 assertEquals(undefined, Load(o1)); 30 assertEquals(undefined, Load(o1));
32 assertEquals(4, Load(o2)); 31 assertEquals(4, Load(o2));
33 } 32 }
34 33
35 // Test objects getting optimized as fast prototypes. 34 // Test objects getting optimized as fast prototypes.
36 35
37 function SlowPrototype() { 36 function SlowPrototype() {
38 this.foo = 1; 37 this.foo = 1;
39 } 38 }
40 SlowPrototype.prototype.bar = 2; 39 SlowPrototype.prototype.bar = 2;
41 SlowPrototype.prototype.baz = 3; 40 SlowPrototype.prototype.baz = 3;
42 SlowPrototype.prototype.z = 4;
43 delete SlowPrototype.prototype.baz; 41 delete SlowPrototype.prototype.baz;
44 assertFalse(%HasFastProperties(SlowPrototype.prototype)); 42 assertFalse(%HasFastProperties(SlowPrototype.prototype));
45 var slow_proto = new SlowPrototype; 43 var slow_proto = new SlowPrototype;
46 // ICs make prototypes fast. 44 // ICs make prototypes fast.
47 function ic() { return slow_proto.bar; } 45 function ic() { return slow_proto.bar; }
48 ic(); 46 ic();
49 ic(); 47 ic();
50 assertTrue(%HasFastProperties(slow_proto.__proto__)); 48 assertTrue(%HasFastProperties(slow_proto.__proto__));
51 49
52 // Prototypes stay fast even after deleting properties. 50 // Prototypes stay fast even after deleting properties.
53 assertTrue(%HasFastProperties(SlowPrototype.prototype)); 51 assertTrue(%HasFastProperties(SlowPrototype.prototype));
54 var fast_proto = new SlowPrototype(); 52 var fast_proto = new SlowPrototype();
55 assertTrue(%HasFastProperties(SlowPrototype.prototype)); 53 assertTrue(%HasFastProperties(SlowPrototype.prototype));
56 assertTrue(%HasFastProperties(fast_proto.__proto__)); 54 assertTrue(%HasFastProperties(fast_proto.__proto__));
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/regress/regress-252797.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698