OLD | NEW |
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Adding this many properties makes it slow. | 64 // Adding this many properties makes it slow. |
65 assertFalse(%HasFastProperties(proto)); | 65 assertFalse(%HasFastProperties(proto)); |
66 DoProtoMagic(proto, set__proto__); | 66 DoProtoMagic(proto, set__proto__); |
67 // Making it a prototype makes it fast again. | 67 // Making it a prototype makes it fast again. |
68 assertTrue(%HasFastProperties(proto)); | 68 assertTrue(%HasFastProperties(proto)); |
69 } else { | 69 } else { |
70 DoProtoMagic(proto, set__proto__); | 70 DoProtoMagic(proto, set__proto__); |
71 // Still fast | 71 // Still fast |
72 assertTrue(%HasFastProperties(proto)); | 72 assertTrue(%HasFastProperties(proto)); |
73 AddProps(proto); | 73 AddProps(proto); |
74 // Setting the bit means it is still fast with all these properties. | 74 // After we add all those properties it went slow mode again :-( |
75 assertTrue(%HasFastProperties(proto)); | 75 assertFalse(%HasFastProperties(proto)); |
76 } | 76 } |
77 if (same_map_as && !add_first) { | 77 if (same_map_as && !add_first) { |
78 assertTrue(%HaveSameMap(same_map_as, proto)); | 78 assertTrue(%HaveSameMap(same_map_as, proto)); |
79 } | 79 } |
80 return proto; | 80 return proto; |
81 } | 81 } |
82 | 82 |
83 | 83 |
84 for (var i = 0; i < 4; i++) { | 84 for (var i = 0; i < 4; i++) { |
85 var set__proto__ = ((i & 1) != 0); | 85 var set__proto__ = ((i & 1) != 0); |
(...skipping 18 matching lines...) Expand all Loading... |
104 assertTrue(key == 'a'); | 104 assertTrue(key == 'a'); |
105 break; | 105 break; |
106 } | 106 } |
107 assertFalse(%HasFastProperties(x)); | 107 assertFalse(%HasFastProperties(x)); |
108 x.d = 4; | 108 x.d = 4; |
109 assertFalse(%HasFastProperties(x)); | 109 assertFalse(%HasFastProperties(x)); |
110 for (key in x) { | 110 for (key in x) { |
111 assertTrue(key == 'a'); | 111 assertTrue(key == 'a'); |
112 break; | 112 break; |
113 } | 113 } |
OLD | NEW |