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 6182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6193 } | 6193 } |
6194 | 6194 |
6195 { | 6195 { |
6196 SharedFunctionInfo::GlobalIterator iterator(isolate); | 6196 SharedFunctionInfo::GlobalIterator iterator(isolate); |
6197 while (iterator.Next()) sfi_count--; | 6197 while (iterator.Next()) sfi_count--; |
6198 } | 6198 } |
6199 | 6199 |
6200 CHECK_EQ(0, sfi_count); | 6200 CHECK_EQ(0, sfi_count); |
6201 } | 6201 } |
6202 | 6202 |
6203 | |
6204 template <typename T> | |
6205 static UniqueId MakeUniqueId(const Persistent<T>& p) { | |
6206 return UniqueId(reinterpret_cast<uintptr_t>(*v8::Utils::OpenPersistent(p))); | |
6207 } | |
6208 | |
6209 | |
6210 TEST(Regress519319) { | |
6211 if (!FLAG_incremental_marking) return; | |
6212 CcTest::InitializeVM(); | |
6213 v8::Isolate* isolate = CcTest::isolate(); | |
6214 v8::HandleScope scope(isolate); | |
6215 Heap* heap = CcTest::heap(); | |
6216 LocalContext context; | |
6217 | |
6218 v8::Persistent<Value> parent; | |
6219 v8::Persistent<Value> child; | |
6220 | |
6221 parent.Reset(isolate, v8::Object::New(isolate)); | |
6222 child.Reset(isolate, v8::Object::New(isolate)); | |
6223 | |
6224 heap::SimulateFullSpace(heap->old_space()); | |
6225 CcTest::CollectGarbage(OLD_SPACE); | |
6226 { | |
6227 UniqueId id = MakeUniqueId(parent); | |
6228 isolate->SetObjectGroupId(parent, id); | |
6229 isolate->SetReferenceFromGroup(id, child); | |
6230 } | |
6231 // The CollectGarbage call above starts sweeper threads. | |
6232 // The crash will happen if the following two functions | |
6233 // are called before sweeping finishes. | |
6234 heap->StartIncrementalMarking(i::Heap::kNoGCFlags, | |
6235 i::GarbageCollectionReason::kTesting); | |
6236 heap->FinalizeIncrementalMarkingIfComplete( | |
6237 i::GarbageCollectionReason::kTesting); | |
6238 } | |
6239 | |
6240 | |
6241 HEAP_TEST(Regress587004) { | 6203 HEAP_TEST(Regress587004) { |
6242 FLAG_concurrent_sweeping = false; | 6204 FLAG_concurrent_sweeping = false; |
6243 #ifdef VERIFY_HEAP | 6205 #ifdef VERIFY_HEAP |
6244 FLAG_verify_heap = false; | 6206 FLAG_verify_heap = false; |
6245 #endif | 6207 #endif |
6246 CcTest::InitializeVM(); | 6208 CcTest::InitializeVM(); |
6247 v8::HandleScope scope(CcTest::isolate()); | 6209 v8::HandleScope scope(CcTest::isolate()); |
6248 Heap* heap = CcTest::heap(); | 6210 Heap* heap = CcTest::heap(); |
6249 Isolate* isolate = CcTest::i_isolate(); | 6211 Isolate* isolate = CcTest::i_isolate(); |
6250 Factory* factory = isolate->factory(); | 6212 Factory* factory = isolate->factory(); |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6870 double deadline = heap->MonotonicallyIncreasingTimeInMs() + 1; | 6832 double deadline = heap->MonotonicallyIncreasingTimeInMs() + 1; |
6871 marking->AdvanceIncrementalMarking( | 6833 marking->AdvanceIncrementalMarking( |
6872 deadline, IncrementalMarking::GC_VIA_STACK_GUARD, | 6834 deadline, IncrementalMarking::GC_VIA_STACK_GUARD, |
6873 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); | 6835 IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); |
6874 } | 6836 } |
6875 DCHECK(marking->IsStopped()); | 6837 DCHECK(marking->IsStopped()); |
6876 } | 6838 } |
6877 | 6839 |
6878 } // namespace internal | 6840 } // namespace internal |
6879 } // namespace v8 | 6841 } // namespace v8 |
OLD | NEW |