fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 1 | /* |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 2 | * Copyright (C) 2012, 2013 Apple Inc. All rights reserved. |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 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 | #include "config.h" |
| 27 | #include "DFGFixupPhase.h" |
| 28 | |
| 29 | #if ENABLE(DFG_JIT) |
| 30 | |
| 31 | #include "DFGGraph.h" |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 32 | #include "DFGInsertionSet.h" |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 33 | #include "DFGPhase.h" |
fpizlo@apple.com | 7e5ed6e | 2013-03-20 22:37:09 +0000 | [diff] [blame] | 34 | #include "DFGPredictionPropagationPhase.h" |
fpizlo@apple.com | bbaf619 | 2013-02-27 01:45:28 +0000 | [diff] [blame] | 35 | #include "DFGVariableAccessDataDump.h" |
fpizlo@apple.com | a4b4cbe | 2013-01-12 04:47:03 +0000 | [diff] [blame] | 36 | #include "Operations.h" |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 37 | |
| 38 | namespace JSC { namespace DFG { |
| 39 | |
| 40 | class FixupPhase : public Phase { |
| 41 | public: |
| 42 | FixupPhase(Graph& graph) |
| 43 | : Phase(graph, "fixup") |
fpizlo@apple.com | f45e88b | 2013-01-20 19:29:50 +0000 | [diff] [blame] | 44 | , m_insertionSet(graph) |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 45 | { |
| 46 | } |
| 47 | |
fpizlo@apple.com | 79c51ee | 2012-05-18 22:30:24 +0000 | [diff] [blame] | 48 | bool run() |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 49 | { |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 50 | ASSERT(m_graph.m_fixpointState == BeforeFixpoint); |
| 51 | ASSERT(m_graph.m_form == ThreadedCPS); |
| 52 | |
fpizlo@apple.com | bbaf619 | 2013-02-27 01:45:28 +0000 | [diff] [blame] | 53 | m_profitabilityChanged = false; |
oliver@apple.com | 426f5b0 | 2013-07-25 04:04:27 +0000 | [diff] [blame] | 54 | for (BlockIndex blockIndex = 0; blockIndex < m_graph.numBlocks(); ++blockIndex) |
| 55 | fixupBlock(m_graph.block(blockIndex)); |
fpizlo@apple.com | bbaf619 | 2013-02-27 01:45:28 +0000 | [diff] [blame] | 56 | |
| 57 | while (m_profitabilityChanged) { |
| 58 | m_profitabilityChanged = false; |
| 59 | |
| 60 | for (unsigned i = m_graph.m_argumentPositions.size(); i--;) |
| 61 | m_graph.m_argumentPositions[i].mergeArgumentUnboxingAwareness(); |
| 62 | |
oliver@apple.com | 426f5b0 | 2013-07-25 04:04:27 +0000 | [diff] [blame] | 63 | for (BlockIndex blockIndex = 0; blockIndex < m_graph.numBlocks(); ++blockIndex) |
| 64 | fixupSetLocalsInBlock(m_graph.block(blockIndex)); |
fpizlo@apple.com | bbaf619 | 2013-02-27 01:45:28 +0000 | [diff] [blame] | 65 | } |
| 66 | |
fpizlo@apple.com | 79c51ee | 2012-05-18 22:30:24 +0000 | [diff] [blame] | 67 | return true; |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | private: |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 71 | void fixupBlock(BasicBlock* block) |
| 72 | { |
fpizlo@apple.com | 79c51ee | 2012-05-18 22:30:24 +0000 | [diff] [blame] | 73 | if (!block) |
| 74 | return; |
| 75 | ASSERT(block->isReachable); |
fpizlo@apple.com | f10d072 | 2012-12-03 09:21:22 +0000 | [diff] [blame] | 76 | m_block = block; |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 77 | for (m_indexInBlock = 0; m_indexInBlock < block->size(); ++m_indexInBlock) { |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 78 | m_currentNode = block->at(m_indexInBlock); |
| 79 | fixupNode(m_currentNode); |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 80 | } |
fpizlo@apple.com | f45e88b | 2013-01-20 19:29:50 +0000 | [diff] [blame] | 81 | m_insertionSet.execute(block); |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 82 | } |
| 83 | |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 84 | void fixupNode(Node* node) |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 85 | { |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 86 | NodeType op = node->op(); |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 87 | |
| 88 | #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 89 | dataLogF(" %s @%u: ", Graph::opName(op), node->index()); |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 90 | #endif |
| 91 | |
| 92 | switch (op) { |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 93 | case SetLocal: { |
fpizlo@apple.com | bbaf619 | 2013-02-27 01:45:28 +0000 | [diff] [blame] | 94 | // This gets handled by fixupSetLocalsInBlock(). |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 95 | break; |
| 96 | } |
| 97 | |
| 98 | case BitAnd: |
| 99 | case BitOr: |
| 100 | case BitXor: |
| 101 | case BitRShift: |
| 102 | case BitLShift: |
oliver@apple.com | 6436732 | 2013-04-26 00:41:38 +0000 | [diff] [blame] | 103 | case BitURShift: |
| 104 | case ArithIMul: { |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 105 | fixIntEdge(node->child1()); |
| 106 | fixIntEdge(node->child2()); |
| 107 | break; |
| 108 | } |
| 109 | |
| 110 | case UInt32ToNumber: { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 111 | setUseKindAndUnboxIfProfitable<KnownInt32Use>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 112 | break; |
| 113 | } |
| 114 | |
| 115 | case DoubleAsInt32: { |
| 116 | RELEASE_ASSERT_NOT_REACHED(); |
| 117 | break; |
| 118 | } |
| 119 | |
| 120 | case ValueToInt32: { |
| 121 | if (node->child1()->shouldSpeculateInteger()) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 122 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
oliver@apple.com | 827d2cf | 2013-07-25 04:04:45 +0000 | [diff] [blame] | 123 | node->setOpAndDefaultFlags(Identity); |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 124 | break; |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | if (node->child1()->shouldSpeculateNumber()) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 128 | setUseKindAndUnboxIfProfitable<NumberUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 129 | break; |
| 130 | } |
| 131 | |
| 132 | if (node->child1()->shouldSpeculateBoolean()) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 133 | setUseKindAndUnboxIfProfitable<BooleanUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 134 | break; |
| 135 | } |
| 136 | |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 137 | setUseKindAndUnboxIfProfitable<NotCellUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 138 | break; |
| 139 | } |
| 140 | |
| 141 | case Int32ToDouble: { |
| 142 | RELEASE_ASSERT_NOT_REACHED(); |
| 143 | break; |
| 144 | } |
| 145 | |
| 146 | case ValueAdd: { |
| 147 | if (attemptToMakeIntegerAdd(node)) |
| 148 | break; |
| 149 | if (Node::shouldSpeculateNumberExpectingDefined(node->child1().node(), node->child2().node())) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 150 | fixDoubleEdge<NumberUse>(node->child1()); |
| 151 | fixDoubleEdge<NumberUse>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 152 | break; |
| 153 | } |
fpizlo@apple.com | 8d22591 | 2013-03-19 00:44:57 +0000 | [diff] [blame] | 154 | |
| 155 | // FIXME: Optimize for the case where one of the operands is the |
| 156 | // empty string. Also consider optimizing for the case where we don't |
| 157 | // believe either side is the emtpy string. Both of these things should |
| 158 | // be easy. |
| 159 | |
| 160 | if (node->child1()->shouldSpeculateString() |
| 161 | && attemptToMakeFastStringAdd<StringUse>(node, node->child1(), node->child2())) |
| 162 | break; |
| 163 | if (node->child2()->shouldSpeculateString() |
| 164 | && attemptToMakeFastStringAdd<StringUse>(node, node->child2(), node->child1())) |
| 165 | break; |
| 166 | if (node->child1()->shouldSpeculateStringObject() |
| 167 | && attemptToMakeFastStringAdd<StringObjectUse>(node, node->child1(), node->child2())) |
| 168 | break; |
| 169 | if (node->child2()->shouldSpeculateStringObject() |
| 170 | && attemptToMakeFastStringAdd<StringObjectUse>(node, node->child2(), node->child1())) |
| 171 | break; |
| 172 | if (node->child1()->shouldSpeculateStringOrStringObject() |
| 173 | && attemptToMakeFastStringAdd<StringOrStringObjectUse>(node, node->child1(), node->child2())) |
| 174 | break; |
| 175 | if (node->child2()->shouldSpeculateStringOrStringObject() |
| 176 | && attemptToMakeFastStringAdd<StringOrStringObjectUse>(node, node->child2(), node->child1())) |
| 177 | break; |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 178 | break; |
| 179 | } |
| 180 | |
fpizlo@apple.com | 4463e44 | 2013-03-20 20:29:37 +0000 | [diff] [blame] | 181 | case MakeRope: { |
| 182 | fixupMakeRope(node); |
| 183 | break; |
| 184 | } |
| 185 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 186 | case ArithAdd: |
| 187 | case ArithSub: { |
| 188 | if (attemptToMakeIntegerAdd(node)) |
| 189 | break; |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 190 | fixDoubleEdge<NumberUse>(node->child1()); |
| 191 | fixDoubleEdge<NumberUse>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 192 | break; |
| 193 | } |
| 194 | |
| 195 | case ArithNegate: { |
| 196 | if (m_graph.negateShouldSpeculateInteger(node)) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 197 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 198 | break; |
| 199 | } |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 200 | fixDoubleEdge<NumberUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 201 | break; |
| 202 | } |
| 203 | |
| 204 | case ArithMul: { |
| 205 | if (m_graph.mulShouldSpeculateInteger(node)) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 206 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
| 207 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 208 | break; |
| 209 | } |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 210 | fixDoubleEdge<NumberUse>(node->child1()); |
| 211 | fixDoubleEdge<NumberUse>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 212 | break; |
| 213 | } |
| 214 | |
oliver@apple.com | f4443a7 | 2013-07-25 04:01:11 +0000 | [diff] [blame] | 215 | case ArithDiv: |
| 216 | case ArithMod: { |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 217 | if (Node::shouldSpeculateIntegerForArithmetic(node->child1().node(), node->child2().node()) |
| 218 | && node->canSpeculateInteger()) { |
rniwa@webkit.org | 3b9e15c | 2013-04-30 20:18:46 +0000 | [diff] [blame] | 219 | if (isX86() || isARMv7s()) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 220 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
| 221 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 222 | break; |
fpizlo@apple.com | 7aed8d8 | 2012-08-23 03:38:52 +0000 | [diff] [blame] | 223 | } |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 224 | injectInt32ToDoubleNode(node->child1()); |
| 225 | injectInt32ToDoubleNode(node->child2()); |
| 226 | |
| 227 | // We don't need to do ref'ing on the children because we're stealing them from |
| 228 | // the original division. |
| 229 | Node* newDivision = m_insertionSet.insertNode( |
fpizlo@apple.com | 06f82b5 | 2013-03-06 02:27:16 +0000 | [diff] [blame] | 230 | m_indexInBlock, SpecDouble, *node); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 231 | |
| 232 | node->setOp(DoubleAsInt32); |
| 233 | node->children.initialize(Edge(newDivision, KnownNumberUse), Edge(), Edge()); |
fpizlo@apple.com | 7aed8d8 | 2012-08-23 03:38:52 +0000 | [diff] [blame] | 234 | break; |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 235 | } |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 236 | fixDoubleEdge<NumberUse>(node->child1()); |
| 237 | fixDoubleEdge<NumberUse>(node->child2()); |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 238 | break; |
| 239 | } |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 240 | |
| 241 | case ArithMin: |
oliver@apple.com | f4443a7 | 2013-07-25 04:01:11 +0000 | [diff] [blame] | 242 | case ArithMax: { |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 243 | if (Node::shouldSpeculateIntegerForArithmetic(node->child1().node(), node->child2().node()) |
| 244 | && node->canSpeculateInteger()) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 245 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
| 246 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 247 | break; |
| 248 | } |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 249 | fixDoubleEdge<NumberUse>(node->child1()); |
| 250 | fixDoubleEdge<NumberUse>(node->child2()); |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 251 | break; |
| 252 | } |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 253 | |
| 254 | case ArithAbs: { |
| 255 | if (node->child1()->shouldSpeculateIntegerForArithmetic() |
| 256 | && node->canSpeculateInteger()) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 257 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 258 | break; |
| 259 | } |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 260 | fixDoubleEdge<NumberUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 261 | break; |
| 262 | } |
| 263 | |
| 264 | case ArithSqrt: { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 265 | fixDoubleEdge<NumberUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 266 | break; |
| 267 | } |
| 268 | |
| 269 | case LogicalNot: { |
| 270 | if (node->child1()->shouldSpeculateBoolean()) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 271 | setUseKindAndUnboxIfProfitable<BooleanUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 272 | else if (node->child1()->shouldSpeculateObjectOrOther()) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 273 | setUseKindAndUnboxIfProfitable<ObjectOrOtherUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 274 | else if (node->child1()->shouldSpeculateInteger()) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 275 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 276 | else if (node->child1()->shouldSpeculateNumber()) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 277 | fixDoubleEdge<NumberUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 278 | break; |
| 279 | } |
| 280 | |
| 281 | case TypeOf: { |
| 282 | if (node->child1()->shouldSpeculateString()) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 283 | setUseKindAndUnboxIfProfitable<StringUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 284 | else if (node->child1()->shouldSpeculateCell()) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 285 | setUseKindAndUnboxIfProfitable<CellUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 286 | break; |
| 287 | } |
| 288 | |
fpizlo@apple.com | ee10e45 | 2013-04-09 00:10:16 +0000 | [diff] [blame] | 289 | case CompareEqConstant: { |
| 290 | break; |
| 291 | } |
| 292 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 293 | case CompareEq: |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 294 | case CompareLess: |
| 295 | case CompareLessEq: |
| 296 | case CompareGreater: |
| 297 | case CompareGreaterEq: { |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 298 | if (Node::shouldSpeculateInteger(node->child1().node(), node->child2().node())) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 299 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
| 300 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 301 | break; |
| 302 | } |
| 303 | if (Node::shouldSpeculateNumber(node->child1().node(), node->child2().node())) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 304 | fixDoubleEdge<NumberUse>(node->child1()); |
| 305 | fixDoubleEdge<NumberUse>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 306 | break; |
| 307 | } |
| 308 | if (node->op() != CompareEq) |
| 309 | break; |
ggaren@apple.com | 0f001eb | 2013-04-24 15:48:55 +0000 | [diff] [blame] | 310 | if (Node::shouldSpeculateBoolean(node->child1().node(), node->child2().node())) { |
| 311 | setUseKindAndUnboxIfProfitable<BooleanUse>(node->child1()); |
| 312 | setUseKindAndUnboxIfProfitable<BooleanUse>(node->child2()); |
| 313 | break; |
| 314 | } |
oliver@apple.com | bd15be8 | 2013-07-25 04:03:42 +0000 | [diff] [blame] | 315 | if (node->child1()->shouldSpeculateStringIdent() && node->child2()->shouldSpeculateStringIdent()) { |
| 316 | setUseKindAndUnboxIfProfitable<StringIdentUse>(node->child1()); |
| 317 | setUseKindAndUnboxIfProfitable<StringIdentUse>(node->child2()); |
| 318 | break; |
| 319 | } |
fpizlo@apple.com | ee10e45 | 2013-04-09 00:10:16 +0000 | [diff] [blame] | 320 | if (node->child1()->shouldSpeculateString() && node->child2()->shouldSpeculateString() && GPRInfo::numberOfRegisters >= 7) { |
| 321 | setUseKindAndUnboxIfProfitable<StringUse>(node->child1()); |
| 322 | setUseKindAndUnboxIfProfitable<StringUse>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 323 | break; |
fpizlo@apple.com | ee10e45 | 2013-04-09 00:10:16 +0000 | [diff] [blame] | 324 | } |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 325 | if (node->child1()->shouldSpeculateObject() && node->child2()->shouldSpeculateObject()) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 326 | setUseKindAndUnboxIfProfitable<ObjectUse>(node->child1()); |
| 327 | setUseKindAndUnboxIfProfitable<ObjectUse>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 328 | break; |
| 329 | } |
| 330 | if (node->child1()->shouldSpeculateObject() && node->child2()->shouldSpeculateObjectOrOther()) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 331 | setUseKindAndUnboxIfProfitable<ObjectUse>(node->child1()); |
| 332 | setUseKindAndUnboxIfProfitable<ObjectOrOtherUse>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 333 | break; |
| 334 | } |
| 335 | if (node->child1()->shouldSpeculateObjectOrOther() && node->child2()->shouldSpeculateObject()) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 336 | setUseKindAndUnboxIfProfitable<ObjectOrOtherUse>(node->child1()); |
| 337 | setUseKindAndUnboxIfProfitable<ObjectUse>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 338 | break; |
| 339 | } |
| 340 | break; |
| 341 | } |
| 342 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 343 | case CompareStrictEqConstant: { |
fpizlo@apple.com | ee10e45 | 2013-04-09 00:10:16 +0000 | [diff] [blame] | 344 | break; |
| 345 | } |
| 346 | |
| 347 | case CompareStrictEq: { |
ggaren@apple.com | 0f001eb | 2013-04-24 15:48:55 +0000 | [diff] [blame] | 348 | if (Node::shouldSpeculateBoolean(node->child1().node(), node->child2().node())) { |
| 349 | setUseKindAndUnboxIfProfitable<BooleanUse>(node->child1()); |
| 350 | setUseKindAndUnboxIfProfitable<BooleanUse>(node->child2()); |
| 351 | break; |
| 352 | } |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 353 | if (Node::shouldSpeculateInteger(node->child1().node(), node->child2().node())) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 354 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
| 355 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 356 | break; |
| 357 | } |
| 358 | if (Node::shouldSpeculateNumber(node->child1().node(), node->child2().node())) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 359 | fixDoubleEdge<NumberUse>(node->child1()); |
| 360 | fixDoubleEdge<NumberUse>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 361 | break; |
| 362 | } |
oliver@apple.com | bd15be8 | 2013-07-25 04:03:42 +0000 | [diff] [blame] | 363 | if (node->child1()->shouldSpeculateStringIdent() && node->child2()->shouldSpeculateStringIdent()) { |
| 364 | setUseKindAndUnboxIfProfitable<StringIdentUse>(node->child1()); |
| 365 | setUseKindAndUnboxIfProfitable<StringIdentUse>(node->child2()); |
| 366 | break; |
| 367 | } |
fpizlo@apple.com | ee10e45 | 2013-04-09 00:10:16 +0000 | [diff] [blame] | 368 | if (node->child1()->shouldSpeculateString() && node->child2()->shouldSpeculateString() && GPRInfo::numberOfRegisters >= 7) { |
| 369 | setUseKindAndUnboxIfProfitable<StringUse>(node->child1()); |
| 370 | setUseKindAndUnboxIfProfitable<StringUse>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 371 | break; |
fpizlo@apple.com | ee10e45 | 2013-04-09 00:10:16 +0000 | [diff] [blame] | 372 | } |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 373 | if (node->child1()->shouldSpeculateObject() && node->child2()->shouldSpeculateObject()) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 374 | setUseKindAndUnboxIfProfitable<ObjectUse>(node->child1()); |
| 375 | setUseKindAndUnboxIfProfitable<ObjectUse>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 376 | break; |
| 377 | } |
| 378 | break; |
| 379 | } |
| 380 | |
commit-queue@webkit.org | aa31a5e | 2013-04-09 06:45:16 +0000 | [diff] [blame] | 381 | case StringFromCharCode: |
| 382 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
| 383 | break; |
| 384 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 385 | case StringCharAt: |
| 386 | case StringCharCodeAt: { |
| 387 | // Currently we have no good way of refining these. |
| 388 | ASSERT(node->arrayMode() == ArrayMode(Array::String)); |
| 389 | blessArrayOperation(node->child1(), node->child2(), node->child3()); |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 390 | setUseKindAndUnboxIfProfitable<KnownCellUse>(node->child1()); |
| 391 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 392 | break; |
| 393 | } |
| 394 | |
fpizlo@apple.com | a387b6a | 2012-11-01 07:41:43 +0000 | [diff] [blame] | 395 | case GetByVal: { |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 396 | node->setArrayMode( |
| 397 | node->arrayMode().refine( |
| 398 | node->child1()->prediction(), |
| 399 | node->child2()->prediction(), |
| 400 | SpecNone, node->flags())); |
fpizlo@apple.com | 7aed8d8 | 2012-08-23 03:38:52 +0000 | [diff] [blame] | 401 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 402 | blessArrayOperation(node->child1(), node->child2(), node->child3()); |
fpizlo@apple.com | 94e84e9 | 2012-11-11 02:56:12 +0000 | [diff] [blame] | 403 | |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 404 | ArrayMode arrayMode = node->arrayMode(); |
oliver@apple.com | 211b3be | 2013-07-25 04:03:39 +0000 | [diff] [blame] | 405 | switch (arrayMode.type()) { |
| 406 | case Array::Double: |
| 407 | if (arrayMode.arrayClass() == Array::OriginalArray |
| 408 | && arrayMode.speculation() == Array::InBounds |
oliver@apple.com | 211b3be | 2013-07-25 04:03:39 +0000 | [diff] [blame] | 409 | && m_graph.globalObjectFor(node->codeOrigin)->arrayPrototypeChainIsSane() |
| 410 | && !(node->flags() & NodeUsedAsOther)) |
| 411 | node->setArrayMode(arrayMode.withSpeculation(Array::SaneChain)); |
| 412 | break; |
| 413 | |
| 414 | case Array::String: |
| 415 | if ((node->prediction() & ~SpecString) |
| 416 | || m_graph.hasExitSite(node->codeOrigin, OutOfBounds)) |
| 417 | node->setArrayMode(arrayMode.withSpeculation(Array::OutOfBounds)); |
| 418 | break; |
| 419 | |
| 420 | default: |
| 421 | break; |
| 422 | } |
fpizlo@apple.com | 94e84e9 | 2012-11-11 02:56:12 +0000 | [diff] [blame] | 423 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 424 | switch (node->arrayMode().type()) { |
| 425 | case Array::SelectUsingPredictions: |
| 426 | case Array::Unprofiled: |
| 427 | case Array::Undecided: |
| 428 | RELEASE_ASSERT_NOT_REACHED(); |
| 429 | break; |
| 430 | case Array::Generic: |
| 431 | #if USE(JSVALUE32_64) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 432 | setUseKindAndUnboxIfProfitable<CellUse>(node->child1()); // Speculating cell due to register pressure on 32-bit. |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 433 | #endif |
| 434 | break; |
| 435 | case Array::ForceExit: |
| 436 | break; |
| 437 | default: |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 438 | setUseKindAndUnboxIfProfitable<KnownCellUse>(node->child1()); |
| 439 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 440 | break; |
| 441 | } |
| 442 | |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 443 | break; |
| 444 | } |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 445 | |
| 446 | case PutByVal: |
| 447 | case PutByValAlias: { |
| 448 | Edge& child1 = m_graph.varArgChild(node, 0); |
| 449 | Edge& child2 = m_graph.varArgChild(node, 1); |
| 450 | Edge& child3 = m_graph.varArgChild(node, 2); |
| 451 | |
| 452 | node->setArrayMode( |
| 453 | node->arrayMode().refine( |
| 454 | child1->prediction(), |
| 455 | child2->prediction(), |
| 456 | child3->prediction())); |
| 457 | |
| 458 | blessArrayOperation(child1, child2, m_graph.varArgChild(node, 3)); |
| 459 | |
| 460 | switch (node->arrayMode().modeForPut().type()) { |
| 461 | case Array::SelectUsingPredictions: |
| 462 | case Array::Unprofiled: |
| 463 | case Array::Undecided: |
| 464 | RELEASE_ASSERT_NOT_REACHED(); |
| 465 | break; |
| 466 | case Array::ForceExit: |
| 467 | case Array::Generic: |
| 468 | #if USE(JSVALUE32_64) |
| 469 | // Due to register pressure on 32-bit, we speculate cell and |
| 470 | // ignore the base-is-not-cell case entirely by letting the |
| 471 | // baseline JIT handle it. |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 472 | setUseKindAndUnboxIfProfitable<CellUse>(child1); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 473 | #endif |
| 474 | break; |
| 475 | case Array::Int32: |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 476 | setUseKindAndUnboxIfProfitable<KnownCellUse>(child1); |
| 477 | setUseKindAndUnboxIfProfitable<Int32Use>(child2); |
| 478 | setUseKindAndUnboxIfProfitable<Int32Use>(child3); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 479 | break; |
| 480 | case Array::Double: |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 481 | setUseKindAndUnboxIfProfitable<KnownCellUse>(child1); |
| 482 | setUseKindAndUnboxIfProfitable<Int32Use>(child2); |
| 483 | fixDoubleEdge<RealNumberUse>(child3); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 484 | break; |
| 485 | case Array::Int8Array: |
| 486 | case Array::Int16Array: |
| 487 | case Array::Int32Array: |
| 488 | case Array::Uint8Array: |
| 489 | case Array::Uint8ClampedArray: |
| 490 | case Array::Uint16Array: |
| 491 | case Array::Uint32Array: |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 492 | setUseKindAndUnboxIfProfitable<KnownCellUse>(child1); |
| 493 | setUseKindAndUnboxIfProfitable<Int32Use>(child2); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 494 | if (child3->shouldSpeculateInteger()) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 495 | setUseKindAndUnboxIfProfitable<Int32Use>(child3); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 496 | else |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 497 | fixDoubleEdge<NumberUse>(child3); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 498 | break; |
| 499 | case Array::Float32Array: |
| 500 | case Array::Float64Array: |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 501 | setUseKindAndUnboxIfProfitable<KnownCellUse>(child1); |
| 502 | setUseKindAndUnboxIfProfitable<Int32Use>(child2); |
| 503 | fixDoubleEdge<NumberUse>(child3); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 504 | break; |
| 505 | default: |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 506 | setUseKindAndUnboxIfProfitable<KnownCellUse>(child1); |
| 507 | setUseKindAndUnboxIfProfitable<Int32Use>(child2); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 508 | break; |
| 509 | } |
fpizlo@apple.com | a387b6a | 2012-11-01 07:41:43 +0000 | [diff] [blame] | 510 | break; |
| 511 | } |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 512 | |
fpizlo@apple.com | 04c1974 | 2012-08-26 22:35:26 +0000 | [diff] [blame] | 513 | case ArrayPush: { |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 514 | // May need to refine the array mode in case the value prediction contravenes |
| 515 | // the array prediction. For example, we may have evidence showing that the |
| 516 | // array is in Int32 mode, but the value we're storing is likely to be a double. |
| 517 | // Then we should turn this into a conversion to Double array followed by the |
| 518 | // push. On the other hand, we absolutely don't want to refine based on the |
| 519 | // base prediction. If it has non-cell garbage in it, then we want that to be |
| 520 | // ignored. That's because ArrayPush can't handle any array modes that aren't |
| 521 | // array-related - so if refine() turned this into a "Generic" ArrayPush then |
| 522 | // that would break things. |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 523 | node->setArrayMode( |
| 524 | node->arrayMode().refine( |
| 525 | node->child1()->prediction() & SpecCell, |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 526 | SpecInt32, |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 527 | node->child2()->prediction())); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 528 | blessArrayOperation(node->child1(), Edge(), node->child3()); |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 529 | setUseKindAndUnboxIfProfitable<KnownCellUse>(node->child1()); |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 530 | |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 531 | switch (node->arrayMode().type()) { |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 532 | case Array::Int32: |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 533 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 534 | break; |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 535 | case Array::Double: |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 536 | fixDoubleEdge<RealNumberUse>(node->child2()); |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 537 | break; |
| 538 | default: |
| 539 | break; |
| 540 | } |
fpizlo@apple.com | 04c1974 | 2012-08-26 22:35:26 +0000 | [diff] [blame] | 541 | break; |
| 542 | } |
| 543 | |
| 544 | case ArrayPop: { |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 545 | blessArrayOperation(node->child1(), Edge(), node->child2()); |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 546 | setUseKindAndUnboxIfProfitable<KnownCellUse>(node->child1()); |
fpizlo@apple.com | 8fd7921 | 2012-10-16 21:59:35 +0000 | [diff] [blame] | 547 | break; |
fpizlo@apple.com | 04c1974 | 2012-08-26 22:35:26 +0000 | [diff] [blame] | 548 | } |
| 549 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 550 | case RegExpExec: |
| 551 | case RegExpTest: { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 552 | setUseKindAndUnboxIfProfitable<CellUse>(node->child1()); |
| 553 | setUseKindAndUnboxIfProfitable<CellUse>(node->child2()); |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 554 | break; |
| 555 | } |
| 556 | |
| 557 | case Branch: { |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 558 | if (node->child1()->shouldSpeculateBoolean()) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 559 | setUseKindAndUnboxIfProfitable<BooleanUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 560 | else if (node->child1()->shouldSpeculateObjectOrOther()) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 561 | setUseKindAndUnboxIfProfitable<ObjectOrOtherUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 562 | else if (node->child1()->shouldSpeculateInteger()) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 563 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 564 | else if (node->child1()->shouldSpeculateNumber()) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 565 | fixDoubleEdge<NumberUse>(node->child1()); |
fpizlo@apple.com | e2967fd | 2012-04-04 21:14:48 +0000 | [diff] [blame] | 566 | |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 567 | Node* logicalNot = node->child1().node(); |
fpizlo@apple.com | 098a145 | 2013-03-01 20:57:37 +0000 | [diff] [blame] | 568 | if (logicalNot->op() == LogicalNot) { |
fpizlo@apple.com | 573b900 | 2013-02-13 21:00:01 +0000 | [diff] [blame] | 569 | |
| 570 | // Make sure that OSR exit can't observe the LogicalNot. If it can, |
| 571 | // then we must compute it and cannot peephole around it. |
| 572 | bool found = false; |
| 573 | bool ok = true; |
| 574 | for (unsigned i = m_indexInBlock; i--;) { |
| 575 | Node* candidate = m_block->at(i); |
fpizlo@apple.com | 573b900 | 2013-02-13 21:00:01 +0000 | [diff] [blame] | 576 | if (candidate == logicalNot) { |
| 577 | found = true; |
| 578 | break; |
| 579 | } |
| 580 | if (candidate->canExit()) { |
| 581 | ok = false; |
| 582 | found = true; |
| 583 | break; |
| 584 | } |
| 585 | } |
| 586 | ASSERT_UNUSED(found, found); |
| 587 | |
| 588 | if (ok) { |
| 589 | Edge newChildEdge = logicalNot->child1(); |
| 590 | if (newChildEdge->hasBooleanResult()) { |
fpizlo@apple.com | 573b900 | 2013-02-13 21:00:01 +0000 | [diff] [blame] | 591 | node->children.setChild1(newChildEdge); |
| 592 | |
oliver@apple.com | 426f5b0 | 2013-07-25 04:04:27 +0000 | [diff] [blame] | 593 | BasicBlock* toBeTaken = node->notTakenBlock(); |
| 594 | BasicBlock* toBeNotTaken = node->takenBlock(); |
| 595 | node->setTakenBlock(toBeTaken); |
| 596 | node->setNotTakenBlock(toBeNotTaken); |
fpizlo@apple.com | 573b900 | 2013-02-13 21:00:01 +0000 | [diff] [blame] | 597 | } |
fpizlo@apple.com | a6c889b | 2012-04-12 04:19:07 +0000 | [diff] [blame] | 598 | } |
fpizlo@apple.com | e2967fd | 2012-04-04 21:14:48 +0000 | [diff] [blame] | 599 | } |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 600 | break; |
| 601 | } |
| 602 | |
oliver@apple.com | 9b7647b | 2013-07-25 04:03:00 +0000 | [diff] [blame] | 603 | case Switch: { |
| 604 | SwitchData* data = node->switchData(); |
| 605 | switch (data->kind) { |
| 606 | case SwitchImm: |
| 607 | if (node->child1()->shouldSpeculateInteger()) |
| 608 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
| 609 | break; |
oliver@apple.com | 9e1c809 | 2013-07-25 04:03:16 +0000 | [diff] [blame] | 610 | case SwitchChar: |
| 611 | if (node->child1()->shouldSpeculateString()) |
| 612 | setUseKindAndUnboxIfProfitable<StringUse>(node->child1()); |
| 613 | break; |
oliver@apple.com | 5c826c0 | 2013-07-25 04:03:51 +0000 | [diff] [blame] | 614 | case SwitchString: |
| 615 | if (node->child1()->shouldSpeculateStringIdent()) |
| 616 | setUseKindAndUnboxIfProfitable<StringIdentUse>(node->child1()); |
| 617 | else if (node->child1()->shouldSpeculateString()) |
| 618 | setUseKindAndUnboxIfProfitable<StringUse>(node->child1()); |
| 619 | break; |
oliver@apple.com | 9b7647b | 2013-07-25 04:03:00 +0000 | [diff] [blame] | 620 | } |
| 621 | break; |
| 622 | } |
| 623 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 624 | case ToPrimitive: { |
fpizlo@apple.com | 7e5ed6e | 2013-03-20 22:37:09 +0000 | [diff] [blame] | 625 | fixupToPrimitive(node); |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 626 | break; |
| 627 | } |
| 628 | |
fpizlo@apple.com | 0e6e154 | 2013-03-18 18:09:22 +0000 | [diff] [blame] | 629 | case ToString: { |
fpizlo@apple.com | 7e5ed6e | 2013-03-20 22:37:09 +0000 | [diff] [blame] | 630 | fixupToString(node); |
fpizlo@apple.com | 0e6e154 | 2013-03-18 18:09:22 +0000 | [diff] [blame] | 631 | break; |
| 632 | } |
| 633 | |
| 634 | case NewStringObject: { |
| 635 | setUseKindAndUnboxIfProfitable<KnownStringUse>(node->child1()); |
| 636 | break; |
| 637 | } |
| 638 | |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 639 | case NewArray: { |
| 640 | for (unsigned i = m_graph.varArgNumChildren(node); i--;) { |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 641 | node->setIndexingType( |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 642 | leastUpperBoundOfIndexingTypeAndType( |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 643 | node->indexingType(), m_graph.varArgChild(node, i)->prediction())); |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 644 | } |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 645 | switch (node->indexingType()) { |
| 646 | case ALL_BLANK_INDEXING_TYPES: |
| 647 | CRASH(); |
| 648 | break; |
| 649 | case ALL_UNDECIDED_INDEXING_TYPES: |
| 650 | if (node->numChildren()) { |
| 651 | // This will only happen if the children have no type predictions. We |
| 652 | // would have already exited by now, but insert a forced exit just to |
| 653 | // be safe. |
| 654 | m_insertionSet.insertNode( |
fpizlo@apple.com | 06f82b5 | 2013-03-06 02:27:16 +0000 | [diff] [blame] | 655 | m_indexInBlock, SpecNone, ForceOSRExit, node->codeOrigin); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 656 | } |
| 657 | break; |
| 658 | case ALL_INT32_INDEXING_TYPES: |
| 659 | for (unsigned operandIndex = 0; operandIndex < node->numChildren(); ++operandIndex) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 660 | setUseKindAndUnboxIfProfitable<Int32Use>(m_graph.m_varArgChildren[node->firstChild() + operandIndex]); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 661 | break; |
| 662 | case ALL_DOUBLE_INDEXING_TYPES: |
| 663 | for (unsigned operandIndex = 0; operandIndex < node->numChildren(); ++operandIndex) |
fpizlo@apple.com | ed63054 | 2013-08-07 04:04:50 +0000 | [diff] [blame] | 664 | fixDoubleEdge<RealNumberUse>(m_graph.m_varArgChildren[node->firstChild() + operandIndex]); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 665 | break; |
| 666 | case ALL_CONTIGUOUS_INDEXING_TYPES: |
| 667 | case ALL_ARRAY_STORAGE_INDEXING_TYPES: |
| 668 | break; |
| 669 | default: |
| 670 | CRASH(); |
| 671 | break; |
fpizlo@apple.com | 75c91a7 | 2012-11-08 22:28:25 +0000 | [diff] [blame] | 672 | } |
| 673 | break; |
| 674 | } |
| 675 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 676 | case NewArrayWithSize: { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 677 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 678 | break; |
| 679 | } |
| 680 | |
oliver@apple.com | e2fe4ce | 2013-07-25 03:59:41 +0000 | [diff] [blame] | 681 | case ToThis: { |
| 682 | ECMAMode ecmaMode = m_graph.executableFor(node->codeOrigin)->isStrictMode() ? StrictMode : NotStrictMode; |
| 683 | |
fpizlo@apple.com | 33b10ee | 2013-03-07 09:04:57 +0000 | [diff] [blame] | 684 | if (isOtherSpeculation(node->child1()->prediction())) { |
oliver@apple.com | e2fe4ce | 2013-07-25 03:59:41 +0000 | [diff] [blame] | 685 | if (ecmaMode == StrictMode) { |
| 686 | setUseKindAndUnboxIfProfitable<OtherUse>(node->child1()); |
| 687 | node->convertToIdentity(); |
| 688 | break; |
| 689 | } |
| 690 | |
fpizlo@apple.com | 33b10ee | 2013-03-07 09:04:57 +0000 | [diff] [blame] | 691 | m_insertionSet.insertNode( |
| 692 | m_indexInBlock, SpecNone, Phantom, node->codeOrigin, |
| 693 | Edge(node->child1().node(), OtherUse)); |
| 694 | observeUseKindOnNode<OtherUse>(node->child1().node()); |
| 695 | node->convertToWeakConstant(m_graph.globalThisObjectFor(node->codeOrigin)); |
| 696 | break; |
| 697 | } |
| 698 | |
oliver@apple.com | e2fe4ce | 2013-07-25 03:59:41 +0000 | [diff] [blame] | 699 | if (isFinalObjectSpeculation(node->child1()->prediction())) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 700 | setUseKindAndUnboxIfProfitable<ObjectUse>(node->child1()); |
fpizlo@apple.com | 33b10ee | 2013-03-07 09:04:57 +0000 | [diff] [blame] | 701 | node->convertToIdentity(); |
| 702 | break; |
| 703 | } |
| 704 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 705 | break; |
| 706 | } |
| 707 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 708 | case GetMyArgumentByVal: |
| 709 | case GetMyArgumentByValSafe: { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 710 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 711 | break; |
| 712 | } |
| 713 | |
oliver@apple.com | 58c8675 | 2013-07-25 04:02:40 +0000 | [diff] [blame] | 714 | case GetClosureRegisters: |
| 715 | case PutClosureVar: |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 716 | case SkipTopScope: |
| 717 | case SkipScope: |
| 718 | case SetCallee: |
| 719 | case SetMyScope: |
| 720 | case PutStructure: |
| 721 | case AllocatePropertyStorage: |
| 722 | case ReallocatePropertyStorage: |
oliver@apple.com | e17632e | 2013-07-25 04:05:31 +0000 | [diff] [blame] | 723 | case GetScope: { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 724 | setUseKindAndUnboxIfProfitable<KnownCellUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 725 | break; |
| 726 | } |
| 727 | |
fpizlo@apple.com | 151e9af | 2013-08-16 02:30:37 +0000 | [diff] [blame] | 728 | case GetById: |
| 729 | case GetByIdFlush: { |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 730 | if (!node->child1()->shouldSpeculateCell()) |
| 731 | break; |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 732 | setUseKindAndUnboxIfProfitable<CellUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 733 | if (!isInt32Speculation(node->prediction())) |
| 734 | break; |
oliver@apple.com | 90fce82 | 2013-07-25 04:00:13 +0000 | [diff] [blame] | 735 | if (m_graph.identifiers()[node->identifierNumber()] != vm().propertyNames->length.impl()) |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 736 | break; |
oliver@apple.com | c14eb7d | 2013-07-25 03:58:47 +0000 | [diff] [blame] | 737 | CodeBlock* profiledBlock = m_graph.baselineCodeBlockFor(node->codeOrigin); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 738 | ArrayProfile* arrayProfile = |
oliver@apple.com | c14eb7d | 2013-07-25 03:58:47 +0000 | [diff] [blame] | 739 | profiledBlock->getArrayProfile(node->codeOrigin.bytecodeIndex); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 740 | ArrayMode arrayMode = ArrayMode(Array::SelectUsingPredictions); |
| 741 | if (arrayProfile) { |
oliver@apple.com | d205666 | 2013-07-25 04:00:37 +0000 | [diff] [blame] | 742 | ConcurrentJITLocker locker(profiledBlock->m_lock); |
oliver@apple.com | c14eb7d | 2013-07-25 03:58:47 +0000 | [diff] [blame] | 743 | arrayProfile->computeUpdatedPrediction(locker, profiledBlock); |
| 744 | arrayMode = ArrayMode::fromObserved(locker, arrayProfile, Array::Read, false); |
fpizlo@apple.com | 151e9af | 2013-08-16 02:30:37 +0000 | [diff] [blame] | 745 | if (arrayMode.type() == Array::Unprofiled) { |
| 746 | // For normal array operations, it makes sense to treat Unprofiled |
| 747 | // accesses as ForceExit and get more data rather than using |
| 748 | // predictions and then possibly ending up with a Generic. But here, |
| 749 | // we treat anything that is Unprofiled as Generic and keep the |
| 750 | // GetById. I.e. ForceExit = Generic. So, there is no harm - and only |
| 751 | // profit - from treating the Unprofiled case as |
| 752 | // SelectUsingPredictions. |
| 753 | arrayMode = ArrayMode(Array::SelectUsingPredictions); |
| 754 | } |
| 755 | } |
| 756 | |
| 757 | arrayMode = arrayMode.refine(node->child1()->prediction(), node->prediction()); |
fpizlo@apple.com | cbc4113 | 2013-03-19 20:23:01 +0000 | [diff] [blame] | 758 | |
| 759 | if (arrayMode.type() == Array::Generic) { |
| 760 | // Check if the input is something that we can't get array length for, but for which we |
| 761 | // could insert some conversions in order to transform it into something that we can do it |
| 762 | // for. |
| 763 | if (node->child1()->shouldSpeculateStringObject()) |
| 764 | attemptToForceStringArrayModeByToStringConversion<StringObjectUse>(arrayMode, node); |
| 765 | else if (node->child1()->shouldSpeculateStringOrStringObject()) |
| 766 | attemptToForceStringArrayModeByToStringConversion<StringOrStringObjectUse>(arrayMode, node); |
| 767 | } |
| 768 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 769 | if (!arrayMode.supportsLength()) |
| 770 | break; |
| 771 | node->setOp(GetArrayLength); |
| 772 | ASSERT(node->flags() & NodeMustGenerate); |
| 773 | node->clearFlags(NodeMustGenerate | NodeClobbersWorld); |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 774 | setUseKindAndUnboxIfProfitable<KnownCellUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 775 | node->setArrayMode(arrayMode); |
| 776 | |
fpizlo@apple.com | 06f82b5 | 2013-03-06 02:27:16 +0000 | [diff] [blame] | 777 | Node* storage = checkArray(arrayMode, node->codeOrigin, node->child1().node(), 0, lengthNeedsStorage); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 778 | if (!storage) |
| 779 | break; |
| 780 | |
| 781 | node->child2() = Edge(storage); |
| 782 | break; |
| 783 | } |
| 784 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 785 | case CheckExecutable: |
| 786 | case CheckStructure: |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 787 | case StructureTransitionWatchpoint: |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 788 | case CheckFunction: |
| 789 | case PutById: |
| 790 | case PutByIdDirect: |
oliver@apple.com | e17632e | 2013-07-25 04:05:31 +0000 | [diff] [blame] | 791 | case CheckHasInstance: |
| 792 | case CreateThis: |
| 793 | case GetButterfly: { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 794 | setUseKindAndUnboxIfProfitable<CellUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 795 | break; |
| 796 | } |
| 797 | |
oliver@apple.com | 500b53a | 2013-07-25 04:05:25 +0000 | [diff] [blame] | 798 | case CheckArray: { |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 799 | switch (node->arrayMode().type()) { |
| 800 | case Array::String: |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 801 | setUseKindAndUnboxIfProfitable<StringUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 802 | break; |
| 803 | default: |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 804 | setUseKindAndUnboxIfProfitable<CellUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 805 | break; |
| 806 | } |
| 807 | break; |
| 808 | } |
| 809 | |
| 810 | case Arrayify: |
| 811 | case ArrayifyToStructure: { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 812 | setUseKindAndUnboxIfProfitable<CellUse>(node->child1()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 813 | if (node->child2()) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 814 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 815 | break; |
| 816 | } |
| 817 | |
| 818 | case GetByOffset: { |
| 819 | if (!node->child1()->hasStorageResult()) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 820 | setUseKindAndUnboxIfProfitable<KnownCellUse>(node->child1()); |
oliver@apple.com | 0402d95 | 2013-07-25 04:05:07 +0000 | [diff] [blame] | 821 | setUseKindAndUnboxIfProfitable<KnownCellUse>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 822 | break; |
| 823 | } |
| 824 | |
| 825 | case PutByOffset: { |
| 826 | if (!node->child1()->hasStorageResult()) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 827 | setUseKindAndUnboxIfProfitable<KnownCellUse>(node->child1()); |
| 828 | setUseKindAndUnboxIfProfitable<KnownCellUse>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 829 | break; |
| 830 | } |
| 831 | |
| 832 | case InstanceOf: { |
| 833 | // FIXME: This appears broken: CheckHasInstance already does an unconditional cell |
| 834 | // check. https://bugs.webkit.org/show_bug.cgi?id=107479 |
| 835 | if (!(node->child1()->prediction() & ~SpecCell)) |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 836 | setUseKindAndUnboxIfProfitable<CellUse>(node->child1()); |
| 837 | setUseKindAndUnboxIfProfitable<CellUse>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 838 | break; |
| 839 | } |
oliver@apple.com | b3e5acb | 2013-07-25 04:02:53 +0000 | [diff] [blame] | 840 | |
| 841 | case In: { |
| 842 | // FIXME: We should at some point have array profiling on op_in, in which |
| 843 | // case we would be able to turn this into a kind of GetByVal. |
| 844 | |
| 845 | setUseKindAndUnboxIfProfitable<CellUse>(node->child2()); |
| 846 | break; |
| 847 | } |
fpizlo@apple.com | 4695591 | 2013-04-26 01:18:18 +0000 | [diff] [blame] | 848 | |
| 849 | case Phantom: |
| 850 | case Identity: { |
| 851 | switch (node->child1().useKind()) { |
| 852 | case NumberUse: |
| 853 | if (node->child1()->shouldSpeculateIntegerForArithmetic()) |
| 854 | node->child1().setUseKind(Int32Use); |
| 855 | break; |
| 856 | default: |
| 857 | break; |
| 858 | } |
| 859 | observeUseKindOnEdge(node->child1()); |
| 860 | break; |
| 861 | } |
| 862 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 863 | case GetArrayLength: |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 864 | case Phi: |
oliver@apple.com | 827d2cf | 2013-07-25 04:04:45 +0000 | [diff] [blame] | 865 | case Upsilon: |
| 866 | case GetArgument: |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 867 | case PhantomPutStructure: |
| 868 | case GetIndexedPropertyStorage: |
| 869 | case LastNodeType: |
fpizlo@apple.com | 06f82b5 | 2013-03-06 02:27:16 +0000 | [diff] [blame] | 870 | case MovHint: |
| 871 | case MovHintAndCheck: |
| 872 | case ZombieHint: |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 873 | RELEASE_ASSERT_NOT_REACHED(); |
| 874 | break; |
| 875 | |
| 876 | #if !ASSERT_DISABLED |
| 877 | // Have these no-op cases here to ensure that nobody forgets to add handlers for new opcodes. |
| 878 | case SetArgument: |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 879 | case JSConstant: |
| 880 | case WeakJSConstant: |
| 881 | case GetLocal: |
| 882 | case GetCallee: |
| 883 | case Flush: |
| 884 | case PhantomLocal: |
| 885 | case GetLocalUnlinked: |
| 886 | case InlineStart: |
| 887 | case GetMyScope: |
oliver@apple.com | 58c8675 | 2013-07-25 04:02:40 +0000 | [diff] [blame] | 888 | case GetClosureVar: |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 889 | case GetGlobalVar: |
| 890 | case PutGlobalVar: |
| 891 | case GlobalVarWatchpoint: |
oliver@apple.com | 58c8675 | 2013-07-25 04:02:40 +0000 | [diff] [blame] | 892 | case VarInjectionWatchpoint: |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 893 | case AllocationProfileWatchpoint: |
| 894 | case Call: |
| 895 | case Construct: |
| 896 | case NewObject: |
| 897 | case NewArrayBuffer: |
| 898 | case NewRegexp: |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 899 | case Breakpoint: |
| 900 | case IsUndefined: |
| 901 | case IsBoolean: |
| 902 | case IsNumber: |
| 903 | case IsString: |
| 904 | case IsObject: |
| 905 | case IsFunction: |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 906 | case CreateActivation: |
| 907 | case TearOffActivation: |
| 908 | case CreateArguments: |
| 909 | case PhantomArguments: |
| 910 | case TearOffArguments: |
| 911 | case GetMyArgumentsLength: |
| 912 | case GetMyArgumentsLengthSafe: |
| 913 | case CheckArgumentsNotCreated: |
| 914 | case NewFunction: |
| 915 | case NewFunctionNoCheck: |
| 916 | case NewFunctionExpression: |
| 917 | case Jump: |
| 918 | case Return: |
| 919 | case Throw: |
| 920 | case ThrowReferenceError: |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 921 | case CountExecution: |
| 922 | case ForceOSRExit: |
mark.lam@apple.com | 10d23a1 | 2013-04-25 02:59:51 +0000 | [diff] [blame] | 923 | case CheckWatchdogTimer: |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 924 | break; |
| 925 | #else |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 926 | default: |
| 927 | break; |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 928 | #endif |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 929 | } |
| 930 | |
| 931 | #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 932 | if (!(node->flags() & NodeHasVarArgs)) { |
fpizlo@apple.com | 01902c8 | 2012-11-22 04:23:36 +0000 | [diff] [blame] | 933 | dataLogF("new children: "); |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 934 | node->dumpChildren(WTF::dataFile()); |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 935 | } |
fpizlo@apple.com | 01902c8 | 2012-11-22 04:23:36 +0000 | [diff] [blame] | 936 | dataLogF("\n"); |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 937 | #endif |
| 938 | } |
| 939 | |
fpizlo@apple.com | 8d22591 | 2013-03-19 00:44:57 +0000 | [diff] [blame] | 940 | template<UseKind useKind> |
fpizlo@apple.com | 4463e44 | 2013-03-20 20:29:37 +0000 | [diff] [blame] | 941 | void createToString(Node* node, Edge& edge) |
fpizlo@apple.com | cbc4113 | 2013-03-19 20:23:01 +0000 | [diff] [blame] | 942 | { |
fpizlo@apple.com | 4463e44 | 2013-03-20 20:29:37 +0000 | [diff] [blame] | 943 | edge.setNode(m_insertionSet.insertNode( |
fpizlo@apple.com | cbc4113 | 2013-03-19 20:23:01 +0000 | [diff] [blame] | 944 | m_indexInBlock, SpecString, ToString, node->codeOrigin, |
fpizlo@apple.com | 4463e44 | 2013-03-20 20:29:37 +0000 | [diff] [blame] | 945 | Edge(edge.node(), useKind))); |
fpizlo@apple.com | cbc4113 | 2013-03-19 20:23:01 +0000 | [diff] [blame] | 946 | } |
| 947 | |
| 948 | template<UseKind useKind> |
| 949 | void attemptToForceStringArrayModeByToStringConversion(ArrayMode& arrayMode, Node* node) |
| 950 | { |
| 951 | ASSERT(arrayMode == ArrayMode(Array::Generic)); |
| 952 | |
| 953 | if (!canOptimizeStringObjectAccess(node->codeOrigin)) |
| 954 | return; |
| 955 | |
fpizlo@apple.com | 4463e44 | 2013-03-20 20:29:37 +0000 | [diff] [blame] | 956 | createToString<useKind>(node, node->child1()); |
fpizlo@apple.com | cbc4113 | 2013-03-19 20:23:01 +0000 | [diff] [blame] | 957 | arrayMode = ArrayMode(Array::String); |
| 958 | } |
| 959 | |
| 960 | template<UseKind useKind> |
fpizlo@apple.com | 8d22591 | 2013-03-19 00:44:57 +0000 | [diff] [blame] | 961 | bool isStringObjectUse() |
| 962 | { |
| 963 | switch (useKind) { |
| 964 | case StringObjectUse: |
| 965 | case StringOrStringObjectUse: |
| 966 | return true; |
| 967 | default: |
| 968 | return false; |
| 969 | } |
| 970 | } |
| 971 | |
| 972 | template<UseKind useKind> |
| 973 | void convertStringAddUse(Node* node, Edge& edge) |
| 974 | { |
| 975 | if (useKind == StringUse) { |
| 976 | // This preserves the binaryUseKind() invariant ot ValueAdd: ValueAdd's |
| 977 | // two edges will always have identical use kinds, which makes the |
| 978 | // decision process much easier. |
| 979 | observeUseKindOnNode<StringUse>(edge.node()); |
| 980 | m_insertionSet.insertNode( |
| 981 | m_indexInBlock, SpecNone, Phantom, node->codeOrigin, |
| 982 | Edge(edge.node(), StringUse)); |
| 983 | edge.setUseKind(KnownStringUse); |
| 984 | return; |
| 985 | } |
| 986 | |
| 987 | // FIXME: We ought to be able to have a ToPrimitiveToString node. |
| 988 | |
| 989 | observeUseKindOnNode<useKind>(edge.node()); |
fpizlo@apple.com | 4463e44 | 2013-03-20 20:29:37 +0000 | [diff] [blame] | 990 | createToString<useKind>(node, edge); |
| 991 | } |
| 992 | |
| 993 | void convertToMakeRope(Node* node) |
| 994 | { |
| 995 | node->setOpAndDefaultFlags(MakeRope); |
| 996 | fixupMakeRope(node); |
| 997 | } |
| 998 | |
| 999 | void fixupMakeRope(Node* node) |
| 1000 | { |
| 1001 | for (unsigned i = 0; i < AdjacencyList::Size; ++i) { |
| 1002 | Edge& edge = node->children.child(i); |
| 1003 | if (!edge) |
| 1004 | break; |
| 1005 | edge.setUseKind(KnownStringUse); |
| 1006 | if (!m_graph.isConstant(edge.node())) |
| 1007 | continue; |
| 1008 | JSString* string = jsCast<JSString*>(m_graph.valueOfJSConstant(edge.node()).asCell()); |
| 1009 | if (string->length()) |
| 1010 | continue; |
fpizlo@apple.com | 4bb938e | 2013-07-16 21:41:06 +0000 | [diff] [blame] | 1011 | |
| 1012 | // Don't allow the MakeRope to have zero children. |
| 1013 | if (!i && !node->child2()) |
| 1014 | break; |
| 1015 | |
fpizlo@apple.com | 4463e44 | 2013-03-20 20:29:37 +0000 | [diff] [blame] | 1016 | node->children.removeEdge(i--); |
| 1017 | } |
| 1018 | |
| 1019 | if (!node->child2()) { |
| 1020 | ASSERT(!node->child3()); |
| 1021 | node->convertToIdentity(); |
| 1022 | } |
fpizlo@apple.com | 8d22591 | 2013-03-19 00:44:57 +0000 | [diff] [blame] | 1023 | } |
| 1024 | |
fpizlo@apple.com | 7e5ed6e | 2013-03-20 22:37:09 +0000 | [diff] [blame] | 1025 | void fixupToPrimitive(Node* node) |
| 1026 | { |
| 1027 | if (node->child1()->shouldSpeculateInteger()) { |
| 1028 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
| 1029 | node->convertToIdentity(); |
| 1030 | return; |
| 1031 | } |
| 1032 | |
| 1033 | if (node->child1()->shouldSpeculateString()) { |
| 1034 | setUseKindAndUnboxIfProfitable<StringUse>(node->child1()); |
| 1035 | node->convertToIdentity(); |
| 1036 | return; |
| 1037 | } |
| 1038 | |
| 1039 | if (node->child1()->shouldSpeculateStringObject() |
| 1040 | && canOptimizeStringObjectAccess(node->codeOrigin)) { |
| 1041 | setUseKindAndUnboxIfProfitable<StringObjectUse>(node->child1()); |
| 1042 | node->convertToToString(); |
| 1043 | return; |
| 1044 | } |
| 1045 | |
| 1046 | if (node->child1()->shouldSpeculateStringOrStringObject() |
| 1047 | && canOptimizeStringObjectAccess(node->codeOrigin)) { |
| 1048 | setUseKindAndUnboxIfProfitable<StringOrStringObjectUse>(node->child1()); |
| 1049 | node->convertToToString(); |
| 1050 | return; |
| 1051 | } |
| 1052 | } |
| 1053 | |
| 1054 | void fixupToString(Node* node) |
| 1055 | { |
| 1056 | if (node->child1()->shouldSpeculateString()) { |
| 1057 | setUseKindAndUnboxIfProfitable<StringUse>(node->child1()); |
| 1058 | node->convertToIdentity(); |
| 1059 | return; |
| 1060 | } |
| 1061 | |
| 1062 | if (node->child1()->shouldSpeculateStringObject() |
| 1063 | && canOptimizeStringObjectAccess(node->codeOrigin)) { |
| 1064 | setUseKindAndUnboxIfProfitable<StringObjectUse>(node->child1()); |
| 1065 | return; |
| 1066 | } |
| 1067 | |
| 1068 | if (node->child1()->shouldSpeculateStringOrStringObject() |
| 1069 | && canOptimizeStringObjectAccess(node->codeOrigin)) { |
| 1070 | setUseKindAndUnboxIfProfitable<StringOrStringObjectUse>(node->child1()); |
| 1071 | return; |
| 1072 | } |
| 1073 | |
| 1074 | if (node->child1()->shouldSpeculateCell()) { |
| 1075 | setUseKindAndUnboxIfProfitable<CellUse>(node->child1()); |
| 1076 | return; |
| 1077 | } |
| 1078 | } |
| 1079 | |
fpizlo@apple.com | 8d22591 | 2013-03-19 00:44:57 +0000 | [diff] [blame] | 1080 | template<UseKind leftUseKind> |
| 1081 | bool attemptToMakeFastStringAdd(Node* node, Edge& left, Edge& right) |
| 1082 | { |
fpizlo@apple.com | dbeeff3 | 2013-07-24 04:51:57 +0000 | [diff] [blame] | 1083 | Node* originalLeft = left.node(); |
| 1084 | Node* originalRight = right.node(); |
| 1085 | |
fpizlo@apple.com | 8d22591 | 2013-03-19 00:44:57 +0000 | [diff] [blame] | 1086 | ASSERT(leftUseKind == StringUse || leftUseKind == StringObjectUse || leftUseKind == StringOrStringObjectUse); |
| 1087 | |
| 1088 | if (isStringObjectUse<leftUseKind>() && !canOptimizeStringObjectAccess(node->codeOrigin)) |
| 1089 | return false; |
| 1090 | |
fpizlo@apple.com | 7e5ed6e | 2013-03-20 22:37:09 +0000 | [diff] [blame] | 1091 | convertStringAddUse<leftUseKind>(node, left); |
| 1092 | |
| 1093 | if (right->shouldSpeculateString()) |
fpizlo@apple.com | 8d22591 | 2013-03-19 00:44:57 +0000 | [diff] [blame] | 1094 | convertStringAddUse<StringUse>(node, right); |
fpizlo@apple.com | 7e5ed6e | 2013-03-20 22:37:09 +0000 | [diff] [blame] | 1095 | else if (right->shouldSpeculateStringObject() && canOptimizeStringObjectAccess(node->codeOrigin)) |
fpizlo@apple.com | 8d22591 | 2013-03-19 00:44:57 +0000 | [diff] [blame] | 1096 | convertStringAddUse<StringObjectUse>(node, right); |
fpizlo@apple.com | 7e5ed6e | 2013-03-20 22:37:09 +0000 | [diff] [blame] | 1097 | else if (right->shouldSpeculateStringOrStringObject() && canOptimizeStringObjectAccess(node->codeOrigin)) |
fpizlo@apple.com | 8d22591 | 2013-03-19 00:44:57 +0000 | [diff] [blame] | 1098 | convertStringAddUse<StringOrStringObjectUse>(node, right); |
fpizlo@apple.com | 7e5ed6e | 2013-03-20 22:37:09 +0000 | [diff] [blame] | 1099 | else { |
| 1100 | // At this point we know that the other operand is something weird. The semantically correct |
| 1101 | // way of dealing with this is: |
| 1102 | // |
| 1103 | // MakeRope(@left, ToString(ToPrimitive(@right))) |
| 1104 | // |
| 1105 | // So that's what we emit. NB, we need to do all relevant type checks on @left before we do |
| 1106 | // anything to @right, since ToPrimitive may be effectful. |
| 1107 | |
| 1108 | Node* toPrimitive = m_insertionSet.insertNode( |
| 1109 | m_indexInBlock, resultOfToPrimitive(right->prediction()), ToPrimitive, node->codeOrigin, |
| 1110 | Edge(right.node())); |
| 1111 | Node* toString = m_insertionSet.insertNode( |
| 1112 | m_indexInBlock, SpecString, ToString, node->codeOrigin, Edge(toPrimitive)); |
| 1113 | |
| 1114 | fixupToPrimitive(toPrimitive); |
| 1115 | fixupToString(toString); |
| 1116 | |
| 1117 | right.setNode(toString); |
fpizlo@apple.com | 8d22591 | 2013-03-19 00:44:57 +0000 | [diff] [blame] | 1118 | } |
| 1119 | |
fpizlo@apple.com | dbeeff3 | 2013-07-24 04:51:57 +0000 | [diff] [blame] | 1120 | // We're doing checks up there, so we need to make sure that the |
| 1121 | // *original* inputs to the addition are live up to here. |
| 1122 | m_insertionSet.insertNode( |
| 1123 | m_indexInBlock, SpecNone, Phantom, node->codeOrigin, |
| 1124 | Edge(originalLeft), Edge(originalRight)); |
| 1125 | |
fpizlo@apple.com | 7e5ed6e | 2013-03-20 22:37:09 +0000 | [diff] [blame] | 1126 | convertToMakeRope(node); |
| 1127 | return true; |
fpizlo@apple.com | 8d22591 | 2013-03-19 00:44:57 +0000 | [diff] [blame] | 1128 | } |
| 1129 | |
oliver@apple.com | 0203946 | 2013-07-25 03:59:29 +0000 | [diff] [blame] | 1130 | bool isStringPrototypeMethodSane(Structure* stringPrototypeStructure, StringImpl* uid) |
fpizlo@apple.com | 0e6e154 | 2013-03-18 18:09:22 +0000 | [diff] [blame] | 1131 | { |
| 1132 | unsigned attributesUnused; |
| 1133 | JSCell* specificValue; |
oliver@apple.com | 22fdb10 | 2013-07-25 03:58:56 +0000 | [diff] [blame] | 1134 | PropertyOffset offset = stringPrototypeStructure->getConcurrently( |
oliver@apple.com | 0203946 | 2013-07-25 03:59:29 +0000 | [diff] [blame] | 1135 | vm(), uid, attributesUnused, specificValue); |
fpizlo@apple.com | 0e6e154 | 2013-03-18 18:09:22 +0000 | [diff] [blame] | 1136 | if (!isValidOffset(offset)) |
| 1137 | return false; |
| 1138 | |
| 1139 | if (!specificValue) |
| 1140 | return false; |
| 1141 | |
fpizlo@apple.com | 10ae2d0 | 2013-08-14 02:41:47 +0000 | [diff] [blame] | 1142 | if (!specificValue->inherits(JSFunction::info())) |
fpizlo@apple.com | 0e6e154 | 2013-03-18 18:09:22 +0000 | [diff] [blame] | 1143 | return false; |
| 1144 | |
| 1145 | JSFunction* function = jsCast<JSFunction*>(specificValue); |
| 1146 | if (function->executable()->intrinsicFor(CodeForCall) != StringPrototypeValueOfIntrinsic) |
| 1147 | return false; |
| 1148 | |
| 1149 | return true; |
| 1150 | } |
| 1151 | |
| 1152 | bool canOptimizeStringObjectAccess(const CodeOrigin& codeOrigin) |
| 1153 | { |
| 1154 | if (m_graph.hasExitSite(codeOrigin, NotStringObject)) |
| 1155 | return false; |
| 1156 | |
| 1157 | Structure* stringObjectStructure = m_graph.globalObjectFor(codeOrigin)->stringObjectStructure(); |
| 1158 | ASSERT(stringObjectStructure->storedPrototype().isObject()); |
fpizlo@apple.com | 10ae2d0 | 2013-08-14 02:41:47 +0000 | [diff] [blame] | 1159 | ASSERT(stringObjectStructure->storedPrototype().asCell()->classInfo() == StringPrototype::info()); |
fpizlo@apple.com | 0e6e154 | 2013-03-18 18:09:22 +0000 | [diff] [blame] | 1160 | |
| 1161 | JSObject* stringPrototypeObject = asObject(stringObjectStructure->storedPrototype()); |
| 1162 | Structure* stringPrototypeStructure = stringPrototypeObject->structure(); |
oliver@apple.com | 90fce82 | 2013-07-25 04:00:13 +0000 | [diff] [blame] | 1163 | if (!m_graph.watchpoints().isStillValid(stringPrototypeStructure->transitionWatchpointSet())) |
fpizlo@apple.com | 0e6e154 | 2013-03-18 18:09:22 +0000 | [diff] [blame] | 1164 | return false; |
| 1165 | |
| 1166 | if (stringPrototypeStructure->isDictionary()) |
| 1167 | return false; |
| 1168 | |
| 1169 | // We're being conservative here. We want DFG's ToString on StringObject to be |
| 1170 | // used in both numeric contexts (that would call valueOf()) and string contexts |
| 1171 | // (that would call toString()). We don't want the DFG to have to distinguish |
| 1172 | // between the two, just because that seems like it would get confusing. So we |
| 1173 | // just require both methods to be sane. |
oliver@apple.com | 0203946 | 2013-07-25 03:59:29 +0000 | [diff] [blame] | 1174 | if (!isStringPrototypeMethodSane(stringPrototypeStructure, vm().propertyNames->valueOf.impl())) |
fpizlo@apple.com | 0e6e154 | 2013-03-18 18:09:22 +0000 | [diff] [blame] | 1175 | return false; |
oliver@apple.com | 0203946 | 2013-07-25 03:59:29 +0000 | [diff] [blame] | 1176 | if (!isStringPrototypeMethodSane(stringPrototypeStructure, vm().propertyNames->toString.impl())) |
fpizlo@apple.com | 0e6e154 | 2013-03-18 18:09:22 +0000 | [diff] [blame] | 1177 | return false; |
| 1178 | |
| 1179 | return true; |
| 1180 | } |
| 1181 | |
fpizlo@apple.com | bbaf619 | 2013-02-27 01:45:28 +0000 | [diff] [blame] | 1182 | void fixupSetLocalsInBlock(BasicBlock* block) |
| 1183 | { |
| 1184 | if (!block) |
| 1185 | return; |
| 1186 | ASSERT(block->isReachable); |
| 1187 | m_block = block; |
| 1188 | for (m_indexInBlock = 0; m_indexInBlock < block->size(); ++m_indexInBlock) { |
| 1189 | Node* node = m_currentNode = block->at(m_indexInBlock); |
| 1190 | if (node->op() != SetLocal) |
| 1191 | continue; |
fpizlo@apple.com | bbaf619 | 2013-02-27 01:45:28 +0000 | [diff] [blame] | 1192 | |
| 1193 | VariableAccessData* variable = node->variableAccessData(); |
| 1194 | |
| 1195 | if (!variable->shouldUnboxIfPossible()) |
| 1196 | continue; |
| 1197 | |
| 1198 | if (variable->shouldUseDoubleFormat()) { |
| 1199 | fixDoubleEdge<NumberUse>(node->child1(), ForwardSpeculation); |
| 1200 | continue; |
| 1201 | } |
| 1202 | |
| 1203 | SpeculatedType predictedType = variable->argumentAwarePrediction(); |
| 1204 | if (isInt32Speculation(predictedType)) |
| 1205 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
| 1206 | else if (isCellSpeculation(predictedType)) |
| 1207 | setUseKindAndUnboxIfProfitable<CellUse>(node->child1()); |
| 1208 | else if (isBooleanSpeculation(predictedType)) |
| 1209 | setUseKindAndUnboxIfProfitable<BooleanUse>(node->child1()); |
| 1210 | } |
| 1211 | m_insertionSet.execute(block); |
| 1212 | } |
| 1213 | |
fpizlo@apple.com | 7bda058 | 2013-03-12 20:38:26 +0000 | [diff] [blame] | 1214 | Node* checkArray(ArrayMode arrayMode, const CodeOrigin& codeOrigin, Node* array, Node* index, bool (*storageCheck)(const ArrayMode&) = canCSEStorage) |
fpizlo@apple.com | 04c1974 | 2012-08-26 22:35:26 +0000 | [diff] [blame] | 1215 | { |
fpizlo@apple.com | 34d1f08 | 2012-10-28 06:13:23 +0000 | [diff] [blame] | 1216 | ASSERT(arrayMode.isSpecific()); |
fpizlo@apple.com | 04c1974 | 2012-08-26 22:35:26 +0000 | [diff] [blame] | 1217 | |
fpizlo@apple.com | 3f1a01b | 2012-11-10 05:54:11 +0000 | [diff] [blame] | 1218 | Structure* structure = arrayMode.originalArrayStructure(m_graph, codeOrigin); |
| 1219 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1220 | Edge indexEdge = index ? Edge(index, Int32Use) : Edge(); |
| 1221 | |
fpizlo@apple.com | 34d1f08 | 2012-10-28 06:13:23 +0000 | [diff] [blame] | 1222 | if (arrayMode.doesConversion()) { |
fpizlo@apple.com | 99f3762 | 2012-10-29 04:02:08 +0000 | [diff] [blame] | 1223 | if (structure) { |
fpizlo@apple.com | f45e88b | 2013-01-20 19:29:50 +0000 | [diff] [blame] | 1224 | m_insertionSet.insertNode( |
fpizlo@apple.com | 06f82b5 | 2013-03-06 02:27:16 +0000 | [diff] [blame] | 1225 | m_indexInBlock, SpecNone, ArrayifyToStructure, codeOrigin, |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1226 | OpInfo(structure), OpInfo(arrayMode.asWord()), Edge(array, CellUse), indexEdge); |
fpizlo@apple.com | 99f3762 | 2012-10-29 04:02:08 +0000 | [diff] [blame] | 1227 | } else { |
fpizlo@apple.com | f45e88b | 2013-01-20 19:29:50 +0000 | [diff] [blame] | 1228 | m_insertionSet.insertNode( |
fpizlo@apple.com | 06f82b5 | 2013-03-06 02:27:16 +0000 | [diff] [blame] | 1229 | m_indexInBlock, SpecNone, Arrayify, codeOrigin, |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1230 | OpInfo(arrayMode.asWord()), Edge(array, CellUse), indexEdge); |
fpizlo@apple.com | 99f3762 | 2012-10-29 04:02:08 +0000 | [diff] [blame] | 1231 | } |
| 1232 | } else { |
fpizlo@apple.com | 3f1a01b | 2012-11-10 05:54:11 +0000 | [diff] [blame] | 1233 | if (structure) { |
fpizlo@apple.com | f45e88b | 2013-01-20 19:29:50 +0000 | [diff] [blame] | 1234 | m_insertionSet.insertNode( |
fpizlo@apple.com | 06f82b5 | 2013-03-06 02:27:16 +0000 | [diff] [blame] | 1235 | m_indexInBlock, SpecNone, CheckStructure, codeOrigin, |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1236 | OpInfo(m_graph.addStructureSet(structure)), Edge(array, CellUse)); |
fpizlo@apple.com | 3f1a01b | 2012-11-10 05:54:11 +0000 | [diff] [blame] | 1237 | } else { |
fpizlo@apple.com | f45e88b | 2013-01-20 19:29:50 +0000 | [diff] [blame] | 1238 | m_insertionSet.insertNode( |
fpizlo@apple.com | 06f82b5 | 2013-03-06 02:27:16 +0000 | [diff] [blame] | 1239 | m_indexInBlock, SpecNone, CheckArray, codeOrigin, |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1240 | OpInfo(arrayMode.asWord()), Edge(array, CellUse)); |
fpizlo@apple.com | 3f1a01b | 2012-11-10 05:54:11 +0000 | [diff] [blame] | 1241 | } |
fpizlo@apple.com | 497c751 | 2012-09-19 01:20:52 +0000 | [diff] [blame] | 1242 | } |
| 1243 | |
fpizlo@apple.com | 04c1974 | 2012-08-26 22:35:26 +0000 | [diff] [blame] | 1244 | if (!storageCheck(arrayMode)) |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 1245 | return 0; |
fpizlo@apple.com | 04c1974 | 2012-08-26 22:35:26 +0000 | [diff] [blame] | 1246 | |
fpizlo@apple.com | f45e88b | 2013-01-20 19:29:50 +0000 | [diff] [blame] | 1247 | if (arrayMode.usesButterfly()) { |
| 1248 | return m_insertionSet.insertNode( |
oliver@apple.com | e17632e | 2013-07-25 04:05:31 +0000 | [diff] [blame] | 1249 | m_indexInBlock, SpecNone, GetButterfly, codeOrigin, Edge(array, CellUse)); |
fpizlo@apple.com | f45e88b | 2013-01-20 19:29:50 +0000 | [diff] [blame] | 1250 | } |
fpizlo@apple.com | 04c1974 | 2012-08-26 22:35:26 +0000 | [diff] [blame] | 1251 | |
fpizlo@apple.com | f45e88b | 2013-01-20 19:29:50 +0000 | [diff] [blame] | 1252 | return m_insertionSet.insertNode( |
fpizlo@apple.com | 06f82b5 | 2013-03-06 02:27:16 +0000 | [diff] [blame] | 1253 | m_indexInBlock, SpecNone, GetIndexedPropertyStorage, codeOrigin, |
| 1254 | OpInfo(arrayMode.asWord()), Edge(array, KnownCellUse)); |
fpizlo@apple.com | 04c1974 | 2012-08-26 22:35:26 +0000 | [diff] [blame] | 1255 | } |
| 1256 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1257 | void blessArrayOperation(Edge base, Edge index, Edge& storageChild) |
fpizlo@apple.com | 04c1974 | 2012-08-26 22:35:26 +0000 | [diff] [blame] | 1258 | { |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 1259 | Node* node = m_currentNode; |
| 1260 | |
| 1261 | switch (node->arrayMode().type()) { |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1262 | case Array::ForceExit: { |
fpizlo@apple.com | f45e88b | 2013-01-20 19:29:50 +0000 | [diff] [blame] | 1263 | m_insertionSet.insertNode( |
fpizlo@apple.com | 06f82b5 | 2013-03-06 02:27:16 +0000 | [diff] [blame] | 1264 | m_indexInBlock, SpecNone, ForceOSRExit, node->codeOrigin); |
fpizlo@apple.com | 04c1974 | 2012-08-26 22:35:26 +0000 | [diff] [blame] | 1265 | return; |
| 1266 | } |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1267 | |
fpizlo@apple.com | a0ec059 | 2012-10-22 23:52:15 +0000 | [diff] [blame] | 1268 | case Array::SelectUsingPredictions: |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1269 | case Array::Unprofiled: |
oliver@apple.com | 5598c18 | 2013-01-23 22:25:07 +0000 | [diff] [blame] | 1270 | RELEASE_ASSERT_NOT_REACHED(); |
fpizlo@apple.com | 04c1974 | 2012-08-26 22:35:26 +0000 | [diff] [blame] | 1271 | return; |
| 1272 | |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1273 | case Array::Generic: |
fpizlo@apple.com | 04c1974 | 2012-08-26 22:35:26 +0000 | [diff] [blame] | 1274 | return; |
| 1275 | |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1276 | default: { |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 1277 | Node* storage = checkArray(node->arrayMode(), node->codeOrigin, base.node(), index.node()); |
| 1278 | if (!storage) |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1279 | return; |
| 1280 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1281 | storageChild = Edge(storage); |
fpizlo@apple.com | 0e9910a | 2012-10-09 23:39:53 +0000 | [diff] [blame] | 1282 | return; |
| 1283 | } } |
fpizlo@apple.com | 04c1974 | 2012-08-26 22:35:26 +0000 | [diff] [blame] | 1284 | } |
| 1285 | |
fpizlo@apple.com | bbaf619 | 2013-02-27 01:45:28 +0000 | [diff] [blame] | 1286 | bool alwaysUnboxSimplePrimitives() |
| 1287 | { |
| 1288 | #if USE(JSVALUE64) |
| 1289 | return false; |
| 1290 | #else |
| 1291 | // Any boolean, int, or cell value is profitable to unbox on 32-bit because it |
| 1292 | // reduces traffic. |
| 1293 | return true; |
| 1294 | #endif |
| 1295 | } |
fpizlo@apple.com | 4695591 | 2013-04-26 01:18:18 +0000 | [diff] [blame] | 1296 | |
fpizlo@apple.com | 33b10ee | 2013-03-07 09:04:57 +0000 | [diff] [blame] | 1297 | template<UseKind useKind> |
| 1298 | void observeUseKindOnNode(Node* node) |
| 1299 | { |
fpizlo@apple.com | 4695591 | 2013-04-26 01:18:18 +0000 | [diff] [blame] | 1300 | observeUseKindOnNode(node, useKind); |
| 1301 | } |
| 1302 | |
| 1303 | void observeUseKindOnEdge(Edge edge) |
| 1304 | { |
| 1305 | observeUseKindOnNode(edge.node(), edge.useKind()); |
| 1306 | } |
| 1307 | |
| 1308 | void observeUseKindOnNode(Node* node, UseKind useKind) |
| 1309 | { |
fpizlo@apple.com | 33b10ee | 2013-03-07 09:04:57 +0000 | [diff] [blame] | 1310 | if (node->op() != GetLocal) |
| 1311 | return; |
| 1312 | |
| 1313 | VariableAccessData* variable = node->variableAccessData(); |
| 1314 | switch (useKind) { |
| 1315 | case Int32Use: |
| 1316 | if (alwaysUnboxSimplePrimitives() |
| 1317 | || isInt32Speculation(variable->prediction())) |
| 1318 | m_profitabilityChanged |= variable->mergeIsProfitableToUnbox(true); |
| 1319 | break; |
| 1320 | case NumberUse: |
| 1321 | case RealNumberUse: |
| 1322 | if (variable->doubleFormatState() == UsingDoubleFormat) |
| 1323 | m_profitabilityChanged |= variable->mergeIsProfitableToUnbox(true); |
| 1324 | break; |
| 1325 | case BooleanUse: |
| 1326 | if (alwaysUnboxSimplePrimitives() |
| 1327 | || isBooleanSpeculation(variable->prediction())) |
| 1328 | m_profitabilityChanged |= variable->mergeIsProfitableToUnbox(true); |
| 1329 | break; |
| 1330 | case CellUse: |
oliver@apple.com | 176a347 | 2013-07-25 04:00:19 +0000 | [diff] [blame] | 1331 | case KnownCellUse: |
fpizlo@apple.com | 33b10ee | 2013-03-07 09:04:57 +0000 | [diff] [blame] | 1332 | case ObjectUse: |
| 1333 | case StringUse: |
fpizlo@apple.com | 0e6e154 | 2013-03-18 18:09:22 +0000 | [diff] [blame] | 1334 | case KnownStringUse: |
| 1335 | case StringObjectUse: |
| 1336 | case StringOrStringObjectUse: |
fpizlo@apple.com | 33b10ee | 2013-03-07 09:04:57 +0000 | [diff] [blame] | 1337 | if (alwaysUnboxSimplePrimitives() |
| 1338 | || isCellSpeculation(variable->prediction())) |
| 1339 | m_profitabilityChanged |= variable->mergeIsProfitableToUnbox(true); |
| 1340 | break; |
| 1341 | default: |
| 1342 | break; |
| 1343 | } |
| 1344 | } |
| 1345 | |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 1346 | // Set the use kind of the edge. In the future (https://bugs.webkit.org/show_bug.cgi?id=110433), |
| 1347 | // this can be used to notify the GetLocal that the variable is profitable to unbox. |
| 1348 | template<UseKind useKind> |
| 1349 | void setUseKindAndUnboxIfProfitable(Edge& edge) |
| 1350 | { |
fpizlo@apple.com | 33b10ee | 2013-03-07 09:04:57 +0000 | [diff] [blame] | 1351 | observeUseKindOnNode<useKind>(edge.node()); |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 1352 | edge.setUseKind(useKind); |
| 1353 | } |
| 1354 | |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 1355 | void fixIntEdge(Edge& edge) |
| 1356 | { |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 1357 | Node* node = edge.node(); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1358 | if (node->op() != ValueToInt32) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 1359 | setUseKindAndUnboxIfProfitable<KnownInt32Use>(edge); |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 1360 | return; |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1361 | } |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 1362 | |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 1363 | Edge newEdge = node->child1(); |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 1364 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1365 | if (newEdge.useKind() != Int32Use) { |
| 1366 | edge.setUseKind(KnownInt32Use); |
| 1367 | return; |
| 1368 | } |
| 1369 | |
| 1370 | ASSERT(newEdge->shouldSpeculateInteger()); |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 1371 | edge = newEdge; |
| 1372 | } |
| 1373 | |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 1374 | template<UseKind useKind> |
| 1375 | void fixDoubleEdge(Edge& edge, SpeculationDirection direction = BackwardSpeculation) |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 1376 | { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 1377 | ASSERT(useKind == NumberUse || useKind == KnownNumberUse || useKind == RealNumberUse); |
| 1378 | |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 1379 | if (edge->prediction() & SpecDouble) { |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 1380 | setUseKindAndUnboxIfProfitable<useKind>(edge); |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 1381 | return; |
| 1382 | } |
| 1383 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1384 | injectInt32ToDoubleNode(edge, useKind, direction); |
msaboff@apple.com | 268bb44 | 2013-01-18 21:45:06 +0000 | [diff] [blame] | 1385 | } |
| 1386 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1387 | void injectInt32ToDoubleNode(Edge& edge, UseKind useKind = NumberUse, SpeculationDirection direction = BackwardSpeculation) |
msaboff@apple.com | 268bb44 | 2013-01-18 21:45:06 +0000 | [diff] [blame] | 1388 | { |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 1389 | Node* result = m_insertionSet.insertNode( |
oliver@apple.com | 500b53a | 2013-07-25 04:05:25 +0000 | [diff] [blame] | 1390 | m_indexInBlock, SpecDouble, Int32ToDouble, |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1391 | m_currentNode->codeOrigin, Edge(edge.node(), NumberUse)); |
oliver@apple.com | 500b53a | 2013-07-25 04:05:25 +0000 | [diff] [blame] | 1392 | if (direction == ForwardSpeculation) |
| 1393 | result->mergeFlags(NodeExitsForward); |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 1394 | |
| 1395 | #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) |
fpizlo@apple.com | f45e88b | 2013-01-20 19:29:50 +0000 | [diff] [blame] | 1396 | dataLogF( |
| 1397 | "(replacing @%u->@%u with @%u->@%u) ", |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1398 | m_currentNode->index(), edge->index(), m_currentNode->index(), result->index()); |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 1399 | #endif |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 1400 | |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1401 | edge = Edge(result, useKind); |
| 1402 | } |
| 1403 | |
| 1404 | void truncateConstantToInt32(Edge& edge) |
| 1405 | { |
| 1406 | Node* oldNode = edge.node(); |
| 1407 | |
| 1408 | ASSERT(oldNode->hasConstant()); |
| 1409 | JSValue value = m_graph.valueOfJSConstant(oldNode); |
| 1410 | if (value.isInt32()) |
| 1411 | return; |
| 1412 | |
| 1413 | value = jsNumber(JSC::toInt32(value.asNumber())); |
| 1414 | ASSERT(value.isInt32()); |
mhahnenberg@apple.com | 941ab38 | 2013-08-16 03:28:39 +0000 | [diff] [blame] | 1415 | unsigned constantRegister; |
| 1416 | if (!codeBlock()->findConstant(value, constantRegister)) { |
| 1417 | initializeLazyWriteBarrier( |
| 1418 | codeBlock()->addConstantLazily(), |
| 1419 | m_graph.m_plan.writeBarriers, |
| 1420 | codeBlock()->ownerExecutable(), |
| 1421 | value); |
| 1422 | } |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1423 | edge.setNode(m_insertionSet.insertNode( |
fpizlo@apple.com | 06f82b5 | 2013-03-06 02:27:16 +0000 | [diff] [blame] | 1424 | m_indexInBlock, SpecInt32, JSConstant, m_currentNode->codeOrigin, |
mhahnenberg@apple.com | 941ab38 | 2013-08-16 03:28:39 +0000 | [diff] [blame] | 1425 | OpInfo(constantRegister))); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1426 | } |
| 1427 | |
| 1428 | void truncateConstantsIfNecessary(Node* node, AddSpeculationMode mode) |
| 1429 | { |
| 1430 | if (mode != SpeculateIntegerAndTruncateConstants) |
| 1431 | return; |
| 1432 | |
| 1433 | ASSERT(node->child1()->hasConstant() || node->child2()->hasConstant()); |
| 1434 | if (node->child1()->hasConstant()) |
| 1435 | truncateConstantToInt32(node->child1()); |
| 1436 | else |
| 1437 | truncateConstantToInt32(node->child2()); |
| 1438 | } |
| 1439 | |
| 1440 | bool attemptToMakeIntegerAdd(Node* node) |
| 1441 | { |
| 1442 | AddSpeculationMode mode = m_graph.addSpeculationMode(node); |
| 1443 | if (mode == DontSpeculateInteger) |
| 1444 | return false; |
| 1445 | |
| 1446 | truncateConstantsIfNecessary(node, mode); |
fpizlo@apple.com | 3570187 | 2013-02-23 01:03:10 +0000 | [diff] [blame] | 1447 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child1()); |
| 1448 | setUseKindAndUnboxIfProfitable<Int32Use>(node->child2()); |
fpizlo@apple.com | 7a1964c | 2013-02-21 22:59:02 +0000 | [diff] [blame] | 1449 | return true; |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 1450 | } |
fpizlo@apple.com | f10d072 | 2012-12-03 09:21:22 +0000 | [diff] [blame] | 1451 | |
| 1452 | BasicBlock* m_block; |
fpizlo@apple.com | 96cfc6b | 2012-03-25 23:50:24 +0000 | [diff] [blame] | 1453 | unsigned m_indexInBlock; |
fpizlo@apple.com | 8ff092f | 2013-01-29 08:01:03 +0000 | [diff] [blame] | 1454 | Node* m_currentNode; |
fpizlo@apple.com | f45e88b | 2013-01-20 19:29:50 +0000 | [diff] [blame] | 1455 | InsertionSet m_insertionSet; |
fpizlo@apple.com | bbaf619 | 2013-02-27 01:45:28 +0000 | [diff] [blame] | 1456 | bool m_profitabilityChanged; |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 1457 | }; |
| 1458 | |
fpizlo@apple.com | 79c51ee | 2012-05-18 22:30:24 +0000 | [diff] [blame] | 1459 | bool performFixup(Graph& graph) |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 1460 | { |
fpizlo@apple.com | 8618e4b | 2012-07-03 01:27:16 +0000 | [diff] [blame] | 1461 | SamplingRegion samplingRegion("DFG Fixup Phase"); |
fpizlo@apple.com | 79c51ee | 2012-05-18 22:30:24 +0000 | [diff] [blame] | 1462 | return runPhase<FixupPhase>(graph); |
fpizlo@apple.com | a73f21d | 2012-03-24 03:23:02 +0000 | [diff] [blame] | 1463 | } |
| 1464 | |
| 1465 | } } // namespace JSC::DFG |
| 1466 | |
| 1467 | #endif // ENABLE(DFG_JIT) |
| 1468 | |