Ignore:
Timestamp:
Apr 4, 2017, 2:48:41 PM (8 years ago)
Author:
[email protected]
Message:

Air::lowerAfterRegAlloc should bail early if it finds no Shuffles or ColdCCalls
https://bugs.webkit.org/show_bug.cgi?id=170305

Reviewed by Saam Barati.

This reduces and sometimes completely eliminates the need to run lowerAfterRegAlloc().

This lowers the Shuffle for the arguments of a CCall before register allocation unless
the CCall arguments require a real shuffle (like if the CCall arguments were argument
registers). This lowers a ColdCCall like a CCall for optLevel<2.

Finally, lowerAfterRegAlloc() now checks if there are any Shuffles or CCalls before it
does anything else. For wasm at -O1, this means that the phase doesn't run at all. This
is a ~3% wasm -O1 compile time progression.

To make this easy, I changed optLevel into a property of Procedure and Code rather than
an argument we thread through everything. I like how Procedure and Code are dumping
ground classes. This does not bother me. Note that I cloned optLevel into Procedure and
Code so that it's cheap to query inside Air phases.

  • b3/B3Compile.cpp:

(JSC::B3::compile):

  • b3/B3Compile.h:
  • b3/B3Generate.cpp:

(JSC::B3::prepareForGeneration):
(JSC::B3::generateToAir):

  • b3/B3Generate.h:
  • b3/B3Procedure.cpp:

(JSC::B3::Procedure::setOptLevel):

  • b3/B3Procedure.h:

(JSC::B3::Procedure::optLevel):

  • b3/air/AirCode.h:

(JSC::B3::Air::Code::isPinned):
(JSC::B3::Air::Code::setOptLevel):
(JSC::B3::Air::Code::optLevel):

  • b3/air/AirEmitShuffle.cpp:

(JSC::B3::Air::ShufflePair::bank):
(JSC::B3::Air::ShufflePair::opcode):
(JSC::B3::Air::ShufflePair::inst):
(JSC::B3::Air::emitShuffle):

  • b3/air/AirEmitShuffle.h:

(JSC::B3::Air::moveFor):

  • b3/air/AirGenerate.cpp:

(JSC::B3::Air::prepareForGeneration):

  • b3/air/AirGenerate.h:
  • b3/air/AirLowerAfterRegAlloc.cpp:

(JSC::B3::Air::lowerAfterRegAlloc):

  • b3/air/AirLowerMacros.cpp:

(JSC::B3::Air::lowerMacros):

  • b3/testb3.cpp:

(JSC::B3::compileProc):

  • wasm/WasmB3IRGenerator.cpp:

(JSC::Wasm::parseAndCompile):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/b3/B3Generate.cpp

    r214636 r214901  
    5353namespace JSC { namespace B3 {
    5454
    55 void prepareForGeneration(Procedure& procedure, unsigned optLevel)
     55void prepareForGeneration(Procedure& procedure)
    5656{
    5757    TimingScope timingScope("prepareForGeneration");
    5858
    59     generateToAir(procedure, optLevel);
    60     Air::prepareForGeneration(procedure.code(), optLevel);
     59    generateToAir(procedure);
     60    Air::prepareForGeneration(procedure.code());
    6161}
    6262
     
    6666}
    6767
    68 void generateToAir(Procedure& procedure, unsigned optLevel)
     68void generateToAir(Procedure& procedure)
    6969{
    7070    TimingScope timingScope("generateToAir");
     
    8181        validate(procedure);
    8282
    83     if (optLevel >= 2) {
     83    if (procedure.optLevel() >= 2) {
    8484        reduceDoubleToFloat(procedure);
    8585        reduceStrength(procedure);
     
    9292        // FIXME: Add more optimizations here.
    9393        // https://bugs.webkit.org/show_bug.cgi?id=150507
    94     } else if (optLevel >= 1) {
     94    } else if (procedure.optLevel() >= 1) {
    9595        // FIXME: Explore better "quick mode" optimizations.
    9696        reduceStrength(procedure);
     
    100100    lowerMacros(procedure);
    101101
    102     if (optLevel >= 2) {
     102    if (procedure.optLevel() >= 2) {
    103103        reduceStrength(procedure);
    104104
Note: See TracChangeset for help on using the changeset viewer.