]>
git.saurik.com Git - apple/javascriptcore.git/blob - dfg/DFGUseKind.h
2 * Copyright (C) 2013, 2014 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.
31 #include "DFGNodeFlags.h"
32 #include "SpeculatedType.h"
33 #include <wtf/PrintStream.h>
35 namespace JSC
{ namespace DFG
{
46 DoubleRepMachineIntUse
,
57 StringOrStringObjectUse
,
62 LastUseKind
// Must always be the last entry in the enum, as it is used to denote the number of enum elements.
65 inline SpeculatedType
typeFilterFor(UseKind useKind
)
74 return SpecMachineInt
;
76 return SpecInt32
| SpecInt52AsDouble
;
78 return SpecBytecodeNumber
;
80 return SpecFullDouble
;
81 case DoubleRepRealUse
:
82 return SpecDoubleReal
;
83 case DoubleRepMachineIntUse
:
84 return SpecInt52AsDouble
;
93 return SpecFinalObject
;
94 case ObjectOrOtherUse
:
95 return SpecObject
| SpecOther
;
97 return SpecStringIdent
;
101 case StringObjectUse
:
102 return SpecStringObject
;
103 case StringOrStringObjectUse
:
104 return SpecString
| SpecStringObject
;
105 case NotStringVarUse
:
106 return ~SpecStringVar
;
114 RELEASE_ASSERT_NOT_REACHED();
119 inline bool shouldNotHaveTypeCheck(UseKind kind
)
134 inline bool mayHaveTypeCheck(UseKind kind
)
136 return !shouldNotHaveTypeCheck(kind
);
139 inline bool isNumerical(UseKind kind
)
147 case DoubleRepRealUse
:
149 case DoubleRepMachineIntUse
:
156 inline bool isDouble(UseKind kind
)
160 case DoubleRepRealUse
:
161 case DoubleRepMachineIntUse
:
168 inline bool isCell(UseKind kind
)
178 case StringObjectUse
:
179 case StringOrStringObjectUse
:
186 // Returns true if it uses structure in a way that could be clobbered by
187 // things that change the structure.
188 inline bool usesStructure(UseKind kind
)
191 case StringObjectUse
:
192 case StringOrStringObjectUse
:
199 inline UseKind
useKindForResult(NodeFlags result
)
201 ASSERT(!(result
& ~NodeResultMask
));
203 case NodeResultInt52
:
205 case NodeResultDouble
:
212 } } // namespace JSC::DFG
216 void printInternal(PrintStream
&, JSC::DFG::UseKind
);
220 #endif // ENABLE(DFG_JIT)
222 #endif // DFGUseKind_h