Changeset 253358 in webkit for trunk/Source/JavaScriptCore/dfg
- Timestamp:
- Dec 10, 2019, 5:45:00 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/dfg/DFGWorklist.cpp
r253243 r253358 308 308 { 309 309 RELEASE_ASSERT(vm.currentThreadIsHoldingAPILock()); 310 #if !ASSERT_DISABLED311 310 HashSet<RefPtr<Plan>> removedPlans; 312 #endif 311 312 // The following scenario can occur: 313 // 1. The DFG thread started compiling a plan. 314 // 2. The GC thread cancels the plan, and adds it to m_cancelledPlansPendingDestruction. 315 // 3. The DFG thread finishes compiling, and discovers that the thread is cancelled. 316 // To avoid destructing the plan in the DFG thread, it adds it to 317 // m_cancelledPlansPendingDestruction. 318 // 4. The above occurs before the mutator runs deleteCancelledPlansForVM(). 319 // 320 // Hence, the same cancelled plan can appear in m_cancelledPlansPendingDestruction 321 // more than once. This is why we need to filter the cancelled plans through 322 // the removedPlans HashSet before we do the refCount check below. 313 323 314 324 for (size_t i = 0; i < m_cancelledPlansPendingDestruction.size(); ++i) { … … 318 328 m_cancelledPlansPendingDestruction[i--] = m_cancelledPlansPendingDestruction.last(); 319 329 m_cancelledPlansPendingDestruction.removeLast(); 320 #if !ASSERT_DISABLED 321 removedPlans.add(plan); 322 #endif 323 } 324 325 #if !ASSERT_DISABLED 330 removedPlans.add(WTFMove(plan)); 331 } 332 326 333 while (!removedPlans.isEmpty()) { 327 334 RefPtr<Plan> plan = removedPlans.takeAny(); 328 RELEASE_ASSERT(plan->stage() == Plan::Cancelled);329 RELEASE_ASSERT(plan->refCount() == 1);330 }331 #endif 335 ASSERT(plan->stage() == Plan::Cancelled); 336 if (plan->refCount() > 1) 337 m_cancelledPlansPendingDestruction.append(WTFMove(plan)); 338 } 332 339 } 333 340 … … 460 467 plan->cancel(); 461 468 if (!isInMutator) 462 m_cancelledPlansPendingDestruction.append( plan);469 m_cancelledPlansPendingDestruction.append(WTFMove(plan)); 463 470 } 464 471 Deque<RefPtr<Plan>> newQueue;
Note:
See TracChangeset
for help on using the changeset viewer.