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

Changeset 276609 in webkit


Ignore:
Timestamp:
Apr 26, 2021, 1:20:13 PM (5 years ago)
Author:
keith_miller@apple.com
Message:

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):

Location:
trunk/Source/JavaScriptCore
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r276592 r276609  
     12021-04-26  Keith Miller  <keith_miller@apple.com>
     2
     3        numCalleeLocals, numParameters, and numVars should be unsigned
     4        https://bugs.webkit.org/show_bug.cgi?id=224995
     5
     6        Reviewed by Mark Lam.
     7
     8        All of the various CodeBlock classes currently have the
     9        numCalleeLocals and numVars marked as ints. I believe this is just
     10        a historical artifact or because VirtualRegister's offset is an
     11        int to make handling constants easier. Regardless, it's a bit
     12        strange to not handle the sign conversion at the point of
     13        comparison between a VirtualRegister offset and the local/var
     14        count. This doesn't completely fix every place we use ints for
     15        these values but starts on the right track. Lastly, I also added
     16        some Check<unsigned>s to the wasm parser for sanity checking.
     17
     18        * bytecode/CodeBlock.cpp:
     19        (JSC::CodeBlock::setNumParameters):
     20        (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeIndexSlow):
     21        * bytecode/CodeBlock.h:
     22        (JSC::CodeBlock::numParameters const):
     23        (JSC::CodeBlock::numberOfArgumentsToSkip const):
     24        (JSC::CodeBlock::numCalleeLocals const):
     25        (JSC::CodeBlock::numVars const):
     26        (JSC::CodeBlock::numTmps const):
     27        (JSC::CodeBlock::addressOfNumParameters):
     28        (JSC::CodeBlock::isTemporaryRegister):
     29        * bytecode/UnlinkedCodeBlock.h:
     30        (JSC::UnlinkedCodeBlock::numCalleeLocals const):
     31        (JSC::UnlinkedCodeBlock::numVars const):
     32        * bytecode/UnlinkedCodeBlockGenerator.h:
     33        (JSC::UnlinkedCodeBlockGenerator::numCalleeLocals const):
     34        (JSC::UnlinkedCodeBlockGenerator::numVars const):
     35        (JSC::UnlinkedCodeBlockGenerator::setNumCalleeLocals):
     36        (JSC::UnlinkedCodeBlockGenerator::setNumVars):
     37        (JSC::UnlinkedCodeBlockGenerator::setNumParameters):
     38        * bytecompiler/BytecodeGenerator.cpp:
     39        (JSC::BytecodeGenerator::generate):
     40        (JSC::BytecodeGenerator::emitPushFunctionNameScope):
     41        * bytecompiler/BytecodeGeneratorBaseInlines.h:
     42        (JSC::BytecodeGeneratorBase<Traits>::newRegister):
     43        * dfg/DFGByteCodeParser.cpp:
     44        (JSC::DFG::ByteCodeParser::handleRecursiveTailCall):
     45        (JSC::DFG::ByteCodeParser::inliningCost):
     46        (JSC::DFG::ByteCodeParser::parseBlock):
     47        * dfg/DFGOSREntrypointCreationPhase.cpp:
     48        (JSC::DFG::OSREntrypointCreationPhase::run):
     49        * dfg/DFGSpeculativeJIT.cpp:
     50        (JSC::DFG::SpeculativeJIT::checkArgumentTypes):
     51        * ftl/FTLLowerDFGToB3.cpp:
     52        (JSC::FTL::DFG::LowerDFGToB3::lower):
     53        * ftl/FTLOSREntry.cpp:
     54        (JSC::FTL::prepareOSREntry):
     55        * interpreter/CallFrameClosure.h:
     56        * interpreter/ProtoCallFrameInlines.h:
     57        (JSC::ProtoCallFrame::init):
     58        * jit/JIT.cpp:
     59        (JSC::JIT::compileWithoutLinking):
     60        * runtime/CommonSlowPaths.h:
     61        (JSC::CommonSlowPaths::numberOfStackPaddingSlots):
     62        (JSC::CommonSlowPaths::numberOfStackPaddingSlotsWithExtraSlots):
     63        * wasm/WasmFunctionCodeBlock.h:
     64        (JSC::Wasm::FunctionCodeBlock::numVars const):
     65        (JSC::Wasm::FunctionCodeBlock::numCalleeLocals const):
     66        (JSC::Wasm::FunctionCodeBlock::setNumVars):
     67        (JSC::Wasm::FunctionCodeBlock::setNumCalleeLocals):
     68        * wasm/WasmLLIntGenerator.cpp:
     69        (JSC::Wasm::LLIntGenerator::push):
     70        (JSC::Wasm::LLIntGenerator::getDropKeepCount):
     71        (JSC::Wasm::LLIntGenerator::walkExpressionStack):
     72        (JSC::Wasm::LLIntGenerator::checkConsistency):
     73        (JSC::Wasm::LLIntGenerator::materializeConstantsAndLocals):
     74        (JSC::Wasm::LLIntGenerator::splitStack):
     75        (JSC::Wasm::LLIntGenerator::finalize):
     76        (JSC::Wasm::LLIntGenerator::callInformationForCaller):
     77        (JSC::Wasm::LLIntGenerator::addLoop):
     78        (JSC::Wasm::LLIntGenerator::addTopLevel):
     79        (JSC::Wasm::LLIntGenerator::addBlock):
     80        (JSC::Wasm::LLIntGenerator::addIf):
     81        (JSC::Wasm::LLIntGenerator::addElseToUnreachable):
     82
    1832021-04-26  Alexey Shvayka  <shvaikalesh@gmail.com>
    284
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r276224 r276609  
    925925}
    926926
    927 void CodeBlock::setNumParameters(int newValue)
     927void CodeBlock::setNumParameters(unsigned newValue)
    928928{
    929929    m_numParameters = newValue;
    … …  
    20162016    });
    20172017
    2018     for (int i = 0; i < numParameters(); ++i)
     2018    for (unsigned i = 0; i < numParameters(); ++i)
    20192019        liveOperands.append(virtualRegisterForArgumentIncludingThis(i));
    20202020
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r276290 r276609  
    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
    … …  
    990990    void ensureCatchLivenessIsComputedForBytecodeIndexSlow(const OpCatch&, BytecodeIndex);
    991991
    992     int m_numCalleeLocals;
    993     int m_numVars;
    994     int m_numParameters;
    995     int m_numberOfArgumentsToSkip { 0 };
     992    unsigned m_numCalleeLocals;
     993    unsigned m_numVars;
     994    unsigned m_numParameters;
     995    unsigned m_numberOfArgumentsToSkip { 0 };
    996996    unsigned m_numberOfNonArgumentValueProfiles { 0 };
    997997    union {
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h

    r276427 r276609  
    210210    const InstructionStream& instructions() const;
    211211
    212     int numCalleeLocals() const { return m_numCalleeLocals; }
    213     int numVars() const { return m_numVars; }
     212    unsigned numCalleeLocals() const { return m_numCalleeLocals; }
     213    unsigned numVars() const { return m_numVars; }
    214214
    215215    // Jump Tables
    … …  
    397397    unsigned m_endColumn { UINT_MAX };
    398398
    399     int m_numVars { 0 };
    400     int m_numCalleeLocals { 0 };
    401     int m_numParameters { 0 };
     399    unsigned m_numVars { 0 };
     400    unsigned m_numCalleeLocals { 0 };
     401    unsigned m_numParameters { 0 };
    402402
    403403    PackedRefPtr<StringImpl> m_sourceURLDirective;
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlockGenerator.h

    r275995 r276609  
    6060    bool isArrowFunctionContext() const { return m_codeBlock->isArrowFunctionContext(); }
    6161    bool isClassContext() const { return m_codeBlock->isClassContext(); }
    62     int numCalleeLocals() const { return m_codeBlock->m_numCalleeLocals; }
    63     int numVars() const { return m_codeBlock->m_numVars; }
     62    unsigned numCalleeLocals() const { return m_codeBlock->m_numCalleeLocals; }
     63    unsigned numVars() const { return m_codeBlock->m_numVars; }
    6464    unsigned numParameters() const { return m_codeBlock->numParameters(); }
    6565    VirtualRegister thisRegister() const { return m_codeBlock->thisRegister(); }
    … …  
    7272    void setHasCheckpoints() { m_codeBlock->setHasCheckpoints(); }
    7373    void setHasTailCalls() { m_codeBlock->setHasTailCalls(); }
    74     void setNumCalleeLocals(int numCalleeLocals) { m_codeBlock->m_numCalleeLocals = numCalleeLocals; }
    75     void setNumVars(int numVars) { m_codeBlock->m_numVars = numVars; }
     74    void setNumCalleeLocals(unsigned numCalleeLocals) { m_codeBlock->m_numCalleeLocals = numCalleeLocals; }
     75    void setNumVars(unsigned numVars) { m_codeBlock->m_numVars = numVars; }
    7676    void setThisRegister(VirtualRegister thisRegister) { m_codeBlock->setThisRegister(thisRegister); }
    7777    void setScopeRegister(VirtualRegister thisRegister) { m_codeBlock->setScopeRegister(thisRegister); }
    78     void setNumParameters(int newValue) { m_codeBlock->setNumParameters(newValue); }
     78    void setNumParameters(unsigned newValue) { m_codeBlock->setNumParameters(newValue); }
    7979
    8080    UnlinkedMetadataTable& metadata() { return m_codeBlock->metadata(); }
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r276384 r276609  
    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)
    … …  
    39883988    unsigned numVars = m_codeBlock->numVars();
    39893989    pushLexicalScopeInternal(nameScopeEnvironment, TDZCheckOptimization::Optimize, NestedScopeType::IsNotNested, nullptr, TDZRequirement::NotUnderTDZ, ScopeType::FunctionNameScope, ScopeRegisterType::Var);
    3990     ASSERT_UNUSED(numVars, m_codeBlock->numVars() == static_cast<int>(numVars + 1)); // Should have only created one new "var" for the function name scope.
     3990    ASSERT_UNUSED(numVars, m_codeBlock->numVars() == numVars + 1); // Should have only created one new "var" for the function name scope.
    39913991    bool shouldTreatAsLexicalVariable = ecmaMode().isStrict();
    39923992    Variable functionVar = variableForLocalEntry(property, m_lexicalScopeStack.last().m_symbolTable->get(NoLockingNecessary, property.impl()), m_lexicalScopeStack.last().m_symbolTableConstantIndex, shouldTreatAsLexicalVariable);
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGeneratorBaseInlines.h

    r255687 r276609  
    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}
  • trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

    r276427 r276609  
    14951495            // Some code may statically use the argument count from the InlineCallFrame, so it would be invalid to loop back if it does not match.
    14961496            // We "continue" instead of returning false in case another stack entry further on the stack has the right number of arguments.
    1497             if (argumentCountIncludingThis != static_cast<int>(callFrame->argumentCountIncludingThis))
     1497            if (argumentCountIncludingThis != callFrame->argumentCountIncludingThis)
    14981498                continue;
    14991499            // If the target InlineCallFrame is Varargs, we do not know how many arguments are actually filled by LoadVarargs. Varargs InlineCallFrame's
    … …  
    15051505            // We are in the machine code entry (i.e. the original caller).
    15061506            // 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.
    1507             if (argumentCountIncludingThis > m_codeBlock->numParameters())
     1507            if (static_cast<unsigned>(argumentCountIncludingThis) > m_codeBlock->numParameters())
    15081508                return false;
    15091509        }
    … …  
    15311531        if (!stackEntry->m_inlineCallFrame)
    15321532            addToGraph(SetArgumentCountIncludingThis, OpInfo(argumentCountIncludingThis));
    1533         int argIndex = 0;
    1534         for (; argIndex < argumentCountIncludingThis; ++argIndex) {
     1533        unsigned argIndex = 0;
     1534        for (; argIndex < static_cast<unsigned>(argumentCountIncludingThis); ++argIndex) {
    15351535            Node* value = get(virtualRegisterForArgumentIncludingThis(argIndex, registerOffset));
    15361536            setDirect(stackEntry->remapOperand(virtualRegisterForArgumentIncludingThis(argIndex)), value, NormalSet);
    … …  
    15421542        // We must repeat the work of op_enter here as we will jump right after it.
    15431543        // We jump right after it and not before it, because of some invariant saying that a CFG root cannot have predecessors in the IR.
    1544         for (int i = 0; i < stackEntry->m_codeBlock->numVars(); ++i)
     1544        for (unsigned i = 0; i < stackEntry->m_codeBlock->numVars(); ++i)
    15451545            setDirect(stackEntry->remapOperand(virtualRegisterForLocal(i)), undefined, NormalSet);
    15461546
    … …  
    15981598
    15991599    if (!Options::useArityFixupInlining()) {
    1600         if (codeBlock->numParameters() > argumentCountIncludingThis) {
     1600        if (codeBlock->numParameters() > static_cast<unsigned>(argumentCountIncludingThis)) {
    16011601            VERBOSE_LOG("    Failing because of arity mismatch.\n");
    16021602            return UINT_MAX;
    … …  
    54195419            Node* undefined = addToGraph(JSConstant, OpInfo(m_constantUndefined));
    54205420            // Initialize all locals to undefined.
    5421             for (int i = 0; i < m_inlineStackTop->m_codeBlock->numVars(); ++i)
     5421            for (unsigned i = 0; i < m_inlineStackTop->m_codeBlock->numVars(); ++i)
    54225422                set(virtualRegisterForLocal(i), undefined, ImmediateNakedSet);
    54235423
  • trunk/Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp

    r261895 r276609  
    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)
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r276449 r276609  
    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) {
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r276427 r276609  
    363363                auto* jitCode = m_ftlState.jitCode->ftlForOSREntry();
    364364                FixedVector<DFG::FlushFormat> argumentFlushFormats(codeBlock()->numParameters());
    365                 for (int i = 0; i < codeBlock()->numParameters(); ++i)
     365                for (unsigned i = 0; i < codeBlock()->numParameters(); ++i)
    366366                    argumentFlushFormats[i] = m_graph.m_argumentFormats[0][i];
    367367                jitCode->setArgumentFlushFormats(WTFMove(argumentFlushFormats));
  • trunk/Source/JavaScriptCore/ftl/FTLOSREntry.cpp

    r268783 r276609  
    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*>(
  • trunk/Source/JavaScriptCore/interpreter/CallFrameClosure.h

    r206525 r276609  
    3737    VM* vm;
    3838    JSScope* scope;
    39     int parameterCountIncludingThis;
     39    unsigned parameterCountIncludingThis;
    4040    int argumentCountIncludingThis;
    4141   
  • trunk/Source/JavaScriptCore/interpreter/ProtoCallFrameInlines.h

    r251584 r276609  
    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
  • trunk/Source/JavaScriptCore/jit/JIT.cpp

    r276470 r276609  
    770770        ASSERT(!m_bytecodeIndex);
    771771        if (shouldEmitProfiling()) {
    772             for (int argument = 0; argument < m_codeBlock->numParameters(); ++argument) {
     772            for (unsigned argument = 0; argument < m_codeBlock->numParameters(); ++argument) {
    773773                // If this is a constructor, then we want to put in a dummy profiling site (to
    774774                // keep things consistent) but we don't actually want to record the dummy value.
  • trunk/Source/JavaScriptCore/runtime/CommonSlowPaths.h

    r271120 r276609  
    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);
  • trunk/Source/JavaScriptCore/tools/VMInspector.cpp

    r271082 r276609  
    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
  • trunk/Source/JavaScriptCore/wasm/WasmFunctionCodeBlock.h

    r273813 r276609  
    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;
  • trunk/Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp

    r275650 r276609  
    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
    … …  
    316316        startOffset = target.stackSize() + 1;
    317317        keep = target.branchTargetArity();
    318         drop = m_stackSize - target.stackSize() - target.branchTargetArity();
     318        drop = (m_stackSize - target.stackSize() - target.branchTargetArity()).unsafeGet();
    319319    }
    320320
    … …  
    349349    void walkExpressionStack(Stack& expressionStack, const Functor& functor)
    350350    {
    351         walkExpressionStack(expressionStack, m_stackSize, functor);
     351        walkExpressionStack(expressionStack, m_stackSize.unsafeGet(), functor);
    352352    }
    353353
    … …  
    374374        }
    375375        walkExpressionStack(m_parser->expressionStack(), [&](VirtualRegister expression, VirtualRegister slot) {
    376             ASSERT(expression == slot || expression.isConstant() || expression.isArgument() || expression.toLocal() < m_codeBlock->m_numVars);
     376            ASSERT(expression == slot || expression.isConstant() || expression.isArgument() || static_cast<unsigned>(expression.toLocal()) < m_codeBlock->m_numVars);
    377377        });
    378378#endif // ASSERT_ENABLED
    … …  
    386386        checkConsistency();
    387387        walkExpressionStack(expressionStack, [&](TypedExpression& expression, VirtualRegister slot) {
    388             ASSERT(expression.value() == slot || expression.value().isConstant() || expression.value().isArgument() || expression.value().toLocal() < m_codeBlock->m_numVars);
     388            ASSERT(expression.value() == slot || expression.value().isConstant() || expression.value().isArgument() || static_cast<unsigned>(expression.value().toLocal()) < m_codeBlock->m_numVars);
    389389            if (expression.value() == slot)
    390390                return;
    … …  
    402402        checkConsistency();
    403403        walkExpressionStack(enclosingStack, [&](TypedExpression& expression, VirtualRegister slot) {
    404             ASSERT(expression.value() == slot || expression.value().isConstant() || expression.value().isArgument() || expression.value().toLocal() < m_codeBlock->m_numVars);
     404            ASSERT(expression.value() == slot || expression.value().isConstant() || expression.value().isArgument() || static_cast<unsigned>(expression.value().toLocal()) < m_codeBlock->m_numVars);
    405405            if (expression.value() == slot || expression.value().isConstant())
    406406                return;
    … …  
    433433    HashMap<EncodedJSValue, VirtualRegister, WTF::IntHash<EncodedJSValue>, ConstantMapHashTraits> m_constantMap;
    434434    Vector<VirtualRegister, 2> m_results;
    435     unsigned m_stackSize { 0 };
    436     unsigned m_maxStackSize { 0 };
     435    Checked<unsigned> m_stackSize { 0 };
     436    Checked<unsigned> m_maxStackSize { 0 };
    437437};
    438438
    … …  
    483483{
    484484    RELEASE_ASSERT(m_codeBlock);
    485     m_codeBlock->m_numCalleeLocals = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), m_maxStackSize);
     485    size_t numCalleeLocals = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), m_maxStackSize.unsafeGet());
     486    m_codeBlock->m_numCalleeLocals = numCalleeLocals;
     487    RELEASE_ASSERT(numCalleeLocals == m_codeBlock->m_numCalleeLocals);
    486488
    487489    auto& threadSpecific = threadSpecificBuffer();
    … …  
    572574    // NOTE: We increase arg count by 1 for the case of indirect calls
    573575    m_stackSize += std::max(signature.argumentCount() + 1, signature.returnCount()) + gprCount + fprCount + stackCount + CallFrame::headerSizeInRegisters;
    574     if (m_stackSize % stackAlignmentRegisters())
     576    if (m_stackSize.unsafeGet() % stackAlignmentRegisters())
    575577        ++m_stackSize;
    576578    if (m_maxStackSize < m_stackSize)
    … …  
    581583    ResultList temporaryResults(signature.returnCount());
    582584
    583     const unsigned stackOffset = m_stackSize;
     585    const unsigned stackOffset = m_stackSize.unsafeGet();
    584586    const unsigned base = stackOffset - CallFrame::headerSizeInRegisters;
    585587
    … …  
    874876    Ref<Label> continuation = newLabel();
    875877
    876     block = ControlType::loop(signature, m_stackSize, WTFMove(body), WTFMove(continuation));
     878    block = ControlType::loop(signature, m_stackSize.unsafeGet(), WTFMove(body), WTFMove(continuation));
    877879
    878880    Vector<VirtualRegister> osrEntryData;
    … …  
    883885    const uint32_t gprCount = callingConvention.gprArgs.size();
    884886    const uint32_t fprCount = callingConvention.fprArgs.size();
    885     for (int32_t i = gprCount + fprCount + numberOfLLIntCalleeSaveRegisters; i < m_codeBlock->m_numVars; i++)
     887    for (uint32_t i = gprCount + fprCount + numberOfLLIntCalleeSaveRegisters; i < m_codeBlock->m_numVars; i++)
    886888        osrEntryData.append(virtualRegisterForLocal(i));
    887889    for (unsigned controlIndex = 0; controlIndex < m_parser->controlStack().size(); ++controlIndex) {
    … …  
    902904auto LLIntGenerator::addTopLevel(BlockSignature signature) -> ControlType
    903905{
    904     return ControlType::topLevel(signature, m_stackSize, newLabel());
     906    return ControlType::topLevel(signature, m_stackSize.unsafeGet(), newLabel());
    905907}
    906908
    … …  
    908910{
    909911    splitStack(signature, enclosingStack, newStack);
    910     newBlock = ControlType::block(signature, m_stackSize, newLabel());
     912    newBlock = ControlType::block(signature, m_stackSize.unsafeGet(), newLabel());
    911913    return { };
    912914}
    … …  
    921923    WasmJfalse::emit(this, condition, alternate->bind(this));
    922924
    923     result = ControlType::if_(signature, m_stackSize, WTFMove(alternate), WTFMove(continuation));
     925    result = ControlType::if_(signature, m_stackSize.unsafeGet(), WTFMove(alternate), WTFMove(continuation));
    924926    return { };
    925927}
    … …  
    939941    ControlIf& control = WTF::get<ControlIf>(data);
    940942    emitLabel(control.m_alternate.get());
    941     data = ControlType::block(data.m_signature, m_stackSize, WTFMove(data.m_continuation));
     943    data = ControlType::block(data.m_signature, m_stackSize.unsafeGet(), WTFMove(data.m_continuation));
    942944    return { };
    943945}
Note: See TracChangeset for help on using the changeset viewer.