tizen beta release
[framework/web/webkit-efl.git] / Source / JavaScriptCore / dfg / DFGCommon.h
1 /*
2  * Copyright (C) 2011 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
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.
12  *
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. 
24  */
25
26 #ifndef DFGCommon_h
27 #define DFGCommon_h
28
29 #include <wtf/Platform.h>
30
31 #if ENABLE(DFG_JIT)
32
33 #include "CodeOrigin.h"
34 #include "VirtualRegister.h"
35
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)
38
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.
47 #if !ASSERT_DISABLED
48 #define DFG_ENABLE_JIT_ASSERT 1
49 #else
50 #define DFG_ENABLE_JIT_ASSERT 0
51 #endif
52 // Consistency check contents compiler data structures.
53 #define DFG_ENABLE_CONSISTENCY_CHECK 0
54 // Emit a breakpoint into the head of every generated function, to aid debugging in GDB.
55 #define DFG_ENABLE_JIT_BREAK_ON_EVERY_FUNCTION 0
56 // Emit a breakpoint into the head of every generated node, to aid debugging in GDB.
57 #define DFG_ENABLE_JIT_BREAK_ON_EVERY_BLOCK 0
58 // Emit a breakpoint into the head of every generated node, to aid debugging in GDB.
59 #define DFG_ENABLE_JIT_BREAK_ON_EVERY_NODE 0
60 // Emit a breakpoint into the speculation failure code.
61 #define DFG_ENABLE_JIT_BREAK_ON_SPECULATION_FAILURE 0
62 // Log every speculation failure.
63 #define DFG_ENABLE_VERBOSE_SPECULATION_FAILURE 0
64 // Disable the DFG JIT without having to touch Platform.h
65 #define DFG_DEBUG_LOCAL_DISBALE 0
66 // Enable OSR entry from baseline JIT.
67 #define DFG_ENABLE_OSR_ENTRY ENABLE(DFG_JIT)
68 // Generate stats on how successful we were in making use of the DFG jit, and remaining on the hot path.
69 #define DFG_ENABLE_SUCCESS_STATS 0
70 // Used to enable conditionally supported opcodes that currently result in performance regressions.
71 #define DFG_ENABLE_RESTRICTIONS 1
72
73 namespace JSC { namespace DFG {
74
75 // Type for a reference to another node in the graph.
76 typedef uint32_t NodeIndex;
77 static const NodeIndex NoNode = UINT_MAX;
78
79 typedef uint32_t BlockIndex;
80 static const BlockIndex NoBlock = UINT_MAX;
81
82 struct NodeIndexTraits {
83     static NodeIndex defaultValue() { return NoNode; }
84     static void dump(NodeIndex value, FILE* out)
85     {
86         if (value == NoNode)
87             fprintf(out, "-");
88         else
89             fprintf(out, "@%u", value);
90     }
91 };
92
93 } } // namespace JSC::DFG
94
95 #endif // ENABLE(DFG_JIT)
96
97 #endif // DFGCommon_h
98