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

Side by Side Diff: test/mjsunit/fast-prototype.js

Issue 437083004: Keep function.prototype fast. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add TODO and make .prototype fast on creating the initial map 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects-inl.h ('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
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // Adding this many properties makes it slow. 65 // Adding this many properties makes it slow.
66 assertFalse(%HasFastProperties(proto)); 66 assertFalse(%HasFastProperties(proto));
67 DoProtoMagic(proto, set__proto__); 67 DoProtoMagic(proto, set__proto__);
68 // Making it a prototype makes it fast again. 68 // Making it a prototype makes it fast again.
69 assertTrue(%HasFastProperties(proto)); 69 assertTrue(%HasFastProperties(proto));
70 } else { 70 } else {
71 DoProtoMagic(proto, set__proto__); 71 DoProtoMagic(proto, set__proto__);
72 // Still fast 72 // Still fast
73 assertTrue(%HasFastProperties(proto)); 73 assertTrue(%HasFastProperties(proto));
74 AddProps(proto); 74 AddProps(proto);
75 // After we add all those properties it went slow mode again :-( 75 if (set__proto__) {
76 assertFalse(%HasFastProperties(proto)); 76 // After we add all those properties it went slow mode again :-(
77 assertFalse(%HasFastProperties(proto));
78 } else {
79 // .prototype keeps it fast.
80 assertTrue(%HasFastProperties(proto));
81 }
77 } 82 }
78 if (same_map_as && !add_first) { 83 if (same_map_as && !add_first && set__proto__) {
79 assertTrue(%HaveSameMap(same_map_as, proto)); 84 assertTrue(%HaveSameMap(same_map_as, proto));
80 } 85 }
81 return proto; 86 return proto;
82 } 87 }
83 88
84 // TODO(mstarzinger): This test fails easily if gc happens at the wrong time. 89 // TODO(mstarzinger): This test fails easily if gc happens at the wrong time.
85 gc(); 90 gc();
86 91
87 for (var i = 0; i < 4; i++) { 92 for (var i = 0; i < 4; i++) {
88 var set__proto__ = ((i & 1) != 0); 93 var set__proto__ = ((i & 1) != 0);
(...skipping 18 matching lines...) Expand all
107 assertTrue(key == 'a'); 112 assertTrue(key == 'a');
108 break; 113 break;
109 } 114 }
110 assertFalse(%HasFastProperties(x)); 115 assertFalse(%HasFastProperties(x));
111 x.d = 4; 116 x.d = 4;
112 assertFalse(%HasFastProperties(x)); 117 assertFalse(%HasFastProperties(x));
113 for (key in x) { 118 for (key in x) {
114 assertTrue(key == 'a'); 119 assertTrue(key == 'a');
115 break; 120 break;
116 } 121 }
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698