Changeset 276664 in webkit
- Timestamp:
- Apr 27, 2021, 2:07:17 PM (5 years ago)
- Location:
- branches/safari-611-branch/Source/JavaScriptCore
- Files:
-
- 19 edited
-
ChangeLog (modified) (1 diff)
-
bytecode/CodeBlock.cpp (modified) (2 diffs)
-
bytecode/CodeBlock.h (modified) (3 diffs)
-
bytecode/UnlinkedCodeBlock.h (modified) (2 diffs)
-
bytecode/UnlinkedCodeBlockGenerator.h (modified) (2 diffs)
-
bytecompiler/BytecodeGenerator.cpp (modified) (2 diffs)
-
bytecompiler/BytecodeGeneratorBaseInlines.h (modified) (1 diff)
-
dfg/DFGByteCodeParser.cpp (modified) (6 diffs)
-
dfg/DFGOSREntrypointCreationPhase.cpp (modified) (3 diffs)
-
dfg/DFGSpeculativeJIT.cpp (modified) (1 diff)
-
ftl/FTLLowerDFGToB3.cpp (modified) (1 diff)
-
ftl/FTLOSREntry.cpp (modified) (1 diff)
-
interpreter/CallFrameClosure.h (modified) (1 diff)
-
interpreter/ProtoCallFrameInlines.h (modified) (1 diff)
-
jit/JIT.cpp (modified) (1 diff)
-
runtime/CommonSlowPaths.h (modified) (2 diffs)
-
tools/VMInspector.cpp (modified) (1 diff)
-
wasm/WasmFunctionCodeBlock.h (modified) (3 diffs)
-
wasm/WasmLLIntGenerator.cpp (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-611-branch/Source/JavaScriptCore/ChangeLog
r276529 r276664 1 2021-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 1 169 2021-04-23 Ruben Turcios <rubent_22@apple.com> 2 170 -
branches/safari-611-branch/Source/JavaScriptCore/bytecode/CodeBlock.cpp
r275706 r276664 968 968 } 969 969 970 void CodeBlock::setNumParameters( intnewValue)970 void CodeBlock::setNumParameters(unsigned newValue) 971 971 { 972 972 m_numParameters = newValue; … … 1990 1990 }); 1991 1991 1992 for ( inti = 0; i < numParameters(); ++i)1992 for (unsigned i = 0; i < numParameters(); ++i) 1993 1993 liveOperands.append(virtualRegisterForArgumentIncludingThis(i)); 1994 1994 -
branches/safari-611-branch/Source/JavaScriptCore/bytecode/CodeBlock.h
r266359 r276664 157 157 MetadataTable* metadataTable() const { return m_metadata.get(); } 158 158 159 intnumParameters() const { return m_numParameters; }160 void setNumParameters( intnewValue);161 162 intnumberOfArgumentsToSkip() const { return m_numberOfArgumentsToSkip; }163 164 intnumCalleeLocals() const { return m_numCalleeLocals; }165 166 intnumVars() const { return m_numVars; }167 intnumTmps() 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; } 170 170 static ptrdiff_t offsetOfNumParameters() { return OBJECT_OFFSETOF(CodeBlock, m_numParameters); } 171 171 … … 244 244 ALWAYS_INLINE bool isTemporaryRegister(VirtualRegister reg) 245 245 { 246 return reg.offset() >= m_numVars;246 return reg.offset() >= static_cast<int>(m_numVars); 247 247 } 248 248 … … 996 996 void ensureCatchLivenessIsComputedForBytecodeIndexSlow(const OpCatch&, BytecodeIndex); 997 997 998 intm_numCalleeLocals;999 intm_numVars;1000 intm_numParameters;1001 intm_numberOfArgumentsToSkip { 0 };998 unsigned m_numCalleeLocals; 999 unsigned m_numVars; 1000 unsigned m_numParameters; 1001 unsigned m_numberOfArgumentsToSkip { 0 }; 1002 1002 unsigned m_numberOfNonArgumentValueProfiles { 0 }; 1003 1003 union { -
branches/safari-611-branch/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h
r259676 r276664 181 181 const InstructionStream& instructions() const; 182 182 183 intnumCalleeLocals() const { return m_numCalleeLocals; }184 intnumVars() const { return m_numVars; }183 unsigned numCalleeLocals() const { return m_numCalleeLocals; } 184 unsigned numVars() const { return m_numVars; } 185 185 186 186 // Jump Tables … … 361 361 unsigned m_endColumn { UINT_MAX }; 362 362 363 intm_numVars { 0 };364 intm_numCalleeLocals { 0 };365 intm_numParameters { 0 };363 unsigned m_numVars { 0 }; 364 unsigned m_numCalleeLocals { 0 }; 365 unsigned m_numParameters { 0 }; 366 366 367 367 PackedRefPtr<StringImpl> m_sourceURLDirective; -
branches/safari-611-branch/Source/JavaScriptCore/bytecode/UnlinkedCodeBlockGenerator.h
r259676 r276664 58 58 bool isArrowFunctionContext() const { return m_codeBlock->isArrowFunctionContext(); } 59 59 bool isClassContext() const { return m_codeBlock->isClassContext(); } 60 intnumCalleeLocals() const { return m_codeBlock->m_numCalleeLocals; }61 intnumVars() const { return m_codeBlock->m_numVars; }60 unsigned numCalleeLocals() const { return m_codeBlock->m_numCalleeLocals; } 61 unsigned numVars() const { return m_codeBlock->m_numVars; } 62 62 unsigned numParameters() const { return m_codeBlock->numParameters(); } 63 63 VirtualRegister thisRegister() const { return m_codeBlock->thisRegister(); } … … 70 70 void setHasCheckpoints() { m_codeBlock->setHasCheckpoints(); } 71 71 void setHasTailCalls() { m_codeBlock->setHasTailCalls(); } 72 void setNumCalleeLocals( intnumCalleeLocals) { m_codeBlock->m_numCalleeLocals = numCalleeLocals; }73 void setNumVars( intnumVars) { 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; } 74 74 void setThisRegister(VirtualRegister thisRegister) { m_codeBlock->setThisRegister(thisRegister); } 75 75 void setScopeRegister(VirtualRegister thisRegister) { m_codeBlock->setScopeRegister(thisRegister); } 76 void setNumParameters( intnewValue) { m_codeBlock->setNumParameters(newValue); }76 void setNumParameters(unsigned newValue) { m_codeBlock->setNumParameters(newValue); } 77 77 78 78 UnlinkedMetadataTable& metadata() { return m_codeBlock->metadata(); } -
branches/safari-611-branch/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r270874 r276664 283 283 performGeneratorification(*this, m_codeBlock.get(), m_writer, m_generatorFrameSymbolTable.get(), m_generatorFrameSymbolTableIndex); 284 284 285 RELEASE_ASSERT( static_cast<unsigned>(m_codeBlock->numCalleeLocals()) < static_cast<unsigned>(FirstConstantRegisterIndex));285 RELEASE_ASSERT(m_codeBlock->numCalleeLocals() < static_cast<unsigned>(FirstConstantRegisterIndex)); 286 286 m_codeBlock->finalize(m_writer.finalize()); 287 287 if (m_expressionTooDeep) … … 3889 3889 unsigned numVars = m_codeBlock->numVars(); 3890 3890 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. 3892 3892 bool shouldTreatAsLexicalVariable = ecmaMode().isStrict(); 3893 3893 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 162 162 { 163 163 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()); 165 165 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()); 167 168 return &m_calleeLocals.last(); 168 169 } -
branches/safari-611-branch/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r272533 r276664 1496 1496 // Some code may statically use the argument count from the InlineCallFrame, so it would be invalid to loop back if it does not match. 1497 1497 // 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) 1499 1499 continue; 1500 1500 // If the target InlineCallFrame is Varargs, we do not know how many arguments are actually filled by LoadVarargs. Varargs InlineCallFrame's … … 1506 1506 // We are in the machine code entry (i.e. the original caller). 1507 1507 // 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()) 1509 1509 return false; 1510 1510 } … … 1532 1532 if (!stackEntry->m_inlineCallFrame) 1533 1533 addToGraph(SetArgumentCountIncludingThis, OpInfo(argumentCountIncludingThis)); 1534 intargIndex = 0;1535 for (; argIndex < argumentCountIncludingThis; ++argIndex) {1534 unsigned argIndex = 0; 1535 for (; argIndex < static_cast<unsigned>(argumentCountIncludingThis); ++argIndex) { 1536 1536 Node* value = get(virtualRegisterForArgumentIncludingThis(argIndex, registerOffset)); 1537 1537 setDirect(stackEntry->remapOperand(virtualRegisterForArgumentIncludingThis(argIndex)), value, NormalSet); … … 1543 1543 // We must repeat the work of op_enter here as we will jump right after it. 1544 1544 // 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 ( inti = 0; i < stackEntry->m_codeBlock->numVars(); ++i)1545 for (unsigned i = 0; i < stackEntry->m_codeBlock->numVars(); ++i) 1546 1546 setDirect(stackEntry->remapOperand(virtualRegisterForLocal(i)), undefined, NormalSet); 1547 1547 … … 1599 1599 1600 1600 if (!Options::useArityFixupInlining()) { 1601 if (codeBlock->numParameters() > argumentCountIncludingThis) {1601 if (codeBlock->numParameters() > static_cast<unsigned>(argumentCountIncludingThis)) { 1602 1602 VERBOSE_LOG(" Failing because of arity mismatch.\n"); 1603 1603 return UINT_MAX; … … 5371 5371 Node* undefined = addToGraph(JSConstant, OpInfo(m_constantUndefined)); 5372 5372 // Initialize all locals to undefined. 5373 for ( inti = 0; i < m_inlineStackTop->m_codeBlock->numVars(); ++i)5373 for (unsigned i = 0; i < m_inlineStackTop->m_codeBlock->numVars(); ++i) 5374 5374 set(virtualRegisterForLocal(i), undefined, ImmediateNakedSet); 5375 5375 -
branches/safari-611-branch/Source/JavaScriptCore/dfg/DFGOSREntrypointCreationPhase.cpp
r261895 r276664 95 95 96 96 Vector<Node*> locals(baseline->numCalleeLocals()); 97 for ( intlocal = 0; local < baseline->numCalleeLocals(); ++local) {97 for (unsigned local = 0; local < baseline->numCalleeLocals(); ++local) { 98 98 Node* previousHead = target->variablesAtHead.local(local); 99 99 if (!previousHead) … … 114 114 115 115 ArgumentsVector newArguments = m_graph.m_rootToArguments.find(m_graph.block(0))->value; 116 for ( intargument = 0; argument < baseline->numParameters(); ++argument) {116 for (unsigned argument = 0; argument < baseline->numParameters(); ++argument) { 117 117 Node* oldNode = target->variablesAtHead.argument(argument); 118 118 if (!oldNode) { … … 126 126 } 127 127 128 for ( intlocal = 0; local < baseline->numCalleeLocals(); ++local) {128 for (unsigned local = 0; local < baseline->numCalleeLocals(); ++local) { 129 129 Node* previousHead = target->variablesAtHead.local(local); 130 130 if (!previousHead) -
branches/safari-611-branch/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r271835 r276664 2080 2080 2081 2081 auto& arguments = m_jit.graph().m_rootToArguments.find(m_jit.graph().block(0))->value; 2082 for ( inti = 0; i < m_jit.codeBlock()->numParameters(); ++i) {2082 for (unsigned i = 0; i < m_jit.codeBlock()->numParameters(); ++i) { 2083 2083 Node* node = arguments[i]; 2084 2084 if (!node) { -
branches/safari-611-branch/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r272508 r276664 363 363 auto* jitCode = m_ftlState.jitCode->ftlForOSREntry(); 364 364 jitCode->argumentFlushFormats().reserveInitialCapacity(codeBlock()->numParameters()); 365 for ( inti = 0; i < codeBlock()->numParameters(); ++i)365 for (unsigned i = 0; i < codeBlock()->numParameters(); ++i) 366 366 jitCode->argumentFlushFormats().uncheckedAppend(m_graph.m_argumentFormats[0][i]); 367 367 } else { -
branches/safari-611-branch/Source/JavaScriptCore/ftl/FTLOSREntry.cpp
r268783 r276664 114 114 } 115 115 116 RELEASE_ASSERT( 117 static_cast<int>(values.numberOfLocals()) == baseline->numCalleeLocals()); 116 RELEASE_ASSERT(values.numberOfLocals() == baseline->numCalleeLocals()); 118 117 119 118 EncodedJSValue* scratch = static_cast<EncodedJSValue*>( -
branches/safari-611-branch/Source/JavaScriptCore/interpreter/CallFrameClosure.h
r206525 r276664 37 37 VM* vm; 38 38 JSScope* scope; 39 intparameterCountIncludingThis;39 unsigned parameterCountIncludingThis; 40 40 int argumentCountIncludingThis; 41 41 -
branches/safari-611-branch/Source/JavaScriptCore/interpreter/ProtoCallFrameInlines.h
r251584 r276664 38 38 this->setGlobalObject(globalObject); 39 39 this->setArgumentCountIncludingThis(argCountIncludingThis); 40 if (codeBlock && argCountIncludingThis< codeBlock->numParameters())40 if (codeBlock && static_cast<unsigned>(argCountIncludingThis) < codeBlock->numParameters()) 41 41 this->hasArityMismatch = true; 42 42 else -
branches/safari-611-branch/Source/JavaScriptCore/jit/JIT.cpp
r271279 r276664 750 750 ASSERT(!m_bytecodeIndex); 751 751 if (shouldEmitProfiling()) { 752 for ( intargument = 0; argument < m_codeBlock->numParameters(); ++argument) {752 for (unsigned argument = 0; argument < m_codeBlock->numParameters(); ++argument) { 753 753 // If this is a constructor, then we want to put in a dummy profiling site (to 754 754 // 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 58 58 ALWAYS_INLINE int numberOfStackPaddingSlots(CodeBlock* codeBlock, int argumentCountIncludingThis) 59 59 { 60 if ( argumentCountIncludingThis>= codeBlock->numParameters())60 if (static_cast<unsigned>(argumentCountIncludingThis) >= codeBlock->numParameters()) 61 61 return 0; 62 62 int alignedFrameSize = WTF::roundUpToMultipleOf(stackAlignmentRegisters(), argumentCountIncludingThis + CallFrame::headerSizeInRegisters); … … 67 67 ALWAYS_INLINE int numberOfStackPaddingSlotsWithExtraSlots(CodeBlock* codeBlock, int argumentCountIncludingThis) 68 68 { 69 if ( argumentCountIncludingThis>= codeBlock->numParameters())69 if (static_cast<unsigned>(argumentCountIncludingThis) >= codeBlock->numParameters()) 70 70 return 0; 71 71 return numberOfStackPaddingSlots(codeBlock, argumentCountIncludingThis) + numberOfExtraSlots(argumentCountIncludingThis); -
branches/safari-611-branch/Source/JavaScriptCore/tools/VMInspector.cpp
r271082 r276664 468 468 } else { 469 469 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()); 471 471 } 472 472 -
branches/safari-611-branch/Source/JavaScriptCore/wasm/WasmFunctionCodeBlock.h
r255687 r276664 66 66 67 67 uint32_t functionIndex() const { return m_functionIndex; } 68 intnumVars() const { return m_numVars; }69 intnumCalleeLocals() const { return m_numCalleeLocals; }68 unsigned numVars() const { return m_numVars; } 69 unsigned numCalleeLocals() const { return m_numCalleeLocals; } 70 70 uint32_t numArguments() const { return m_numArguments; } 71 71 const Vector<Type>& constantTypes() const { return m_constantTypes; } … … 73 73 const InstructionStream& instructions() const { return *m_instructions; } 74 74 75 void setNumVars( intnumVars) { m_numVars = numVars; }76 void setNumCalleeLocals( intnumCalleeLocals) { m_numCalleeLocals = numCalleeLocals; }75 void setNumVars(unsigned numVars) { m_numVars = numVars; } 76 void setNumCalleeLocals(unsigned numCalleeLocals) { m_numCalleeLocals = numCalleeLocals; } 77 77 78 78 ALWAYS_INLINE uint64_t getConstant(VirtualRegister reg) const { return m_constants[reg.toConstantIndex()]; } … … 127 127 128 128 // Used for the number of WebAssembly locals, as in https://webassembly.github.io/spec/core/syntax/modules.html#syntax-local 129 intm_numVars { 0 };129 unsigned m_numVars { 0 }; 130 130 // Number of VirtualRegister. The naming is unfortunate, but has to match UnlinkedCodeBlock 131 intm_numCalleeLocals { 0 };131 unsigned m_numCalleeLocals { 0 }; 132 132 uint32_t m_numArguments { 0 }; 133 133 Vector<Type> m_constantTypes; -
branches/safari-611-branch/Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp
r270948 r276664 170 170 { 171 171 m_maxStackSize = std::max(m_maxStackSize, ++m_stackSize); 172 return virtualRegisterForLocal( m_stackSize - 1);172 return virtualRegisterForLocal((m_stackSize - 1).unsafeGet()); 173 173 } 174 174 … … 313 313 startOffset = target.stackSize() + 1; 314 314 keep = target.branchTargetArity(); 315 drop = m_stackSize - target.stackSize() - target.branchTargetArity();315 drop = (m_stackSize - target.stackSize() - target.branchTargetArity()).unsafeGet(); 316 316 } 317 317 … … 346 346 void walkExpressionStack(Stack& expressionStack, const Functor& functor) 347 347 { 348 walkExpressionStack(expressionStack, m_stackSize , functor);348 walkExpressionStack(expressionStack, m_stackSize.unsafeGet(), functor); 349 349 } 350 350 … … 371 371 } 372 372 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); 374 374 }); 375 375 #endif // ASSERT_ENABLED … … 383 383 checkConsistency(); 384 384 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); 386 386 if (expression.value() == slot) 387 387 return; … … 399 399 checkConsistency(); 400 400 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); 402 402 if (expression.value() == slot || expression.value().isConstant()) 403 403 return; … … 430 430 HashMap<EncodedJSValue, VirtualRegister, WTF::IntHash<EncodedJSValue>, ConstantMapHashTraits> m_constantMap; 431 431 Vector<VirtualRegister, 2> m_results; 432 unsignedm_stackSize { 0 };433 unsignedm_maxStackSize { 0 };432 Checked<unsigned> m_stackSize { 0 }; 433 Checked<unsigned> m_maxStackSize { 0 }; 434 434 }; 435 435 … … 480 480 { 481 481 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); 483 485 484 486 auto& threadSpecific = threadSpecificBuffer(); … … 568 570 // NOTE: We increase arg count by 1 for the case of indirect calls 569 571 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()) 571 573 ++m_stackSize; 572 574 if (m_maxStackSize < m_stackSize) … … 577 579 ResultList temporaryResults(signature.returnCount()); 578 580 579 const unsigned stackOffset = m_stackSize ;581 const unsigned stackOffset = m_stackSize.unsafeGet(); 580 582 const unsigned base = stackOffset - CallFrame::headerSizeInRegisters; 581 583 … … 866 868 Ref<Label> continuation = newLabel(); 867 869 868 block = ControlType::loop(signature, m_stackSize , WTFMove(body), WTFMove(continuation));870 block = ControlType::loop(signature, m_stackSize.unsafeGet(), WTFMove(body), WTFMove(continuation)); 869 871 870 872 Vector<VirtualRegister> osrEntryData; … … 875 877 const uint32_t gprCount = callingConvention.gprArgs.size(); 876 878 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++) 878 880 osrEntryData.append(virtualRegisterForLocal(i)); 879 881 for (unsigned controlIndex = 0; controlIndex < m_parser->controlStack().size(); ++controlIndex) { … … 894 896 auto LLIntGenerator::addTopLevel(BlockSignature signature) -> ControlType 895 897 { 896 return ControlType::topLevel(signature, m_stackSize , newLabel());898 return ControlType::topLevel(signature, m_stackSize.unsafeGet(), newLabel()); 897 899 } 898 900 … … 900 902 { 901 903 splitStack(signature, enclosingStack, newStack); 902 newBlock = ControlType::block(signature, m_stackSize , newLabel());904 newBlock = ControlType::block(signature, m_stackSize.unsafeGet(), newLabel()); 903 905 return { }; 904 906 } … … 913 915 WasmJfalse::emit(this, condition, alternate->bind(this)); 914 916 915 result = ControlType::if_(signature, m_stackSize , WTFMove(alternate), WTFMove(continuation));917 result = ControlType::if_(signature, m_stackSize.unsafeGet(), WTFMove(alternate), WTFMove(continuation)); 916 918 return { }; 917 919 } … … 931 933 ControlIf& control = WTF::get<ControlIf>(data); 932 934 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)); 934 936 return { }; 935 937 }
Note:
See TracChangeset
for help on using the changeset viewer.