| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 EXPECT_EQ(afterGC2.totalObjectSpace(), afterOneAdd.totalObjectSpace()); | 1139 EXPECT_EQ(afterGC2.totalObjectSpace(), afterOneAdd.totalObjectSpace()); |
| 1140 | 1140 |
| 1141 for (int i = 1; i < 1000; i++) | 1141 for (int i = 1; i < 1000; i++) |
| 1142 set->add(IntWrapper::create(i), &set); | 1142 set->add(IntWrapper::create(i), &set); |
| 1143 | 1143 |
| 1144 HeapStats afterAdding1000; | 1144 HeapStats afterAdding1000; |
| 1145 Heap::getStats(&afterAdding1000); | 1145 Heap::getStats(&afterAdding1000); |
| 1146 EXPECT_TRUE(afterAdding1000.totalObjectSpace() > afterGC2.totalObjectSpa
ce()); | 1146 EXPECT_TRUE(afterAdding1000.totalObjectSpace() > afterGC2.totalObjectSpa
ce()); |
| 1147 | 1147 |
| 1148 EXPECT_EQ(set->size(), 1000); | 1148 EXPECT_EQ(set->size(), 1000); |
| 1149 int i = 0, ninetyNines = 0; | 1149 int i = 0, ninetyNines = 0, threeSixties = 0; |
| 1150 for (HeapSet::iterator it(set->begin(&set)), end(set->end(&set)); it !=
end; ++it) { | 1150 for (HeapSet::iterator it(set->begin(&set)), end(set->end(&set)); it !=
end; ++it) { |
| 1151 HandleScope forScope; | 1151 HandleScope forScope; |
| 1152 if (Handle<IntWrapper>(*it.get())->value() == 99) | 1152 if (it.get()->value() == 99) |
| 1153 ninetyNines++; | 1153 ninetyNines++; |
| 1154 if (it->value() == 360) |
| 1155 threeSixties++; |
| 1154 i++; | 1156 i++; |
| 1155 } | 1157 } |
| 1156 EXPECT_EQ(i, 1000); | 1158 EXPECT_EQ(i, 1000); |
| 1157 EXPECT_EQ(ninetyNines, 1); | 1159 EXPECT_EQ(ninetyNines, 1); |
| 1160 EXPECT_EQ(threeSixties, 1); |
| 1158 | 1161 |
| 1159 // Equality is by underlying pointer, so there are two different | 1162 // Equality is by underlying pointer, so there are two different |
| 1160 // IntWrappers in there now that contain '1'. We add one of them | 1163 // IntWrappers in there now that contain '1'. We add one of them |
| 1161 // again, that should not matter. | 1164 // again, that should not matter. |
| 1162 set->add(one, &set); | 1165 set->add(one, &set); |
| 1163 EXPECT_EQ(set->size(), 1000); | 1166 EXPECT_EQ(set->size(), 1000); |
| 1164 } | 1167 } |
| 1165 | 1168 |
| 1166 Heap::collectGarbage(); | 1169 Heap::collectGarbage(); |
| 1167 EXPECT_EQ(IntWrapper::s_destructorCalls, 1000); | 1170 EXPECT_EQ(IntWrapper::s_destructorCalls, 1000); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 { | 1241 { |
| 1239 HeapTester::hashMapMembers(); | 1242 HeapTester::hashMapMembers(); |
| 1240 } | 1243 } |
| 1241 | 1244 |
| 1242 TEST(heap, HashMapOfMembers2) | 1245 TEST(heap, HashMapOfMembers2) |
| 1243 { | 1246 { |
| 1244 HeapTester::hashMapMembers2(); | 1247 HeapTester::hashMapMembers2(); |
| 1245 } | 1248 } |
| 1246 | 1249 |
| 1247 } // namespace WebCore | 1250 } // namespace WebCore |
| OLD | NEW |