Ignore:
Timestamp:
Oct 9, 2011, 3:19:23 AM (14 years ago)
Author:
[email protected]
Message:

Fix value profiling in 32_64 JIT
https://bugs.webkit.org/show_bug.cgi?id=69717

Patch by Yuqiang Xian <[email protected]> on 2011-10-09
Reviewed by Filip Pizlo.

Current value profiling for 32_64 JIT is broken and cannot record
correct predicated types, which results in many speculation failures
in the 32_64 DFG JIT, fallbacks to baseline JIT, and re-optimizations
again and again.
With this fix 32_64 DFG JIT can demonstrate real performance gains.

  • bytecode/ValueProfile.cpp:

(JSC::ValueProfile::computeStatistics):

  • bytecode/ValueProfile.h:

(JSC::ValueProfile::classInfo):
(JSC::ValueProfile::numberOfSamples):
(JSC::ValueProfile::isLive):
(JSC::ValueProfile::numberOfInt32s):
(JSC::ValueProfile::numberOfDoubles):
(JSC::ValueProfile::numberOfBooleans):
(JSC::ValueProfile::dump):

Empty value check should be performed on decoded JSValue,
as for 32_64 empty value is not identical to encoded 0.

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • jit/JITInlineMethods.h:

(JSC::JIT::emitValueProfilingSite):

  • jit/JITStubCall.h:

(JSC::JITStubCall::callWithValueProfiling):

Record the right profiling result for 32_64.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/ValueProfile.h

    r95901 r97025  
    5656    const ClassInfo* classInfo(unsigned bucket) const
    5757    {
    58         if (!!m_buckets[bucket]) {
    59             JSValue value = JSValue::decode(m_buckets[bucket]);
     58        JSValue value = JSValue::decode(m_buckets[bucket]);
     59        if (!!value) {
    6060            if (!value.isCell())
    6161                return 0;
     
    6969        unsigned result = 0;
    7070        for (unsigned i = 0; i < numberOfBuckets; ++i) {
    71             if (!!m_buckets[i] || !!m_weakBuckets[i])
     71            if (!!JSValue::decode(m_buckets[i]) || !!m_weakBuckets[i])
    7272                result++;
    7373        }
     
    8383    {
    8484        for (unsigned i = 0; i < numberOfBuckets; ++i) {
    85             if (!!m_buckets[i] || !!m_weakBuckets[i])
     85            if (!!JSValue::decode(m_buckets[i]) || !!m_weakBuckets[i])
    8686                return true;
    8787        }
     
    100100        unsigned result = 0;
    101101        for (unsigned i = 0; i < numberOfBuckets; ++i) {
    102             if (!!m_buckets[i] && JSValue::decode(m_buckets[i]).isInt32())
     102            if (JSValue::decode(m_buckets[i]).isInt32())
    103103                result++;
    104104        }
     
    110110        unsigned result = 0;
    111111        for (unsigned i = 0; i < numberOfBuckets; ++i) {
    112             if (!!m_buckets[i] && JSValue::decode(m_buckets[i]).isDouble())
     112            if (JSValue::decode(m_buckets[i]).isDouble())
    113113                result++;
    114114        }
     
    171171        unsigned result = 0;
    172172        for (unsigned i = 0; i < numberOfBuckets; ++i) {
    173             if (!!m_buckets[i] && JSValue::decode(m_buckets[i]).isBoolean())
     173            if (JSValue::decode(m_buckets[i]).isBoolean())
    174174                result++;
    175175        }
     
    239239        bool first = true;
    240240        for (unsigned i = 0; i < numberOfBuckets; ++i) {
    241             if (!!m_buckets[i] || !!m_weakBuckets[i]) {
     241            JSValue value = JSValue::decode(m_buckets[i]);
     242            if (!!value || !!m_weakBuckets[i]) {
    242243                if (first) {
    243244                    fprintf(out, ": ");
     
    247248            }
    248249           
    249             if (!!m_buckets[i])
    250                 fprintf(out, "%s", JSValue::decode(m_buckets[i]).description());
     250            if (!!value)
     251                fprintf(out, "%s", value.description());
    251252           
    252253            if (!!m_weakBuckets[i])
Note: See TracChangeset for help on using the changeset viewer.