⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 276664 in webkit


Ignore:
Timestamp:
Apr 27, 2021, 2:07:17 PM (5 years ago)
Author:
Alan Coon
Message:

Cherry-pick r276609. rdar://problem/77211512

numCalleeLocals, numParameters, and numVars should be unsigned
​https://bugs.webkit.org/show_bug.cgi?id=224995

Reviewed by Mark Lam.

All of the various CodeBlock classes currently have the
numCalleeLocals and numVars marked as ints. I believe this is just
a historical artifact or because VirtualRegister's offset is an
int to make handling constants easier. Regardless, it's a bit
strange to not handle the sign conversion at the point of
comparison between a VirtualRegister offset and the local/var
count. This doesn't completely fix every place we use ints for
these values but starts on the right track. Lastly, I also added
some Check<unsigned>s to the wasm parser for sanity checking.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::setNumParameters): (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeIndexSlow):
  • bytecode/CodeBlock.h: (JSC::CodeBlock::numParameters const): (JSC::CodeBlock::numberOfArgumentsToSkip const): (JSC::CodeBlock::numCalleeLocals const): (JSC::CodeBlock::numVars const): (JSC::CodeBlock::numTmps const): (JSC::CodeBlock::addressOfNumParameters): (JSC::CodeBlock::isTemporaryRegister):
  • bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::numCalleeLocals const): (JSC::UnlinkedCodeBlock::numVars const):
  • bytecode/UnlinkedCodeBlockGenerator.h: (JSC::UnlinkedCodeBlockGenerator::numCalleeLocals const): (JSC::UnlinkedCodeBlockGenerator::numVars const): (JSC::UnlinkedCodeBlockGenerator::setNumCalleeLocals): (JSC::UnlinkedCodeBlockGenerator::setNumVars): (JSC::UnlinkedCodeBlockGenerator::setNumParameters):
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::generate): (JSC::BytecodeGenerator::emitPushFunctionNameScope):
  • bytecompiler/BytecodeGeneratorBaseInlines.h: (JSC::BytecodeGeneratorBase<Traits>::newRegister):
  • dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleRecursiveTailCall): (JSC::DFG::ByteCodeParser::inliningCost): (JSC::DFG::ByteCodeParser::parseBlock):
  • dfg/DFGOSREntrypointCreationPhase.cpp: (JSC::DFG::OSREntrypointCreationPhase::run):
  • dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
  • ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::lower):
  • ftl/FTLOSREntry.cpp: (JSC::FTL::prepareOSREntry):
  • interpreter/CallFrameClosure.h:
  • interpreter/ProtoCallFrameInlines.h: (JSC::ProtoCallFrame::init):
  • jit/JIT.cpp: (JSC::JIT::compileWithoutLinking):
  • runtime/CommonSlowPaths.h: (JSC::CommonSlowPaths::numberOfStackPaddingSlots): (JSC::CommonSlowPaths::numberOfStackPaddingSlotsWithExtraSlots):
  • wasm/WasmFunctionCodeBlock.h: (JSC::Wasm::FunctionCodeBlock::numVars const): (JSC::Wasm::FunctionCodeBlock::numCalleeLocals const): (JSC::Wasm::FunctionCodeBlock::setNumVars): (JSC::Wasm::FunctionCodeBlock::setNumCalleeLocals):
  • wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::push): (JSC::Wasm::LLIntGenerator::getDropKeepCount): (JSC::Wasm::LLIntGenerator::walkExpressionStack): (JSC::Wasm::LLIntGenerator::checkConsistency): (JSC::Wasm::LLIntGenerator::materializeConstantsAndLocals): (JSC::Wasm::LLIntGenerator::splitStack): (JSC::Wasm::LLIntGenerator::finalize): (JSC::Wasm::LLIntGenerator::callInformationForCaller): (JSC::Wasm::LLIntGenerator::addLoop): (JSC::Wasm::LLIntGenerator::addTopLevel): (JSC::Wasm::LLIntGenerator::addBlock): (JSC::Wasm::LLIntGenerator::addIf): (JSC::Wasm::LLIntGenerator::addElseToUnreachable):

git-svn-id: ​https://svn.webkit.org/repository/webkit/trunk@276609 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-611-branch/Source/JavaScriptCore
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-611-branch/Source/JavaScriptCore/ChangeLog

    r276529 r276664  
     12021-04-27  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r276609. rdar://problem/77211512
     4
     5    numCalleeLocals, numParameters, and numVars should be unsigned
     6    https://bugs.webkit.org/show_bug.cgi?id=224995
     7   
     8    Reviewed by Mark Lam.
     9   
     10    All of the various CodeBlock classes currently have the
     11    numCalleeLocals and numVars marked as ints. I believe this is just
     12    a historical artifact or because VirtualRegister's offset is an
     13    int to make handling constants easier. Regardless, it's a bit
     14    strange to not handle the sign conversion at the point of
     15    comparison between a VirtualRegister offset and the local/var
     16    count. This doesn't completely fix every place we use ints for
     17    these values but starts on the right track. Lastly, I also added
     18    some Check<unsigned>s to the wasm parser for sanity checking.
     19   
     20    * bytecode/CodeBlock.cpp:
     21    (JSC::CodeBlock::setNumParameters):
     22    (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeIndexSlow):
     23    * bytecode/CodeBlock.h:
     24    (JSC::CodeBlock::numParameters const):
     25    (JSC::CodeBlock::numberOfArgumentsToSkip const):
     26    (JSC::CodeBlock::numCalleeLocals const):
     27    (JSC::CodeBlock::numVars const):
     28    (JSC::CodeBlock::numTmps const):
     29    (JSC::CodeBlock::addressOfNumParameters):
     30    (JSC::CodeBlock::isTemporaryRegister):
     31    * bytecode/UnlinkedCodeBlock.h:
     32    (JSC::UnlinkedCodeBlock::numCalleeLocals const):
     33    (JSC::UnlinkedCodeBlock::numVars const):
     34    * bytecode/UnlinkedCodeBlockGenerator.h:
     35    (JSC::UnlinkedCodeBlockGenerator::numCalleeLocals const):
     36    (JSC::UnlinkedCodeBlockGenerator::numVars const):
     37    (JSC::UnlinkedCodeBlockGenerator::setNumCalleeLocals):
     38    (JSC::UnlinkedCodeBlockGenerator::setNumVars):
     39    (JSC::UnlinkedCodeBlockGenerator::setNumParameters):
     40    * bytecompiler/BytecodeGenerator.cpp:
     41    (JSC::BytecodeGenerator::generate):
     42    (JSC::BytecodeGenerator::emitPushFunctionNameScope):
     43    * bytecompiler/BytecodeGeneratorBaseInlines.h:
     44    (JSC::BytecodeGeneratorBase<Traits>::newRegister):
     45    * dfg/DFGByteCodeParser.cpp:
     46    (JSC::DFG::ByteCodeParser::handleRecursiveTailCall):
     47    (JSC::DFG::ByteCodeParser::inliningCost):
     48    (JSC::DFG::ByteCodeParser::parseBlock):
     49    * dfg/DFGOSREntrypointCreationPhase.cpp:
     50    (JSC::DFG::OSREntrypointCreationPhase::run):
     51    * dfg/DFGSpeculativeJIT.cpp:
     52    (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
     53    * ftl/FTLLowerDFGToB3.cpp:
     54    (JSC::FTL::DFG::LowerDFGToB3::lower):
     55    * ftl/FTLOSREntry.cpp:
     56    (JSC::FTL::prepareOSREntry):
     57    * interpreter/CallFrameClosure.h:
     58    * interpreter/ProtoCallFrameInlines.h:
     59    (JSC::ProtoCallFrame::init):
     60    * jit/JIT.cpp:
     61    (JSC::JIT::compileWithoutLinking):
     62    * runtime/CommonSlowPaths.h:
     63    (JSC::CommonSlowPaths::numberOfStackPaddingSlots):
     64    (JSC::CommonSlowPaths::numberOfStackPaddingSlotsWithExtraSlots):
     65    * wasm/WasmFunctionCodeBlock.h:
     66    (JSC::Wasm::FunctionCodeBlock::numVars const):
     67    (JSC::Wasm::FunctionCodeBlock::numCalleeLocals const):
     68    (JSC::Wasm::FunctionCodeBlock::setNumVars):
     69    (JSC::Wasm::FunctionCodeBlock::setNumCalleeLocals):
     70    * wasm/WasmLLIntGenerator.cpp:
     71    (JSC::Wasm::LLIntGenerator::push):
     72    (JSC::Wasm::LLIntGenerator::getDropKeepCount):
     73    (JSC::Wasm::LLIntGenerator::walkExpressionStack):
     74    (JSC::Wasm::LLIntGenerator::checkConsistency):
     75    (JSC::Wasm::LLIntGenerator::materializeConstantsAndLocals):
     76    (JSC::Wasm::LLIntGenerator::splitStack):
     77    (JSC::Wasm::LLIntGenerator::finalize):
     78    (JSC::Wasm::LLIntGenerator::callInformationForCaller):
     79    (JSC::Wasm::LLIntGenerator::addLoop):
     80    (JSC::Wasm::LLIntGenerator::addTopLevel):
     81    (JSC::Wasm::LLIntGenerator::addBlock):
     82    (JSC::Wasm::LLIntGenerator::addIf):
     83    (JSC::Wasm::LLIntGenerator::addElseToUnreachable):
     84   
     85    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276609 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     86
     87    2021-04-26  Keith Miller  <keith_miller@apple.com>
     88
     89            numCalleeLocals, numParameters, and numVars should be unsigned
     90            https://bugs.webkit.org/show_bug.cgi?id=224995
     91
     92            Reviewed by Mark Lam.
     93
     94            All of the various CodeBlock classes currently have the
     95            numCalleeLocals and numVars marked as ints. I believe this is just
     96            a historical artifact or because VirtualRegister's offset is an
     97            int to make handling constants easier. Regardless, it's a bit
     98            strange to not handle the sign conversion at the point of
     99            comparison between a VirtualRegister offset and the local/var
     100            count. This doesn't completely fix every place we use ints for
     101            these values but starts on the right track. Lastly, I also added
     102            some Check<unsigned>s to the wasm parser for sanity checking.
     103
     104            * bytecode/CodeBlock.cpp:
     105            (JSC::CodeBlock::setNumParameters):
     106            (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeIndexSlow):
     107            * bytecode/CodeBlock.h:
     108            (JSC::CodeBlock::numParameters const):
     109            (JSC::CodeBlock::numberOfArgumentsToSkip const):
     110            (JSC::CodeBlock::numCalleeLocals const):
     111            (JSC::CodeBlock::numVars const):
     112            (JSC::CodeBlock::numTmps const):
     113            (JSC::CodeBlock::addressOfNumParameters):
     114            (JSC::CodeBlock::isTemporaryRegister):
     115            * bytecode/UnlinkedCodeBlock.h:
     116            (JSC::UnlinkedCodeBlock::numCalleeLocals const):
     117            (JSC::UnlinkedCodeBlock::numVars const):
     118            * bytecode/UnlinkedCodeBlockGenerator.h:
     119            (JSC::UnlinkedCodeBlockGenerator::numCalleeLocals const):
     120            (JSC::UnlinkedCodeBlockGenerator::numVars const):
     121            (JSC::UnlinkedCodeBlockGenerator::setNumCalleeLocals):
     122            (JSC::UnlinkedCodeBlockGenerator::setNumVars):
     123            (JSC::UnlinkedCodeBlockGenerator::setNumParameters):
     124            * bytecompiler/BytecodeGenerator.cpp:
     125            (JSC::BytecodeGenerator::generate):
     126            (JSC::BytecodeGenerator::emitPushFunctionNameScope):
     127            * bytecompiler/BytecodeGeneratorBaseInlines.h:
     128            (JSC::BytecodeGeneratorBase<Traits>::newRegister):
     129            * dfg/DFGByteCodeParser.cpp:
     130            (JSC::DFG::ByteCodeParser::handleRecursiveTailCall):
     131            (JSC::DFG::ByteCodeParser::inliningCost):
     132            (JSC::DFG::ByteCodeParser::parseBlock):
     133            * dfg/DFGOSREntrypointCreationPhase.cpp:
     134            (JSC::DFG::OSREntrypointCreationPhase::run):
     135            * dfg/DFGSpeculativeJIT.cpp:
     136            (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
     137            * ftl/FTLLowerDFGToB3.cpp:
     138            (JSC::FTL::DFG::LowerDFGToB3::lower):
     139            * ftl/FTLOSREntry.cpp:
     140            (JSC::FTL::prepareOSREntry):
     141            * interpreter/CallFrameClosure.h:
     142            * interpreter/ProtoCallFrameInlines.h:
     143            (JSC::ProtoCallFrame::init):
     144            * jit/JIT.cpp:
     145            (JSC::JIT::compileWithoutLinking):
     146            * runtime/CommonSlowPaths.h:
     147            (JSC::CommonSlowPaths::numberOfStackPaddingSlots):
     148            (JSC::CommonSlowPaths::numberOfStackPaddingSlotsWithExtraSlots):
     149            * wasm/WasmFunctionCodeBlock.h:
     150            (JSC::Wasm::FunctionCodeBlock::numVars const):
     151            (JSC::Wasm::FunctionCodeBlock::numCalleeLocals const):
     152            (JSC::Wasm::FunctionCodeBlock::setNumVars):
     153            (JSC::Wasm::FunctionCodeBlock::setNumCalleeLocals):
     154            * wasm/WasmLLIntGenerator.cpp:
     155            (JSC::Wasm::LLIntGenerator::push):
     156            (JSC::Wasm::LLIntGenerator::getDropKeepCount):
     157            (JSC::Wasm::LLIntGenerator::walkExpressionStack):
     158            (JSC::Wasm::LLIntGenerator::checkConsistency):
     159            (JSC::Wasm::LLIntGenerator::materializeConstantsAndLocals):
     160            (JSC::Wasm::LLIntGenerator::splitStack):
     161            (JSC::Wasm::LLIntGenerator::finalize):
     162            (JSC::Wasm::LLIntGenerator::callInformationForCaller):
     163            (JSC::Wasm::LLIntGenerator::addLoop):
     164            (JSC::Wasm::LLIntGenerator::addTopLevel):
     165            (JSC::Wasm::LLIntGenerator::addBlock):
     166            (JSC::Wasm::LLIntGenerator::addIf):
     167            (JSC::Wasm::LLIntGenerator::addElseToUnreachable):
     168
    11692021-04-23  Ruben Turcios  <rubent_22@apple.com>
    2170
  • branches/safari-611-branch/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r275706 r276664  
    968968}
    969969
    970 void CodeBlock::setNumParameters(int newValue)
     970void CodeBlock::setNumParameters(unsigned newValue)
    971971{
    972972    m_numParameters = newValue;
    … …  
    19901990    });
    19911991
    1992     for (int i = 0; i < numParameters(); ++i)
     1992    for (unsigned i = 0; i < numParameters(); ++i)
    19931993        liveOperands.append(virtualRegisterForArgumentIncludingThis(i));
    19941994
  • branches/safari-611-branch/Source/JavaScriptCore/bytecode/CodeBlock.h

    r266359 r276664  
    157157    MetadataTable* metadataTable() const { return m_metadata.get(); }
    158158
    159     int numParameters() const { return m_numParameters; }
    160     void setNumParameters(int newValue);
    161 
    162     int numberOfArgumentsToSkip() const { return m_numberOfArgumentsToSkip; }
    163 
    164     int numCalleeLocals() const { return m_numCalleeLocals; }
    165 
    166     int numVars() const { return m_numVars; }
    167     int numTmps() const { return m_unlinkedCode->hasCheckpoints() * maxNumCheckpointTmps; }
    168 
    169     int* addressOfNumParameters() { return &m_numParameters; }
     159    unsigned numParameters() const { return m_numParameters; }
     160    void setNumParameters(unsigned newValue);
     161
     162    unsigned numberOfArgumentsToSkip() const { return m_numberOfArgumentsToSkip; }
     163
     164    unsigned numCalleeLocals() const { return m_numCalleeLocals; }
     165
     166    unsigned numVars() const { return m_numVars; }
     167    unsigned numTmps() const { return m_unlinkedCode->hasCheckpoints() * maxNumCheckpointTmps; }
     168
     169    unsigned* addressOfNumParameters() { return &m_numParameters; }
    170170    static ptrdiff_t offsetOfNumParameters() { return OBJECT_OFFSETOF(CodeBlock, m_numParameters); }
    171171
    … …  
    244244    ALWAYS_INLINE bool isTemporaryRegister(VirtualRegister reg)
    245245    {
    246         return reg.offset() >= m_numVars;
     246        return reg.offset() >= static_cast<int>(m_numVars);
    247247    }
    248248
    … …  
    996996    void ensureCatchLivenessIsComputedForBytecodeIndexSlow(const OpCatch&, BytecodeIndex);
    997997
    998     int m_numCalleeLocals;
    999     int m_numVars;
    1000     int m_numParameters;
    1001     int m_numberOfArgumentsToSkip { 0 };
     998    unsigned m_numCalleeLocals;
     999    unsigned m_numVars;
     1000    unsigned m_numParameters;
     1001    unsigned m_numberOfArgumentsToSkip { 0 };
    10021002    unsigned m_numberOfNonArgumentValueProfiles { 0 };
    10031003    union {
  • branches/safari-611-branch/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h

    r259676 r276664  
    181181    const InstructionStream& instructions() const;
    182182
    183     int numCalleeLocals() const { return m_numCalleeLocals; }
    184     int numVars() const { return m_numVars; }
     183    unsigned numCalleeLocals() const { return m_numCalleeLocals; }
     184    unsigned numVars() const { return m_numVars; }
    185185
    186186    // Jump Tables
    … …  
    361361    unsigned m_endColumn { UINT_MAX };
    362362
    363     int m_numVars { 0 };
    364     int m_numCalleeLocals { 0 };
    365     int m_numParameters { 0 };
     363    unsigned m_numVars { 0 };
     364    unsigned m_numCalleeLocals { 0 };
     365    unsigned m_numParameters { 0 };
    366366
    367367    PackedRefPtr<StringImpl> m_sourceURLDirective;
  • branches/safari-611-branch/Source/JavaScriptCore/bytecode/UnlinkedCodeBlockGenerator.h

    r259676 r276664  
    5858    bool isArrowFunctionContext() const { return m_codeBlock->isArrowFunctionContext(); }
    5959    bool isClassContext() const { return m_codeBlock->isClassContext(); }
    60     int numCalleeLocals() const { return m_codeBlock->m_numCalleeLocals; }
    61     int numVars() const { return m_codeBlock->m_numVars; }
     60    unsigned numCalleeLocals() const { return m_codeBlock->m_numCalleeLocals; }
     61    unsigned numVars() const { return m_codeBlock->m_numVars; }
    6262    unsigned numParameters() const { return m_codeBlock->numParameters(); }
    6363    VirtualRegister thisRegister() const { return m_codeBlock->thisRegister(); }
    … …  
    7070    void setHasCheckpoints() { m_codeBlock->setHasCheckpoints(); }
    7171    void setHasTailCalls() { m_codeBlock->setHasTailCalls(); }
    72     void setNumCalleeLocals(int numCalleeLocals) { m_codeBlock->m_numCalleeLocals = numCalleeLocals; }
    73     void setNumVars(int numVars) { m_codeBlock->m_numVars = numVars; }
     72    void setNumCalleeLocals(unsigned numCalleeLocals) { m_codeBlock->m_numCalleeLocals = numCalleeLocals; }
     73    void setNumVars(unsigned numVars) { m_codeBlock->m_numVars = numVars; }
    7474    void setThisRegister(VirtualRegister thisRegister) { m_codeBlock->setThisRegister(thisRegister); }
    7575    void setScopeRegister(VirtualRegister thisRegister) { m_codeBlock->setScopeRegister(thisRegister); }
    76     void setNumParameters(int newValue) { m_codeBlock->setNumParameters(newValue); }
     76    void setNumParameters(unsigned newValue) { m_codeBlock->setNumParameters(newValue); }
    7777
    7878    UnlinkedMetadataTable& metadata() { return m_codeBlock->metadata(); }
  • branches/safari-611-branch/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r270874 r276664  
    283283        performGeneratorification(*this, m_codeBlock.get(), m_writer, m_generatorFrameSymbolTable.get(), m_generatorFrameSymbolTableIndex);
    284284
    285     RELEASE_ASSERT(static_cast<unsigned>(m_codeBlock->numCalleeLocals()) < static_cast<unsigned>(FirstConstantRegisterIndex));
     285    RELEASE_ASSERT(m_codeBlock->numCalleeLocals() < static_cast<unsigned>(FirstConstantRegisterIndex));
    286286    m_codeBlock->finalize(m_writer.finalize());
    287287    if (m_expressionTooDeep)
    … …  
    38893889    unsigned numVars = m_codeBlock->numVars();
    38903890    pushLexicalScopeInternal(nameScopeEnvironment, TDZCheckOptimization::Optimize, NestedScopeType::IsNotNested, nullptr, TDZRequirement::NotUnderTDZ, ScopeType::FunctionNameScope, ScopeRegisterType::Var);
    3891     ASSERT_UNUSED(numVars, m_codeBlock->numVars() == static_cast<int>(numVars + 1)); // Should have only created one new "var" for the function name scope.
     3891    ASSERT_UNUSED(numVars, m_codeBlock->numVars() == numVars + 1); // Should have only created one new "var" for the function name scope.
    38923892    bool shouldTreatAsLexicalVariable = ecmaMode().isStrict();
    38933893    Variable functionVar = variableForLocalEntry(property, m_lexicalScopeStack.last().m_symbolTable->get(NoLockingNecessary, property.impl()), m_lexicalScopeStack.last().m_symbolTableConstantIndex, shouldTreatAsLexicalVariable);
  • branches/safari-611-branch/Source/JavaScriptCore/bytecompiler/BytecodeGeneratorBaseInlines.h

    r255687 r276664  
    162162{
    163163    m_calleeLocals.append(virtualRegisterForLocal(m_calleeLocals.size()));
    164     int numCalleeLocals = std::max<int>(m_codeBlock->numCalleeLocals(), m_calleeLocals.size());
     164    size_t numCalleeLocals = std::max<size_t>(m_codeBlock->numCalleeLocals(), m_calleeLocals.size());
    165165    numCalleeLocals = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), numCalleeLocals);
    166     m_codeBlock->setNumCalleeLocals(numCalleeLocals);
     166    m_codeBlock->setNumCalleeLocals(static_cast<unsigned>(numCalleeLocals));
     167    RELEASE_ASSERT(numCalleeLocals == m_codeBlock->numCalleeLocals());
    167168    return &m_calleeLocals.last();
    168169}
  • branches/safari-611-branch/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r272533 r276664  
    14961496            // Some code may statically use the argument count from the InlineCallFrame, so it would be invalid to loop back if it does not match.
    14971497            // We "continue" instead of returning false in case another stack entry further on the stack has the right number of arguments.
    1498             if (argumentCountIncludingThis != static_cast<int>(callFrame->argumentCountIncludingThis))
     1498            if (argumentCountIncludingThis != callFrame->argumentCountIncludingThis)
    14991499                continue;
    15001500            // If the target InlineCallFrame is Varargs, we do not know how many arguments are actually filled by LoadVarargs. Varargs InlineCallFrame's
    … …  
    15061506            // We are in the machine code entry (i.e. the original caller).
    15071507            // If we have more arguments than the number of parameters to the function, it is not clear where we could put them on the stack.
    1508             if (argumentCountIncludingThis > m_codeBlock->numParameters())
     1508            if (static_cast<unsigned>(argumentCountIncludingThis) > m_codeBlock->numParameters())
    15091509                return false;
    15101510        }
    … …  
    15321532        if (!stackEntry->m_inlineCallFrame)
    15331533            addToGraph(SetArgumentCountIncludingThis, OpInfo(argumentCountIncludingThis));
    1534         int argIndex = 0;
    1535         for (; argIndex < argumentCountIncludingThis; ++argIndex) {
     1534        unsigned argIndex = 0;
     1535        for (; argIndex < static_cast<unsigned>(argumentCountIncludingThis); ++argIndex) {
    15361536            Node* value = get(virtualRegisterForArgumentIncludingThis(argIndex, registerOffset));
    15371537            setDirect(stackEntry->remapOperand(virtualRegisterForArgumentIncludingThis(argIndex)), value, NormalSet);
    … …  
    15431543        // We must repeat the work of op_enter here as we will jump right after it.
    15441544        // We jump right after it and not before it, because of some invariant saying that a CFG root cannot have predecessors in the IR.
    1545         for (int i = 0; i < stackEntry->m_codeBlock->numVars(); ++i)
     1545        for (unsigned i = 0; i < stackEntry->m_codeBlock->numVars(); ++i)
    15461546            setDirect(stackEntry->remapOperand(virtualRegisterForLocal(i)), undefined, NormalSet);
    15471547
    … …  
    15991599
    16001600    if (!Options::useArityFixupInlining()) {
    1601         if (codeBlock->numParameters() > argumentCountIncludingThis) {
     1601        if (codeBlock->numParameters() > static_cast<unsigned>(argumentCountIncludingThis)) {
    16021602            VERBOSE_LOG("    Failing because of arity mismatch.\n");
    16031603            return UINT_MAX;
    … …  
    53715371            Node* undefined = addToGraph(JSConstant, OpInfo(m_constantUndefined));
    53725372            // Initialize all locals to undefined.
    5373             for (int i = 0; i < m_inlineStackTop->m_codeBlock->numVars(); ++i)
     5373            for (unsigned i = 0; i < m_inlineStackTop->m_codeBlock->numVars(); ++i)
    53745374                set(virtualRegisterForLocal(i), undefined, ImmediateNakedSet);
    53755375
  • branches/safari-611-branch/Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp

    r261895 r276664  
    9595       
    9696        Vector<Node*> locals(baseline->numCalleeLocals());
    97         for (int local = 0; local < baseline->numCalleeLocals(); ++local) {
     97        for (unsigned local = 0; local < baseline->numCalleeLocals(); ++local) {
    9898            Node* previousHead = target->variablesAtHead.local(local);
    9999            if (!previousHead)
    … …  
    114114       
    115115        ArgumentsVector newArguments = m_graph.m_rootToArguments.find(m_graph.block(0))->value;
    116         for (int argument = 0; argument < baseline->numParameters(); ++argument) {
     116        for (unsigned argument = 0; argument < baseline->numParameters(); ++argument) {
    117117            Node* oldNode = target->variablesAtHead.argument(argument);
    118118            if (!oldNode) {
    … …  
    126126        }
    127127
    128         for (int local = 0; local < baseline->numCalleeLocals(); ++local) {
     128        for (unsigned local = 0; local < baseline->numCalleeLocals(); ++local) {
    129129            Node* previousHead = target->variablesAtHead.local(local);
    130130            if (!previousHead)
  • branches/safari-611-branch/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r271835 r276664  
    20802080
    20812081    auto& arguments = m_jit.graph().m_rootToArguments.find(m_jit.graph().block(0))->value;
    2082     for (int i = 0; i < m_jit.codeBlock()->numParameters(); ++i) {
     2082    for (unsigned i = 0; i < m_jit.codeBlock()->numParameters(); ++i) {
    20832083        Node* node = arguments[i];
    20842084        if (!node) {
  • branches/safari-611-branch/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r272508 r276664  
    363363                auto* jitCode = m_ftlState.jitCode->ftlForOSREntry();
    364364                jitCode->argumentFlushFormats().reserveInitialCapacity(codeBlock()->numParameters());
    365                 for (int i = 0; i < codeBlock()->numParameters(); ++i)
     365                for (unsigned i = 0; i < codeBlock()->numParameters(); ++i)
    366366                    jitCode->argumentFlushFormats().uncheckedAppend(m_graph.m_argumentFormats[0][i]);
    367367            } else {
  • branches/safari-611-branch/Source/JavaScriptCore/ftl/FTLOSREntry.cpp

    r268783 r276664  
    114114    }
    115115   
    116     RELEASE_ASSERT(
    117         static_cast<int>(values.numberOfLocals()) == baseline->numCalleeLocals());
     116    RELEASE_ASSERT(values.numberOfLocals() == baseline->numCalleeLocals());
    118117   
    119118    EncodedJSValue* scratch = static_cast<EncodedJSValue*>(
  • branches/safari-611-branch/Source/JavaScriptCore/interpreter/CallFrameClosure.h

    r206525 r276664  
    3737    VM* vm;
    3838    JSScope* scope;
    39     int parameterCountIncludingThis;
     39    unsigned parameterCountIncludingThis;
    4040    int argumentCountIncludingThis;
    4141   
  • branches/safari-611-branch/Source/JavaScriptCore/interpreter/ProtoCallFrameInlines.h

    r251584 r276664  
    3838    this->setGlobalObject(globalObject);
    3939    this->setArgumentCountIncludingThis(argCountIncludingThis);
    40     if (codeBlock && argCountIncludingThis < codeBlock->numParameters())
     40    if (codeBlock && static_cast<unsigned>(argCountIncludingThis) < codeBlock->numParameters())
    4141        this->hasArityMismatch = true;
    4242    else
  • branches/safari-611-branch/Source/JavaScriptCore/jit/JIT.cpp

    r271279 r276664  
    750750        ASSERT(!m_bytecodeIndex);
    751751        if (shouldEmitProfiling()) {
    752             for (int argument = 0; argument < m_codeBlock->numParameters(); ++argument) {
     752            for (unsigned argument = 0; argument < m_codeBlock->numParameters(); ++argument) {
    753753                // If this is a constructor, then we want to put in a dummy profiling site (to
    754754                // keep things consistent) but we don't actually want to record the dummy value.
  • branches/safari-611-branch/Source/JavaScriptCore/runtime/CommonSlowPaths.h

    r271120 r276664  
    5858ALWAYS_INLINE int numberOfStackPaddingSlots(CodeBlock* codeBlock, int argumentCountIncludingThis)
    5959{
    60     if (argumentCountIncludingThis >= codeBlock->numParameters())
     60    if (static_cast<unsigned>(argumentCountIncludingThis) >= codeBlock->numParameters())
    6161        return 0;
    6262    int alignedFrameSize = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), argumentCountIncludingThis + CallFrame::headerSizeInRegisters);
    … …  
    6767ALWAYS_INLINE int numberOfStackPaddingSlotsWithExtraSlots(CodeBlock* codeBlock, int argumentCountIncludingThis)
    6868{
    69     if (argumentCountIncludingThis >= codeBlock->numParameters())
     69    if (static_cast<unsigned>(argumentCountIncludingThis) >= codeBlock->numParameters())
    7070        return 0;
    7171    return numberOfStackPaddingSlots(codeBlock, argumentCountIncludingThis) + numberOfExtraSlots(argumentCountIncludingThis);
  • branches/safari-611-branch/Source/JavaScriptCore/tools/VMInspector.cpp

    r271082 r276664  
    468468    } else {
    469469        end = bitwise_cast<const Register*>(nextCallFrame);
    470         RELEASE_ASSERT(it - end < codeBlock->numCalleeLocals() - codeBlock->numVars());
     470        RELEASE_ASSERT(static_cast<unsigned>(it - end) < codeBlock->numCalleeLocals() - codeBlock->numVars());
    471471    }
    472472
  • branches/safari-611-branch/Source/JavaScriptCore/wasm/WasmFunctionCodeBlock.h

    r255687 r276664  
    6666
    6767    uint32_t functionIndex() const { return m_functionIndex; }
    68     int numVars() const { return m_numVars; }
    69     int numCalleeLocals() const { return m_numCalleeLocals; }
     68    unsigned numVars() const { return m_numVars; }
     69    unsigned numCalleeLocals() const { return m_numCalleeLocals; }
    7070    uint32_t numArguments() const { return m_numArguments; }
    7171    const Vector<Type>& constantTypes() const { return m_constantTypes; }
    … …  
    7373    const InstructionStream& instructions() const { return *m_instructions; }
    7474
    75     void setNumVars(int numVars) { m_numVars = numVars; }
    76     void setNumCalleeLocals(int numCalleeLocals) { m_numCalleeLocals = numCalleeLocals; }
     75    void setNumVars(unsigned numVars) { m_numVars = numVars; }
     76    void setNumCalleeLocals(unsigned numCalleeLocals) { m_numCalleeLocals = numCalleeLocals; }
    7777
    7878    ALWAYS_INLINE uint64_t getConstant(VirtualRegister reg) const { return m_constants[reg.toConstantIndex()]; }
    … …  
    127127
    128128    // Used for the number of WebAssembly locals, as in https://webassembly.github.io/spec/core/syntax/modules.html#syntax-local
    129     int m_numVars { 0 };
     129    unsigned m_numVars { 0 };
    130130    // Number of VirtualRegister. The naming is unfortunate, but has to match UnlinkedCodeBlock
    131     int m_numCalleeLocals { 0 };
     131    unsigned m_numCalleeLocals { 0 };
    132132    uint32_t m_numArguments { 0 };
    133133    Vector<Type> m_constantTypes;
  • branches/safari-611-branch/Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp

    r270948 r276664  
    170170    {
    171171        m_maxStackSize = std::max(m_maxStackSize, ++m_stackSize);
    172         return virtualRegisterForLocal(m_stackSize - 1);
     172        return virtualRegisterForLocal((m_stackSize - 1).unsafeGet());
    173173    }
    174174
    … …  
    313313        startOffset = target.stackSize() + 1;
    314314        keep = target.branchTargetArity();
    315         drop = m_stackSize - target.stackSize() - target.branchTargetArity();
     315        drop = (m_stackSize - target.stackSize() - target.branchTargetArity()).unsafeGet();
    316316    }
    317317
    … …  
    346346    void walkExpressionStack(Stack& expressionStack, const Functor& functor)
    347347    {
    348         walkExpressionStack(expressionStack, m_stackSize, functor);
     348        walkExpressionStack(expressionStack, m_stackSize.unsafeGet(), functor);
    349349    }
    350350
    … …  
    371371        }
    372372        walkExpressionStack(m_parser->expressionStack(), [&](VirtualRegister expression, VirtualRegister slot) {
    373             ASSERT(expression == slot || expression.isConstant() || expression.isArgument() || expression.toLocal() < m_codeBlock->m_numVars);
     373            ASSERT(expression == slot || expression.isConstant() || expression.isArgument() || static_cast<unsigned>(expression.toLocal()) < m_codeBlock->m_numVars);
    374374        });
    375375#endif // ASSERT_ENABLED
    … …  
    383383        checkConsistency();
    384384        walkExpressionStack(expressionStack, [&](TypedExpression& expression, VirtualRegister slot) {
    385             ASSERT(expression.value() == slot || expression.value().isConstant() || expression.value().isArgument() || expression.value().toLocal() < m_codeBlock->m_numVars);
     385            ASSERT(expression.value() == slot || expression.value().isConstant() || expression.value().isArgument() || static_cast<unsigned>(expression.value().toLocal()) < m_codeBlock->m_numVars);
    386386            if (expression.value() == slot)
    387387                return;
    … …  
    399399        checkConsistency();
    400400        walkExpressionStack(enclosingStack, [&](TypedExpression& expression, VirtualRegister slot) {
    401             ASSERT(expression.value() == slot || expression.value().isConstant() || expression.value().isArgument() || expression.value().toLocal() < m_codeBlock->m_numVars);
     401            ASSERT(expression.value() == slot || expression.value().isConstant() || expression.value().isArgument() || static_cast<unsigned>(expression.value().toLocal()) < m_codeBlock->m_numVars);
    402402            if (expression.value() == slot || expression.value().isConstant())
    403403                return;
    … …  
    430430    HashMap<EncodedJSValue, VirtualRegister, WTF::IntHash<EncodedJSValue>, ConstantMapHashTraits> m_constantMap;
    431431    Vector<VirtualRegister, 2> m_results;
    432     unsigned m_stackSize { 0 };
    433     unsigned m_maxStackSize { 0 };
     432    Checked<unsigned> m_stackSize { 0 };
     433    Checked<unsigned> m_maxStackSize { 0 };
    434434};
    435435
    … …  
    480480{
    481481    RELEASE_ASSERT(m_codeBlock);
    482     m_codeBlock->m_numCalleeLocals = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), m_maxStackSize);
     482    size_t numCalleeLocals = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), m_maxStackSize.unsafeGet());
     483    m_codeBlock->m_numCalleeLocals = numCalleeLocals;
     484    RELEASE_ASSERT(numCalleeLocals == m_codeBlock->m_numCalleeLocals);
    483485
    484486    auto& threadSpecific = threadSpecificBuffer();
    … …  
    568570    // NOTE: We increase arg count by 1 for the case of indirect calls
    569571    m_stackSize += std::max(signature.argumentCount() + 1, signature.returnCount()) + gprCount + fprCount + stackCount + CallFrame::headerSizeInRegisters;
    570     if (m_stackSize % stackAlignmentRegisters())
     572    if (m_stackSize.unsafeGet() % stackAlignmentRegisters())
    571573        ++m_stackSize;
    572574    if (m_maxStackSize < m_stackSize)
    … …  
    577579    ResultList temporaryResults(signature.returnCount());
    578580
    579     const unsigned stackOffset = m_stackSize;
     581    const unsigned stackOffset = m_stackSize.unsafeGet();
    580582    const unsigned base = stackOffset - CallFrame::headerSizeInRegisters;
    581583
    … …  
    866868    Ref<Label> continuation = newLabel();
    867869
    868     block = ControlType::loop(signature, m_stackSize, WTFMove(body), WTFMove(continuation));
     870    block = ControlType::loop(signature, m_stackSize.unsafeGet(), WTFMove(body), WTFMove(continuation));
    869871
    870872    Vector<VirtualRegister> osrEntryData;
    … …  
    875877    const uint32_t gprCount = callingConvention.gprArgs.size();
    876878    const uint32_t fprCount = callingConvention.fprArgs.size();
    877     for (int32_t i = gprCount + fprCount + numberOfLLIntCalleeSaveRegisters; i < m_codeBlock->m_numVars; i++)
     879    for (uint32_t i = gprCount + fprCount + numberOfLLIntCalleeSaveRegisters; i < m_codeBlock->m_numVars; i++)
    878880        osrEntryData.append(virtualRegisterForLocal(i));
    879881    for (unsigned controlIndex = 0; controlIndex < m_parser->controlStack().size(); ++controlIndex) {
    … …  
    894896auto LLIntGenerator::addTopLevel(BlockSignature signature) -> ControlType
    895897{
    896     return ControlType::topLevel(signature, m_stackSize, newLabel());
     898    return ControlType::topLevel(signature, m_stackSize.unsafeGet(), newLabel());
    897899}
    898900
    … …  
    900902{
    901903    splitStack(signature, enclosingStack, newStack);
    902     newBlock = ControlType::block(signature, m_stackSize, newLabel());
     904    newBlock = ControlType::block(signature, m_stackSize.unsafeGet(), newLabel());
    903905    return { };
    904906}
    … …  
    913915    WasmJfalse::emit(this, condition, alternate->bind(this));
    914916
    915     result = ControlType::if_(signature, m_stackSize, WTFMove(alternate), WTFMove(continuation));
     917    result = ControlType::if_(signature, m_stackSize.unsafeGet(), WTFMove(alternate), WTFMove(continuation));
    916918    return { };
    917919}
    … …  
    931933    ControlIf& control = WTF::get<ControlIf>(data);
    932934    emitLabel(control.m_alternate.get());
    933     data = ControlType::block(data.m_signature, m_stackSize, WTFMove(data.m_continuation));
     935    data = ControlType::block(data.m_signature, m_stackSize.unsafeGet(), WTFMove(data.m_continuation));
    934936    return { };
    935937}
Note: See TracChangeset for help on using the changeset viewer.