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

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

Issue 332783002: Optimize prototype chain when creating initial maps for functions used as constructors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 // Flags: --allow-natives-syntax
6
7 // Test loading existent and nonexistent properties from dictionary
8 // mode objects.
9
10 function SlowObject() {
11 this.foo = 1;
12 this.bar = 2;
13 this.qux = 3;
14 delete this.qux;
15 assertFalse(%HasFastProperties(this));
16 }
17 function SlowObjectWithBaz() {
18 var o = new SlowObject();
19 o.baz = 4;
20 return o;
21 }
22
23 function Load(o) {
24 return o.baz;
25 }
26
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));
32 }
33
34 // Test objects getting optimized as fast prototypes.
35
36 function SlowPrototype() {
37 this.foo = 1;
38 }
39 SlowPrototype.prototype.bar = 2;
40 SlowPrototype.prototype.baz = 3;
41 delete SlowPrototype.prototype.baz;
42
43 assertFalse(%HasFastProperties(SlowPrototype.prototype));
44 var fast_proto = new SlowPrototype();
45 assertTrue(%HasFastProperties(SlowPrototype.prototype));
46 assertTrue(%HasFastProperties(fast_proto.__proto__));
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698