Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (241221 => 241222)
--- trunk/Source/_javascript_Core/ChangeLog 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-02-09 00:29:21 UTC (rev 241222)
@@ -1,3 +1,155 @@
+2019-02-08 Yusuke Suzuki <[email protected]>
+
+ [JSC] Shrink sizeof(CodeBlock) more
+ https://bugs.webkit.org/show_bug.cgi?id=194419
+
+ Reviewed by Mark Lam.
+
+ This patch further shrinks the size of CodeBlock, from 352 to 296 (304).
+
+ 1. CodeBlock copies so many data from ScriptExecutable even if ScriptExecutable
+ has the same information. These data is not touched in CodeBlock::~CodeBlock,
+ so we can just use the data in ScriptExecutable instead of holding it in CodeBlock.
+
+ 2. We remove m_instructions pointer since the ownership is managed by UnlinkedCodeBlock.
+ And we do not touch it in CodeBlock::~CodeBlock.
+
+ 3. We move m_calleeSaveRegisters from CodeBlock to CodeBlock::JITData. For baseline and LLInt
+ cases, this patch offers RegisterAtOffsetList::llintBaselineCalleeSaveRegisters() which returns
+ singleton to `const RegisterAtOffsetList*` usable for LLInt and Baseline JIT CodeBlocks.
+
+ 4. Move m_catchProfiles to RareData and materialize only when op_catch's slow path is called.
+
+ 5. Drop ownerScriptExecutable. ownerExecutable() returns ScriptExecutable*.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::hash const):
+ (JSC::CodeBlock::sourceCodeForTools const):
+ (JSC::CodeBlock::dumpAssumingJITType const):
+ (JSC::CodeBlock::dumpSource):
+ (JSC::CodeBlock::CodeBlock):
+ (JSC::CodeBlock::finishCreation):
+ (JSC::CodeBlock::propagateTransitions):
+ (JSC::CodeBlock::finalizeLLIntInlineCaches):
+ (JSC::CodeBlock::setCalleeSaveRegisters):
+ (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset):
+ (JSC::CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffsetSlow):
+ (JSC::CodeBlock::lineNumberForBytecodeOffset):
+ (JSC::CodeBlock::expressionRangeForBytecodeOffset const):
+ (JSC::CodeBlock::hasOpDebugForLineAndColumn):
+ (JSC::CodeBlock::newReplacement):
+ (JSC::CodeBlock::replacement):
+ (JSC::CodeBlock::computeCapabilityLevel):
+ (JSC::CodeBlock::jettison):
+ (JSC::CodeBlock::calleeSaveRegisters const):
+ (JSC::CodeBlock::calleeSaveSpaceAsVirtualRegisters):
+ (JSC::CodeBlock::updateOSRExitCounterAndCheckIfNeedToReoptimize):
+ (JSC::CodeBlock::getArrayProfile):
+ (JSC::CodeBlock::updateAllPredictionsAndCountLiveness):
+ (JSC::CodeBlock::notifyLexicalBindingUpdate):
+ (JSC::CodeBlock::tryGetValueProfileForBytecodeOffset):
+ (JSC::CodeBlock::validate):
+ (JSC::CodeBlock::outOfLineJumpTarget):
+ (JSC::CodeBlock::arithProfileForBytecodeOffset):
+ (JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::specializationKind const):
+ (JSC::CodeBlock::isStrictMode const):
+ (JSC::CodeBlock::isConstructor const):
+ (JSC::CodeBlock::codeType const):
+ (JSC::CodeBlock::isKnownNotImmediate):
+ (JSC::CodeBlock::instructions const):
+ (JSC::CodeBlock::ownerExecutable const):
+ (JSC::CodeBlock::thisRegister const):
+ (JSC::CodeBlock::source const):
+ (JSC::CodeBlock::sourceOffset const):
+ (JSC::CodeBlock::firstLineColumnOffset const):
+ (JSC::CodeBlock::createRareDataIfNecessary):
+ (JSC::CodeBlock::ownerScriptExecutable const): Deleted.
+ (JSC::CodeBlock::setThisRegister): Deleted.
+ (JSC::CodeBlock::calleeSaveRegisters const): Deleted.
+ * bytecode/EvalCodeBlock.h:
+ * bytecode/FunctionCodeBlock.h:
+ * bytecode/GlobalCodeBlock.h:
+ (JSC::GlobalCodeBlock::GlobalCodeBlock):
+ * bytecode/ModuleProgramCodeBlock.h:
+ * bytecode/ProgramCodeBlock.h:
+ * debugger/Debugger.cpp:
+ (JSC::Debugger::toggleBreakpoint):
+ * debugger/DebuggerCallFrame.cpp:
+ (JSC::DebuggerCallFrame::sourceID const):
+ (JSC::DebuggerCallFrame::sourceIDForCallFrame):
+ * debugger/DebuggerScope.cpp:
+ (JSC::DebuggerScope::location const):
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::InlineStackEntry::executable):
+ (JSC::DFG::ByteCodeParser::inliningCost):
+ (JSC::DFG::ByteCodeParser::parseCodeBlock):
+ * dfg/DFGCapabilities.cpp:
+ (JSC::DFG::isSupportedForInlining):
+ (JSC::DFG::mightCompileEval):
+ (JSC::DFG::mightCompileProgram):
+ (JSC::DFG::mightCompileFunctionForCall):
+ (JSC::DFG::mightCompileFunctionForConstruct):
+ (JSC::DFG::canUseOSRExitFuzzing):
+ * dfg/DFGGraph.h:
+ (JSC::DFG::Graph::executableFor):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::compileFunction):
+ * dfg/DFGOSREntry.cpp:
+ (JSC::DFG::prepareOSREntry):
+ * dfg/DFGOSRExit.cpp:
+ (JSC::DFG::restoreCalleeSavesFor):
+ (JSC::DFG::saveCalleeSavesFor):
+ (JSC::DFG::saveOrCopyCalleeSavesFor):
+ * dfg/DFGOSRExitCompilerCommon.cpp:
+ (JSC::DFG::handleExitCounts):
+ * dfg/DFGOperations.cpp:
+ * dfg/DFGToFTLDeferredCompilationCallback.cpp:
+ (JSC::DFG::ToFTLDeferredCompilationCallback::compilationDidComplete):
+ * ftl/FTLCapabilities.cpp:
+ (JSC::FTL::canCompile):
+ * ftl/FTLLink.cpp:
+ (JSC::FTL::link):
+ * ftl/FTLOSRExitCompiler.cpp:
+ (JSC::FTL::compileStub):
+ * interpreter/CallFrame.cpp:
+ (JSC::CallFrame::callerSourceOrigin):
+ * interpreter/Interpreter.cpp:
+ (JSC::eval):
+ (JSC::UnwindFunctor::copyCalleeSavesToEntryFrameCalleeSavesBuffer const):
+ * interpreter/StackVisitor.cpp:
+ (JSC::StackVisitor::Frame::calleeSaveRegisters):
+ (JSC::StackVisitor::Frame::sourceURL const):
+ (JSC::StackVisitor::Frame::sourceID):
+ (JSC::StackVisitor::Frame::computeLineAndColumn const):
+ * interpreter/StackVisitor.h:
+ * jit/AssemblyHelpers.h:
+ (JSC::AssemblyHelpers::emitSaveCalleeSavesFor):
+ (JSC::AssemblyHelpers::emitSaveOrCopyCalleeSavesFor):
+ (JSC::AssemblyHelpers::emitRestoreCalleeSavesFor):
+ * jit/CallFrameShuffleData.cpp:
+ (JSC::CallFrameShuffleData::setupCalleeSaveRegisters):
+ * jit/JIT.cpp:
+ (JSC::JIT::compileWithoutLinking):
+ * jit/JITToDFGDeferredCompilationCallback.cpp:
+ (JSC::JITToDFGDeferredCompilationCallback::compilationDidComplete):
+ * jit/JITWorklist.cpp:
+ (JSC::JITWorklist::Plan::finalize):
+ (JSC::JITWorklist::compileNow):
+ * jit/RegisterAtOffsetList.cpp:
+ (JSC::RegisterAtOffsetList::llintBaselineCalleeSaveRegisters):
+ * jit/RegisterAtOffsetList.h:
+ (JSC::RegisterAtOffsetList::at const):
+ * runtime/ErrorInstance.cpp:
+ (JSC::appendSourceToError):
+ * runtime/ScriptExecutable.cpp:
+ (JSC::ScriptExecutable::newCodeBlockFor):
+ * runtime/StackFrame.cpp:
+ (JSC::StackFrame::sourceID const):
+ (JSC::StackFrame::sourceURL const):
+ (JSC::StackFrame::computeLineAndColumn const):
+
2019-02-08 Robin Morisset <[email protected]>
B3LowerMacros wrongly sets m_changed to true in the case of AtomicWeakCAS on x86
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -147,7 +147,7 @@
{
if (!m_hash) {
RELEASE_ASSERT(isSafeToComputeHash());
- m_hash = CodeBlockHash(ownerScriptExecutable()->source(), specializationKind());
+ m_hash = CodeBlockHash(ownerExecutable()->source(), specializationKind());
}
return m_hash;
}
@@ -155,9 +155,9 @@
CString CodeBlock::sourceCodeForTools() const
{
if (codeType() != FunctionCode)
- return ownerScriptExecutable()->source().toUTF8();
+ return ownerExecutable()->source().toUTF8();
- SourceProvider* provider = source();
+ SourceProvider* provider = source().provider();
FunctionExecutable* executable = jsCast<FunctionExecutable*>(ownerExecutable());
UnlinkedFunctionExecutable* unlinked = executable->unlinkedExecutable();
unsigned unlinkedStartOffset = unlinked->startOffset();
@@ -195,15 +195,15 @@
out.print(", ", instructionCount());
if (this->jitType() == JITCode::BaselineJIT && m_shouldAlwaysBeInlined)
out.print(" (ShouldAlwaysBeInlined)");
- if (ownerScriptExecutable()->neverInline())
+ if (ownerExecutable()->neverInline())
out.print(" (NeverInline)");
- if (ownerScriptExecutable()->neverOptimize())
+ if (ownerExecutable()->neverOptimize())
out.print(" (NeverOptimize)");
- else if (ownerScriptExecutable()->neverFTLOptimize())
+ else if (ownerExecutable()->neverFTLOptimize())
out.print(" (NeverFTLOptimize)");
- if (ownerScriptExecutable()->didTryToEnterInLoop())
+ if (ownerExecutable()->didTryToEnterInLoop())
out.print(" (DidTryToEnterInLoop)");
- if (ownerScriptExecutable()->isStrictMode())
+ if (ownerExecutable()->isStrictMode())
out.print(" (StrictMode)");
if (m_didFailJITCompilation)
out.print(" (JITFail)");
@@ -226,7 +226,7 @@
void CodeBlock::dumpSource(PrintStream& out)
{
- ScriptExecutable* executable = ownerScriptExecutable();
+ ScriptExecutable* executable = ownerExecutable();
if (executable->isFunctionExecutable()) {
FunctionExecutable* functionExecutable = reinterpret_cast<FunctionExecutable*>(executable);
StringView source = functionExecutable->source().provider()->getRange(
@@ -294,9 +294,6 @@
, m_didFailJITCompilation(false)
, m_didFailFTLCompilation(false)
, m_hasBeenCompiledWithFTL(false)
- , m_isConstructor(other.m_isConstructor)
- , m_isStrictMode(other.m_isStrictMode)
- , m_codeType(other.m_codeType)
, m_numCalleeLocals(other.m_numCalleeLocals)
, m_numVars(other.m_numVars)
, m_numberOfArgumentsToSkip(other.m_numberOfArgumentsToSkip)
@@ -303,18 +300,13 @@
, m_hasDebuggerStatement(false)
, m_steppingMode(SteppingModeDisabled)
, m_numBreakpoints(0)
+ , m_instructionCount(other.m_instructionCount)
+ , m_scopeRegister(other.m_scopeRegister)
+ , m_hash(other.m_hash)
, m_unlinkedCode(*other.vm(), this, other.m_unlinkedCode.get())
, m_ownerExecutable(*other.vm(), this, other.m_ownerExecutable.get())
, m_vm(other.m_vm)
- , m_instructions(other.m_instructions)
, m_instructionsRawPointer(other.m_instructionsRawPointer)
- , m_instructionCount(other.m_instructionCount)
- , m_thisRegister(other.m_thisRegister)
- , m_scopeRegister(other.m_scopeRegister)
- , m_hash(other.m_hash)
- , m_source(other.m_source)
- , m_sourceOffset(other.m_sourceOffset)
- , m_firstLineColumnOffset(other.m_firstLineColumnOffset)
, m_constantRegisters(other.m_constantRegisters)
, m_constantsSourceCodeRepresentation(other.m_constantsSourceCodeRepresentation)
, m_functionDecls(other.m_functionDecls)
@@ -328,6 +320,7 @@
ASSERT(heap()->isDeferred());
ASSERT(m_scopeRegister.isLocal());
+ ASSERT(source().provider());
setNumParameters(other.numParameters());
vm->heap.codeBlockSet().add(this);
@@ -350,8 +343,7 @@
}
}
-CodeBlock::CodeBlock(VM* vm, Structure* structure, ScriptExecutable* ownerExecutable, UnlinkedCodeBlock* unlinkedCodeBlock,
- JSScope* scope, RefPtr<SourceProvider>&& sourceProvider, unsigned sourceOffset, unsigned firstLineColumnOffset)
+CodeBlock::CodeBlock(VM* vm, Structure* structure, ScriptExecutable* ownerExecutable, UnlinkedCodeBlock* unlinkedCodeBlock, JSScope* scope)
: JSCell(*vm, structure)
, m_globalObject(*vm, this, scope->globalObject(*vm))
, m_shouldAlwaysBeInlined(true)
@@ -361,24 +353,16 @@
, m_didFailJITCompilation(false)
, m_didFailFTLCompilation(false)
, m_hasBeenCompiledWithFTL(false)
- , m_isConstructor(unlinkedCodeBlock->isConstructor())
- , m_isStrictMode(unlinkedCodeBlock->isStrictMode())
- , m_codeType(unlinkedCodeBlock->codeType())
, m_numCalleeLocals(unlinkedCodeBlock->numCalleeLocals())
, m_numVars(unlinkedCodeBlock->numVars())
, m_hasDebuggerStatement(false)
, m_steppingMode(SteppingModeDisabled)
, m_numBreakpoints(0)
+ , m_scopeRegister(unlinkedCodeBlock->scopeRegister())
, m_unlinkedCode(*vm, this, unlinkedCodeBlock)
, m_ownerExecutable(*vm, this, ownerExecutable)
, m_vm(vm)
- , m_instructions(&unlinkedCodeBlock->instructions())
- , m_instructionsRawPointer(m_instructions->rawPointer())
- , m_thisRegister(unlinkedCodeBlock->thisRegister())
- , m_scopeRegister(unlinkedCodeBlock->scopeRegister())
- , m_source(WTFMove(sourceProvider))
- , m_sourceOffset(sourceOffset)
- , m_firstLineColumnOffset(firstLineColumnOffset)
+ , m_instructionsRawPointer(unlinkedCodeBlock->instructions().rawPointer())
, m_osrExitCounter(0)
, m_optimizationDelayCounter(0)
, m_reoptimizationRetryCounter(0)
@@ -388,7 +372,7 @@
ASSERT(heap()->isDeferred());
ASSERT(m_scopeRegister.isLocal());
- ASSERT(m_source);
+ ASSERT(source().provider());
setNumParameters(unlinkedCodeBlock->numParameters());
vm->heap.codeBlockSet().add(this);
@@ -462,7 +446,7 @@
const UnlinkedHandlerInfo& unlinkedHandler = unlinkedCodeBlock->exceptionHandler(i);
HandlerInfo& handler = m_rareData->m_exceptionHandlers[i];
#if ENABLE(JIT)
- MacroAssemblerCodePtr<BytecodePtrTag> codePtr = m_instructions->at(unlinkedHandler.target)->isWide()
+ MacroAssemblerCodePtr<BytecodePtrTag> codePtr = instructions().at(unlinkedHandler.target)->isWide()
? LLInt::getWideCodePtr<BytecodePtrTag>(op_catch)
: LLInt::getCodePtr<BytecodePtrTag>(op_catch);
handler.initialize(unlinkedHandler, CodeLocationLabel<ExceptionHandlerPtrTag>(codePtr.retagged<ExceptionHandlerPtrTag>()));
@@ -496,10 +480,6 @@
}
}
-#if !ENABLE(C_LOOP)
- setCalleeSaveRegisters(RegisterSet::llintBaselineCalleeSaveRegisters());
-#endif
-
// Bookkeep the strongly referenced module environments.
HashSet<JSModuleEnvironment*> stronglyReferencedModuleEnvironments;
@@ -543,7 +523,8 @@
break; \
}
- for (const auto& instruction : *m_instructions) {
+ const InstructionStream& instructionStream = instructions();
+ for (const auto& instruction : instructionStream) {
OpcodeID opcodeID = instruction->opcodeID();
m_instructionCount += opcodeLengths[opcodeID];
switch (opcodeID) {
@@ -805,7 +786,7 @@
if (vm.controlFlowProfiler())
insertBasicBlockBoundariesForControlFlowProfiler();
- // Set optimization thresholds only after m_instructions is initialized, since these
+ // Set optimization thresholds only after instructions is initialized, since these
// rely on the instruction count (and are in theory permitted to also inspect the
// instruction stream to more accurate assess the cost of tier-up).
optimizeAfterWarmUp();
@@ -1090,8 +1071,9 @@
if (jitType() == JITCode::InterpreterThunk) {
const Vector<InstructionStream::Offset>& propertyAccessInstructions = m_unlinkedCode->propertyAccessInstructions();
+ const InstructionStream& instructionStream = instructions();
for (size_t i = 0; i < propertyAccessInstructions.size(); ++i) {
- auto instruction = m_instructions->at(propertyAccessInstructions[i]);
+ auto instruction = instructionStream.at(propertyAccessInstructions[i]);
if (instruction->is<OpPutById>()) {
auto& metadata = instruction->as<OpPutById>().metadata(this);
StructureID oldStructureID = metadata.m_oldStructureID;
@@ -1220,8 +1202,9 @@
structure.clear();
};
+ const InstructionStream& instructionStream = instructions();
for (size_t size = propertyAccessInstructions.size(), i = 0; i < size; ++i) {
- const auto curInstruction = m_instructions->at(propertyAccessInstructions[i]);
+ const auto curInstruction = instructionStream.at(propertyAccessInstructions[i]);
switch (curInstruction->opcodeID()) {
case op_get_by_id: {
auto& metadata = curInstruction->as<OpGetById>().metadata(this);
@@ -1528,6 +1511,18 @@
return 0;
}
+void CodeBlock::setCalleeSaveRegisters(RegisterSet calleeSaveRegisters)
+{
+ ConcurrentJSLocker locker(m_lock);
+ ensureJITData(locker).m_calleeSaveRegisters = std::make_unique<RegisterAtOffsetList>(calleeSaveRegisters);
+}
+
+void CodeBlock::setCalleeSaveRegisters(std::unique_ptr<RegisterAtOffsetList> registerAtOffsetList)
+{
+ ConcurrentJSLocker locker(m_lock);
+ ensureJITData(locker).m_calleeSaveRegisters = WTFMove(registerAtOffsetList);
+}
+
void CodeBlock::resetJITData()
{
RELEASE_ASSERT(!JITCode::isJIT(jitType()));
@@ -1716,7 +1711,7 @@
void CodeBlock::ensureCatchLivenessIsComputedForBytecodeOffset(InstructionStream::Offset bytecodeOffset)
{
- auto instruction = m_instructions->at(bytecodeOffset);
+ auto& instruction = instructions().at(bytecodeOffset);
OpCatch op = instruction->as<OpCatch>();
auto& metadata = op.metadata(this);
if (!!metadata.m_buffer) {
@@ -1723,7 +1718,9 @@
#if !ASSERT_DISABLED
ConcurrentJSLocker locker(m_lock);
bool found = false;
- for (auto& profile : m_catchProfiles) {
+ auto* rareData = m_rareData.get();
+ ASSERT(rareData);
+ for (auto& profile : rareData->m_catchProfiles) {
if (profile.get() == metadata.m_buffer) {
found = true;
break;
@@ -1746,7 +1743,7 @@
// we can avoid profiling them and extracting them when doing OSR entry
// into the DFG.
- auto nextOffset = m_instructions->at(bytecodeOffset).next().offset();
+ auto nextOffset = instructions().at(bytecodeOffset).next().offset();
FastBitVector liveLocals = bytecodeLiveness.getLivenessInfoAtBytecodeOffset(this, nextOffset);
Vector<VirtualRegister> liveOperands;
liveOperands.reserveInitialCapacity(liveLocals.bitCount());
@@ -1762,6 +1759,8 @@
for (unsigned i = 0; i < profiles->m_size; ++i)
profiles->m_buffer.get()[i].m_operand = liveOperands[i].offset();
+ createRareDataIfNecessary();
+
// The compiler thread will read this pointer value and then proceed to dereference it
// if it is not null. We need to make sure all above stores happen before this store so
// the compiler thread reads fully initialized data.
@@ -1768,10 +1767,9 @@
WTF::storeStoreFence();
op.metadata(this).m_buffer = profiles.get();
-
{
ConcurrentJSLocker locker(m_lock);
- m_catchProfiles.append(WTFMove(profiles));
+ m_rareData->m_catchProfiles.append(WTFMove(profiles));
}
}
@@ -1794,7 +1792,7 @@
unsigned CodeBlock::lineNumberForBytecodeOffset(unsigned bytecodeOffset)
{
RELEASE_ASSERT(bytecodeOffset < instructions().size());
- return ownerScriptExecutable()->firstLine() + m_unlinkedCode->lineNumberForBytecodeOffset(bytecodeOffset);
+ return ownerExecutable()->firstLine() + m_unlinkedCode->lineNumberForBytecodeOffset(bytecodeOffset);
}
unsigned CodeBlock::columnNumberForBytecodeOffset(unsigned bytecodeOffset)
@@ -1811,14 +1809,15 @@
void CodeBlock::expressionRangeForBytecodeOffset(unsigned bytecodeOffset, int& divot, int& startOffset, int& endOffset, unsigned& line, unsigned& column) const
{
m_unlinkedCode->expressionRangeForBytecodeOffset(bytecodeOffset, divot, startOffset, endOffset, line, column);
- divot += m_sourceOffset;
+ divot += sourceOffset();
column += line ? 1 : firstLineColumnOffset();
- line += ownerScriptExecutable()->firstLine();
+ line += ownerExecutable()->firstLine();
}
bool CodeBlock::hasOpDebugForLineAndColumn(unsigned line, unsigned column)
{
- for (const auto& it : *m_instructions) {
+ const InstructionStream& instructionStream = instructions();
+ for (const auto& it : instructionStream) {
if (it->is<OpDebug>()) {
int unused;
unsigned opDebugLine;
@@ -1896,7 +1895,7 @@
CodeBlock* CodeBlock::newReplacement()
{
- return ownerScriptExecutable()->newReplacementCodeBlockFor(specializationKind());
+ return ownerExecutable()->newReplacementCodeBlockFor(specializationKind());
}
#if ENABLE(JIT)
@@ -1905,7 +1904,7 @@
const ClassInfo* classInfo = this->classInfo(*vm());
if (classInfo == FunctionCodeBlock::info())
- return jsCast<FunctionExecutable*>(ownerExecutable())->codeBlockFor(m_isConstructor ? CodeForConstruct : CodeForCall);
+ return jsCast<FunctionExecutable*>(ownerExecutable())->codeBlockFor(isConstructor() ? CodeForConstruct : CodeForCall);
if (classInfo == EvalCodeBlock::info())
return jsCast<EvalExecutable*>(ownerExecutable())->codeBlock();
@@ -1925,7 +1924,7 @@
const ClassInfo* classInfo = this->classInfo(*vm());
if (classInfo == FunctionCodeBlock::info()) {
- if (m_isConstructor)
+ if (isConstructor())
return DFG::functionForConstructCapabilityLevel(this);
return DFG::functionForCallCapabilityLevel(this);
}
@@ -2006,7 +2005,7 @@
// This accomplishes (1), and does its own book-keeping about whether it has already happened.
if (!jitCode()->dfgCommon()->invalidate()) {
// We've already been invalidated.
- RELEASE_ASSERT(this != replacement() || (vm.heap.isCurrentThreadBusy() && !Heap::isMarked(ownerScriptExecutable())));
+ RELEASE_ASSERT(this != replacement() || (vm.heap.isCurrentThreadBusy() && !Heap::isMarked(ownerExecutable())));
return;
}
}
@@ -2038,11 +2037,11 @@
// Jettison can happen during GC. We don't want to install code to a dead executable
// because that would add a dead object to the remembered set.
- if (vm.heap.isCurrentThreadBusy() && !Heap::isMarked(ownerScriptExecutable()))
+ if (vm.heap.isCurrentThreadBusy() && !Heap::isMarked(ownerExecutable()))
return;
// This accomplishes (2).
- ownerScriptExecutable()->installCode(vm, alternative(), codeType(), specializationKind());
+ ownerExecutable()->installCode(vm, alternative(), codeType(), specializationKind());
#if ENABLE(DFG_JIT)
if (DFG::shouldDumpDisassembly())
@@ -2196,15 +2195,17 @@
}
#if !ENABLE(C_LOOP)
-void CodeBlock::setCalleeSaveRegisters(RegisterSet calleeSaveRegisters)
+const RegisterAtOffsetList* CodeBlock::calleeSaveRegisters() const
{
- m_calleeSaveRegisters = std::make_unique<RegisterAtOffsetList>(calleeSaveRegisters);
+#if ENABLE(JIT)
+ if (auto* jitData = m_jitData.get()) {
+ if (const RegisterAtOffsetList* registers = jitData->m_calleeSaveRegisters.get())
+ return registers;
+ }
+#endif
+ return &RegisterAtOffsetList::llintBaselineCalleeSaveRegisters();
}
-void CodeBlock::setCalleeSaveRegisters(std::unique_ptr<RegisterAtOffsetList> registerAtOffsetList)
-{
- m_calleeSaveRegisters = WTFMove(registerAtOffsetList);
-}
static size_t roundCalleeSaveSpaceAsVirtualRegisters(size_t calleeSaveRegisters)
{
@@ -2220,7 +2221,7 @@
size_t CodeBlock::calleeSaveSpaceAsVirtualRegisters()
{
- return roundCalleeSaveSpaceAsVirtualRegisters(m_calleeSaveRegisters->size());
+ return roundCalleeSaveSpaceAsVirtualRegisters(calleeSaveRegisters()->size());
}
#endif
@@ -2398,7 +2399,7 @@
bool didTryToEnterInLoop = false;
for (InlineCallFrame* inlineCallFrame = exit.m_codeOrigin.inlineCallFrame; inlineCallFrame; inlineCallFrame = inlineCallFrame->directCaller.inlineCallFrame) {
- if (inlineCallFrame->baselineCodeBlock->ownerScriptExecutable()->didTryToEnterInLoop()) {
+ if (inlineCallFrame->baselineCodeBlock->ownerExecutable()->didTryToEnterInLoop()) {
didTryToEnterInLoop = true;
break;
}
@@ -2555,7 +2556,7 @@
ArrayProfile* CodeBlock::getArrayProfile(const ConcurrentJSLocker&, unsigned bytecodeOffset)
{
- auto instruction = m_instructions->at(bytecodeOffset);
+ auto instruction = instructions().at(bytecodeOffset);
switch (instruction->opcodeID()) {
#define CASE(Op) \
case Op::opcodeID: \
@@ -2629,10 +2630,12 @@
profile.computeUpdatedPrediction(locker);
});
- for (auto& profileBucket : m_catchProfiles) {
- profileBucket->forEach([&] (ValueProfileAndOperand& profile) {
- profile.m_profile.computeUpdatedPrediction(locker);
- });
+ if (auto* rareData = m_rareData.get()) {
+ for (auto& profileBucket : rareData->m_catchProfiles) {
+ profileBucket->forEach([&] (ValueProfileAndOperand& profile) {
+ profile.m_profile.computeUpdatedPrediction(locker);
+ });
+ }
}
#if ENABLE(DFG_JIT)
@@ -2753,7 +2756,8 @@
return symbolTable->contains(locker, uid);
};
- for (const auto& instruction : *m_instructions) {
+ const InstructionStream& instructionStream = instructions();
+ for (const auto& instruction : instructionStream) {
OpcodeID opcodeID = instruction->opcodeID();
switch (opcodeID) {
case op_resolve_scope: {
@@ -2888,7 +2892,7 @@
ValueProfile* CodeBlock::tryGetValueProfileForBytecodeOffset(int bytecodeOffset)
{
- auto instruction = m_instructions->at(bytecodeOffset);
+ auto instruction = instructions().at(bytecodeOffset);
switch (instruction->opcodeID()) {
#define CASE(Op) \
@@ -2942,7 +2946,8 @@
}
}
- for (const auto& instruction : *m_instructions) {
+ const InstructionStream& instructionStream = instructions();
+ for (const auto& instruction : instructionStream) {
OpcodeID opcode = instruction->opcodeID();
if (!!baselineAlternative()->handlerForBytecodeOffset(instruction.offset())) {
if (opcode == op_catch || opcode == op_enter) {
@@ -2999,12 +3004,12 @@
{
int offset = bytecodeOffset(pc);
int target = m_unlinkedCode->outOfLineJumpOffset(offset);
- return m_instructions->at(offset + target).ptr();
+ return instructions().at(offset + target).ptr();
}
ArithProfile* CodeBlock::arithProfileForBytecodeOffset(InstructionStream::Offset bytecodeOffset)
{
- return arithProfileForPC(m_instructions->at(bytecodeOffset).ptr());
+ return arithProfileForPC(instructions().at(bytecodeOffset).ptr());
}
ArithProfile* CodeBlock::arithProfileForPC(const Instruction* pc)
@@ -3055,7 +3060,7 @@
// Because op_profile_control_flow is emitted at the beginning of every basic block, finding
// the next op_profile_control_flow will give us the text range of a single basic block.
size_t startIdx = bytecodeOffsets[i];
- auto instruction = m_instructions->at(startIdx);
+ auto instruction = instructions().at(startIdx);
RELEASE_ASSERT(instruction->opcodeID() == op_profile_control_flow);
auto bytecode = instruction->as<OpProfileControlFlow>();
auto& metadata = bytecode.metadata(this);
@@ -3063,11 +3068,11 @@
int basicBlockEndOffset;
if (i + 1 < offsetsLength) {
size_t endIdx = bytecodeOffsets[i + 1];
- auto endInstruction = m_instructions->at(endIdx);
+ auto endInstruction = instructions().at(endIdx);
RELEASE_ASSERT(endInstruction->opcodeID() == op_profile_control_flow);
basicBlockEndOffset = endInstruction->as<OpProfileControlFlow>().m_textOffset - 1;
} else {
- basicBlockEndOffset = m_sourceOffset + ownerScriptExecutable()->source().length() - 1; // Offset before the closing brace.
+ basicBlockEndOffset = sourceOffset() + ownerExecutable()->source().length() - 1; // Offset before the closing brace.
basicBlockStartOffset = std::min(basicBlockStartOffset, basicBlockEndOffset); // Some start offsets may be at the closing brace, ensure it is the offset before.
}
@@ -3095,7 +3100,7 @@
continue;
}
- BasicBlockLocation* basicBlockLocation = vm()->controlFlowProfiler()->getBasicBlockLocation(ownerScriptExecutable()->sourceID(), basicBlockStartOffset, basicBlockEndOffset);
+ BasicBlockLocation* basicBlockLocation = vm()->controlFlowProfiler()->getBasicBlockLocation(ownerExecutable()->sourceID(), basicBlockStartOffset, basicBlockEndOffset);
// Find all functions that are enclosed within the range: [basicBlockStartOffset, basicBlockEndOffset]
// and insert these functions' start/end offsets as gaps in the current BasicBlockLocation.
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (241221 => 241222)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h 2019-02-09 00:29:21 UTC (rev 241222)
@@ -121,7 +121,7 @@
protected:
CodeBlock(VM*, Structure*, CopyParsedBlockTag, CodeBlock& other);
- CodeBlock(VM*, Structure*, ScriptExecutable* ownerExecutable, UnlinkedCodeBlock*, JSScope*, RefPtr<SourceProvider>&&, unsigned sourceOffset, unsigned firstLineColumnOffset);
+ CodeBlock(VM*, Structure*, ScriptExecutable* ownerExecutable, UnlinkedCodeBlock*, JSScope*);
void finishCreation(VM&, CopyParsedBlockTag, CodeBlock& other);
bool finishCreation(VM&, ScriptExecutable* ownerExecutable, UnlinkedCodeBlock*, JSScope*);
@@ -179,7 +179,7 @@
CodeSpecializationKind specializationKind() const
{
- return specializationFromIsConstruct(m_isConstructor);
+ return specializationFromIsConstruct(isConstructor());
}
CodeBlock* alternativeForJettison();
@@ -211,8 +211,10 @@
void dumpMathICStats();
- bool isStrictMode() const { return m_isStrictMode; }
+ bool isStrictMode() const { return m_unlinkedCode->isStrictMode(); }
+ bool isConstructor() const { return m_unlinkedCode->isConstructor(); }
ECMAMode ecmaMode() const { return isStrictMode() ? StrictMode : NotStrictMode; }
+ CodeType codeType() const { return m_unlinkedCode->codeType(); }
JSParserScriptMode scriptMode() const { return m_unlinkedCode->scriptMode(); }
@@ -221,7 +223,7 @@
inline bool isKnownNotImmediate(int index)
{
- if (index == m_thisRegister.offset() && !m_isStrictMode)
+ if (index == thisRegister().offset() && !isStrictMode())
return true;
if (isConstantRegisterIndex(index))
@@ -263,6 +265,7 @@
SentinelLinkedList<PolymorphicCallNode, BasicRawSentinelNode<PolymorphicCallNode>> m_incomingPolymorphicCalls;
SegmentedVector<RareCaseProfile, 8> m_rareCaseProfiles;
std::unique_ptr<PCToCodeOriginMap> m_pcToCodeOriginMap;
+ std::unique_ptr<RegisterAtOffsetList> m_calleeSaveRegisters;
JITCodeMap m_jitCodeMap;
};
@@ -320,6 +323,9 @@
void setPCToCodeOriginMap(std::unique_ptr<PCToCodeOriginMap>&&);
Optional<CodeOrigin> findPC(void* pc);
+ void setCalleeSaveRegisters(RegisterSet);
+ void setCalleeSaveRegisters(std::unique_ptr<RegisterAtOffsetList>);
+
RareCaseProfile* addRareCaseProfile(int bytecodeOffset);
RareCaseProfile* rareCaseProfileForBytecodeOffset(const ConcurrentJSLocker&, int bytecodeOffset);
unsigned rareCaseProfileCountForBytecodeOffset(const ConcurrentJSLocker&, int bytecodeOffset);
@@ -374,7 +380,7 @@
return returnAddress - instructionsBegin;
}
- const InstructionStream& instructions() const { return *m_instructions; }
+ const InstructionStream& instructions() const { return m_unlinkedCode->instructions(); }
size_t predictedMachineCodeSize();
@@ -420,15 +426,13 @@
void jettison(Profiler::JettisonReason, ReoptimizationMode = DontCountReoptimization, const FireDetail* = nullptr);
- ExecutableBase* ownerExecutable() const { return m_ownerExecutable.get(); }
- ScriptExecutable* ownerScriptExecutable() const { return jsCast<ScriptExecutable*>(m_ownerExecutable.get()); }
+ ScriptExecutable* ownerExecutable() const { return m_ownerExecutable.get(); }
ExecutableToCodeBlockEdge* ownerEdge() const { return m_ownerEdge.get(); }
VM* vm() const { return m_vm; }
- void setThisRegister(VirtualRegister thisRegister) { m_thisRegister = thisRegister; }
- VirtualRegister thisRegister() const { return m_thisRegister; }
+ VirtualRegister thisRegister() const { return m_unlinkedCode->thisRegister(); }
bool usesEval() const { return m_unlinkedCode->usesEval(); }
@@ -443,11 +447,6 @@
return m_scopeRegister;
}
- CodeType codeType() const
- {
- return static_cast<CodeType>(m_codeType);
- }
-
PutPropertySlot::Context putByIdContext() const
{
if (codeType() == EvalCode)
@@ -455,9 +454,9 @@
return PutPropertySlot::PutById;
}
- SourceProvider* source() const { return m_source.get(); }
- unsigned sourceOffset() const { return m_sourceOffset; }
- unsigned firstLineColumnOffset() const { return m_firstLineColumnOffset; }
+ const SourceCode& source() const { return m_ownerExecutable->source(); }
+ unsigned sourceOffset() const { return m_ownerExecutable->source().startOffset(); }
+ unsigned firstLineColumnOffset() const { return m_ownerExecutable->startColumn(); }
size_t numberOfJumpTargets() const { return m_unlinkedCode->numberOfJumpTargets(); }
unsigned jumpTarget(int index) const { return m_unlinkedCode->jumpTarget(index); }
@@ -662,11 +661,8 @@
void countReoptimization();
#if !ENABLE(C_LOOP)
- void setCalleeSaveRegisters(RegisterSet);
- void setCalleeSaveRegisters(std::unique_ptr<RegisterAtOffsetList>);
+ const RegisterAtOffsetList* calleeSaveRegisters() const;
- RegisterAtOffsetList* calleeSaveRegisters() const { return m_calleeSaveRegisters.get(); }
-
static unsigned numberOfLLIntBaselineCalleeSaveRegisters() { return RegisterSet::llintBaselineCalleeSaveRegisters().numberOfSetRegisters(); }
static size_t llintBaselineCalleeSaveSpaceAsVirtualRegisters();
size_t calleeSaveSpaceAsVirtualRegisters();
@@ -834,9 +830,6 @@
bool m_didFailJITCompilation : 1;
bool m_didFailFTLCompilation : 1;
bool m_hasBeenCompiledWithFTL : 1;
- bool m_isConstructor : 1;
- bool m_isStrictMode : 1;
- unsigned m_codeType : 2; // CodeType
// Internal methods for use by validation code. It would be private if it wasn't
// for the fact that we use it from anonymous namespaces.
@@ -852,6 +845,8 @@
Vector<SimpleJumpTable> m_switchJumpTables;
Vector<StringJumpTable> m_stringSwitchJumpTables;
+ Vector<std::unique_ptr<ValueProfileAndOperandBuffer>> m_catchProfiles;
+
DirectEvalCodeCache m_directEvalCodeCache;
};
@@ -942,8 +937,11 @@
void createRareDataIfNecessary()
{
- if (!m_rareData)
- m_rareData = std::make_unique<RareData>();
+ if (!m_rareData) {
+ auto rareData = std::make_unique<RareData>();
+ WTF::storeStoreFence(); // m_catchProfiles can be touched from compiler threads.
+ m_rareData = WTFMove(rareData);
+ }
}
void insertBasicBlockBoundariesForControlFlowProfiler();
@@ -962,28 +960,19 @@
unsigned m_numBreakpoints : 30;
};
};
+ unsigned m_instructionCount { 0 };
+ VirtualRegister m_scopeRegister;
+ mutable CodeBlockHash m_hash;
+
WriteBarrier<UnlinkedCodeBlock> m_unlinkedCode;
- WriteBarrier<ExecutableBase> m_ownerExecutable;
+ WriteBarrier<ScriptExecutable> m_ownerExecutable;
WriteBarrier<ExecutableToCodeBlockEdge> m_ownerEdge;
VM* m_vm;
- const InstructionStream* m_instructions;
const void* m_instructionsRawPointer { nullptr };
- unsigned m_instructionCount { 0 };
- VirtualRegister m_thisRegister;
- VirtualRegister m_scopeRegister;
- mutable CodeBlockHash m_hash;
-
- RefPtr<SourceProvider> m_source;
- unsigned m_sourceOffset;
- unsigned m_firstLineColumnOffset;
-
SentinelLinkedList<LLIntCallLinkInfo, BasicRawSentinelNode<LLIntCallLinkInfo>> m_incomingLLIntCalls;
StructureWatchpointMap m_llintGetByIdWatchpointMap;
RefPtr<JITCode> m_jitCode;
-#if !ENABLE(C_LOOP)
- std::unique_ptr<RegisterAtOffsetList> m_calleeSaveRegisters;
-#endif
#if ENABLE(JIT)
std::unique_ptr<JITData> m_jitData;
#endif
@@ -993,7 +982,6 @@
CompressedLazyOperandValueProfileHolder m_lazyOperandValueProfiles;
#endif
RefCountedArray<ValueProfile> m_argumentValueProfiles;
- Vector<std::unique_ptr<ValueProfileAndOperandBuffer>> m_catchProfiles;
// Constant Pool
COMPILE_ASSERT(sizeof(Register) == sizeof(WriteBarrier<Unknown>), Register_must_be_same_size_as_WriteBarrier_Unknown);
@@ -1010,6 +998,7 @@
BaselineExecutionCounter m_jitExecuteCounter;
uint32_t m_osrExitCounter;
+
uint16_t m_optimizationDelayCounter;
uint16_t m_reoptimizationRetryCounter;
Modified: trunk/Source/_javascript_Core/bytecode/EvalCodeBlock.h (241221 => 241222)
--- trunk/Source/_javascript_Core/bytecode/EvalCodeBlock.h 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/bytecode/EvalCodeBlock.h 2019-02-09 00:29:21 UTC (rev 241222)
@@ -52,11 +52,10 @@
return instance;
}
- static EvalCodeBlock* create(VM* vm, EvalExecutable* ownerExecutable, UnlinkedEvalCodeBlock* unlinkedCodeBlock,
- JSScope* scope, RefPtr<SourceProvider>&& sourceProvider)
+ static EvalCodeBlock* create(VM* vm, EvalExecutable* ownerExecutable, UnlinkedEvalCodeBlock* unlinkedCodeBlock, JSScope* scope)
{
EvalCodeBlock* instance = new (NotNull, allocateCell<EvalCodeBlock>(vm->heap))
- EvalCodeBlock(vm, vm->evalCodeBlockStructure.get(), ownerExecutable, unlinkedCodeBlock, scope, WTFMove(sourceProvider));
+ EvalCodeBlock(vm, vm->evalCodeBlockStructure.get(), ownerExecutable, unlinkedCodeBlock, scope);
if (!instance->finishCreation(*vm, ownerExecutable, unlinkedCodeBlock, scope))
return nullptr;
return instance;
@@ -75,9 +74,8 @@
{
}
- EvalCodeBlock(VM* vm, Structure* structure, EvalExecutable* ownerExecutable, UnlinkedEvalCodeBlock* unlinkedCodeBlock,
- JSScope* scope, RefPtr<SourceProvider>&& sourceProvider)
- : GlobalCodeBlock(vm, structure, ownerExecutable, unlinkedCodeBlock, scope, WTFMove(sourceProvider), 0, 1)
+ EvalCodeBlock(VM* vm, Structure* structure, EvalExecutable* ownerExecutable, UnlinkedEvalCodeBlock* unlinkedCodeBlock, JSScope* scope)
+ : GlobalCodeBlock(vm, structure, ownerExecutable, unlinkedCodeBlock, scope)
{
}
};
Modified: trunk/Source/_javascript_Core/bytecode/FunctionCodeBlock.h (241221 => 241222)
--- trunk/Source/_javascript_Core/bytecode/FunctionCodeBlock.h 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/bytecode/FunctionCodeBlock.h 2019-02-09 00:29:21 UTC (rev 241222)
@@ -53,11 +53,10 @@
return instance;
}
- static FunctionCodeBlock* create(VM* vm, FunctionExecutable* ownerExecutable, UnlinkedFunctionCodeBlock* unlinkedCodeBlock, JSScope* scope,
- RefPtr<SourceProvider>&& sourceProvider, unsigned sourceOffset, unsigned firstLineColumnOffset)
+ static FunctionCodeBlock* create(VM* vm, FunctionExecutable* ownerExecutable, UnlinkedFunctionCodeBlock* unlinkedCodeBlock, JSScope* scope)
{
FunctionCodeBlock* instance = new (NotNull, allocateCell<FunctionCodeBlock>(vm->heap))
- FunctionCodeBlock(vm, vm->functionCodeBlockStructure.get(), ownerExecutable, unlinkedCodeBlock, scope, WTFMove(sourceProvider), sourceOffset, firstLineColumnOffset);
+ FunctionCodeBlock(vm, vm->functionCodeBlockStructure.get(), ownerExecutable, unlinkedCodeBlock, scope);
if (!instance->finishCreation(*vm, ownerExecutable, unlinkedCodeBlock, scope))
return nullptr;
return instance;
@@ -74,9 +73,8 @@
{
}
- FunctionCodeBlock(VM* vm, Structure* structure, FunctionExecutable* ownerExecutable, UnlinkedFunctionCodeBlock* unlinkedCodeBlock, JSScope* scope,
- RefPtr<SourceProvider>&& sourceProvider, unsigned sourceOffset, unsigned firstLineColumnOffset)
- : CodeBlock(vm, structure, ownerExecutable, unlinkedCodeBlock, scope, WTFMove(sourceProvider), sourceOffset, firstLineColumnOffset)
+ FunctionCodeBlock(VM* vm, Structure* structure, FunctionExecutable* ownerExecutable, UnlinkedFunctionCodeBlock* unlinkedCodeBlock, JSScope* scope)
+ : CodeBlock(vm, structure, ownerExecutable, unlinkedCodeBlock, scope)
{
}
};
Modified: trunk/Source/_javascript_Core/bytecode/GlobalCodeBlock.h (241221 => 241222)
--- trunk/Source/_javascript_Core/bytecode/GlobalCodeBlock.h 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/bytecode/GlobalCodeBlock.h 2019-02-09 00:29:21 UTC (rev 241222)
@@ -45,8 +45,8 @@
{
}
- GlobalCodeBlock(VM* vm, Structure* structure, ScriptExecutable* ownerExecutable, UnlinkedCodeBlock* unlinkedCodeBlock, JSScope* scope, RefPtr<SourceProvider>&& sourceProvider, unsigned sourceOffset, unsigned firstLineColumnOffset)
- : CodeBlock(vm, structure, ownerExecutable, unlinkedCodeBlock, scope, WTFMove(sourceProvider), sourceOffset, firstLineColumnOffset)
+ GlobalCodeBlock(VM* vm, Structure* structure, ScriptExecutable* ownerExecutable, UnlinkedCodeBlock* unlinkedCodeBlock, JSScope* scope)
+ : CodeBlock(vm, structure, ownerExecutable, unlinkedCodeBlock, scope)
{
}
};
Modified: trunk/Source/_javascript_Core/bytecode/ModuleProgramCodeBlock.h (241221 => 241222)
--- trunk/Source/_javascript_Core/bytecode/ModuleProgramCodeBlock.h 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/bytecode/ModuleProgramCodeBlock.h 2019-02-09 00:29:21 UTC (rev 241222)
@@ -53,11 +53,10 @@
return instance;
}
- static ModuleProgramCodeBlock* create(VM* vm, ModuleProgramExecutable* ownerExecutable, UnlinkedModuleProgramCodeBlock* unlinkedCodeBlock,
- JSScope* scope, RefPtr<SourceProvider>&& sourceProvider, unsigned firstLineColumnOffset)
+ static ModuleProgramCodeBlock* create(VM* vm, ModuleProgramExecutable* ownerExecutable, UnlinkedModuleProgramCodeBlock* unlinkedCodeBlock, JSScope* scope)
{
ModuleProgramCodeBlock* instance = new (NotNull, allocateCell<ModuleProgramCodeBlock>(vm->heap))
- ModuleProgramCodeBlock(vm, vm->moduleProgramCodeBlockStructure.get(), ownerExecutable, unlinkedCodeBlock, scope, WTFMove(sourceProvider), firstLineColumnOffset);
+ ModuleProgramCodeBlock(vm, vm->moduleProgramCodeBlockStructure.get(), ownerExecutable, unlinkedCodeBlock, scope);
if (!instance->finishCreation(*vm, ownerExecutable, unlinkedCodeBlock, scope))
return nullptr;
return instance;
@@ -74,9 +73,8 @@
{
}
- ModuleProgramCodeBlock(VM* vm, Structure* structure, ModuleProgramExecutable* ownerExecutable, UnlinkedModuleProgramCodeBlock* unlinkedCodeBlock,
- JSScope* scope, RefPtr<SourceProvider>&& sourceProvider, unsigned firstLineColumnOffset)
- : GlobalCodeBlock(vm, structure, ownerExecutable, unlinkedCodeBlock, scope, WTFMove(sourceProvider), 0, firstLineColumnOffset)
+ ModuleProgramCodeBlock(VM* vm, Structure* structure, ModuleProgramExecutable* ownerExecutable, UnlinkedModuleProgramCodeBlock* unlinkedCodeBlock, JSScope* scope)
+ : GlobalCodeBlock(vm, structure, ownerExecutable, unlinkedCodeBlock, scope)
{
}
};
Modified: trunk/Source/_javascript_Core/bytecode/ProgramCodeBlock.h (241221 => 241222)
--- trunk/Source/_javascript_Core/bytecode/ProgramCodeBlock.h 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/bytecode/ProgramCodeBlock.h 2019-02-09 00:29:21 UTC (rev 241222)
@@ -53,11 +53,10 @@
return instance;
}
- static ProgramCodeBlock* create(VM* vm, ProgramExecutable* ownerExecutable, UnlinkedProgramCodeBlock* unlinkedCodeBlock,
- JSScope* scope, RefPtr<SourceProvider>&& sourceProvider, unsigned firstLineColumnOffset)
+ static ProgramCodeBlock* create(VM* vm, ProgramExecutable* ownerExecutable, UnlinkedProgramCodeBlock* unlinkedCodeBlock, JSScope* scope)
{
ProgramCodeBlock* instance = new (NotNull, allocateCell<ProgramCodeBlock>(vm->heap))
- ProgramCodeBlock(vm, vm->programCodeBlockStructure.get(), ownerExecutable, unlinkedCodeBlock, scope, WTFMove(sourceProvider), firstLineColumnOffset);
+ ProgramCodeBlock(vm, vm->programCodeBlockStructure.get(), ownerExecutable, unlinkedCodeBlock, scope);
if (!instance->finishCreation(*vm, ownerExecutable, unlinkedCodeBlock, scope))
return nullptr;
return instance;
@@ -74,9 +73,8 @@
{
}
- ProgramCodeBlock(VM* vm, Structure* structure, ProgramExecutable* ownerExecutable, UnlinkedProgramCodeBlock* unlinkedCodeBlock,
- JSScope* scope, RefPtr<SourceProvider>&& sourceProvider, unsigned firstLineColumnOffset)
- : GlobalCodeBlock(vm, structure, ownerExecutable, unlinkedCodeBlock, scope, WTFMove(sourceProvider), 0, firstLineColumnOffset)
+ ProgramCodeBlock(VM* vm, Structure* structure, ProgramExecutable* ownerExecutable, UnlinkedProgramCodeBlock* unlinkedCodeBlock, JSScope* scope)
+ : GlobalCodeBlock(vm, structure, ownerExecutable, unlinkedCodeBlock, scope)
{
}
};
Modified: trunk/Source/_javascript_Core/debugger/Debugger.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/debugger/Debugger.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/debugger/Debugger.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -262,7 +262,7 @@
{
ASSERT(breakpoint.resolved);
- ScriptExecutable* executable = codeBlock->ownerScriptExecutable();
+ ScriptExecutable* executable = codeBlock->ownerExecutable();
SourceID sourceID = static_cast<SourceID>(executable->sourceID());
if (breakpoint.sourceID != sourceID)
Modified: trunk/Source/_javascript_Core/debugger/DebuggerCallFrame.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/debugger/DebuggerCallFrame.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/debugger/DebuggerCallFrame.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -129,7 +129,7 @@
if (!isValid())
return noSourceID;
if (isTailDeleted())
- return m_shadowChickenFrame.codeBlock->ownerScriptExecutable()->sourceID();
+ return m_shadowChickenFrame.codeBlock->ownerExecutable()->sourceID();
return sourceIDForCallFrame(m_validMachineFrame);
}
@@ -316,7 +316,7 @@
CodeBlock* codeBlock = callFrame->codeBlock();
if (!codeBlock)
return noSourceID;
- return codeBlock->ownerScriptExecutable()->sourceID();
+ return codeBlock->ownerExecutable()->sourceID();
}
} // namespace JSC
Modified: trunk/Source/_javascript_Core/debugger/DebuggerScope.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/debugger/DebuggerScope.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/debugger/DebuggerScope.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -245,7 +245,7 @@
if (!codeBlock)
return DebuggerLocation();
- ScriptExecutable* executable = codeBlock->ownerScriptExecutable();
+ ScriptExecutable* executable = codeBlock->ownerExecutable();
return DebuggerLocation(executable);
}
Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -1085,7 +1085,7 @@
CodeBlock* m_profiledBlock;
InlineCallFrame* m_inlineCallFrame;
- ScriptExecutable* executable() { return m_codeBlock->ownerScriptExecutable(); }
+ ScriptExecutable* executable() { return m_codeBlock->ownerExecutable(); }
QueryableExitProfile m_exitProfile;
@@ -1504,7 +1504,7 @@
VERBOSE_LOG(" Might inline function: ", mightInlineFunctionFor(codeBlock, specializationKind), "\n");
VERBOSE_LOG(" Might compile function: ", mightCompileFunctionFor(codeBlock, specializationKind), "\n");
VERBOSE_LOG(" Is supported for inlining: ", isSupportedForInlining(codeBlock), "\n");
- VERBOSE_LOG(" Is inlining candidate: ", codeBlock->ownerScriptExecutable()->isInliningCandidate(), "\n");
+ VERBOSE_LOG(" Is inlining candidate: ", codeBlock->ownerExecutable()->isInliningCandidate(), "\n");
if (!canInline(capabilityLevel)) {
VERBOSE_LOG(" Failing because the function is not inlineable.\n");
return UINT_MAX;
@@ -7094,7 +7094,7 @@
" ", inlineCallFrame()->directCaller);
}
dataLog(
- ", isStrictMode = ", codeBlock->ownerScriptExecutable()->isStrictMode(), "\n");
+ ", isStrictMode = ", codeBlock->ownerExecutable()->isStrictMode(), "\n");
codeBlock->baselineVersion()->dumpBytecode();
}
Modified: trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -44,7 +44,7 @@
bool isSupportedForInlining(CodeBlock* codeBlock)
{
- return codeBlock->ownerScriptExecutable()->isInliningCandidate();
+ return codeBlock->ownerExecutable()->isInliningCandidate();
}
bool mightCompileEval(CodeBlock* codeBlock)
@@ -51,25 +51,25 @@
{
return isSupported()
&& codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount()
- && codeBlock->ownerScriptExecutable()->isOkToOptimize();
+ && codeBlock->ownerExecutable()->isOkToOptimize();
}
bool mightCompileProgram(CodeBlock* codeBlock)
{
return isSupported()
&& codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount()
- && codeBlock->ownerScriptExecutable()->isOkToOptimize();
+ && codeBlock->ownerExecutable()->isOkToOptimize();
}
bool mightCompileFunctionForCall(CodeBlock* codeBlock)
{
return isSupported()
&& codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount()
- && codeBlock->ownerScriptExecutable()->isOkToOptimize();
+ && codeBlock->ownerExecutable()->isOkToOptimize();
}
bool mightCompileFunctionForConstruct(CodeBlock* codeBlock)
{
return isSupported()
&& codeBlock->instructionCount() <= Options::maximumOptimizationCandidateInstructionCount()
- && codeBlock->ownerScriptExecutable()->isOkToOptimize();
+ && codeBlock->ownerExecutable()->isOkToOptimize();
}
bool mightInlineFunctionForCall(CodeBlock* codeBlock)
@@ -89,7 +89,7 @@
}
bool canUseOSRExitFuzzing(CodeBlock* codeBlock)
{
- return codeBlock->ownerScriptExecutable()->canUseOSRExitFuzzing();
+ return codeBlock->ownerExecutable()->canUseOSRExitFuzzing();
}
static bool verboseCapabilities()
Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.h (241221 => 241222)
--- trunk/Source/_javascript_Core/dfg/DFGGraph.h 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.h 2019-02-09 00:29:21 UTC (rev 241222)
@@ -417,9 +417,9 @@
ScriptExecutable* executableFor(InlineCallFrame* inlineCallFrame)
{
if (!inlineCallFrame)
- return m_codeBlock->ownerScriptExecutable();
+ return m_codeBlock->ownerExecutable();
- return inlineCallFrame->baselineCodeBlock->ownerScriptExecutable();
+ return inlineCallFrame->baselineCodeBlock->ownerExecutable();
}
ScriptExecutable* executableFor(const CodeOrigin& codeOrigin)
Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -484,7 +484,7 @@
emitStoreCodeOrigin(CodeOrigin(0));
if (maxFrameExtentForSlowPathCall)
addPtr(TrustedImm32(-static_cast<int32_t>(maxFrameExtentForSlowPathCall)), stackPointerRegister);
- m_speculative->callOperationWithCallFrameRollbackOnException(m_codeBlock->m_isConstructor ? operationConstructArityCheck : operationCallArityCheck, GPRInfo::regT0);
+ m_speculative->callOperationWithCallFrameRollbackOnException(m_codeBlock->isConstructor() ? operationConstructArityCheck : operationCallArityCheck, GPRInfo::regT0);
if (maxFrameExtentForSlowPathCall)
addPtr(TrustedImm32(maxFrameExtentForSlowPathCall), stackPointerRegister);
branchTest32(Zero, GPRInfo::returnValueGPR).linkTo(fromArityCheck, this);
Modified: trunk/Source/_javascript_Core/dfg/DFGOSREntry.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/dfg/DFGOSREntry.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/dfg/DFGOSREntry.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -113,7 +113,7 @@
sanitizeStackForVM(vm);
if (bytecodeIndex)
- codeBlock->ownerScriptExecutable()->setDidTryToEnterInLoop(true);
+ codeBlock->ownerExecutable()->setDidTryToEnterInLoop(true);
if (codeBlock->jitType() != JITCode::DFGJIT) {
RELEASE_ASSERT(codeBlock->jitType() == JITCode::FTLJIT);
@@ -313,7 +313,7 @@
// 6) Copy our callee saves to buffer.
#if NUMBER_OF_CALLEE_SAVES_REGISTERS > 0
- RegisterAtOffsetList* registerSaveLocations = codeBlock->calleeSaveRegisters();
+ const RegisterAtOffsetList* registerSaveLocations = codeBlock->calleeSaveRegisters();
RegisterAtOffsetList* allCalleeSaves = RegisterSet::vmCalleeSaveRegisterOffsets();
RegisterSet dontSaveRegisters = RegisterSet(RegisterSet::stackRegisters(), RegisterSet::allFPRs());
Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -80,7 +80,7 @@
{
ASSERT(codeBlock);
- RegisterAtOffsetList* calleeSaves = codeBlock->calleeSaveRegisters();
+ const RegisterAtOffsetList* calleeSaves = codeBlock->calleeSaveRegisters();
RegisterSet dontRestoreRegisters = RegisterSet(RegisterSet::stackRegisters(), RegisterSet::allFPRs());
unsigned registerCount = calleeSaves->size();
@@ -103,7 +103,7 @@
auto& stack = context.stack();
ASSERT(codeBlock);
- RegisterAtOffsetList* calleeSaves = codeBlock->calleeSaveRegisters();
+ const RegisterAtOffsetList* calleeSaves = codeBlock->calleeSaveRegisters();
RegisterSet dontSaveRegisters = RegisterSet(RegisterSet::stackRegisters(), RegisterSet::allFPRs());
unsigned registerCount = calleeSaves->size();
@@ -182,7 +182,7 @@
Frame frame(context.fp(), context.stack());
ASSERT(codeBlock);
- RegisterAtOffsetList* calleeSaves = codeBlock->calleeSaveRegisters();
+ const RegisterAtOffsetList* calleeSaves = codeBlock->calleeSaveRegisters();
RegisterSet dontSaveRegisters = RegisterSet(RegisterSet::stackRegisters(), RegisterSet::allFPRs());
unsigned registerCount = calleeSaves->size();
Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilerCommon.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilerCommon.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilerCommon.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -78,7 +78,7 @@
jit.branchTest8(
AssemblyHelpers::NonZero,
AssemblyHelpers::AbsoluteAddress(
- inlineCallFrame->baselineCodeBlock->ownerScriptExecutable()->addressOfDidTryToEnterInLoop())));
+ inlineCallFrame->baselineCodeBlock->ownerExecutable()->addressOfDidTryToEnterInLoop())));
}
jit.move(
Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -3023,7 +3023,7 @@
bool didTryToEnterIntoInlinedLoops = false;
for (InlineCallFrame* inlineCallFrame = exit->m_codeOrigin.inlineCallFrame; inlineCallFrame; inlineCallFrame = inlineCallFrame->directCaller.inlineCallFrame) {
- if (inlineCallFrame->baselineCodeBlock->ownerScriptExecutable()->didTryToEnterInLoop()) {
+ if (inlineCallFrame->baselineCodeBlock->ownerExecutable()->didTryToEnterInLoop()) {
didTryToEnterIntoInlinedLoops = true;
break;
}
Modified: trunk/Source/_javascript_Core/dfg/DFGToFTLDeferredCompilationCallback.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/dfg/DFGToFTLDeferredCompilationCallback.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/dfg/DFGToFTLDeferredCompilationCallback.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -77,7 +77,7 @@
}
if (result == CompilationSuccessful)
- codeBlock->ownerScriptExecutable()->installCode(codeBlock);
+ codeBlock->ownerExecutable()->installCode(codeBlock);
profiledDFGCodeBlock->jitCode()->dfg()->setOptimizationThresholdBasedOnCompilationResult(
profiledDFGCodeBlock, result);
Modified: trunk/Source/_javascript_Core/ftl/FTLCapabilities.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/ftl/FTLCapabilities.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/ftl/FTLCapabilities.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -405,7 +405,7 @@
return CannotCompile;
}
- if (UNLIKELY(graph.m_codeBlock->ownerScriptExecutable()->neverFTLOptimize())) {
+ if (UNLIKELY(graph.m_codeBlock->ownerExecutable()->neverFTLOptimize())) {
if (verboseCapabilities())
dataLog("FTL rejecting ", *graph.m_codeBlock, " because it is marked as never FTL compile.\n");
return CannotCompile;
Modified: trunk/Source/_javascript_Core/ftl/FTLLink.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/ftl/FTLLink.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/ftl/FTLLink.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -171,7 +171,7 @@
state.allocationFailed = true;
return;
}
- linkBuffer->link(callArityCheck, FunctionPtr<OperationPtrTag>(codeBlock->m_isConstructor ? operationConstructArityCheck : operationCallArityCheck));
+ linkBuffer->link(callArityCheck, FunctionPtr<OperationPtrTag>(codeBlock->isConstructor() ? operationConstructArityCheck : operationCallArityCheck));
linkBuffer->link(callLookupExceptionHandlerFromCallerFrame, FunctionPtr<OperationPtrTag>(lookupExceptionHandlerFromCallerFrame));
linkBuffer->link(callArityFixup, FunctionPtr<JITThunkPtrTag>(vm.getCTIStub(arityFixupGenerator).code()));
linkBuffer->link(mainPathJumps, state.generatedFunction);
Modified: trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -419,7 +419,7 @@
jit.checkStackPointerAlignment();
RegisterSet allFTLCalleeSaves = RegisterSet::ftlCalleeSaveRegisters();
- RegisterAtOffsetList* baselineCalleeSaves = baselineCodeBlock->calleeSaveRegisters();
+ const RegisterAtOffsetList* baselineCalleeSaves = baselineCodeBlock->calleeSaveRegisters();
RegisterAtOffsetList* vmCalleeSaves = RegisterSet::vmCalleeSaveRegisterOffsets();
RegisterSet vmCalleeSavesToSkip = RegisterSet::stackRegisters();
if (exit.isExceptionHandler()) {
@@ -434,7 +434,7 @@
continue;
}
unsigned unwindIndex = codeBlock->calleeSaveRegisters()->indexOf(reg);
- RegisterAtOffset* baselineRegisterOffset = baselineCalleeSaves->find(reg);
+ const RegisterAtOffset* baselineRegisterOffset = baselineCalleeSaves->find(reg);
RegisterAtOffset* vmCalleeSave = nullptr;
if (exit.isExceptionHandler())
vmCalleeSave = vmCalleeSaves->find(reg);
Modified: trunk/Source/_javascript_Core/interpreter/CallFrame.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/interpreter/CallFrame.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/interpreter/CallFrame.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -253,7 +253,7 @@
// In the above case, the eval function will be interpreted as the indirect call to eval inside forEach function.
// At that time, the generated eval code should have the source origin to the original caller of the forEach function
// instead of the source origin of the forEach function.
- if (static_cast<FunctionExecutable*>(visitor->codeBlock()->ownerScriptExecutable())->isBuiltinFunction())
+ if (static_cast<FunctionExecutable*>(visitor->codeBlock()->ownerExecutable())->isBuiltinFunction())
return StackVisitor::Status::Continue;
FALLTHROUGH;
@@ -260,7 +260,7 @@
case StackVisitor::Frame::CodeType::Eval:
case StackVisitor::Frame::CodeType::Module:
case StackVisitor::Frame::CodeType::Global:
- sourceOrigin = visitor->codeBlock()->ownerScriptExecutable()->sourceOrigin();
+ sourceOrigin = visitor->codeBlock()->ownerExecutable()->sourceOrigin();
return StackVisitor::Status::Done;
case StackVisitor::Frame::CodeType::Native:
Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -160,7 +160,7 @@
VariableEnvironment variablesUnderTDZ;
JSScope::collectClosureVariablesUnderTDZ(callerScopeChain, variablesUnderTDZ);
- eval = DirectEvalExecutable::create(callFrame, makeSource(programSource, callerCodeBlock->source()->sourceOrigin()), callerCodeBlock->isStrictMode(), derivedContextType, isArrowFunctionContext, evalContextType, &variablesUnderTDZ);
+ eval = DirectEvalExecutable::create(callFrame, makeSource(programSource, callerCodeBlock->source().provider()->sourceOrigin()), callerCodeBlock->isStrictMode(), derivedContextType, isArrowFunctionContext, evalContextType, &variablesUnderTDZ);
EXCEPTION_ASSERT(!!scope.exception() == !eval);
if (!eval)
return jsUndefined();
@@ -564,7 +564,7 @@
void copyCalleeSavesToEntryFrameCalleeSavesBuffer(StackVisitor& visitor) const
{
#if !ENABLE(C_LOOP) && NUMBER_OF_CALLEE_SAVES_REGISTERS > 0
- RegisterAtOffsetList* currentCalleeSaves = visitor->calleeSaveRegisters();
+ const RegisterAtOffsetList* currentCalleeSaves = visitor->calleeSaveRegisters();
if (!currentCalleeSaves)
return;
Modified: trunk/Source/_javascript_Core/interpreter/StackVisitor.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/interpreter/StackVisitor.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/interpreter/StackVisitor.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -252,7 +252,7 @@
return CodeType::Global;
}
-RegisterAtOffsetList* StackVisitor::Frame::calleeSaveRegisters()
+const RegisterAtOffsetList* StackVisitor::Frame::calleeSaveRegisters()
{
if (isInlinedFrame())
return nullptr;
@@ -317,7 +317,7 @@
case CodeType::Module:
case CodeType::Function:
case CodeType::Global: {
- String sourceURL = codeBlock()->ownerScriptExecutable()->sourceURL();
+ String sourceURL = codeBlock()->ownerExecutable()->sourceURL();
if (!sourceURL.isEmpty())
traceLine = sourceURL.impl();
break;
@@ -358,7 +358,7 @@
intptr_t StackVisitor::Frame::sourceID()
{
if (CodeBlock* codeBlock = this->codeBlock())
- return codeBlock->ownerScriptExecutable()->sourceID();
+ return codeBlock->ownerExecutable()->sourceID();
return noSourceID;
}
@@ -403,10 +403,10 @@
unsigned divotColumn = 0;
retrieveExpressionInfo(divot, unusedStartOffset, unusedEndOffset, divotLine, divotColumn);
- line = divotLine + codeBlock->ownerScriptExecutable()->firstLine();
+ line = divotLine + codeBlock->ownerExecutable()->firstLine();
column = divotColumn + (divotLine ? 1 : codeBlock->firstLineColumnOffset());
- if (Optional<int> overrideLineNumber = codeBlock->ownerScriptExecutable()->overrideLineNumber(*codeBlock->vm()))
+ if (Optional<int> overrideLineNumber = codeBlock->ownerExecutable()->overrideLineNumber(*codeBlock->vm()))
line = overrideLineNumber.value();
}
Modified: trunk/Source/_javascript_Core/interpreter/StackVisitor.h (241221 => 241222)
--- trunk/Source/_javascript_Core/interpreter/StackVisitor.h 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/interpreter/StackVisitor.h 2019-02-09 00:29:21 UTC (rev 241222)
@@ -94,7 +94,7 @@
bool hasLineAndColumnInfo() const;
JS_EXPORT_PRIVATE void computeLineAndColumn(unsigned& line, unsigned& column) const;
- RegisterAtOffsetList* calleeSaveRegisters();
+ const RegisterAtOffsetList* calleeSaveRegisters();
ClonedArguments* createArguments();
CallFrame* callFrame() const { return m_callFrame; }
Modified: trunk/Source/_javascript_Core/jit/AssemblyHelpers.h (241221 => 241222)
--- trunk/Source/_javascript_Core/jit/AssemblyHelpers.h 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/jit/AssemblyHelpers.h 2019-02-09 00:29:21 UTC (rev 241222)
@@ -261,7 +261,7 @@
{
ASSERT(codeBlock);
- RegisterAtOffsetList* calleeSaves = codeBlock->calleeSaveRegisters();
+ const RegisterAtOffsetList* calleeSaves = codeBlock->calleeSaveRegisters();
RegisterSet dontSaveRegisters = RegisterSet(RegisterSet::stackRegisters(), RegisterSet::allFPRs());
unsigned registerCount = calleeSaves->size();
@@ -279,7 +279,7 @@
{
ASSERT(codeBlock);
- RegisterAtOffsetList* calleeSaves = codeBlock->calleeSaveRegisters();
+ const RegisterAtOffsetList* calleeSaves = codeBlock->calleeSaveRegisters();
RegisterSet dontSaveRegisters = RegisterSet(RegisterSet::stackRegisters(), RegisterSet::allFPRs());
unsigned registerCount = calleeSaves->size();
@@ -313,7 +313,7 @@
{
ASSERT(codeBlock);
- RegisterAtOffsetList* calleeSaves = codeBlock->calleeSaveRegisters();
+ const RegisterAtOffsetList* calleeSaves = codeBlock->calleeSaveRegisters();
RegisterSet dontRestoreRegisters = RegisterSet(RegisterSet::stackRegisters(), RegisterSet::allFPRs());
unsigned registerCount = calleeSaves->size();
@@ -409,7 +409,7 @@
addPtr(TrustedImm32(EntryFrame::calleeSaveRegistersBufferOffset()), temp1);
RegisterAtOffsetList* allCalleeSaves = RegisterSet::vmCalleeSaveRegisterOffsets();
- RegisterAtOffsetList* currentCalleeSaves = codeBlock()->calleeSaveRegisters();
+ const RegisterAtOffsetList* currentCalleeSaves = codeBlock()->calleeSaveRegisters();
RegisterSet dontCopyRegisters = RegisterSet::stackRegisters();
unsigned registerCount = allCalleeSaves->size();
Modified: trunk/Source/_javascript_Core/jit/CallFrameShuffleData.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/jit/CallFrameShuffleData.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/jit/CallFrameShuffleData.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -38,7 +38,7 @@
void CallFrameShuffleData::setupCalleeSaveRegisters(CodeBlock* codeBlock)
{
RegisterSet calleeSaveRegisters { RegisterSet::vmCalleeSaveRegisters() };
- RegisterAtOffsetList* registerSaveLocations = codeBlock->calleeSaveRegisters();
+ const RegisterAtOffsetList* registerSaveLocations = codeBlock->calleeSaveRegisters();
for (size_t i = 0; i < registerSaveLocations->size(); ++i) {
RegisterAtOffset entry { registerSaveLocations->at(i) };
Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/jit/JIT.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -687,7 +687,7 @@
for (int argument = 0; argument < m_codeBlock->numParameters(); ++argument) {
// If this is a constructor, then we want to put in a dummy profiling site (to
// keep things consistent) but we don't actually want to record the dummy value.
- if (m_codeBlock->m_isConstructor && !argument)
+ if (m_codeBlock->isConstructor() && !argument)
continue;
int offset = CallFrame::argumentOffsetIncludingThis(argument) * static_cast<int>(sizeof(Register));
#if USE(JSVALUE64)
@@ -748,7 +748,7 @@
if (maxFrameExtentForSlowPathCall)
addPtr(TrustedImm32(-static_cast<int32_t>(maxFrameExtentForSlowPathCall)), stackPointerRegister);
- callOperationWithCallFrameRollbackOnException(m_codeBlock->m_isConstructor ? operationConstructArityCheck : operationCallArityCheck);
+ callOperationWithCallFrameRollbackOnException(m_codeBlock->isConstructor() ? operationConstructArityCheck : operationCallArityCheck);
if (maxFrameExtentForSlowPathCall)
addPtr(TrustedImm32(maxFrameExtentForSlowPathCall), stackPointerRegister);
branchTest32(Zero, returnValueGPR).linkTo(beginLabel, this);
Modified: trunk/Source/_javascript_Core/jit/JITToDFGDeferredCompilationCallback.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/jit/JITToDFGDeferredCompilationCallback.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/jit/JITToDFGDeferredCompilationCallback.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -63,7 +63,7 @@
dataLog("Optimizing compilation of ", *codeBlock, " result: ", result, "\n");
if (result == CompilationSuccessful)
- codeBlock->ownerScriptExecutable()->installCode(codeBlock);
+ codeBlock->ownerExecutable()->installCode(codeBlock);
codeBlock->alternative()->setOptimizationThresholdBasedOnCompilationResult(result);
Modified: trunk/Source/_javascript_Core/jit/JITWorklist.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/jit/JITWorklist.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/jit/JITWorklist.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -65,7 +65,7 @@
case CompilationSuccessful:
if (Options::verboseOSR())
dataLogF(" JIT compilation successful.\n");
- m_codeBlock->ownerScriptExecutable()->installCode(m_codeBlock);
+ m_codeBlock->ownerExecutable()->installCode(m_codeBlock);
m_codeBlock->jitSoon();
return;
default:
@@ -309,7 +309,7 @@
// OK, just compile it.
JIT::compile(vm, codeBlock, JITCompilationMustSucceed, loopOSREntryBytecodeOffset);
- codeBlock->ownerScriptExecutable()->installCode(codeBlock);
+ codeBlock->ownerExecutable()->installCode(codeBlock);
}
void JITWorklist::finalizePlans(Plans& myPlans)
Modified: trunk/Source/_javascript_Core/jit/RegisterAtOffsetList.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/jit/RegisterAtOffsetList.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/jit/RegisterAtOffsetList.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -66,6 +66,16 @@
return UINT_MAX;
}
+const RegisterAtOffsetList& RegisterAtOffsetList::llintBaselineCalleeSaveRegisters()
+{
+ static std::once_flag onceKey;
+ static LazyNeverDestroyed<RegisterAtOffsetList> result;
+ std::call_once(onceKey, [] {
+ result.construct(RegisterSet::llintBaselineCalleeSaveRegisters());
+ });
+ return result.get();
+}
+
} // namespace JSC
#endif // ENABLE(ASSEMBLER)
Modified: trunk/Source/_javascript_Core/jit/RegisterAtOffsetList.h (241221 => 241222)
--- trunk/Source/_javascript_Core/jit/RegisterAtOffsetList.h 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/jit/RegisterAtOffsetList.h 2019-02-09 00:29:21 UTC (rev 241222)
@@ -52,6 +52,11 @@
return m_registers.size();
}
+ const RegisterAtOffset& at(size_t index) const
+ {
+ return m_registers.at(index);
+ }
+
RegisterAtOffset& at(size_t index)
{
return m_registers.at(index);
@@ -63,6 +68,8 @@
Vector<RegisterAtOffset>::const_iterator begin() const { return m_registers.begin(); }
Vector<RegisterAtOffset>::const_iterator end() const { return m_registers.end(); }
+ static const RegisterAtOffsetList& llintBaselineCalleeSaveRegisters(); // Registers and Offsets saved and used by the LLInt.
+
private:
Vector<RegisterAtOffset> m_registers;
};
Modified: trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -76,7 +76,7 @@
int expressionStart = divotPoint - startOffset;
int expressionStop = divotPoint + endOffset;
- StringView sourceString = codeBlock->source()->source();
+ StringView sourceString = codeBlock->source().provider()->source();
if (!expressionStop || expressionStart > static_cast<int>(sourceString.length()))
return;
@@ -87,7 +87,7 @@
String message = asString(jsMessage)->value(callFrame);
if (expressionStart < expressionStop)
- message = appender(message, codeBlock->source()->getRange(expressionStart, expressionStop).toString(), type, ErrorInstance::FoundExactSource);
+ message = appender(message, codeBlock->source().provider()->getRange(expressionStart, expressionStop).toString(), type, ErrorInstance::FoundExactSource);
else {
// No range information, so give a few characters of context.
int dataLength = sourceString.length();
@@ -103,7 +103,7 @@
stop++;
while (stop > expressionStart && isStrWhiteSpace(sourceString[stop - 1]))
stop--;
- message = appender(message, codeBlock->source()->getRange(start, stop).toString(), type, ErrorInstance::FoundApproximateSource);
+ message = appender(message, codeBlock->source().provider()->getRange(start, stop).toString(), type, ErrorInstance::FoundApproximateSource);
}
exception->putDirect(*vm, vm->propertyNames->message, jsString(vm, message));
Modified: trunk/Source/_javascript_Core/runtime/ScriptExecutable.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/runtime/ScriptExecutable.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/runtime/ScriptExecutable.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -269,8 +269,7 @@
RELEASE_ASSERT(!executable->m_evalCodeBlock);
RELEASE_ASSERT(!function);
auto codeBlock = EvalCodeBlock::create(vm,
- executable, executable->m_unlinkedEvalCodeBlock.get(), scope,
- executable->source().provider());
+ executable, executable->m_unlinkedEvalCodeBlock.get(), scope);
EXCEPTION_ASSERT(throwScope.exception() || codeBlock);
if (!codeBlock) {
exception = throwException(
@@ -287,8 +286,7 @@
RELEASE_ASSERT(!executable->m_programCodeBlock);
RELEASE_ASSERT(!function);
auto codeBlock = ProgramCodeBlock::create(vm,
- executable, executable->m_unlinkedProgramCodeBlock.get(), scope,
- executable->source().provider(), startColumn());
+ executable, executable->m_unlinkedProgramCodeBlock.get(), scope);
EXCEPTION_ASSERT(throwScope.exception() || codeBlock);
if (!codeBlock) {
exception = throwException(
@@ -305,8 +303,7 @@
RELEASE_ASSERT(!executable->m_moduleProgramCodeBlock);
RELEASE_ASSERT(!function);
auto codeBlock = ModuleProgramCodeBlock::create(vm,
- executable, executable->m_unlinkedModuleProgramCodeBlock.get(), scope,
- executable->source().provider(), startColumn());
+ executable, executable->m_unlinkedModuleProgramCodeBlock.get(), scope);
EXCEPTION_ASSERT(throwScope.exception() || codeBlock);
if (!codeBlock) {
exception = throwException(
@@ -338,8 +335,7 @@
return nullptr;
}
- RELEASE_AND_RETURN(throwScope, FunctionCodeBlock::create(vm, executable, unlinkedCodeBlock, scope,
- source().provider(), source().startOffset(), startColumn()));
+ RELEASE_AND_RETURN(throwScope, FunctionCodeBlock::create(vm, executable, unlinkedCodeBlock, scope));
}
CodeBlock* ScriptExecutable::newReplacementCodeBlockFor(
Modified: trunk/Source/_javascript_Core/runtime/StackFrame.cpp (241221 => 241222)
--- trunk/Source/_javascript_Core/runtime/StackFrame.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/_javascript_Core/runtime/StackFrame.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -55,7 +55,7 @@
{
if (!m_codeBlock)
return noSourceID;
- return m_codeBlock->ownerScriptExecutable()->sourceID();
+ return m_codeBlock->ownerExecutable()->sourceID();
}
String StackFrame::sourceURL() const
@@ -67,7 +67,7 @@
return "[native code]"_s;
}
- String sourceURL = m_codeBlock->ownerScriptExecutable()->sourceURL();
+ String sourceURL = m_codeBlock->ownerExecutable()->sourceURL();
if (!sourceURL.isNull())
return sourceURL;
return emptyString();
@@ -113,7 +113,7 @@
int unusedEndOffset = 0;
m_codeBlock->expressionRangeForBytecodeOffset(m_bytecodeOffset, divot, unusedStartOffset, unusedEndOffset, line, column);
- ScriptExecutable* executable = m_codeBlock->ownerScriptExecutable();
+ ScriptExecutable* executable = m_codeBlock->ownerExecutable();
if (Optional<int> overrideLineNumber = executable->overrideLineNumber(*m_codeBlock->vm()))
line = overrideLineNumber.value();
}
Modified: trunk/Source/WebCore/ChangeLog (241221 => 241222)
--- trunk/Source/WebCore/ChangeLog 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/WebCore/ChangeLog 2019-02-09 00:29:21 UTC (rev 241222)
@@ -1,3 +1,13 @@
+2019-02-08 Yusuke Suzuki <[email protected]>
+
+ [JSC] Shrink sizeof(CodeBlock) more
+ https://bugs.webkit.org/show_bug.cgi?id=194419
+
+ Reviewed by Mark Lam.
+
+ * testing/Internals.cpp:
+ (WebCore::Internals::parserMetaData):
+
2019-02-08 Chris Dumez <[email protected]>
[Cocoa] Optimize ResourceResponse::platformLazyInit()
Modified: trunk/Source/WebCore/testing/Internals.cpp (241221 => 241222)
--- trunk/Source/WebCore/testing/Internals.cpp 2019-02-09 00:28:19 UTC (rev 241221)
+++ trunk/Source/WebCore/testing/Internals.cpp 2019-02-09 00:29:21 UTC (rev 241222)
@@ -2128,7 +2128,7 @@
GetCallerCodeBlockFunctor iter;
exec->iterate(iter);
CodeBlock* codeBlock = iter.codeBlock();
- executable = codeBlock->ownerScriptExecutable();
+ executable = codeBlock->ownerExecutable();
} else if (code.isFunction(vm)) {
JSFunction* funcObj = JSC::jsCast<JSFunction*>(code.toObject(exec));
executable = funcObj->jsExecutable();