X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/2d39b0e377c0896910ee49ae70082ba665faf986..refs/heads/master:/dfg/DFGCommon.h diff --git a/dfg/DFGCommon.h b/dfg/DFGCommon.h index dbe7ca2..df8c8ef 100644 --- a/dfg/DFGCommon.h +++ b/dfg/DFGCommon.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2014 Apple Inc. All rights reserved. + * Copyright (C) 2011-2015 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,7 +30,6 @@ #if ENABLE(DFG_JIT) -#include "CodeOrigin.h" #include "Options.h" #include "VirtualRegister.h" @@ -63,6 +62,13 @@ enum RefNodeMode { DontRefNode }; +enum SwitchKind { + SwitchImm, + SwitchChar, + SwitchString, + SwitchCell +}; + inline bool verboseCompilationEnabled(CompilationMode mode = DFGMode) { return Options::verboseCompilation() || Options::dumpGraphAtEachPhase() || (isFTL(mode) && Options::verboseFTLCompilation()); @@ -146,6 +152,10 @@ enum PredictionPass { FixupPass }; +enum StructureRegistrationState { HaveNotStartedRegistering, AllStructuresAreRegistered }; + +enum StructureRegistrationResult { StructureRegisteredNormally, StructureRegisteredAndWatched }; + enum OptimizationFixpointState { BeforeFixpoint, FixpointNotConverged, FixpointConverged }; // Describes the form you can expect the entire graph to be in. @@ -182,12 +192,10 @@ enum GraphForm { // expect to be live at the head, and which locals they make available at the // tail. ThreadedCPS form also implies that: // - // - GetLocals and SetLocals to uncaptured variables are not redundant within - // a basic block. + // - GetLocals and SetLocals are not redundant within a basic block. // // - All GetLocals and Flushes are linked directly to the last access point - // of the variable, which must not be another GetLocal if the variable is - // uncaptured. + // of the variable, which must not be another GetLocal. // // - Phantom(Phi) is not legal, but PhantomLocal is. // @@ -245,6 +253,11 @@ inline KillStatus killStatusForDoesKill(bool doesKill) return doesKill ? DoesKill : DoesNotKill; } +enum class PlanStage { + Initial, + AfterFixup +}; + template bool checkAndSet(T& left, U right) { @@ -259,6 +272,35 @@ bool checkAndSet(T& left, U right) // when you're forcing a crash with diagnostics. void startCrashing(); +JS_EXPORT_PRIVATE bool isCrashing(); + +struct NodeAndIndex { + NodeAndIndex() + : node(nullptr) + , index(UINT_MAX) + { + } + + NodeAndIndex(Node* node, unsigned index) + : node(node) + , index(index) + { + ASSERT(!node == (index == UINT_MAX)); + } + + bool operator!() const + { + return !node; + } + + Node* node; + unsigned index; +}; + +// A less-than operator for strings that is useful for generating string switches. Sorts by < +// relation on characters. Ensures that if a is a prefix of b, then a < b. +bool stringLessThan(StringImpl& a, StringImpl& b); + } } // namespace JSC::DFG namespace WTF { @@ -279,7 +321,6 @@ namespace JSC { namespace DFG { enum CapabilityLevel { CannotCompile, - CanInline, CanCompile, CanCompileAndInline, CapabilityLevelNotSet @@ -299,7 +340,6 @@ inline bool canCompile(CapabilityLevel level) inline bool canInline(CapabilityLevel level) { switch (level) { - case CanInline: case CanCompileAndInline: return true; default: @@ -312,14 +352,6 @@ inline CapabilityLevel leastUpperBound(CapabilityLevel a, CapabilityLevel b) switch (a) { case CannotCompile: return CannotCompile; - case CanInline: - switch (b) { - case CanInline: - case CanCompileAndInline: - return CanInline; - default: - return CannotCompile; - } case CanCompile: switch (b) { case CanCompile: @@ -351,5 +383,11 @@ inline bool shouldShowDisassembly(CompilationMode mode = DFGMode) } } // namespace JSC::DFG +namespace WTF { + +void printInternal(PrintStream&, JSC::DFG::CapabilityLevel); + +} // namespace WTF + #endif // DFGCommon_h