Commit 42949ede authored by fpizlo@apple.com's avatar fpizlo@apple.com

DFG should use CheckStructure for typed array checks whenever possible

https://bugs.webkit.org/show_bug.cgi?id=113374

Reviewed by Geoffrey Garen.
        
We used to do the right thing, but it appears that this regressed at some point. Since the
FixupPhase now has the ability to outright remove spurious CheckStructures on array
operations, it is profitable for the ByteCodeParser to insert CheckStructures whenver there
is a chance that it might be profitable, and when the profiling tells us what structure to
check.
        
Also added some code for doing ArrayProfile debugging.
        
This is a slightly speed-up. Maybe 3% on Mandreel.

* bytecode/ArrayProfile.cpp:
(JSC::ArrayProfile::computeUpdatedPrediction):
* dfg/DFGArrayMode.h:
(JSC::DFG::ArrayMode::benefitsFromStructureCheck):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146996 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent eaaeb59a
2013-03-27 Filip Pizlo <fpizlo@apple.com>
DFG should use CheckStructure for typed array checks whenever possible
https://bugs.webkit.org/show_bug.cgi?id=113374
Reviewed by Geoffrey Garen.
We used to do the right thing, but it appears that this regressed at some point. Since the
FixupPhase now has the ability to outright remove spurious CheckStructures on array
operations, it is profitable for the ByteCodeParser to insert CheckStructures whenver there
is a chance that it might be profitable, and when the profiling tells us what structure to
check.
Also added some code for doing ArrayProfile debugging.
This is a slightly speed-up. Maybe 3% on Mandreel.
* bytecode/ArrayProfile.cpp:
(JSC::ArrayProfile::computeUpdatedPrediction):
* dfg/DFGArrayMode.h:
(JSC::DFG::ArrayMode::benefitsFromStructureCheck):
2013-03-27 Zeno Albisser <zeno@webkit.org>
[Qt] Remove Qt specific WorkQueueItem definitions.
......
......@@ -83,6 +83,8 @@ ArrayModes ArrayProfile::updatedObservedArrayModes() const
void ArrayProfile::computeUpdatedPrediction(CodeBlock* codeBlock, OperationInProgress operation)
{
const bool verbose = false;
if (m_lastSeenStructure) {
m_observedArrayModes |= arrayModeFromStructure(m_lastSeenStructure);
m_mayInterceptIndexedAccesses |=
......@@ -92,19 +94,28 @@ void ArrayProfile::computeUpdatedPrediction(CodeBlock* codeBlock, OperationInPro
if (!structureIsPolymorphic()) {
if (!m_expectedStructure)
m_expectedStructure = m_lastSeenStructure;
else if (m_expectedStructure != m_lastSeenStructure)
else if (m_expectedStructure != m_lastSeenStructure) {
if (verbose)
dataLog(*codeBlock, " bc#", m_bytecodeOffset, ": making structure polymorphic because ", RawPointer(m_expectedStructure), " (", m_expectedStructure->classInfo()->className, ") != ", RawPointer(m_lastSeenStructure), " (", m_lastSeenStructure->classInfo()->className, ")\n");
m_expectedStructure = polymorphicStructure();
}
}
m_lastSeenStructure = 0;
}
if (hasTwoOrMoreBitsSet(m_observedArrayModes))
if (hasTwoOrMoreBitsSet(m_observedArrayModes)) {
if (verbose)
dataLog(*codeBlock, " bc#", m_bytecodeOffset, ": making structure polymorphic because two or more bits are set in m_observedArrayModes\n");
m_expectedStructure = polymorphicStructure();
}
if (operation == Collection
&& expectedStructure()
&& !Heap::isMarked(m_expectedStructure))
&& !Heap::isMarked(m_expectedStructure)) {
if (verbose)
dataLog(*codeBlock, " bc#", m_bytecodeOffset, ": making structure during GC\n");
m_expectedStructure = polymorphicStructure();
}
}
CString ArrayProfile::briefDescription(CodeBlock* codeBlock)
......
......@@ -349,6 +349,11 @@ public:
{
switch (type()) {
case Array::SelectUsingPredictions:
// It might benefit from structure checks! If it ends up not benefiting, we can just
// remove it. The FixupPhase does this: if it finds a CheckStructure just before an
// array op and it had turned that array op into either generic or conversion mode,
// it will remove the CheckStructure.
return true;
case Array::Unprofiled:
case Array::ForceExit:
case Array::Generic:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment