Changeset 191602 in webkit


Ignore:
Timestamp:
Oct 26, 2015 2:45:59 PM (9 years ago)
Author:
mark.lam@apple.com
Message:

Add logging to warn about under-estimated FTL inline cache sizes.
https://bugs.webkit.org/show_bug.cgi?id=150570

Reviewed by Geoffrey Garen.

Added 2 options:

  1. JSC_dumpFailedICSizing - dumps an error message if the FTL encounters IC size estimates that are less than the actual needed code size.

This option is useful for when we add a new IC and want to compute an
estimated size for the IC. To do this:

  1. Build jsc for the target port with a very small IC size (enough to store the jump instruction needed for the out of line fallback implementation).
  2. Implement a test suite with scenarios that exercise all the code paths in the IC generator.
  3. Run jsc with JSC_dumpFailedICSizing=true on the test suite.
  4. The max value reported by the dumps will be the worst case size needed to store the IC. We should use this value for our estimate.
  5. Update the IC's estimated size and rebuild jsc.
  6. Re-run (3) and confirm that there are no more error messages about the IC sizing.
  1. JSC_assertICSizing - same as JSC_dumpFailedICSizing except that it also crashes the VM each time it encounters an inadequate IC size estimate.

This option is useful for regression testing to ensure that our estimates
do not regress.

  • ftl/FTLCompile.cpp:

(JSC::FTL::generateInlineIfPossibleOutOfLineIfNot):

  • runtime/Options.h:
Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r191594 r191602  
     12015-10-26  Mark Lam  <mark.lam@apple.com>
     2
     3        Add logging to warn about under-estimated FTL inline cache sizes.
     4        https://bugs.webkit.org/show_bug.cgi?id=150570
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Added 2 options:
     9        1. JSC_dumpFailedICSizing - dumps an error message if the FTL encounters IC size
     10           estimates that are less than the actual needed code size.
     11
     12           This option is useful for when we add a new IC and want to compute an
     13           estimated size for the IC.  To do this:
     14           1. Build jsc for the target port with a very small IC size (enough to
     15              store the jump instruction needed for the out of line fallback
     16              implementation).
     17           2. Implement a test suite with scenarios that exercise all the code paths in
     18              the IC generator.
     19           3. Run jsc with JSC_dumpFailedICSizing=true on the test suite.
     20           4. The max value reported by the dumps will be the worst case size needed to
     21              store the IC.  We should use this value for our estimate.
     22           5. Update the IC's estimated size and rebuild jsc.
     23           6. Re-run (3) and confirm that there are no more error messages about the
     24              IC sizing.
     25
     26        2. JSC_assertICSizing - same as JSC_dumpFailedICSizing except that it also
     27           crashes the VM each time it encounters an inadequate IC size estimate.
     28
     29           This option is useful for regression testing to ensure that our estimates
     30           do not regress.
     31
     32        * ftl/FTLCompile.cpp:
     33        (JSC::FTL::generateInlineIfPossibleOutOfLineIfNot):
     34        * runtime/Options.h:
     35
    1362015-10-26  Saam barati  <sbarati@apple.com>
    237
  • trunk/Source/JavaScriptCore/ftl/FTLCompile.cpp

    r191394 r191602  
    170170    }
    171171
     172    if (Options::assertICSizing() || Options::dumpFailedICSizing()) {
     173        static size_t maxSize = 0;
     174        if (maxSize < actualCodeSize)
     175            maxSize = actualCodeSize;
     176        dataLogF("ALERT: Under-estimated FTL Inline Cache Size for %s: estimated %zu, actual %zu, max %zu\n", codeDescription, sizeOfInlineCode, actualCodeSize, maxSize);
     177        if (Options::assertICSizing())
     178            CRASH();
     179    }
     180
    172181    // If there isn't enough space in the provided inline code area, allocate out of line
    173182    // executable memory to link the provided code. Place a jump at the beginning of the
  • trunk/Source/JavaScriptCore/runtime/Options.h

    r191426 r191602  
    281281    v(unsigned, reoptimizationRetryCounterMax, 0, nullptr)  \
    282282    \
     283    v(bool, assertICSizing, false, "crash if estimated IC sizes are inadequate")  \
     284    v(bool, dumpFailedICSizing, false, "dumps a log entry if estimated IC sizes are inadequate")  \
     285    \
    283286    v(unsigned, minimumOptimizationDelay, 1, nullptr) \
    284287    v(unsigned, maximumOptimizationDelay, 5, nullptr) \
Note: See TracChangeset for help on using the changeset viewer.