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
3 // found in the LICENSE file.
5 // Flags: --allow-natives-syntax
7 // Test loading existent and nonexistent properties from dictionary
10 function SlowObject() {
15 assertFalse(%HasFastProperties(this));
17 function SlowObjectWithBaz() {
18 var o = new SlowObject();
27 for (var i = 0; i < 10; i++) {
28 var o1 = new SlowObject();
29 var o2 = SlowObjectWithBaz();
30 assertEquals(undefined, Load(o1));
31 assertEquals(4, Load(o2));
34 // Test objects getting optimized as fast prototypes.
36 function SlowPrototype() {
39 SlowPrototype.prototype.bar = 2;
40 SlowPrototype.prototype.baz = 3;
41 delete SlowPrototype.prototype.baz;
44 // Prototypes stay fast even after deleting properties.
45 assertTrue(%HasFastProperties(SlowPrototype.prototype));
46 var fast_proto = new SlowPrototype();
47 assertTrue(%HasFastProperties(SlowPrototype.prototype));
48 assertTrue(%HasFastProperties(fast_proto.__proto__));