void TimeUnitFormat::setup(UErrorCode& err) { initDataMembers(err); readFromCurrentLocale(kFull, gUnitsTag, err); checkConsistency(kFull, gUnitsTag, err); readFromCurrentLocale(kAbbreviate, gShortUnitsTag, err); checkConsistency(kAbbreviate, gShortUnitsTag, err); }
void Structure::createPropertyMap(unsigned capacity) { ASSERT(!m_propertyTable); checkConsistency(); m_propertyTable = adoptPtr(new PropertyTable(capacity)); checkConsistency(); }
void LineBoxList::appendLineBox(InlineFlowBox* box) { checkConsistency(); if (!m_firstLineBox) { m_firstLineBox = m_lastLineBox = box; } else { m_lastLineBox->setNextLineBox(box); box->setPreviousLineBox(m_lastLineBox); m_lastLineBox = box; } checkConsistency(); }
void RenderTextLineBoxes::extract(InlineTextBox& box) { checkConsistency(); m_last = box.prevTextBox(); if (&box == m_first) m_first = nullptr; if (box.prevTextBox()) box.prevTextBox()->setNextTextBox(nullptr); box.setPreviousTextBox(nullptr); for (auto current = &box; current; current = current->nextTextBox()) current->setExtracted(); checkConsistency(); }
void RenderTextLineBoxes::remove(InlineTextBox& box) { checkConsistency(); if (&box == m_first) m_first = box.nextTextBox(); if (&box == m_last) m_last = box.prevTextBox(); if (box.nextTextBox()) box.nextTextBox()->setPreviousTextBox(box.prevTextBox()); if (box.prevTextBox()) box.prevTextBox()->setNextTextBox(box.nextTextBox()); checkConsistency(); }
void LineBoxList::extractLineBox(InlineFlowBox* box) { checkConsistency(); m_lastLineBox = box->prevLineBox(); if (box == m_firstLineBox) m_firstLineBox = 0; if (box->prevLineBox()) box->prevLineBox()->setNextLineBox(0); box->setPreviousLineBox(0); for (InlineFlowBox* curr = box; curr; curr = curr->nextLineBox()) curr->setExtracted(); checkConsistency(); }
void LineBoxList::removeLineBox(InlineFlowBox* box) { checkConsistency(); if (box == m_firstLineBox) m_firstLineBox = box->nextLineBox(); if (box == m_lastLineBox) m_lastLineBox = box->prevLineBox(); if (box->nextLineBox()) box->nextLineBox()->setPreviousLineBox(box->prevLineBox()); if (box->prevLineBox()) box->prevLineBox()->setNextLineBox(box->nextLineBox()); checkConsistency(); }
void Structure::createPropertyMap(JSGlobalData& globalData, unsigned capacity) { ASSERT(!propertyTable()); checkConsistency(); propertyTable().set(globalData, this, PropertyTable::create(globalData, capacity)); }
/*------------------------------------------------------------------*/ int AzTrTreeFeat::update_with_ens(const AzTrTreeEnsemble_ReadOnly *ens, AzIntArr *ia_rmv_fx) /* output */ { int old_t_num = ip_featDef.size(); int added_from_new = 0, added_from_old = 0; added_from_old = _update_with_existing_trees(old_t_num, ens, ia_rmv_fx); added_from_new = _update_with_new_trees(old_t_num, ens); updateRulePools(); if (!out.isNull()) { AzPrint o(out); o.printBegin("", ",", ","); o.print("#tree", treeNum()); o.print("#added(from existing trees)", added_from_old); o.print("#added(from new trees)", added_from_new); o.print("#removed", ia_rmv_fx->size()); o.printEnd(); } if (doCheckConsistency) { checkConsistency(ens); } return added_from_new+added_from_old; }
void TimerBase::setNextFireTime(double newTime) { ASSERT(m_thread == currentThread()); // Keep heap valid while changing the next-fire time. double oldTime = m_nextFireTime; if (oldTime != newTime) { m_nextFireTime = newTime; static unsigned currentHeapInsertionOrder; m_heapInsertionOrder = currentHeapInsertionOrder++; bool wasFirstTimerInHeap = m_heapIndex == 0; if (oldTime == 0) heapInsert(); else if (newTime == 0) heapDelete(); else if (newTime < oldTime) heapDecreaseKey(); else heapIncreaseKey(); bool isFirstTimerInHeap = m_heapIndex == 0; if (wasFirstTimerInHeap || isFirstTimerInHeap) threadGlobalData().threadTimers().updateSharedTimer(); } checkConsistency(); }
void KDocumentTextBuffer::localTextRemoved( KTextEditor::Document *document, const KTextEditor::Range &range, const QString& oldText ) { if ( m_aboutToClose ) return; kDebug() << "local text removed:" << kDocument() << range; emit localChangedText(range, user(), true); Q_UNUSED(document) textOpPerformed(); if( !m_user.isNull() ) { unsigned int offset = cursorToOffset_kte( range.start() ); unsigned int len = countUnicodeCharacters(oldText); blockRemoteRemove = true; kDebug() << "ERASING TEXT" << oldText << "with len" << len << "offset" << offset << "range" << range; kDebug() << offset << len << length(); if( len > 0 ) eraseText( offset, len, m_user ); else kDebug() << "0 legth delete operation. Skipping."; checkConsistency(); } else kDebug() << "Could not remove text: No local user set."; }
void KDocumentTextBuffer::onEraseText( unsigned int offset, unsigned int length, QInfinity::User *user ) { if ( m_aboutToClose ) return; if( !blockRemoteRemove ) { kDebug() << "REMOTE ERASE TEXT len" << length << "offset" << offset << kDocument()->url(); KTextEditor::Cursor startCursor = offsetRelativeTo_kte(KTextEditor::Cursor(0, 0), offset); KTextEditor::Cursor endCursor = offsetRelativeTo_kte(startCursor, length); KTextEditor::Range range = KTextEditor::Range(startCursor, endCursor); ReadWriteTransaction transaction(kDocument()); #ifdef KTEXTEDITOR_HAS_BUFFER_IFACE // see onInsertText if ( KTextEditor::BufferInterface* iface = qobject_cast<KTextEditor::BufferInterface*>(kDocument()) ) { iface->removeTextSilent(KTextEditor::Range(startCursor, endCursor)); } #else if ( false ) { } #endif else { kDocument()->blockSignals(true); kDocument()->removeText( range ); kDocument()->blockSignals(false); } emit remoteChangedText(range, user, true); checkConsistency(); } else blockRemoteRemove = false; }
bool AbstractValue::mergeOSREntryValue(Graph& graph, JSValue value) { AbstractValue oldMe = *this; if (isClear()) { FrozenValue* frozenValue = graph.freeze(value); if (frozenValue->pointsToHeap()) { m_structure = frozenValue->structure(); m_arrayModes = asArrayModes(frozenValue->structure()->indexingType()); } else { m_structure.clear(); m_arrayModes = 0; } m_type = speculationFromValue(value); m_value = value; } else { mergeSpeculation(m_type, speculationFromValue(value)); if (!!value && value.isCell()) { Structure* structure = value.asCell()->structure(); graph.registerStructure(structure); mergeArrayModes(m_arrayModes, asArrayModes(structure->indexingType())); m_structure.merge(StructureSet(structure)); } if (m_value != value) m_value = JSValue(); } checkConsistency(); assertIsRegistered(graph); return oldMe != *this; }
void AbstractValue::set(Graph& graph, const FrozenValue& value, StructureClobberState clobberState) { if (!!value && value.value().isCell()) { Structure* structure = value.structure(); // FIXME: This check may not be necessary since any frozen value should have its structure // watched already. // https://bugs.webkit.org/show_bug.cgi?id=136055 if (graph.registerStructure(structure) == StructureRegisteredAndWatched) { m_structure = structure; if (clobberState == StructuresAreClobbered) { m_arrayModes = ALL_ARRAY_MODES; m_structure.clobber(); } else m_arrayModes = asArrayModes(structure->indexingType()); } else { m_structure.makeTop(); m_arrayModes = ALL_ARRAY_MODES; } } else { m_structure.clear(); m_arrayModes = 0; } m_type = speculationFromValue(value.value()); m_value = value.value(); checkConsistency(); assertIsRegistered(graph); }
void ScriptExecutionContext::suspendActiveDOMObjects(ActiveDOMObject::ReasonForSuspension why) { checkConsistency(); if (m_activeDOMObjectsAreSuspended) { // A page may subsequently suspend DOM objects, say as part of entering the page cache, after the embedding // client requested the page be suspended. We ignore such requests so long as the embedding client requested // the suspension first. See <rdar://problem/13754896> for more details. ASSERT(m_reasonForSuspendingActiveDOMObjects == ActiveDOMObject::PageWillBeSuspended); return; } m_activeDOMObjectsAreSuspended = true; m_activeDOMObjectAdditionForbidden = true; #if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS) m_activeDOMObjectRemovalForbidden = true; #endif // We assume that m_activeDOMObjects will not change during iteration: suspend // functions should not add new active DOM objects, nor execute arbitrary JavaScript. // An ASSERT_WITH_SECURITY_IMPLICATION or RELEASE_ASSERT will fire if this happens, but it's important to code // suspend functions so it will not happen! NoEventDispatchAssertion assertNoEventDispatch; for (auto* activeDOMObject : m_activeDOMObjects) activeDOMObject->suspend(why); m_activeDOMObjectAdditionForbidden = false; #if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS) m_activeDOMObjectRemovalForbidden = false; #endif m_reasonForSuspendingActiveDOMObjects = why; }
void ScriptExecutionContext::stopActiveDOMObjects() { checkConsistency(); if (m_activeDOMObjectsAreStopped) return; m_activeDOMObjectsAreStopped = true; // Make a frozen copy of the objects so we can iterate while new ones might be destroyed. Vector<ActiveDOMObject*> possibleActiveDOMObjects; copyToVector(m_activeDOMObjects, possibleActiveDOMObjects); m_activeDOMObjectAdditionForbidden = true; // We assume that new objects will not be added to m_activeDOMObjects during iteration: // stop functions should not add new active DOM objects, nor execute arbitrary JavaScript. // A RELEASE_ASSERT will fire if this happens, but it's important to code stop functions // so it will not happen! for (auto* activeDOMObject : possibleActiveDOMObjects) { // Check if this object was deleted already. If so, just skip it. // Calling contains on a possibly-already-deleted object is OK because we guarantee // no new object can be added, so even if a new object ends up allocated with the // same address, that will be *after* this function exits. if (!m_activeDOMObjects.contains(activeDOMObject)) continue; activeDOMObject->stop(); } m_activeDOMObjectAdditionForbidden = false; // FIXME: Make message ports be active DOM objects and let them implement stop instead // of having this separate mechanism just for them. for (auto* messagePort : m_messagePorts) messagePort->close(); }
void ScriptExecutionContext::suspendActiveDOMObjects(ActiveDOMObject::ReasonForSuspension why) { checkConsistency(); #if PLATFORM(IOS) if (m_activeDOMObjectsAreSuspended) { ASSERT(m_reasonForSuspendingActiveDOMObjects == ActiveDOMObject::DocumentWillBePaused); return; } #endif m_activeDOMObjectAdditionForbidden = true; #if !ASSERT_DISABLED m_activeDOMObjectRemovalForbidden = true; #endif // We assume that m_activeDOMObjects will not change during iteration: suspend // functions should not add new active DOM objects, nor execute arbitrary JavaScript. // An ASSERT or RELEASE_ASSERT will fire if this happens, but it's important to code // suspend functions so it will not happen! for (auto* activeDOMObject : m_activeDOMObjects) activeDOMObject->suspend(why); m_activeDOMObjectAdditionForbidden = false; #if !ASSERT_DISABLED m_activeDOMObjectRemovalForbidden = false; #endif m_activeDOMObjectsAreSuspended = true; m_reasonForSuspendingActiveDOMObjects = why; }
bool ScriptExecutionContext::canSuspendActiveDOMObjects() { checkConsistency(); bool canSuspend = true; m_activeDOMObjectAdditionForbidden = true; #if !ASSERT_DISABLED m_activeDOMObjectRemovalForbidden = true; #endif // We assume that m_activeDOMObjects will not change during iteration: canSuspend // functions should not add new active DOM objects, nor execute arbitrary JavaScript. // An ASSERT or RELEASE_ASSERT will fire if this happens, but it's important to code // canSuspend functions so it will not happen! for (auto* activeDOMObject : m_activeDOMObjects) { if (!activeDOMObject->canSuspend()) { canSuspend = false; break; } } m_activeDOMObjectAdditionForbidden = false; #if !ASSERT_DISABLED m_activeDOMObjectRemovalForbidden = false; #endif return canSuspend; }
void CDPTH::load(ReadContext &ctx) { readCells(ctx); checkConsistency(ctx); drawImage(ctx); }
void AbstractValue::set(Graph& graph, const FrozenValue& value, StructureClobberState clobberState) { if (!!value && value.value().isCell()) { Structure* structure = value.structure(); if (graph.registerStructure(structure) == StructureRegisteredAndWatched) { m_structure = structure; if (clobberState == StructuresAreClobbered) { m_arrayModes = ALL_ARRAY_MODES; m_structure.clobber(); } else m_arrayModes = asArrayModes(structure->indexingType()); } else { m_structure.makeTop(); m_arrayModes = ALL_ARRAY_MODES; } } else { m_structure.clear(); m_arrayModes = 0; } m_type = speculationFromValue(value.value()); m_value = value.value(); checkConsistency(); assertIsRegistered(graph); }
void TimerBase::setNextFireTime(double newUnalignedTime) { ASSERT(m_thread == currentThread()); if (m_unalignedNextFireTime != newUnalignedTime) m_unalignedNextFireTime = newUnalignedTime; // Accessing thread global data is slow. Cache the heap pointer. if (!m_cachedThreadGlobalTimerHeap) m_cachedThreadGlobalTimerHeap = &threadGlobalTimerHeap(); // Keep heap valid while changing the next-fire time. double oldTime = m_nextFireTime; double newTime = alignedFireTime(newUnalignedTime); if (oldTime != newTime) { m_nextFireTime = newTime; static unsigned currentHeapInsertionOrder; m_heapInsertionOrder = currentHeapInsertionOrder++; bool wasFirstTimerInHeap = m_heapIndex == 0; updateHeapIfNeeded(oldTime); bool isFirstTimerInHeap = m_heapIndex == 0; if (wasFirstTimerInHeap || isFirstTimerInHeap) PlatformThreadData::current().threadTimers().updateSharedTimer(); } checkConsistency(); }
bool ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension(Vector<ActiveDOMObject*>* unsuspendableObjects) { checkConsistency(); bool canSuspend = true; m_activeDOMObjectAdditionForbidden = true; #if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS) m_activeDOMObjectRemovalForbidden = true; #endif // We assume that m_activeDOMObjects will not change during iteration: canSuspend // functions should not add new active DOM objects, nor execute arbitrary JavaScript. // An ASSERT_WITH_SECURITY_IMPLICATION or RELEASE_ASSERT will fire if this happens, but it's important to code // canSuspend functions so it will not happen! NoEventDispatchAssertion assertNoEventDispatch; for (auto* activeDOMObject : m_activeDOMObjects) { if (!activeDOMObject->canSuspendForDocumentSuspension()) { canSuspend = false; if (unsuspendableObjects) unsuspendableObjects->append(activeDOMObject); else break; } } m_activeDOMObjectAdditionForbidden = false; #if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS) m_activeDOMObjectRemovalForbidden = false; #endif return canSuspend; }
FiltrationResult AbstractValue::filter(SpeculatedType type) { if ((m_type & type) == m_type) return FiltrationOK; // Fast path for the case that we don't even have a cell. if (!(m_type & SpecCell)) { m_type &= type; FiltrationResult result; if (m_type == SpecNone) { clear(); result = Contradiction; } else result = FiltrationOK; checkConsistency(); return result; } m_type &= type; // It's possible that prior to this filter() call we had, say, (Final, TOP), and // the passed type is Array. At this point we'll have (None, TOP). The best way // to ensure that the structure filtering does the right thing is to filter on // the new type (None) rather than the one passed (Array). m_structure.filter(type); filterArrayModesByType(); filterValueByType(); return normalizeClarity(); }
void ScriptExecutionContext::resumeActiveDOMObjects(ActiveDOMObject::ReasonForSuspension why) { checkConsistency(); if (m_reasonForSuspendingActiveDOMObjects != why) return; m_activeDOMObjectsAreSuspended = false; m_activeDOMObjectAdditionForbidden = true; #if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS) m_activeDOMObjectRemovalForbidden = true; #endif // We assume that m_activeDOMObjects will not change during iteration: resume // functions should not add new active DOM objects, nor execute arbitrary JavaScript. // An ASSERT_WITH_SECURITY_IMPLICATION or RELEASE_ASSERT will fire if this happens, but it's important to code // resume functions so it will not happen! NoEventDispatchAssertion assertNoEventDispatch; for (auto* activeDOMObject : m_activeDOMObjects) activeDOMObject->resume(); m_activeDOMObjectAdditionForbidden = false; #if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS) m_activeDOMObjectRemovalForbidden = false; #endif }
TriangleMesh makeBox( const Aabb& aabb ) { TriangleMesh result; result.m_vertices = { aabb.corner( Aabb::BottomLeftFloor ), aabb.corner( Aabb::BottomRightFloor ), aabb.corner( Aabb::TopLeftFloor ), aabb.corner( Aabb::TopRightFloor ), aabb.corner( Aabb::BottomLeftCeil ), aabb.corner( Aabb::BottomRightCeil ), aabb.corner( Aabb::TopLeftCeil ), aabb.corner( Aabb::TopRightCeil ) }; result.m_triangles = { Triangle( 0, 2, 1 ), Triangle( 1, 2, 3 ), // Floor Triangle( 0, 1, 4 ), Triangle( 4, 1, 5 ), // Front Triangle( 3, 2, 6 ), Triangle( 3, 6, 7 ), // Back Triangle( 5, 1, 3 ), Triangle( 5, 3, 7 ), // Right Triangle( 2, 0, 4 ), Triangle( 2, 4, 6 ), // Left Triangle( 4, 5, 6 ), Triangle( 6, 5, 7 ) // Top }; getAutoNormals( result, result.m_normals ); checkConsistency( result ); return result; }
void TimerBase::setNextFireTime(double newTime) { // Keep heap valid while changing the next-fire time. if (timersReadyToFire) timersReadyToFire->remove(this); double oldTime = m_nextFireTime; if (oldTime != newTime) { m_nextFireTime = newTime; bool wasFirstTimerInHeap = m_heapIndex == 0; if (oldTime == 0) heapInsert(); else if (newTime == 0) heapDelete(); else if (newTime < oldTime) heapDecreaseKey(); else heapIncreaseKey(); bool isFirstTimerInHeap = m_heapIndex == 0; if (wasFirstTimerInHeap || isFirstTimerInHeap) updateSharedTimer(); } checkConsistency(); }
void AbstractValue::fixTypeForRepresentation(Graph& graph, NodeFlags representation, Node* node) { if (representation == NodeResultDouble) { if (m_value) { ASSERT(m_value.isNumber()); if (m_value.isInt32()) m_value = jsDoubleNumber(m_value.asNumber()); } if (m_type & SpecMachineInt) { m_type &= ~SpecMachineInt; m_type |= SpecInt52AsDouble; } if (m_type & ~SpecFullDouble) DFG_CRASH(graph, node, toCString("Abstract value ", *this, " for double node has type outside SpecFullDouble.\n").data()); } else if (representation == NodeResultInt52) { if (m_type & SpecInt52AsDouble) { m_type &= ~SpecInt52AsDouble; m_type |= SpecInt52; } if (m_type & ~SpecMachineInt) DFG_CRASH(graph, node, toCString("Abstract value ", *this, " for int52 node has type outside SpecMachineInt.\n").data()); } else { if (m_type & SpecInt52) { m_type &= ~SpecInt52; m_type |= SpecInt52AsDouble; } if (m_type & ~SpecBytecodeTop) DFG_CRASH(graph, node, toCString("Abstract value ", *this, " for value node has type outside SpecBytecodeTop.\n").data()); } checkConsistency(); }
void JPetHit::setSignals(JPetPhysSignal& p_sigA, JPetPhysSignal& p_sigB) { fSignalA = p_sigA; fIsSignalAset = true; fSignalB = p_sigB; fIsSignalBset = true; checkConsistency(); }
void RenderLineBoxList::appendLineBox(std::unique_ptr<InlineFlowBox> box) { checkConsistency(); InlineFlowBox* boxPtr = box.release(); if (!m_firstLineBox) { m_firstLineBox = boxPtr; m_lastLineBox = boxPtr; } else { m_lastLineBox->setNextLineBox(boxPtr); boxPtr->setPreviousLineBox(m_lastLineBox); m_lastLineBox = boxPtr; } checkConsistency(); }
void RenderLineBoxList::attachLineBox(InlineFlowBox* box) { checkConsistency(); if (m_lastLineBox) { m_lastLineBox->setNextLineBox(box); box->setPreviousLineBox(m_lastLineBox); } else m_firstLineBox = box; InlineFlowBox* last = box; for (InlineFlowBox* curr = box; curr; curr = curr->nextLineBox()) { curr->setExtracted(false); last = curr; } m_lastLineBox = last; checkConsistency(); }