Ignore:
Timestamp:
Jul 24, 2013, 9:00:58 PM (12 years ago)
Author:
[email protected]
Message:

fourthTier: rationalize DFG::CapabilityLevel and DFGCapabilities.[h|cpp]
https://bugs.webkit.org/show_bug.cgi?id=116696

Reviewed by Sam Weinig.

Make it so that all capability calculation is funneled through one function, which tells
you everything you wanted to know: can it be inlined, and can it be compiled.

This work will help with https://bugs.webkit.org/show_bug.cgi?id=116557, since now the
JIT has a fairly authoritative answer to the "can it be inlined" question.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::CodeBlock):
(JSC::ProgramCodeBlock::capabilityLevelInternal):
(JSC::EvalCodeBlock::capabilityLevelInternal):
(JSC::FunctionCodeBlock::capabilityLevelInternal):

  • bytecode/CodeBlock.h:

(CodeBlock):
(JSC::CodeBlock::capabilityLevel):
(JSC::CodeBlock::capabilityLevelState):
(ProgramCodeBlock):
(EvalCodeBlock):
(FunctionCodeBlock):

  • dfg/DFGCapabilities.cpp:

(JSC::DFG::debugFail):
(DFG):
(JSC::DFG::canInlineResolveOperations):
(JSC::DFG::capabilityLevel):

  • dfg/DFGCapabilities.h:

(DFG):
(JSC::DFG::capabilityLevel):
(JSC::DFG::evalCapabilityLevel):
(JSC::DFG::programCapabilityLevel):
(JSC::DFG::functionForCallCapabilityLevel):
(JSC::DFG::functionForConstructCapabilityLevel):
(JSC::DFG::canInlineFunctionForCall):
(JSC::DFG::canInlineFunctionForClosureCall):
(JSC::DFG::canInlineFunctionForConstruct):

  • dfg/DFGCommon.h:

(JSC::DFG::canCompile):
(DFG):
(JSC::DFG::canInline):
(JSC::DFG::leastUpperBound):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

  • jit/JIT.cpp:

(JSC::JIT::privateCompile):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::privateCompilePutByIdTransition):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::privateCompilePutByIdTransition):

  • tools/CodeProfile.cpp:

(JSC::CodeProfile::sample):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGCommon.h

    r153175 r153179  
    262262// Put things here that must be defined even if ENABLE(DFG_JIT) is false.
    263263
    264 enum CapabilityLevel { CannotCompile, MayInline, CanCompile, CapabilityLevelNotSet };
     264enum CapabilityLevel { CannotCompile, CanInline, CanCompile, CanCompileAndInline, CapabilityLevelNotSet };
     265
     266inline bool canCompile(CapabilityLevel level)
     267{
     268    switch (level) {
     269    case CanCompile:
     270    case CanCompileAndInline:
     271        return true;
     272    default:
     273        return false;
     274    }
     275}
     276
     277inline bool canInline(CapabilityLevel level)
     278{
     279    switch (level) {
     280    case CanInline:
     281    case CanCompileAndInline:
     282        return true;
     283    default:
     284        return false;
     285    }
     286}
     287
     288inline CapabilityLevel leastUpperBound(CapabilityLevel a, CapabilityLevel b)
     289{
     290    switch (a) {
     291    case CannotCompile:
     292        return CannotCompile;
     293    case CanInline:
     294        switch (b) {
     295        case CanInline:
     296        case CanCompileAndInline:
     297            return CanInline;
     298        default:
     299            return CannotCompile;
     300        }
     301    case CanCompile:
     302        switch (b) {
     303        case CanCompile:
     304        case CanCompileAndInline:
     305            return CanCompile;
     306        default:
     307            return CannotCompile;
     308        }
     309    case CanCompileAndInline:
     310        return b;
     311    case CapabilityLevelNotSet:
     312        ASSERT_NOT_REACHED();
     313        return CannotCompile;
     314    }
     315    ASSERT_NOT_REACHED();
     316    return CannotCompile;
     317}
    265318
    266319// Unconditionally disable DFG disassembly support if the DFG is not compiled in.
Note: See TracChangeset for help on using the changeset viewer.