| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // in subsequent calls will request GC. | 180 // in subsequent calls will request GC. |
| 181 SimulateFullSpace(CcTest::heap()->new_space()); | 181 SimulateFullSpace(CcTest::heap()->new_space()); |
| 182 SimulateFullSpace(CcTest::heap()->old_pointer_space()); | 182 SimulateFullSpace(CcTest::heap()->old_pointer_space()); |
| 183 | 183 |
| 184 // Calling Contains() should not cause GC ever. | 184 // Calling Contains() should not cause GC ever. |
| 185 int gc_count = isolate->heap()->gc_count(); | 185 int gc_count = isolate->heap()->gc_count(); |
| 186 CHECK(!table->Contains(key)); | 186 CHECK(!table->Contains(key)); |
| 187 CHECK(gc_count == isolate->heap()->gc_count()); | 187 CHECK(gc_count == isolate->heap()->gc_count()); |
| 188 | 188 |
| 189 // Calling Remove() will not cause GC in this case. | 189 // Calling Remove() will not cause GC in this case. |
| 190 table = HashSet::Remove(table, key); | 190 bool was_present = false; |
| 191 table = HashSet::Remove(table, key, &was_present); |
| 192 CHECK(!was_present); |
| 191 CHECK(gc_count == isolate->heap()->gc_count()); | 193 CHECK(gc_count == isolate->heap()->gc_count()); |
| 192 | 194 |
| 193 // Calling Add() should cause GC. | 195 // Calling Add() should cause GC. |
| 194 table = HashSet::Add(table, key); | 196 table = HashSet::Add(table, key); |
| 195 CHECK(gc_count < isolate->heap()->gc_count()); | 197 CHECK(gc_count < isolate->heap()->gc_count()); |
| 196 } | 198 } |
| 197 | 199 |
| 198 | 200 |
| 199 TEST(ObjectHashSetCausesGC) { | 201 TEST(ObjectHashSetCausesGC) { |
| 200 i::FLAG_stress_compaction = false; | 202 i::FLAG_stress_compaction = false; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 LocalContext context; | 242 LocalContext context; |
| 241 v8::HandleScope scope(context->GetIsolate()); | 243 v8::HandleScope scope(context->GetIsolate()); |
| 242 Isolate* isolate = CcTest::i_isolate(); | 244 Isolate* isolate = CcTest::i_isolate(); |
| 243 TestHashMapCausesGC(ObjectHashTable::New(isolate, 1)); | 245 TestHashMapCausesGC(ObjectHashTable::New(isolate, 1)); |
| 244 TestHashMapCausesGC(isolate->factory()->NewOrderedHashMap()); | 246 TestHashMapCausesGC(isolate->factory()->NewOrderedHashMap()); |
| 245 } | 247 } |
| 246 #endif | 248 #endif |
| 247 | 249 |
| 248 | 250 |
| 249 } | 251 } |
| OLD | NEW |