Title: [199376] trunk/Source/_javascript_Core
- Revision
- 199376
- Author
- [email protected]
- Date
- 2016-04-12 11:38:16 -0700 (Tue, 12 Apr 2016)
Log Message
There is a race with the compiler thread and the main thread with result profiles
https://bugs.webkit.org/show_bug.cgi?id=156503
Reviewed by Filip Pizlo.
The compiler thread should not be asking for a result
profile while the execution thread is creating one.
We must guard against such races with a lock.
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::resultProfileForBytecodeOffset):
(JSC::CodeBlock::ensureResultProfile):
(JSC::CodeBlock::capabilityLevel):
* bytecode/CodeBlock.h:
(JSC::CodeBlock::couldTakeSlowCase):
(JSC::CodeBlock::numberOfResultProfiles):
(JSC::CodeBlock::specialFastCaseProfileCountForBytecodeOffset):
(JSC::CodeBlock::ensureResultProfile): Deleted.
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (199375 => 199376)
--- trunk/Source/_javascript_Core/ChangeLog 2016-04-12 18:33:56 UTC (rev 199375)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-04-12 18:38:16 UTC (rev 199376)
@@ -1,3 +1,24 @@
+2016-04-12 Saam barati <[email protected]>
+
+ There is a race with the compiler thread and the main thread with result profiles
+ https://bugs.webkit.org/show_bug.cgi?id=156503
+
+ Reviewed by Filip Pizlo.
+
+ The compiler thread should not be asking for a result
+ profile while the execution thread is creating one.
+ We must guard against such races with a lock.
+
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::resultProfileForBytecodeOffset):
+ (JSC::CodeBlock::ensureResultProfile):
+ (JSC::CodeBlock::capabilityLevel):
+ * bytecode/CodeBlock.h:
+ (JSC::CodeBlock::couldTakeSlowCase):
+ (JSC::CodeBlock::numberOfResultProfiles):
+ (JSC::CodeBlock::specialFastCaseProfileCountForBytecodeOffset):
+ (JSC::CodeBlock::ensureResultProfile): Deleted.
+
2016-04-12 Commit Queue <[email protected]>
Unreviewed, rolling out r199339.
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (199375 => 199376)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2016-04-12 18:33:56 UTC (rev 199375)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2016-04-12 18:38:16 UTC (rev 199376)
@@ -4229,6 +4229,13 @@
ResultProfile* CodeBlock::resultProfileForBytecodeOffset(int bytecodeOffset)
{
+ ConcurrentJITLocker locker(m_lock);
+ return resultProfileForBytecodeOffset(locker, bytecodeOffset);
+}
+
+ResultProfile* CodeBlock::resultProfileForBytecodeOffset(const ConcurrentJITLocker&, int bytecodeOffset)
+{
+ ASSERT(m_lock.isLocked());
if (!m_bytecodeOffsetToResultProfileIndexMap)
return nullptr;
auto iterator = m_bytecodeOffsetToResultProfileIndexMap->find(bytecodeOffset);
@@ -4237,6 +4244,28 @@
return &m_resultProfiles[iterator->value];
}
+
+ResultProfile* CodeBlock::ensureResultProfile(int bytecodeOffset)
+{
+ ConcurrentJITLocker locker(m_lock);
+ return ensureResultProfile(locker, bytecodeOffset);
+}
+
+ResultProfile* CodeBlock::ensureResultProfile(const ConcurrentJITLocker& locker, int bytecodeOffset)
+{
+ ASSERT(m_lock.isLocked());
+ ResultProfile* profile = "" bytecodeOffset);
+ if (!profile) {
+ m_resultProfiles.append(ResultProfile(bytecodeOffset));
+ profile = ""
+ ASSERT(&m_resultProfiles.last() == &m_resultProfiles[m_resultProfiles.size() - 1]);
+ if (!m_bytecodeOffsetToResultProfileIndexMap)
+ m_bytecodeOffsetToResultProfileIndexMap = std::make_unique<BytecodeOffsetToResultProfileIndexMap>();
+ m_bytecodeOffsetToResultProfileIndexMap->add(bytecodeOffset, m_resultProfiles.size() - 1);
+ }
+ return profile;
+}
+
#if ENABLE(JIT)
DFG::CapabilityLevel CodeBlock::capabilityLevel()
{
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (199375 => 199376)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h 2016-04-12 18:33:56 UTC (rev 199375)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h 2016-04-12 18:38:16 UTC (rev 199376)
@@ -436,21 +436,11 @@
return value >= Options::couldTakeSlowCaseMinimumCount();
}
- ResultProfile* ensureResultProfile(int bytecodeOffset)
- {
- ResultProfile* profile = ""
- if (!profile) {
- m_resultProfiles.append(ResultProfile(bytecodeOffset));
- profile = ""
- ASSERT(&m_resultProfiles.last() == &m_resultProfiles[m_resultProfiles.size() - 1]);
- if (!m_bytecodeOffsetToResultProfileIndexMap)
- m_bytecodeOffsetToResultProfileIndexMap = std::make_unique<BytecodeOffsetToResultProfileIndexMap>();
- m_bytecodeOffsetToResultProfileIndexMap->add(bytecodeOffset, m_resultProfiles.size() - 1);
- }
- return profile;
- }
+ ResultProfile* ensureResultProfile(int bytecodeOffset);
+ ResultProfile* ensureResultProfile(const ConcurrentJITLocker&, int bytecodeOffset);
unsigned numberOfResultProfiles() { return m_resultProfiles.size(); }
ResultProfile* resultProfileForBytecodeOffset(int bytecodeOffset);
+ ResultProfile* resultProfileForBytecodeOffset(const ConcurrentJITLocker&, int bytecodeOffset);
unsigned specialFastCaseProfileCountForBytecodeOffset(int bytecodeOffset)
{
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes