| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 Factory* factory = isolate->factory(); | 203 Factory* factory = isolate->factory(); |
| 204 | 204 |
| 205 Handle<JSObject> key = factory->NewJSArray(0); | 205 Handle<JSObject> key = factory->NewJSArray(0); |
| 206 | 206 |
| 207 // Simulate a full heap so that generating an identity hash code | 207 // Simulate a full heap so that generating an identity hash code |
| 208 // in subsequent calls will request GC. | 208 // in subsequent calls will request GC. |
| 209 heap::SimulateFullSpace(CcTest::heap()->new_space()); | 209 heap::SimulateFullSpace(CcTest::heap()->new_space()); |
| 210 heap::SimulateFullSpace(CcTest::heap()->old_space()); | 210 heap::SimulateFullSpace(CcTest::heap()->old_space()); |
| 211 | 211 |
| 212 // Calling Lookup() should not cause GC ever. | 212 // Calling Lookup() should not cause GC ever. |
| 213 CHECK(table->Lookup(key)->IsTheHole()); | 213 CHECK(table->Lookup(key)->IsTheHole(isolate)); |
| 214 | 214 |
| 215 // Calling Put() should request GC by returning a failure. | 215 // Calling Put() should request GC by returning a failure. |
| 216 int gc_count = isolate->heap()->gc_count(); | 216 int gc_count = isolate->heap()->gc_count(); |
| 217 HashMap::Put(table, key, key); | 217 HashMap::Put(table, key, key); |
| 218 CHECK(gc_count < isolate->heap()->gc_count()); | 218 CHECK(gc_count < isolate->heap()->gc_count()); |
| 219 } | 219 } |
| 220 | 220 |
| 221 | 221 |
| 222 TEST(ObjectHashTableCausesGC) { | 222 TEST(ObjectHashTableCausesGC) { |
| 223 i::FLAG_stress_compaction = false; | 223 i::FLAG_stress_compaction = false; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 236 dict->SetRequiresCopyOnCapacityChange(); | 236 dict->SetRequiresCopyOnCapacityChange(); |
| 237 Handle<Name> key = isolate->factory()->InternalizeString( | 237 Handle<Name> key = isolate->factory()->InternalizeString( |
| 238 v8::Utils::OpenHandle(*v8_str("key"))); | 238 v8::Utils::OpenHandle(*v8_str("key"))); |
| 239 Handle<Object> value = handle(Smi::FromInt(0), isolate); | 239 Handle<Object> value = handle(Smi::FromInt(0), isolate); |
| 240 Handle<NameDictionary> new_dict = | 240 Handle<NameDictionary> new_dict = |
| 241 NameDictionary::Add(dict, key, value, PropertyDetails::Empty()); | 241 NameDictionary::Add(dict, key, value, PropertyDetails::Empty()); |
| 242 CHECK_NE(*dict, *new_dict); | 242 CHECK_NE(*dict, *new_dict); |
| 243 } | 243 } |
| 244 | 244 |
| 245 } // namespace | 245 } // namespace |
| OLD | NEW |