Diff
Modified: trunk/Source/_javascript_Core/API/JSCallbackObject.h (210022 => 210023)
--- trunk/Source/_javascript_Core/API/JSCallbackObject.h 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/API/JSCallbackObject.h 2016-12-20 18:26:10 UTC (rev 210023)
@@ -106,9 +106,9 @@
void visitChildren(SlotVisitor& visitor)
{
LockHolder locker(m_lock);
- for (PrivatePropertyMap::iterator ptr = m_propertyMap.begin(); ptr != m_propertyMap.end(); ++ptr) {
- if (ptr->value)
- visitor.append(ptr->value);
+ for (auto& pair : m_propertyMap) {
+ if (pair.value)
+ visitor.append(pair.value);
}
}
Modified: trunk/Source/_javascript_Core/ChangeLog (210022 => 210023)
--- trunk/Source/_javascript_Core/ChangeLog 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-12-20 18:26:10 UTC (rev 210023)
@@ -1,5 +1,93 @@
2016-12-20 Konstantin Tokarev <[email protected]>
+ Modernize for loops in JSC
+ https://bugs.webkit.org/show_bug.cgi?id=166060
+
+ Reviewed by Yusuke Suzuki.
+
+ * API/JSCallbackObject.h:
+ (JSC::JSCallbackObjectData::JSPrivatePropertyMap::visitChildren):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::dumpBytecode):
+ (JSC::CodeBlock::propagateTransitions):
+ (JSC::CodeBlock::stronglyVisitStrongReferences):
+ (JSC::CodeBlock::stronglyVisitWeakReferences):
+ (JSC::CodeBlock::jettison):
+ (JSC::CodeBlock::getArrayProfile):
+ (JSC::CodeBlock::tallyFrequentExitSites):
+ (JSC::CodeBlock::nameForRegister):
+ * bytecompiler/BytecodeGenerator.cpp:
+ (JSC::BytecodeGenerator::generate):
+ (JSC::BytecodeGenerator::BytecodeGenerator):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::ObjectPatternNode::bindValue):
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::applyBreakpoints):
+ * dfg/DFGCPSRethreadingPhase.cpp:
+ (JSC::DFG::CPSRethreadingPhase::canonicalizeLocalsInBlock):
+ * dfg/DFGClobberSet.cpp:
+ (JSC::DFG::ClobberSet::setOf):
+ * dfg/DFGDesiredIdentifiers.cpp:
+ (JSC::DFG::DesiredIdentifiers::reallyAdd):
+ * dfg/DFGGraph.cpp:
+ (JSC::DFG::Graph::visitChildren):
+ * dfg/DFGIntegerCheckCombiningPhase.cpp:
+ (JSC::DFG::IntegerCheckCombiningPhase::handleBlock):
+ * dfg/DFGIntegerRangeOptimizationPhase.cpp:
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::link):
+ * dfg/DFGLICMPhase.cpp:
+ (JSC::DFG::LICMPhase::run):
+ * dfg/DFGMaximalFlushInsertionPhase.cpp:
+ (JSC::DFG::MaximalFlushInsertionPhase::treatRootBlock):
+ * dfg/DFGPutStackSinkingPhase.cpp:
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::compileCurrentBlock):
+ (JSC::DFG::SpeculativeJIT::linkBranches):
+ * dfg/DFGStructureRegistrationPhase.cpp:
+ (JSC::DFG::StructureRegistrationPhase::run):
+ * dfg/DFGTypeCheckHoistingPhase.cpp:
+ (JSC::DFG::TypeCheckHoistingPhase::identifyRedundantStructureChecks):
+ (JSC::DFG::TypeCheckHoistingPhase::identifyRedundantArrayChecks):
+ * dfg/DFGValidate.cpp:
+ * dfg/DFGVirtualRegisterAllocationPhase.cpp:
+ (JSC::DFG::VirtualRegisterAllocationPhase::run):
+ * heap/HeapVerifier.cpp:
+ (JSC::trimDeadObjectsFromList):
+ (JSC::HeapVerifier::trimDeadObjects):
+ * heap/LiveObjectList.cpp:
+ (JSC::LiveObjectList::findObject):
+ * heap/MarkedAllocator.cpp:
+ (JSC::MarkedAllocator::isPagedOut):
+ * inspector/ScriptCallStack.cpp:
+ (Inspector::ScriptCallStack::firstNonNativeCallFrame):
+ * jit/JIT.cpp:
+ (JSC::JIT::link):
+ * parser/VariableEnvironment.cpp:
+ (JSC::VariableEnvironment::markAllVariablesAsCaptured):
+ (JSC::VariableEnvironment::hasCapturedVariables):
+ * runtime/FunctionHasExecutedCache.cpp:
+ (JSC::FunctionHasExecutedCache::hasExecutedAtOffset):
+ (JSC::FunctionHasExecutedCache::getFunctionRanges):
+ * runtime/JSPropertyNameEnumerator.cpp:
+ (JSC::JSPropertyNameEnumerator::visitChildren):
+ * runtime/TypeProfiler.cpp:
+ (JSC::TypeProfiler::findLocation):
+ * runtime/TypeSet.cpp:
+ (JSC::TypeSet::addTypeInformation):
+ (JSC::TypeSet::dumpTypes):
+ * runtime/VM.cpp:
+ (JSC::VM::gatherConservativeRoots):
+ * runtime/WeakMapData.cpp:
+ (JSC::WeakMapData::DeadKeyCleaner::visitWeakReferences):
+ (JSC::WeakMapData::DeadKeyCleaner::finalizeUnconditionally):
+ * tools/ProfileTreeNode.h:
+ (JSC::ProfileTreeNode::dumpInternal):
+ * yarr/YarrInterpreter.cpp:
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+
+2016-12-20 Konstantin Tokarev <[email protected]>
+
__cpuid() requires <intrin.h> to be included
https://bugs.webkit.org/show_bug.cgi?id=166051
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -1769,8 +1769,8 @@
if (!exitSites.isEmpty()) {
out.print(" !! frequent exits: ");
CommaPrinter comma;
- for (unsigned i = 0; i < exitSites.size(); ++i)
- out.print(comma, exitSites[i].kind(), " ", exitSites[i].jitType());
+ for (auto& exitSite : exitSites)
+ out.print(comma, exitSite.kind(), " ", exitSite.jitType());
}
#else // ENABLE(DFG_JIT)
UNUSED_PARAM(location);
@@ -2677,9 +2677,9 @@
DFG::CommonData* dfgCommon = m_jitCode->dfgCommon();
for (auto& weakReference : dfgCommon->weakStructureReferences)
allAreMarkedSoFar &= weakReference->markIfCheap(visitor);
-
- for (unsigned i = 0; i < dfgCommon->transitions.size(); ++i) {
- if (shouldMarkTransition(dfgCommon->transitions[i])) {
+
+ for (auto& transition : dfgCommon->transitions) {
+ if (shouldMarkTransition(transition)) {
// If the following three things are live, then the target of the
// transition is also live:
//
@@ -2698,8 +2698,8 @@
// We also short-circuit the liveness if the structure is harmless
// to mark (i.e. its global object and prototype are both already
// live).
-
- visitor.append(dfgCommon->transitions[i].m_to);
+
+ visitor.append(transition.m_to);
} else
allAreMarkedSoFar = false;
}
@@ -3068,12 +3068,12 @@
if (m_rareData)
m_rareData->m_directEvalCodeCache.visitAggregate(visitor);
visitor.appendValues(m_constantRegisters.data(), m_constantRegisters.size());
- for (size_t i = 0; i < m_functionExprs.size(); ++i)
- visitor.append(m_functionExprs[i]);
- for (size_t i = 0; i < m_functionDecls.size(); ++i)
- visitor.append(m_functionDecls[i]);
- for (unsigned i = 0; i < m_objectAllocationProfiles.size(); ++i)
- m_objectAllocationProfiles[i].visitAggregate(visitor);
+ for (auto& functionExpr : m_functionExprs)
+ visitor.append(functionExpr);
+ for (auto& functionDecl : m_functionDecls)
+ visitor.append(functionDecl);
+ for (auto& objectAllocationProfile : m_objectAllocationProfiles)
+ objectAllocationProfile.visitAggregate(visitor);
#if ENABLE(JIT)
for (ByValInfo* byValInfo : m_byValInfos)
@@ -3096,19 +3096,19 @@
DFG::CommonData* dfgCommon = m_jitCode->dfgCommon();
- for (unsigned i = 0; i < dfgCommon->transitions.size(); ++i) {
- if (!!dfgCommon->transitions[i].m_codeOrigin)
- visitor.append(dfgCommon->transitions[i].m_codeOrigin); // Almost certainly not necessary, since the code origin should also be a weak reference. Better to be safe, though.
- visitor.append(dfgCommon->transitions[i].m_from);
- visitor.append(dfgCommon->transitions[i].m_to);
+ for (auto& transition : dfgCommon->transitions) {
+ if (!!transition.m_codeOrigin)
+ visitor.append(transition.m_codeOrigin); // Almost certainly not necessary, since the code origin should also be a weak reference. Better to be safe, though.
+ visitor.append(transition.m_from);
+ visitor.append(transition.m_to);
}
-
- for (unsigned i = 0; i < dfgCommon->weakReferences.size(); ++i)
- visitor.append(dfgCommon->weakReferences[i]);
- for (unsigned i = 0; i < dfgCommon->weakStructureReferences.size(); ++i)
- visitor.append(dfgCommon->weakStructureReferences[i]);
+ for (auto& weakReference : dfgCommon->weakReferences)
+ visitor.append(weakReference);
+ for (auto& weakStructureReference : dfgCommon->weakStructureReferences)
+ visitor.append(weakStructureReference);
+
dfgCommon->livenessHasBeenProved = true;
#endif
}
@@ -3376,8 +3376,7 @@
if (DFG::shouldDumpDisassembly()) {
dataLog(*this, " will be jettisoned because of the following dead references:\n");
DFG::CommonData* dfgCommon = m_jitCode->dfgCommon();
- for (unsigned i = 0; i < dfgCommon->transitions.size(); ++i) {
- DFG::WeakReferenceTransition& transition = dfgCommon->transitions[i];
+ for (auto& transition : dfgCommon->transitions) {
JSCell* origin = transition.m_codeOrigin.get();
JSCell* from = transition.m_from.get();
JSCell* to = transition.m_to.get();
@@ -3906,9 +3905,9 @@
ArrayProfile* CodeBlock::getArrayProfile(const ConcurrentJSLocker&, unsigned bytecodeOffset)
{
- for (unsigned i = 0; i < m_arrayProfiles.size(); ++i) {
- if (m_arrayProfiles[i].bytecodeOffset() == bytecodeOffset)
- return &m_arrayProfiles[i];
+ for (auto& m_arrayProfile : m_arrayProfiles) {
+ if (m_arrayProfile.bytecodeOffset() == bytecodeOffset)
+ return &m_arrayProfile;
}
return 0;
}
@@ -4064,10 +4063,8 @@
switch (jitType()) {
case JITCode::DFGJIT: {
DFG::JITCode* jitCode = m_jitCode->dfg();
- for (unsigned i = 0; i < jitCode->osrExit.size(); ++i) {
- DFG::OSRExit& exit = jitCode->osrExit[i];
+ for (auto& exit : jitCode->osrExit)
exit.considerAddingAsFrequentExitSite(profiledBlock);
- }
break;
}
@@ -4205,10 +4202,10 @@
String CodeBlock::nameForRegister(VirtualRegister virtualRegister)
{
- for (unsigned i = 0; i < m_constantRegisters.size(); i++) {
- if (m_constantRegisters[i].get().isEmpty())
+ for (auto& constantRegister : m_constantRegisters) {
+ if (constantRegister.get().isEmpty())
continue;
- if (SymbolTable* symbolTable = jsDynamicCast<SymbolTable*>(m_constantRegisters[i].get())) {
+ if (SymbolTable* symbolTable = jsDynamicCast<SymbolTable*>(constantRegister.get())) {
ConcurrentJSLocker locker(symbolTable->m_lock);
auto end = symbolTable->end(locker);
for (auto ptr = symbolTable->begin(locker); ptr != end; ++ptr) {
Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -126,8 +126,7 @@
m_staticPropertyAnalyzer.kill();
- for (unsigned i = 0; i < m_tryRanges.size(); ++i) {
- TryRange& range = m_tryRanges[i];
+ for (auto& range : m_tryRanges) {
int start = range.start->bind();
int end = range.end->bind();
@@ -201,10 +200,9 @@
const FunctionStack& functionStack = programNode->functionStack();
- for (size_t i = 0; i < functionStack.size(); ++i) {
- FunctionMetadataNode* function = functionStack[i];
+ for (auto* function : functionStack)
m_functionsToInitialize.append(std::make_pair(function, GlobalFunctionVariable));
- }
+
if (Options::validateBytecode()) {
for (auto& entry : programNode->varDeclarations())
RELEASE_ASSERT(entry.value.isVar());
Modified: trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -3962,8 +3962,7 @@
void ObjectPatternNode::bindValue(BytecodeGenerator& generator, RegisterID* rhs) const
{
generator.emitRequireObjectCoercible(rhs, ASCIILiteral("Right side of assignment cannot be destructured"));
- for (size_t i = 0; i < m_targetPatterns.size(); i++) {
- auto& target = m_targetPatterns[i];
+ for (const auto& target : m_targetPatterns) {
RefPtr<RegisterID> temp = generator.newTemporary();
if (!target.propertyExpression) {
// Should not emit get_by_id for indexed ones.
Modified: trunk/Source/_javascript_Core/debugger/Debugger.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/debugger/Debugger.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/debugger/Debugger.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -295,10 +295,8 @@
void Debugger::applyBreakpoints(CodeBlock* codeBlock)
{
BreakpointIDToBreakpointMap& breakpoints = m_breakpointIDToBreakpoint;
- for (auto it = breakpoints.begin(); it != breakpoints.end(); ++it) {
- Breakpoint& breakpoint = *it->value;
- toggleBreakpoint(codeBlock, breakpoint, BreakpointEnabled);
- }
+ for (auto* breakpoint : breakpoints.values())
+ toggleBreakpoint(codeBlock, *breakpoint, BreakpointEnabled);
}
class Debugger::ToggleBreakpointFunctor {
Modified: trunk/Source/_javascript_Core/dfg/DFGCPSRethreadingPhase.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/dfg/DFGCPSRethreadingPhase.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/dfg/DFGCPSRethreadingPhase.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -291,9 +291,7 @@
// but not logicalRefCount == actualRefCount). Assumes that it can break ref
// counts.
- for (unsigned nodeIndex = 0; nodeIndex < m_block->size(); ++nodeIndex) {
- Node* node = m_block->at(nodeIndex);
-
+ for (auto* node : *m_block) {
m_graph.performSubstitution(node);
// The rules for threaded CPS form:
Modified: trunk/Source/_javascript_Core/dfg/DFGClobberSet.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/dfg/DFGClobberSet.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/dfg/DFGClobberSet.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -129,9 +129,9 @@
HashSet<AbstractHeap> ClobberSet::setOf(bool direct) const
{
HashSet<AbstractHeap> result;
- for (HashMap<AbstractHeap, bool>::const_iterator iter = m_clobbers.begin(); iter != m_clobbers.end(); ++iter) {
- if (iter->value == direct)
- result.add(iter->key);
+ for (auto& clobber : m_clobbers) {
+ if (clobber.value == direct)
+ result.add(clobber.key);
}
return result;
}
Modified: trunk/Source/_javascript_Core/dfg/DFGDesiredIdentifiers.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/dfg/DFGDesiredIdentifiers.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/dfg/DFGDesiredIdentifiers.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -87,8 +87,7 @@
void DesiredIdentifiers::reallyAdd(VM& vm, CommonData* commonData)
{
- for (unsigned i = 0; i < m_addedIdentifiers.size(); ++i) {
- auto rep = m_addedIdentifiers[i];
+ for (auto rep : m_addedIdentifiers) {
ASSERT(rep->hasAtLeastOneRef());
commonData->dfgIdentifiers.append(Identifier::fromUid(&vm, rep));
}
Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/dfg/DFGGraph.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -1419,9 +1419,7 @@
if (!block)
continue;
- for (unsigned nodeIndex = 0; nodeIndex < block->size(); ++nodeIndex) {
- Node* node = block->at(nodeIndex);
-
+ for (auto* node : *block) {
switch (node->op()) {
case CheckStructure:
for (unsigned i = node->structureSet().size(); i--;)
Modified: trunk/Source/_javascript_Core/dfg/DFGIntegerCheckCombiningPhase.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/dfg/DFGIntegerCheckCombiningPhase.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/dfg/DFGIntegerCheckCombiningPhase.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -192,8 +192,7 @@
// First we collect Ranges. If operations within the range have enough redundancy,
// we hoist. And then we remove additions and checks that fall within the max range.
- for (unsigned nodeIndex = 0; nodeIndex < block->size(); ++nodeIndex) {
- Node* node = block->at(nodeIndex);
+ for (auto* node : *block) {
RangeKeyAndAddend data = ""
if (verbose)
dataLog("For ", node, ": ", data, "\n");
Modified: trunk/Source/_javascript_Core/dfg/DFGIntegerRangeOptimizationPhase.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/dfg/DFGIntegerRangeOptimizationPhase.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/dfg/DFGIntegerRangeOptimizationPhase.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -1109,8 +1109,7 @@
m_relationships = m_relationshipsAtHead[block];
- for (unsigned nodeIndex = 0; nodeIndex < block->size(); ++nodeIndex) {
- Node* node = block->at(nodeIndex);
+ for (auto* node : *block) {
if (verbose)
dataLog("Analysis: at ", node, ": ", listDump(sortedRelationships()), "\n");
executeNode(node);
Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -274,8 +274,7 @@
start, linkBuffer.locationOf(m_ins[i].m_slowPathGenerator->label()));
}
- for (unsigned i = 0; i < m_jsCalls.size(); ++i) {
- JSCallRecord& record = m_jsCalls[i];
+ for (auto& record : m_jsCalls) {
CallLinkInfo& info = *record.info;
linkBuffer.link(record.slowCall, FunctionPtr(m_vm->getCTIStub(linkCallThunkGenerator).code().executableAddress()));
info.setCallLocations(
Modified: trunk/Source/_javascript_Core/dfg/DFGLICMPhase.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/dfg/DFGLICMPhase.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/dfg/DFGLICMPhase.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -102,9 +102,7 @@
if (!loop)
continue;
LoopData& data = ""
- for (unsigned nodeIndex = 0; nodeIndex < block->size(); ++nodeIndex) {
- Node* node = block->at(nodeIndex);
-
+ for (auto* node : *block) {
// Don't look beyond parts of the code that definitely always exit.
// FIXME: This shouldn't be needed.
// https://bugs.webkit.org/show_bug.cgi?id=128584
Modified: trunk/Source/_javascript_Core/dfg/DFGMaximalFlushInsertionPhase.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/dfg/DFGMaximalFlushInsertionPhase.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/dfg/DFGMaximalFlushInsertionPhase.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -108,8 +108,7 @@
{
Operands<VariableAccessData*> initialAccessData(block->variablesAtTail.numberOfArguments(), block->variablesAtTail.numberOfLocals(), nullptr);
Operands<Node*> initialAccessNodes(block->variablesAtTail.numberOfArguments(), block->variablesAtTail.numberOfLocals(), nullptr);
- for (unsigned i = 0; i < block->size(); i++) {
- Node* node = block->at(i);
+ for (auto* node : *block) {
if (!node->accessesStack(m_graph))
continue;
Modified: trunk/Source/_javascript_Core/dfg/DFGPutStackSinkingPhase.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/dfg/DFGPutStackSinkingPhase.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/dfg/DFGPutStackSinkingPhase.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -560,9 +560,7 @@
// Finally eliminate the sunken PutStacks by turning them into Checks. This keeps whatever
// type check they were doing.
for (BasicBlock* block : m_graph.blocksInNaturalOrder()) {
- for (unsigned nodeIndex = 0; nodeIndex < block->size(); ++nodeIndex) {
- Node* node = block->at(nodeIndex);
-
+ for (auto* node : *block) {
if (!putStacksToSink.contains(node))
continue;
Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -1767,10 +1767,8 @@
// Perform the most basic verification that children have been used correctly.
if (!ASSERT_DISABLED) {
- for (unsigned index = 0; index < m_generationInfo.size(); ++index) {
- GenerationInfo& info = m_generationInfo[index];
+ for (auto& info : m_generationInfo)
RELEASE_ASSERT(!info.alive());
- }
}
}
@@ -8892,10 +8890,8 @@
void SpeculativeJIT::linkBranches()
{
- for (size_t i = 0; i < m_branches.size(); ++i) {
- BranchRecord& branch = m_branches[i];
+ for (auto& branch : m_branches)
branch.jump.linkTo(m_jit.blockHeads()[branch.destination->index], &m_jit);
- }
}
void SpeculativeJIT::compileStoreBarrier(Node* node)
Modified: trunk/Source/_javascript_Core/dfg/DFGStructureRegistrationPhase.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/dfg/DFGStructureRegistrationPhase.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/dfg/DFGStructureRegistrationPhase.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -71,9 +71,7 @@
if (!block)
continue;
- for (unsigned nodeIndex = 0; nodeIndex < block->size(); ++nodeIndex) {
- Node* node = block->at(nodeIndex);
-
+ for (auto* node : *block) {
switch (node->op()) {
case CheckStructure:
assertAreRegistered(node->structureSet());
Modified: trunk/Source/_javascript_Core/dfg/DFGTypeCheckHoistingPhase.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/dfg/DFGTypeCheckHoistingPhase.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/dfg/DFGTypeCheckHoistingPhase.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -272,8 +272,7 @@
if (!shouldConsiderForHoisting<StructureTypeCheck>(variable))
break;
Node* source = node->child1().node();
- for (unsigned subIndexInBlock = 0; subIndexInBlock < block->size(); ++subIndexInBlock) {
- Node* subNode = block->at(subIndexInBlock);
+ for (auto* subNode : *block) {
switch (subNode->op()) {
case CheckStructure: {
if (subNode->child1() != source)
@@ -305,8 +304,7 @@
BasicBlock* block = m_graph.block(blockIndex);
if (!block)
continue;
- for (unsigned indexInBlock = 0; indexInBlock < block->size(); ++indexInBlock) {
- Node* node = block->at(indexInBlock);
+ for (auto* node : *block) {
switch (node->op()) {
case CheckArray: {
Node* child = node->child1().node();
@@ -364,8 +362,7 @@
if (!shouldConsiderForHoisting<ArrayTypeCheck>(variable))
break;
Node* source = node->child1().node();
- for (unsigned subIndexInBlock = 0; subIndexInBlock < block->size(); ++subIndexInBlock) {
- Node* subNode = block->at(subIndexInBlock);
+ for (auto subNode : *block) {
switch (subNode->op()) {
case CheckStructure: {
if (subNode->child1() != source)
Modified: trunk/Source/_javascript_Core/dfg/DFGValidate.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/dfg/DFGValidate.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/dfg/DFGValidate.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -638,8 +638,7 @@
bool didSeeExitOK = false;
- for (unsigned nodeIndex = 0; nodeIndex < block->size(); ++nodeIndex) {
- Node* node = block->at(nodeIndex);
+ for (auto* node : *block) {
didSeeExitOK |= node->origin.exitOK;
switch (node->op()) {
case Phi:
Modified: trunk/Source/_javascript_Core/dfg/DFGVirtualRegisterAllocationPhase.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/dfg/DFGVirtualRegisterAllocationPhase.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/dfg/DFGVirtualRegisterAllocationPhase.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -59,9 +59,7 @@
// Force usage of highest-numbered virtual registers.
scoreBoard.sortFree();
}
- for (size_t indexInBlock = 0; indexInBlock < block->size(); ++indexInBlock) {
- Node* node = block->at(indexInBlock);
-
+ for (auto* node : *block) {
if (!node->shouldGenerate())
continue;
Modified: trunk/Source/_javascript_Core/heap/HeapVerifier.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/heap/HeapVerifier.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/heap/HeapVerifier.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -127,8 +127,7 @@
return;
size_t liveObjectsFound = 0;
- for (size_t i = 0; i < list.liveObjects.size(); i++) {
- LiveObjectData& objData = list.liveObjects[i];
+ for (auto& objData : list.liveObjects) {
if (objData.isConfirmedDead)
continue; // Don't "resurrect" known dead objects.
if (!knownLiveSet.contains(objData.obj)) {
@@ -145,10 +144,8 @@
HashSet<JSObject*> knownLiveSet;
LiveObjectList& after = currentCycle().after;
- for (size_t i = 0; i < after.liveObjects.size(); i++) {
- LiveObjectData& objData = after.liveObjects[i];
+ for (auto& objData : after.liveObjects)
knownLiveSet.add(objData.obj);
- }
trimDeadObjectsFromList(knownLiveSet, currentCycle().before);
Modified: trunk/Source/_javascript_Core/heap/LiveObjectList.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/heap/LiveObjectList.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/heap/LiveObjectList.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -30,8 +30,7 @@
LiveObjectData* LiveObjectList::findObject(JSObject* obj)
{
- for (size_t i = 0; i < liveObjects.size(); i++) {
- LiveObjectData& data = ""
+ for (auto& data : liveObjects) {
if (obj == data.obj)
return &data;
}
Modified: trunk/Source/_javascript_Core/heap/MarkedAllocator.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/heap/MarkedAllocator.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/heap/MarkedAllocator.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -51,8 +51,7 @@
bool MarkedAllocator::isPagedOut(double deadline)
{
unsigned itersSinceLastTimeCheck = 0;
- for (size_t index = 0; index < m_blocks.size(); ++index) {
- MarkedBlock::Handle* block = m_blocks[index];
+ for (auto* block : m_blocks) {
if (block)
block->block().updateNeedsDestruction();
++itersSinceLastTimeCheck;
Modified: trunk/Source/_javascript_Core/inspector/ScriptCallStack.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/inspector/ScriptCallStack.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/inspector/ScriptCallStack.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -75,8 +75,7 @@
if (!m_frames.size())
return nullptr;
- for (size_t i = 0; i < m_frames.size(); ++i) {
- const ScriptCallFrame& frame = m_frames[i];
+ for (const auto& frame : m_frames) {
if (!frame.isNative())
return &frame;
}
Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/jit/JIT.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -693,8 +693,7 @@
return CompilationFailed;
// Translate vPC offsets into addresses in JIT generated code, for switch tables.
- for (unsigned i = 0; i < m_switches.size(); ++i) {
- SwitchRecord record = m_switches[i];
+ for (auto& record : m_switches) {
unsigned bytecodeOffset = record.bytecodeOffset;
if (record.type != SwitchRecord::String) {
@@ -712,10 +711,9 @@
record.jumpTable.stringJumpTable->ctiDefault = patchBuffer.locationOf(m_labels[bytecodeOffset + record.defaultOffset]);
- StringJumpTable::StringOffsetTable::iterator end = record.jumpTable.stringJumpTable->offsetTable.end();
- for (StringJumpTable::StringOffsetTable::iterator it = record.jumpTable.stringJumpTable->offsetTable.begin(); it != end; ++it) {
- unsigned offset = it->value.branchOffset;
- it->value.ctiOffset = offset ? patchBuffer.locationOf(m_labels[bytecodeOffset + offset]) : record.jumpTable.stringJumpTable->ctiDefault;
+ for (auto& location : record.jumpTable.stringJumpTable->offsetTable.values()) {
+ unsigned offset = location.branchOffset;
+ location.ctiOffset = offset ? patchBuffer.locationOf(m_labels[bytecodeOffset + offset]) : record.jumpTable.stringJumpTable->ctiDefault;
}
}
}
@@ -725,9 +723,9 @@
handler.nativeCode = patchBuffer.locationOf(m_labels[handler.target]);
}
- for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) {
- if (iter->to)
- patchBuffer.link(iter->from, FunctionPtr(iter->to));
+ for (auto& record : m_calls) {
+ if (record.to)
+ patchBuffer.link(record.from, FunctionPtr(record.to));
}
for (unsigned i = m_getByIds.size(); i--;)
@@ -762,8 +760,7 @@
}
}
- for (unsigned i = 0; i < m_callCompilationInfo.size(); ++i) {
- CallCompilationInfo& compilationInfo = m_callCompilationInfo[i];
+ for (auto& compilationInfo : m_callCompilationInfo) {
CallLinkInfo& info = *compilationInfo.callLinkInfo;
info.setCallLocations(
CodeLocationLabel(patchBuffer.locationOfNearCall(compilationInfo.callReturnLocation)),
Modified: trunk/Source/_javascript_Core/parser/VariableEnvironment.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/parser/VariableEnvironment.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/parser/VariableEnvironment.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -50,8 +50,8 @@
m_isEverythingCaptured = true; // For fast queries.
// We must mark every entry as captured for when we iterate through m_map and entry.isCaptured() is called.
- for (auto iter = m_map.begin(), end = m_map.end(); iter != end; ++iter)
- iter->value.setIsCaptured();
+ for (auto& value : m_map.values())
+ value.setIsCaptured();
}
bool VariableEnvironment::hasCapturedVariables() const
@@ -58,8 +58,8 @@
{
if (m_isEverythingCaptured)
return size() > 0;
- for (auto entry : m_map) {
- if (entry.value.isCaptured())
+ for (auto& value : m_map.values()) {
+ if (value.isCaptured())
return true;
}
return false;
Modified: trunk/Source/_javascript_Core/runtime/FunctionHasExecutedCache.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/runtime/FunctionHasExecutedCache.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/runtime/FunctionHasExecutedCache.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -38,10 +38,10 @@
RangeMap& map = m_rangeMap.find(id)->second;
unsigned distance = UINT_MAX;
bool hasExecuted = false;
- for (auto iter = map.begin(), end = map.end(); iter != end; ++iter) {
- const FunctionRange& range = iter->first;
+ for (auto& pair : map) {
+ const FunctionRange& range = pair.first;
if (range.m_start <= offset && offset <= range.m_end && range.m_end - range.m_start < distance) {
- hasExecuted = iter->second;
+ hasExecuted = pair.second;
distance = range.m_end - range.m_start;
}
}
@@ -88,9 +88,9 @@
return ranges;
RangeMap& map = m_rangeMap.find(id)->second;
- for (auto iter = map.begin(), end = map.end(); iter != end; ++iter) {
- const FunctionRange& range = iter->first;
- bool hasExecuted = iter->second;
+ for (auto& pair : map) {
+ const FunctionRange& range = pair.first;
+ bool hasExecuted = pair.second;
ranges.append(std::tuple<bool, unsigned, unsigned>(hasExecuted, range.m_start, range.m_end));
}
Modified: trunk/Source/_javascript_Core/runtime/JSPropertyNameEnumerator.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/runtime/JSPropertyNameEnumerator.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/runtime/JSPropertyNameEnumerator.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -91,8 +91,8 @@
Base::visitChildren(cell, visitor);
JSPropertyNameEnumerator* thisObject = jsCast<JSPropertyNameEnumerator*>(cell);
auto locker = holdLock(*thisObject);
- for (unsigned i = 0; i < thisObject->m_propertyNames.size(); ++i)
- visitor.append(thisObject->m_propertyNames[i]);
+ for (auto& propertyName : thisObject->m_propertyNames)
+ visitor.append(propertyName);
visitor.append(thisObject->m_prototypeChain);
}
Modified: trunk/Source/_javascript_Core/runtime/TypeProfiler.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/runtime/TypeProfiler.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/runtime/TypeProfiler.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -122,8 +122,7 @@
Vector<TypeLocation*>& bucket = m_bucketMap.find(sourceID)->value;
TypeLocation* bestMatch = nullptr;
unsigned distance = UINT_MAX; // Because assignments may be nested, make sure we find the closest enclosing assignment to this character offset.
- for (size_t i = 0, size = bucket.size(); i < size; i++) {
- TypeLocation* location = bucket.at(i);
+ for (auto* location : bucket) {
// We found the type location that correlates to the convergence of all return statements in a function.
// This text offset is the offset of the opening brace in a function declaration.
if (descriptor == TypeProfilerSearchDescriptorFunctionReturn && location->m_globalVariableID == TypeProfilerReturnStatement && location->m_divotForFunctionOffsetIfReturnStatement == divot)
Modified: trunk/Source/_javascript_Core/runtime/TypeSet.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/runtime/TypeSet.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/runtime/TypeSet.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -58,8 +58,7 @@
// prototype chain, they will be merged into one shape.
bool found = false;
String hash = newShape->propertyHash();
- for (size_t i = 0; i < m_structureHistory.size(); i++) {
- RefPtr<StructureShape>& seenShape = m_structureHistory.at(i);
+ for (auto& seenShape : m_structureHistory) {
if (seenShape->propertyHash() == hash) {
found = true;
break;
@@ -114,8 +113,7 @@
if (m_seenTypes & TypeSymbol)
seen.appendLiteral("Symbol ");
- for (size_t i = 0; i < m_structureHistory.size(); i++) {
- RefPtr<StructureShape> shape = m_structureHistory.at(i);
+ for (const auto& shape : m_structureHistory) {
seen.append(shape->m_constructorName);
seen.append(' ');
}
@@ -122,8 +120,8 @@
if (m_structureHistory.size())
seen.appendLiteral("\nStructures:[ ");
- for (size_t i = 0; i < m_structureHistory.size(); i++) {
- seen.append(m_structureHistory.at(i)->stringRepresentation());
+ for (const auto& shape : m_structureHistory) {
+ seen.append(shape->stringRepresentation());
seen.append(' ');
}
if (m_structureHistory.size())
Modified: trunk/Source/_javascript_Core/runtime/VM.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/runtime/VM.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/runtime/VM.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -699,8 +699,7 @@
#if ENABLE(DFG_JIT)
void VM::gatherConservativeRoots(ConservativeRoots& conservativeRoots)
{
- for (size_t i = 0; i < scratchBuffers.size(); i++) {
- ScratchBuffer* scratchBuffer = scratchBuffers[i];
+ for (auto* scratchBuffer : scratchBuffers) {
if (scratchBuffer->activeLength()) {
void* bufferStart = scratchBuffer->dataBuffer();
conservativeRoots.add(bufferStart, static_cast<void*>(static_cast<char*>(bufferStart) + scratchBuffer->activeLength()));
Modified: trunk/Source/_javascript_Core/runtime/WeakMapData.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/runtime/WeakMapData.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/runtime/WeakMapData.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -108,11 +108,11 @@
void WeakMapData::DeadKeyCleaner::visitWeakReferences(SlotVisitor& visitor)
{
m_liveKeyCount = 0;
- for (auto it = m_target->m_map.begin(), end = m_target->m_map.end(); it != end; ++it) {
- if (!Heap::isMarked(it->key))
+ for (auto& pair : m_target->m_map) {
+ if (!Heap::isMarked(pair.key))
continue;
m_liveKeyCount++;
- visitor.append(it->value);
+ visitor.append(pair.value);
}
RELEASE_ASSERT(m_liveKeyCount <= m_target->m_map.size());
}
@@ -126,19 +126,19 @@
return;
Vector<JSObject*> deadEntries;
deadEntries.reserveCapacity(deadCount);
- for (auto it = m_target->m_map.begin(), end = m_target->m_map.end(); it != end; ++it) {
- if (Heap::isMarked(it->key))
+ for (auto& pair : m_target->m_map) {
+ if (Heap::isMarked(pair.key))
continue;
- deadEntries.uncheckedAppend(it->key);
+ deadEntries.uncheckedAppend(pair.key);
}
- for (size_t i = 0; i < deadEntries.size(); i++)
- m_target->m_map.remove(deadEntries[i]);
+ for (auto& deadEntry : deadEntries)
+ m_target->m_map.remove(deadEntry);
} else {
MapType newMap;
- for (auto it = m_target->m_map.begin(), end = m_target->m_map.end(); it != end; ++it) {
- if (!Heap::isMarked(it->key))
+ for (auto& pair : m_target->m_map) {
+ if (!Heap::isMarked(pair.key))
continue;
- newMap.add(it->key, it->value);
+ newMap.add(pair.key, pair.value);
}
m_target->m_map.swap(newMap);
}
Modified: trunk/Source/_javascript_Core/tools/ProfileTreeNode.h (210022 => 210023)
--- trunk/Source/_javascript_Core/tools/ProfileTreeNode.h 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/tools/ProfileTreeNode.h 2016-12-20 18:26:10 UTC (rev 210023)
@@ -88,9 +88,7 @@
qsort(entries.begin(), entries.size(), sizeof(MapEntry*), compareEntries);
// Iterate over the children in sample-frequency order.
- for (size_t e = 0; e < entries.size(); ++e) {
- MapEntry* entry = entries[e];
-
+ for (auto* entry : entries) {
// Print the number of samples, the name of this node, and the number of samples that are stack-top
// in this node (samples directly within this node, excluding samples in children.
for (unsigned i = 0; i < indent; ++i)
Modified: trunk/Source/_javascript_Core/yarr/YarrInterpreter.cpp (210022 => 210023)
--- trunk/Source/_javascript_Core/yarr/YarrInterpreter.cpp 2016-12-20 17:25:26 UTC (rev 210022)
+++ trunk/Source/_javascript_Core/yarr/YarrInterpreter.cpp 2016-12-20 18:26:10 UTC (rev 210023)
@@ -1943,9 +1943,7 @@
currentCountAlreadyChecked += countToCheck;
}
- for (unsigned i = 0; i < alternative->m_terms.size(); ++i) {
- PatternTerm& term = alternative->m_terms[i];
-
+ for (auto& term : alternative->m_terms) {
switch (term.type) {
case PatternTerm::TypeAssertionBOL:
assertionBOL(currentCountAlreadyChecked - term.inputPosition);