Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (226927 => 226928)
--- trunk/Source/_javascript_Core/ChangeLog 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/ChangeLog 2018-01-13 00:36:37 UTC (rev 226928)
@@ -1,3 +1,61 @@
+2018-01-12 Saam Barati <sbar...@apple.com>
+
+ Move ExitProfile to UnlinkedCodeBlock so it can be shared amongst CodeBlocks backed by the same UnlinkedCodeBlock
+ https://bugs.webkit.org/show_bug.cgi?id=181545
+
+ Reviewed by Michael Saboff.
+
+ This patch follows the theme of putting optimization profiling information on
+ UnlinkedCodeBlock. This allows the unlinked code cache to remember OSR exit data.
+ This often leads to the first compile of a CodeBlock, backed by an UnlinkedCodeBlock
+ pulled from the code cache, making better compilation decisions, usually
+ resulting in fewer exits, and fewer recompilations.
+
+ This is a 1% Speedometer progression in my testing.
+
+ * bytecode/BytecodeDumper.cpp:
+ (JSC::BytecodeDumper<CodeBlock>::dumpProfilesForBytecodeOffset):
+ * bytecode/CallLinkStatus.cpp:
+ (JSC::CallLinkStatus::computeFromLLInt):
+ (JSC::CallLinkStatus::computeFor):
+ (JSC::CallLinkStatus::computeExitSiteData):
+ (JSC::CallLinkStatus::computeDFGStatuses):
+ * bytecode/CallLinkStatus.h:
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::addFrequentExitSite): Deleted.
+ (JSC::CodeBlock::hasExitSite const): Deleted.
+ (JSC::CodeBlock::exitProfile): Deleted.
+ * bytecode/DFGExitProfile.cpp:
+ (JSC::DFG::ExitProfile::add):
+ (JSC::DFG::QueryableExitProfile::initialize):
+ * bytecode/DFGExitProfile.h:
+ (JSC::DFG::ExitProfile::hasExitSite const):
+ * bytecode/GetByIdStatus.cpp:
+ (JSC::GetByIdStatus::hasExitSite):
+ (JSC::GetByIdStatus::computeFor):
+ (JSC::GetByIdStatus::computeForStubInfo):
+ * bytecode/GetByIdStatus.h:
+ * bytecode/PutByIdStatus.cpp:
+ (JSC::PutByIdStatus::hasExitSite):
+ (JSC::PutByIdStatus::computeFor):
+ (JSC::PutByIdStatus::computeForStubInfo):
+ * bytecode/PutByIdStatus.h:
+ * bytecode/UnlinkedCodeBlock.cpp:
+ (JSC::UnlinkedCodeBlock::livenessAnalysisSlow):
+ * bytecode/UnlinkedCodeBlock.h:
+ (JSC::UnlinkedCodeBlock::hasExitSite const):
+ (JSC::UnlinkedCodeBlock::hasExitSite):
+ (JSC::UnlinkedCodeBlock::exitProfile):
+ * dfg/DFGByteCodeParser.cpp:
+ (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
+ * dfg/DFGGraph.h:
+ (JSC::DFG::Graph::hasGlobalExitSite):
+ (JSC::DFG::Graph::hasExitSite):
+ * dfg/DFGLICMPhase.cpp:
+ (JSC::DFG::LICMPhase::attemptHoist):
+ * dfg/DFGOSRExitBase.cpp:
+ (JSC::DFG::OSRExitBase::considerAddingAsFrequentExitSiteSlow):
+
2018-01-12 JF Bastien <jfbast...@apple.com>
PoisonedWriteBarrier
Modified: trunk/Source/_javascript_Core/bytecode/BytecodeDumper.cpp (226927 => 226928)
--- trunk/Source/_javascript_Core/bytecode/BytecodeDumper.cpp 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeDumper.cpp 2018-01-13 00:36:37 UTC (rev 226928)
@@ -226,7 +226,7 @@
}
#if ENABLE(DFG_JIT)
- Vector<DFG::FrequentExitSite> exitSites = block()->exitProfile().exitSitesFor(location);
+ Vector<DFG::FrequentExitSite> exitSites = block()->unlinkedCodeBlock()->exitProfile().exitSitesFor(location);
if (!exitSites.isEmpty()) {
out.print(" !! frequent exits: ");
CommaPrinter comma;
Modified: trunk/Source/_javascript_Core/bytecode/CallLinkStatus.cpp (226927 => 226928)
--- trunk/Source/_javascript_Core/bytecode/CallLinkStatus.cpp 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/bytecode/CallLinkStatus.cpp 2018-01-13 00:36:37 UTC (rev 226928)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -54,12 +54,12 @@
m_variants.append(CallVariant(value.asCell()));
}
-CallLinkStatus CallLinkStatus::computeFromLLInt(const ConcurrentJSLocker& locker, CodeBlock* profiledBlock, unsigned bytecodeIndex)
+CallLinkStatus CallLinkStatus::computeFromLLInt(const ConcurrentJSLocker&, CodeBlock* profiledBlock, unsigned bytecodeIndex)
{
UNUSED_PARAM(profiledBlock);
UNUSED_PARAM(bytecodeIndex);
#if ENABLE(DFG_JIT)
- if (profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCell))) {
+ if (profiledBlock->unlinkedCodeBlock()->hasExitSite(DFG::FrequentExitSite(bytecodeIndex, BadCell))) {
// We could force this to be a closure call, but instead we'll just assume that it
// takes slow path.
return takesSlowPath();
@@ -87,7 +87,7 @@
UNUSED_PARAM(bytecodeIndex);
UNUSED_PARAM(map);
#if ENABLE(DFG_JIT)
- ExitSiteData exitSiteData = computeExitSiteData(locker, profiledBlock, bytecodeIndex);
+ ExitSiteData exitSiteData = computeExitSiteData(profiledBlock, bytecodeIndex);
CallLinkInfo* callLinkInfo = map.get(CodeOrigin(bytecodeIndex));
if (!callLinkInfo) {
@@ -102,17 +102,18 @@
#endif
}
-CallLinkStatus::ExitSiteData CallLinkStatus::computeExitSiteData(
- const ConcurrentJSLocker& locker, CodeBlock* profiledBlock, unsigned bytecodeIndex)
+CallLinkStatus::ExitSiteData CallLinkStatus::computeExitSiteData(CodeBlock* profiledBlock, unsigned bytecodeIndex)
{
ExitSiteData exitSiteData;
-
#if ENABLE(DFG_JIT)
+ UnlinkedCodeBlock* codeBlock = profiledBlock->unlinkedCodeBlock();
+ ConcurrentJSLocker locker(codeBlock->m_lock);
+
exitSiteData.takesSlowPath =
- profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadType))
- || profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadExecutable));
+ codeBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadType))
+ || codeBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadExecutable));
exitSiteData.badFunction =
- profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCell));
+ codeBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCell));
#else
UNUSED_PARAM(locker);
UNUSED_PARAM(profiledBlock);
@@ -275,12 +276,7 @@
// InlineCallFrames.
CodeBlock* currentBaseline =
baselineCodeBlockForOriginAndBaselineCodeBlock(codeOrigin, baselineCodeBlock);
- ExitSiteData exitSiteData;
- {
- ConcurrentJSLocker locker(currentBaseline->m_lock);
- exitSiteData = computeExitSiteData(
- locker, currentBaseline, codeOrigin.bytecodeIndex);
- }
+ ExitSiteData exitSiteData = computeExitSiteData(currentBaseline, codeOrigin.bytecodeIndex);
{
ConcurrentJSLocker locker(dfgCodeBlock->m_lock);
Modified: trunk/Source/_javascript_Core/bytecode/CallLinkStatus.h (226927 => 226928)
--- trunk/Source/_javascript_Core/bytecode/CallLinkStatus.h 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/bytecode/CallLinkStatus.h 2018-01-13 00:36:37 UTC (rev 226928)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -67,7 +67,7 @@
bool takesSlowPath { false };
bool badFunction { false };
};
- static ExitSiteData computeExitSiteData(const ConcurrentJSLocker&, CodeBlock*, unsigned bytecodeIndex);
+ static ExitSiteData computeExitSiteData(CodeBlock*, unsigned bytecodeIndex);
#if ENABLE(JIT)
// Computes the status assuming that we never took slow path and never previously
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (226927 => 226928)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h 2018-01-13 00:36:37 UTC (rev 226928)
@@ -40,7 +40,6 @@
#include "CompilationResult.h"
#include "ConcurrentJSLock.h"
#include "DFGCommon.h"
-#include "DFGExitProfile.h"
#include "DirectEvalCodeCache.h"
#include "EvalExecutable.h"
#include "ExecutionCounter.h"
@@ -512,25 +511,6 @@
return codeOrigins()[index.bits()];
}
- bool addFrequentExitSite(const DFG::FrequentExitSite& site)
- {
- ASSERT(JITCode::isBaselineCode(jitType()));
- ConcurrentJSLocker locker(m_lock);
- return m_exitProfile.add(locker, this, site);
- }
-
- bool hasExitSite(const ConcurrentJSLocker& locker, const DFG::FrequentExitSite& site) const
- {
- return m_exitProfile.hasExitSite(locker, site);
- }
- bool hasExitSite(const DFG::FrequentExitSite& site) const
- {
- ConcurrentJSLocker locker(m_lock);
- return hasExitSite(locker, site);
- }
-
- DFG::ExitProfile& exitProfile() { return m_exitProfile; }
-
CompressedLazyOperandValueProfileHolder& lazyOperandValueProfiles()
{
return m_lazyOperandValueProfiles;
@@ -1019,7 +999,6 @@
#if ENABLE(DFG_JIT)
// This is relevant to non-DFG code blocks that serve as the profiled code block
// for DFG code blocks.
- DFG::ExitProfile m_exitProfile;
CompressedLazyOperandValueProfileHolder m_lazyOperandValueProfiles;
#endif
RefCountedArray<ValueProfile> m_argumentValueProfiles;
Modified: trunk/Source/_javascript_Core/bytecode/DFGExitProfile.cpp (226927 => 226928)
--- trunk/Source/_javascript_Core/bytecode/DFGExitProfile.cpp 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/bytecode/DFGExitProfile.cpp 2018-01-13 00:36:37 UTC (rev 226928)
@@ -41,8 +41,9 @@
ExitProfile::ExitProfile() { }
ExitProfile::~ExitProfile() { }
-bool ExitProfile::add(const ConcurrentJSLocker&, CodeBlock* owner, const FrequentExitSite& site)
+bool ExitProfile::add(CodeBlock* owner, const FrequentExitSite& site)
{
+ ConcurrentJSLocker locker(owner->unlinkedCodeBlock()->m_lock);
ASSERT(site.jitType() != ExitFromAnything);
CODEBLOCK_LOG_EVENT(owner, "frequentExit", (site));
@@ -49,12 +50,14 @@
if (Options::verboseExitProfile())
dataLog(pointerDump(owner), ": Adding exit site: ", site, "\n");
+
+ ExitProfile& profile = ""
// If we've never seen any frequent exits then create the list and put this site
// into it.
- if (!m_frequentExitSites) {
- m_frequentExitSites = std::make_unique<Vector<FrequentExitSite>>();
- m_frequentExitSites->append(site);
+ if (!profile.m_frequentExitSites) {
+ profile.m_frequentExitSites = std::make_unique<Vector<FrequentExitSite>>();
+ profile.m_frequentExitSites->append(site);
return true;
}
@@ -61,12 +64,12 @@
// Don't add it if it's already there. This is O(n), but that's OK, because we
// know that the total number of places where code exits tends to not be large,
// and this code is only used when recompilation is triggered.
- for (unsigned i = 0; i < m_frequentExitSites->size(); ++i) {
- if (m_frequentExitSites->at(i) == site)
+ for (unsigned i = 0; i < profile.m_frequentExitSites->size(); ++i) {
+ if (profile.m_frequentExitSites->at(i) == site)
return false;
}
- m_frequentExitSites->append(site);
+ profile.m_frequentExitSites->append(site);
return true;
}
@@ -100,8 +103,10 @@
QueryableExitProfile::QueryableExitProfile() { }
QueryableExitProfile::~QueryableExitProfile() { }
-void QueryableExitProfile::initialize(const ConcurrentJSLocker&, const ExitProfile& profile)
+void QueryableExitProfile::initialize(UnlinkedCodeBlock* unlinkedCodeBlock)
{
+ ConcurrentJSLocker locker(unlinkedCodeBlock->m_lock);
+ const ExitProfile& profile = ""
if (!profile.m_frequentExitSites)
return;
Modified: trunk/Source/_javascript_Core/bytecode/DFGExitProfile.h (226927 => 226928)
--- trunk/Source/_javascript_Core/bytecode/DFGExitProfile.h 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/bytecode/DFGExitProfile.h 2018-01-13 00:36:37 UTC (rev 226928)
@@ -160,7 +160,7 @@
// be called a fixed number of times per recompilation. Recompilation is
// rare to begin with, and implies doing O(n) operations on the CodeBlock
// anyway.
- bool add(const ConcurrentJSLocker&, CodeBlock* owner, const FrequentExitSite&);
+ static bool add(CodeBlock*, const FrequentExitSite&);
// Get the frequent exit sites for a bytecode index. This is O(n), and is
// meant to only be used from debugging/profiling code.
@@ -175,10 +175,6 @@
{
return hasExitSite(locker, FrequentExitSite(kind));
}
- bool hasExitSite(const ConcurrentJSLocker& locker, unsigned bytecodeIndex, ExitKind kind) const
- {
- return hasExitSite(locker, FrequentExitSite(bytecodeIndex, kind));
- }
private:
friend class QueryableExitProfile;
@@ -191,7 +187,7 @@
QueryableExitProfile();
~QueryableExitProfile();
- void initialize(const ConcurrentJSLocker&, const ExitProfile&);
+ void initialize(UnlinkedCodeBlock*);
bool hasExitSite(const FrequentExitSite& site) const
{
Modified: trunk/Source/_javascript_Core/bytecode/GetByIdStatus.cpp (226927 => 226928)
--- trunk/Source/_javascript_Core/bytecode/GetByIdStatus.cpp 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/bytecode/GetByIdStatus.cpp 2018-01-13 00:36:37 UTC (rev 226928)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -65,10 +65,12 @@
}
#if ENABLE(DFG_JIT)
-bool GetByIdStatus::hasExitSite(const ConcurrentJSLocker& locker, CodeBlock* profiledBlock, unsigned bytecodeIndex)
+bool GetByIdStatus::hasExitSite(CodeBlock* profiledBlock, unsigned bytecodeIndex)
{
- return profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCache))
- || profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadConstantCache));
+ UnlinkedCodeBlock* unlinkedCodeBlock = profiledBlock->unlinkedCodeBlock();
+ ConcurrentJSLocker locker(unlinkedCodeBlock->m_lock);
+ return unlinkedCodeBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCache))
+ || unlinkedCodeBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadConstantCache));
}
#endif
@@ -119,10 +121,10 @@
#if ENABLE(DFG_JIT)
result = computeForStubInfoWithoutExitSiteFeedback(
locker, profiledBlock, map.get(CodeOrigin(bytecodeIndex)), uid,
- CallLinkStatus::computeExitSiteData(locker, profiledBlock, bytecodeIndex));
+ CallLinkStatus::computeExitSiteData(profiledBlock, bytecodeIndex));
if (!result.takesSlowPath()
- && hasExitSite(locker, profiledBlock, bytecodeIndex))
+ && hasExitSite(profiledBlock, bytecodeIndex))
return GetByIdStatus(result.makesCalls() ? MakesCalls : TakesSlowPath, true);
#else
UNUSED_PARAM(map);
@@ -139,9 +141,9 @@
{
GetByIdStatus result = GetByIdStatus::computeForStubInfoWithoutExitSiteFeedback(
locker, profiledBlock, stubInfo, uid,
- CallLinkStatus::computeExitSiteData(locker, profiledBlock, codeOrigin.bytecodeIndex));
+ CallLinkStatus::computeExitSiteData(profiledBlock, codeOrigin.bytecodeIndex));
- if (!result.takesSlowPath() && GetByIdStatus::hasExitSite(locker, profiledBlock, codeOrigin.bytecodeIndex))
+ if (!result.takesSlowPath() && GetByIdStatus::hasExitSite(profiledBlock, codeOrigin.bytecodeIndex))
return GetByIdStatus(result.makesCalls() ? GetByIdStatus::MakesCalls : GetByIdStatus::TakesSlowPath, true);
return result;
}
@@ -328,7 +330,7 @@
{
ConcurrentJSLocker locker(profiledBlock->m_lock);
exitSiteData = CallLinkStatus::computeExitSiteData(
- locker, profiledBlock, codeOrigin.bytecodeIndex);
+ profiledBlock, codeOrigin.bytecodeIndex);
}
GetByIdStatus result;
@@ -341,11 +343,8 @@
if (result.takesSlowPath())
return result;
- {
- ConcurrentJSLocker locker(profiledBlock->m_lock);
- if (hasExitSite(locker, profiledBlock, codeOrigin.bytecodeIndex))
- return GetByIdStatus(TakesSlowPath, true);
- }
+ if (hasExitSite(profiledBlock, codeOrigin.bytecodeIndex))
+ return GetByIdStatus(TakesSlowPath, true);
if (result.isSet())
return result;
Modified: trunk/Source/_javascript_Core/bytecode/GetByIdStatus.h (226927 => 226928)
--- trunk/Source/_javascript_Core/bytecode/GetByIdStatus.h 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/bytecode/GetByIdStatus.h 2018-01-13 00:36:37 UTC (rev 226928)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -119,7 +119,7 @@
private:
#if ENABLE(DFG_JIT)
- static bool hasExitSite(const ConcurrentJSLocker&, CodeBlock*, unsigned bytecodeIndex);
+ static bool hasExitSite(CodeBlock*, unsigned bytecodeIndex);
#endif
#if ENABLE(JIT)
GetByIdStatus(const ModuleNamespaceAccessCase&);
Modified: trunk/Source/_javascript_Core/bytecode/PutByIdStatus.cpp (226927 => 226928)
--- trunk/Source/_javascript_Core/bytecode/PutByIdStatus.cpp 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/bytecode/PutByIdStatus.cpp 2018-01-13 00:36:37 UTC (rev 226928)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -55,11 +55,12 @@
}
#if ENABLE(DFG_JIT)
-bool PutByIdStatus::hasExitSite(const ConcurrentJSLocker& locker, CodeBlock* profiledBlock, unsigned bytecodeIndex)
+bool PutByIdStatus::hasExitSite(CodeBlock* profiledBlock, unsigned bytecodeIndex)
{
- return profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCache))
- || profiledBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadConstantCache));
-
+ UnlinkedCodeBlock* unlinkedCodeBlock = profiledBlock->unlinkedCodeBlock();
+ ConcurrentJSLocker locker(unlinkedCodeBlock->m_lock);
+ return unlinkedCodeBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadCache))
+ || unlinkedCodeBlock->hasExitSite(locker, DFG::FrequentExitSite(bytecodeIndex, BadConstantCache));
}
#endif
@@ -117,13 +118,13 @@
UNUSED_PARAM(bytecodeIndex);
UNUSED_PARAM(uid);
#if ENABLE(DFG_JIT)
- if (hasExitSite(locker, profiledBlock, bytecodeIndex))
+ if (hasExitSite(profiledBlock, bytecodeIndex))
return PutByIdStatus(TakesSlowPath);
StructureStubInfo* stubInfo = map.get(CodeOrigin(bytecodeIndex));
PutByIdStatus result = computeForStubInfo(
locker, profiledBlock, stubInfo, uid,
- CallLinkStatus::computeExitSiteData(locker, profiledBlock, bytecodeIndex));
+ CallLinkStatus::computeExitSiteData(profiledBlock, bytecodeIndex));
if (!result)
return computeFromLLInt(profiledBlock, bytecodeIndex, uid);
@@ -139,7 +140,7 @@
{
return computeForStubInfo(
locker, baselineBlock, stubInfo, uid,
- CallLinkStatus::computeExitSiteData(locker, baselineBlock, codeOrigin.bytecodeIndex));
+ CallLinkStatus::computeExitSiteData(baselineBlock, codeOrigin.bytecodeIndex));
}
PutByIdStatus PutByIdStatus::computeForStubInfo(
@@ -267,13 +268,13 @@
{
#if ENABLE(DFG_JIT)
if (dfgBlock) {
+ if (hasExitSite(baselineBlock, codeOrigin.bytecodeIndex))
+ return PutByIdStatus(TakesSlowPath);
CallLinkStatus::ExitSiteData exitSiteData;
{
ConcurrentJSLocker locker(baselineBlock->m_lock);
- if (hasExitSite(locker, baselineBlock, codeOrigin.bytecodeIndex))
- return PutByIdStatus(TakesSlowPath);
exitSiteData = CallLinkStatus::computeExitSiteData(
- locker, baselineBlock, codeOrigin.bytecodeIndex);
+ baselineBlock, codeOrigin.bytecodeIndex);
}
PutByIdStatus result;
Modified: trunk/Source/_javascript_Core/bytecode/PutByIdStatus.h (226927 => 226928)
--- trunk/Source/_javascript_Core/bytecode/PutByIdStatus.h 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/bytecode/PutByIdStatus.h 2018-01-13 00:36:37 UTC (rev 226928)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -95,7 +95,7 @@
private:
#if ENABLE(DFG_JIT)
- static bool hasExitSite(const ConcurrentJSLocker&, CodeBlock*, unsigned bytecodeIndex);
+ static bool hasExitSite(CodeBlock*, unsigned bytecodeIndex);
#endif
#if ENABLE(JIT)
static PutByIdStatus computeForStubInfo(
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp (226927 => 226928)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.cpp 2018-01-13 00:36:37 UTC (rev 226928)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2017 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -422,12 +422,11 @@
{
RELEASE_ASSERT(codeBlock->unlinkedCodeBlock() == this);
-
{
- auto locker = holdLock(m_lock);
+ ConcurrentJSLocker locker(m_lock);
if (!m_liveness) {
// There is a chance two compiler threads raced to the slow path.
- // We defend against computing liveness twice.
+ // Grabbing the lock above defends against computing liveness twice.
m_liveness = std::make_unique<BytecodeLivenessAnalysis>(codeBlock);
}
}
Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h (226927 => 226928)
--- trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedCodeBlock.h 2018-01-13 00:36:37 UTC (rev 226928)
@@ -27,6 +27,7 @@
#include "BytecodeConventions.h"
#include "CodeType.h"
+#include "DFGExitProfile.h"
#include "ExpressionRangeInfo.h"
#include "HandlerInfo.h"
#include "Identifier.h"
@@ -383,6 +384,21 @@
return livenessAnalysisSlow(codeBlock);
}
+#if ENABLE(DFG_JIT)
+ bool hasExitSite(const ConcurrentJSLocker& locker, const DFG::FrequentExitSite& site) const
+ {
+ return m_exitProfile.hasExitSite(locker, site);
+ }
+
+ bool hasExitSite(const DFG::FrequentExitSite& site)
+ {
+ ConcurrentJSLocker locker(m_lock);
+ return hasExitSite(locker, site);
+ }
+
+ DFG::ExitProfile& exitProfile() { return m_exitProfile; }
+#endif
+
protected:
UnlinkedCodeBlock(VM*, Structure*, CodeType, const ExecutableInfo&, DebuggerMode);
~UnlinkedCodeBlock();
@@ -419,6 +435,10 @@
String m_sourceURLDirective;
String m_sourceMappingURLDirective;
+#if ENABLE(DFG_JIT)
+ DFG::ExitProfile m_exitProfile;
+#endif
+
unsigned m_usesEval : 1;
unsigned m_isStrictMode : 1;
unsigned m_isConstructor : 1;
@@ -436,7 +456,9 @@
unsigned m_lineCount;
unsigned m_endColumn;
- Lock m_lock;
+public:
+ ConcurrentJSLock m_lock;
+private:
TriState m_didOptimize;
SourceParseMode m_parseMode;
CodeFeatures m_features;
Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (226927 => 226928)
--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp 2018-01-13 00:36:37 UTC (rev 226928)
@@ -6394,9 +6394,10 @@
, m_caller(byteCodeParser->m_inlineStackTop)
{
{
+ m_exitProfile.initialize(m_profiledBlock->unlinkedCodeBlock());
+
ConcurrentJSLocker locker(m_profiledBlock->m_lock);
m_lazyOperands.initialize(locker, m_profiledBlock->lazyOperandValueProfiles());
- m_exitProfile.initialize(locker, profiledBlock->exitProfile());
// We do this while holding the lock because we want to encourage StructureStubInfo's
// to be potentially added to operations and because the profiled block could be in the
Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.h (226927 => 226928)
--- trunk/Source/_javascript_Core/dfg/DFGGraph.h 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.h 2018-01-13 00:36:37 UTC (rev 226928)
@@ -469,12 +469,12 @@
bool hasGlobalExitSite(const CodeOrigin& codeOrigin, ExitKind exitKind)
{
- return baselineCodeBlockFor(codeOrigin)->hasExitSite(FrequentExitSite(exitKind));
+ return baselineCodeBlockFor(codeOrigin)->unlinkedCodeBlock()->hasExitSite(FrequentExitSite(exitKind));
}
bool hasExitSite(const CodeOrigin& codeOrigin, ExitKind exitKind)
{
- return baselineCodeBlockFor(codeOrigin)->hasExitSite(FrequentExitSite(codeOrigin.bytecodeIndex, exitKind));
+ return baselineCodeBlockFor(codeOrigin)->unlinkedCodeBlock()->hasExitSite(FrequentExitSite(codeOrigin.bytecodeIndex, exitKind));
}
bool hasExitSite(Node* node, ExitKind exitKind)
Modified: trunk/Source/_javascript_Core/dfg/DFGLICMPhase.cpp (226927 => 226928)
--- trunk/Source/_javascript_Core/dfg/DFGLICMPhase.cpp 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/dfg/DFGLICMPhase.cpp 2018-01-13 00:36:37 UTC (rev 226928)
@@ -281,7 +281,7 @@
&& !m_graph.m_controlEquivalenceAnalysis->dominatesEquivalently(data.preHeader, fromBlock);
if (addsBlindSpeculation
- && m_graph.baselineCodeBlockFor(originalOrigin.semantic)->hasExitSite(FrequentExitSite(HoistingFailed))) {
+ && m_graph.hasExitSite(originalOrigin.semantic, HoistingFailed)) {
if (verbose) {
dataLog(
" Not hoisting ", node, " because it may exit and the pre-header (",
Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExitBase.cpp (226927 => 226928)
--- trunk/Source/_javascript_Core/dfg/DFGOSRExitBase.cpp 2018-01-13 00:30:02 UTC (rev 226927)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExitBase.cpp 2018-01-13 00:36:37 UTC (rev 226928)
@@ -47,7 +47,7 @@
site = FrequentExitSite(HoistingFailed, jitType);
else
site = FrequentExitSite(m_codeOriginForExitProfile.bytecodeIndex, m_kind, jitType);
- sourceProfiledCodeBlock->addFrequentExitSite(site);
+ ExitProfile::add(sourceProfiledCodeBlock, site);
}
}