2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include <wtf/Platform.h>
33 #include "CodeOrigin.h"
34 #include "VirtualRegister.h"
36 /* DFG_ENABLE() - turn on a specific features in the DFG JIT */
37 #define DFG_ENABLE(DFG_FEATURE) (defined DFG_ENABLE_##DFG_FEATURE && DFG_ENABLE_##DFG_FEATURE)
39 // Emit various logging information for debugging, including dumping the dataflow graphs.
40 #define DFG_ENABLE_DEBUG_VERBOSE 0
41 // Emit dumps during propagation, in addition to just after.
42 #define DFG_ENABLE_DEBUG_PROPAGATION_VERBOSE 0
43 // Emit logging for OSR exit value recoveries at every node, not just nodes that
44 // actually has speculation checks.
45 #define DFG_ENABLE_VERBOSE_VALUE_RECOVERIES 0
46 // Enable generation of dynamic checks into the instruction stream.
48 #define DFG_ENABLE_JIT_ASSERT 1
50 #define DFG_ENABLE_JIT_ASSERT 0
52 // Enable validation of the graph.
54 #define DFG_ENABLE_VALIDATION 1
56 #define DFG_ENABLE_VALIDATION 0
58 // Consistency check contents compiler data structures.
59 #define DFG_ENABLE_CONSISTENCY_CHECK 0
60 // Emit a breakpoint into the head of every generated function, to aid debugging in GDB.
61 #define DFG_ENABLE_JIT_BREAK_ON_EVERY_FUNCTION 0
62 // Emit a breakpoint into the head of every generated block, to aid debugging in GDB.
63 #define DFG_ENABLE_JIT_BREAK_ON_EVERY_BLOCK 0
64 // Emit a breakpoint into the head of every generated node, to aid debugging in GDB.
65 #define DFG_ENABLE_JIT_BREAK_ON_EVERY_NODE 0
66 // Emit a pair of xorPtr()'s on regT0 with the node index to make it easy to spot node boundaries in disassembled code.
67 #define DFG_ENABLE_XOR_DEBUG_AID 0
68 // Emit a breakpoint into the speculation failure code.
69 #define DFG_ENABLE_JIT_BREAK_ON_SPECULATION_FAILURE 0
70 // Log every speculation failure.
71 #define DFG_ENABLE_VERBOSE_SPECULATION_FAILURE 0
72 // Disable the DFG JIT without having to touch Platform.h
73 #define DFG_DEBUG_LOCAL_DISBALE 0
74 // Enable OSR entry from baseline JIT.
75 #define DFG_ENABLE_OSR_ENTRY ENABLE(DFG_JIT)
76 // Generate stats on how successful we were in making use of the DFG jit, and remaining on the hot path.
77 #define DFG_ENABLE_SUCCESS_STATS 0
78 // Enable verification that the DFG is able to insert code for control flow edges.
79 #define DFG_ENABLE_EDGE_CODE_VERIFICATION 0
81 namespace JSC { namespace DFG {
83 // Type for a reference to another node in the graph.
84 typedef uint32_t NodeIndex;
85 static const NodeIndex NoNode = UINT_MAX;
87 typedef uint32_t BlockIndex;
88 static const BlockIndex NoBlock = UINT_MAX;
90 struct NodeIndexTraits {
91 static NodeIndex defaultValue() { return NoNode; }
92 static void dump(NodeIndex value, FILE* out)
97 fprintf(out, "@%u", value);
104 LastUseKind // Must always be the last entry in the enum, as it is used to denote the number of enum elements.
107 inline const char* useKindToString(UseKind useKind)
115 ASSERT_NOT_REACHED();
122 #if CPU(X86_64) || CPU(X86)
129 enum SpillRegistersMode { NeedToSpill, DontSpill };
131 enum NoResultTag { NoResult };
133 enum OptimizationFixpointState { FixpointConverged, FixpointNotConverged };
135 } } // namespace JSC::DFG
137 #endif // ENABLE(DFG_JIT)
139 namespace JSC { namespace DFG {
141 // Put things here that must be defined even if ENABLE(DFG_JIT) is false.
143 enum CapabilityLevel { CannotCompile, ShouldProfile, CanCompile, CapabilityLevelNotSet };
145 } } // namespace JSC::DFG
147 #endif // DFGCommon_h