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

Side by Side Diff: test/cctest/test-dictionary.cc

Issue 1051233002: Reland "Merge old data and pointer space." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « test/cctest/test-constantpool.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 v8::Handle<v8::Object> key_obj = v8::Utils::ToLocal(key); 175 v8::Handle<v8::Object> key_obj = v8::Utils::ToLocal(key);
176 176
177 // Force allocation of hash table backing store for hidden properties. 177 // Force allocation of hash table backing store for hidden properties.
178 key_obj->SetHiddenValue(v8_str("key 1"), v8_str("val 1")); 178 key_obj->SetHiddenValue(v8_str("key 1"), v8_str("val 1"));
179 key_obj->SetHiddenValue(v8_str("key 2"), v8_str("val 2")); 179 key_obj->SetHiddenValue(v8_str("key 2"), v8_str("val 2"));
180 key_obj->SetHiddenValue(v8_str("key 3"), v8_str("val 3")); 180 key_obj->SetHiddenValue(v8_str("key 3"), v8_str("val 3"));
181 181
182 // Simulate a full heap so that generating an identity hash code 182 // Simulate a full heap so that generating an identity hash code
183 // in subsequent calls will request GC. 183 // in subsequent calls will request GC.
184 SimulateFullSpace(CcTest::heap()->new_space()); 184 SimulateFullSpace(CcTest::heap()->new_space());
185 SimulateFullSpace(CcTest::heap()->old_pointer_space()); 185 SimulateFullSpace(CcTest::heap()->old_space());
186 186
187 // Calling Contains() should not cause GC ever. 187 // Calling Contains() should not cause GC ever.
188 int gc_count = isolate->heap()->gc_count(); 188 int gc_count = isolate->heap()->gc_count();
189 CHECK(!table->Contains(key)); 189 CHECK(!table->Contains(key));
190 CHECK(gc_count == isolate->heap()->gc_count()); 190 CHECK(gc_count == isolate->heap()->gc_count());
191 191
192 // Calling Remove() will not cause GC in this case. 192 // Calling Remove() will not cause GC in this case.
193 bool was_present = false; 193 bool was_present = false;
194 table = HashSet::Remove(table, key, &was_present); 194 table = HashSet::Remove(table, key, &was_present);
195 CHECK(!was_present); 195 CHECK(!was_present);
(...skipping 25 matching lines...) Expand all
221 v8::Handle<v8::Object> key_obj = v8::Utils::ToLocal(key); 221 v8::Handle<v8::Object> key_obj = v8::Utils::ToLocal(key);
222 222
223 // Force allocation of hash table backing store for hidden properties. 223 // Force allocation of hash table backing store for hidden properties.
224 key_obj->SetHiddenValue(v8_str("key 1"), v8_str("val 1")); 224 key_obj->SetHiddenValue(v8_str("key 1"), v8_str("val 1"));
225 key_obj->SetHiddenValue(v8_str("key 2"), v8_str("val 2")); 225 key_obj->SetHiddenValue(v8_str("key 2"), v8_str("val 2"));
226 key_obj->SetHiddenValue(v8_str("key 3"), v8_str("val 3")); 226 key_obj->SetHiddenValue(v8_str("key 3"), v8_str("val 3"));
227 227
228 // Simulate a full heap so that generating an identity hash code 228 // Simulate a full heap so that generating an identity hash code
229 // in subsequent calls will request GC. 229 // in subsequent calls will request GC.
230 SimulateFullSpace(CcTest::heap()->new_space()); 230 SimulateFullSpace(CcTest::heap()->new_space());
231 SimulateFullSpace(CcTest::heap()->old_pointer_space()); 231 SimulateFullSpace(CcTest::heap()->old_space());
232 232
233 // Calling Lookup() should not cause GC ever. 233 // Calling Lookup() should not cause GC ever.
234 CHECK(table->Lookup(key)->IsTheHole()); 234 CHECK(table->Lookup(key)->IsTheHole());
235 235
236 // Calling Put() should request GC by returning a failure. 236 // Calling Put() should request GC by returning a failure.
237 int gc_count = isolate->heap()->gc_count(); 237 int gc_count = isolate->heap()->gc_count();
238 HashMap::Put(table, key, key); 238 HashMap::Put(table, key, key);
239 CHECK(gc_count < isolate->heap()->gc_count()); 239 CHECK(gc_count < isolate->heap()->gc_count());
240 } 240 }
241 241
242 242
243 TEST(ObjectHashTableCausesGC) { 243 TEST(ObjectHashTableCausesGC) {
244 i::FLAG_stress_compaction = false; 244 i::FLAG_stress_compaction = false;
245 LocalContext context; 245 LocalContext context;
246 v8::HandleScope scope(context->GetIsolate()); 246 v8::HandleScope scope(context->GetIsolate());
247 Isolate* isolate = CcTest::i_isolate(); 247 Isolate* isolate = CcTest::i_isolate();
248 TestHashMapCausesGC(ObjectHashTable::New(isolate, 1)); 248 TestHashMapCausesGC(ObjectHashTable::New(isolate, 1));
249 TestHashMapCausesGC(isolate->factory()->NewOrderedHashMap()); 249 TestHashMapCausesGC(isolate->factory()->NewOrderedHashMap());
250 } 250 }
251 #endif 251 #endif
252 252
253 253
254 } 254 }
OLDNEW
« no previous file with comments | « test/cctest/test-constantpool.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698