FTLLowerDFGToLLVM.cpp 131 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
/*
 * Copyright (C) 2013 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 */

#include "config.h"
#include "FTLLowerDFGToLLVM.h"

#if ENABLE(FTL_JIT)

#include "CodeBlockWithJITType.h"
32 33
#include "DFGAbstractInterpreterInlines.h"
#include "DFGInPlaceAbstractState.h"
34 35
#include "FTLAbstractHeapRepository.h"
#include "FTLExitThunkGenerator.h"
36
#include "FTLForOSREntryJITCode.h"
37
#include "FTLFormattedValue.h"
38
#include "FTLLoweredNodeValue.h"
39 40 41 42
#include "FTLOutput.h"
#include "FTLThunks.h"
#include "FTLValueSource.h"
#include "LinkBuffer.h"
43
#include "OperandsInlines.h"
44
#include "Operations.h"
45 46
#include "VirtualRegister.h"

47
#include <wtf/ProcessID.h>
48 49 50 51 52

namespace JSC { namespace FTL {

using namespace DFG;

53 54
static int compileCounter;

55 56 57 58 59 60
// Using this instead of typeCheck() helps to reduce the load on LLVM, by creating
// significantly less dead code.
#define FTL_TYPE_CHECK(lowValue, highValue, typesPassedThrough, failCondition) do { \
        FormattedValue _ftc_lowValue = (lowValue);                      \
        Edge _ftc_highValue = (highValue);                              \
        SpeculatedType _ftc_typesPassedThrough = (typesPassedThrough);  \
61
        if (!m_interpreter.needsTypeCheck(_ftc_highValue, _ftc_typesPassedThrough)) \
62 63 64 65 66 67 68 69 70
            break;                                                      \
        typeCheck(_ftc_lowValue, _ftc_highValue, _ftc_typesPassedThrough, (failCondition)); \
    } while (false)

class LowerDFGToLLVM {
public:
    LowerDFGToLLVM(State& state)
        : m_graph(state.graph)
        , m_ftlState(state)
71 72
        , m_heaps(state.context)
        , m_out(state.context)
73
        , m_valueSources(OperandsLike, state.graph.block(0)->variablesAtHead)
74
        , m_lastSetOperand(VirtualRegister())
75 76
        , m_exitThunkGenerator(state)
        , m_state(state.graph)
77
        , m_interpreter(state.graph, m_state)
78 79 80 81 82
    {
    }
    
    void lower()
    {
83 84 85 86 87 88 89 90 91 92
        CString name;
        if (verboseCompilationEnabled()) {
            name = toCString(
                "jsBody_", atomicIncrement(&compileCounter), "_", codeBlock()->inferredName(),
                "_", codeBlock()->hash());
        } else
            name = "jsBody";
        
        m_graph.m_dominators.computeIfNecessary(m_graph);
        
93
        m_ftlState.module =
94
            LLVMModuleCreateWithNameInContext(name.data(), m_ftlState.context);
95 96
        
        m_ftlState.function = addFunction(
97
            m_ftlState.module, name.data(), functionType(m_out.int64, m_out.intPtr));
98 99 100 101
        setFunctionCallingConv(m_ftlState.function, LLVMCCallConv);
        
        m_out.initialize(m_ftlState.module, m_ftlState.function, m_heaps);
        
102
        m_prologue = appendBasicBlock(m_ftlState.context, m_ftlState.function);
103
        m_out.appendTo(m_prologue);
104
        createPhiVariables();
105
        
106
        m_initialization = appendBasicBlock(m_ftlState.context, m_ftlState.function);
107 108 109 110 111

        m_callFrame = m_out.param(0);
        m_tagTypeNumber = m_out.constInt64(TagTypeNumber);
        m_tagMask = m_out.constInt64(TagMask);
        
112 113
        for (BlockIndex blockIndex = 0; blockIndex < m_graph.numBlocks(); ++blockIndex) {
            m_highBlock = m_graph.block(blockIndex);
114 115
            if (!m_highBlock)
                continue;
116
            m_blocks.add(m_highBlock, FTL_NEW_BLOCK(m_out, ("Block ", *m_highBlock)));
117 118
        }
        
119 120 121 122
        Vector<BasicBlock*> depthFirst;
        m_graph.getBlocksInDepthFirstOrder(depthFirst);
        for (unsigned i = 0; i < depthFirst.size(); ++i)
            compileBlock(depthFirst[i]);
123 124 125 126
        
        // And now complete the initialization block.
        linkOSRExitsAndCompleteInitializationBlocks();

127 128 129
        if (Options::dumpLLVMIR())
            dumpModule(m_ftlState.module);
        
130 131 132 133 134 135 136 137
        if (verboseCompilationEnabled())
            m_ftlState.dumpState("after lowering");
        if (validationEnabled())
            verifyModule(m_ftlState.module);
    }

private:
    
138
    void createPhiVariables()
139
    {
140 141 142
        for (BlockIndex blockIndex = m_graph.numBlocks(); blockIndex--;) {
            BasicBlock* block = m_graph.block(blockIndex);
            if (!block)
143
                continue;
144 145 146
            for (unsigned nodeIndex = block->size(); nodeIndex--;) {
                Node* node = block->at(nodeIndex);
                if (node->op() != Phi)
147
                    continue;
148 149 150 151 152 153 154 155
                LType type;
                switch (node->flags() & NodeResultMask) {
                case NodeResultNumber:
                    type = m_out.doubleType;
                    break;
                case NodeResultInt32:
                    type = m_out.int32;
                    break;
156 157 158
                case NodeResultInt52:
                    type = m_out.int64;
                    break;
159 160 161 162 163 164 165 166 167
                case NodeResultBoolean:
                    type = m_out.boolean;
                    break;
                case NodeResultJS:
                    type = m_out.int64;
                    break;
                default:
                    RELEASE_ASSERT_NOT_REACHED();
                    break;
168
                }
169
                m_phis.add(node, buildAlloca(m_out.m_builder, type));
170 171 172 173
            }
        }
    }
    
174
    void compileBlock(BasicBlock* block)
175
    {
176
        if (!block)
177 178
            return;
        
179 180 181 182 183
        if (verboseCompilationEnabled())
            dataLog("Compiling block ", *block, "\n");
        
        m_highBlock = block;
        
184 185 186
        LBasicBlock lowBlock = m_blocks.get(m_highBlock);
        
        m_nextHighBlock = 0;
187
        for (BlockIndex nextBlockIndex = m_highBlock->index + 1; nextBlockIndex < m_graph.numBlocks(); ++nextBlockIndex) {
188
            m_nextHighBlock = m_graph.block(nextBlockIndex);
189 190 191 192 193 194 195 196 197 198 199
            if (m_nextHighBlock)
                break;
        }
        m_nextLowBlock = m_nextHighBlock ? m_blocks.get(m_nextHighBlock) : 0;
        
        // All of this effort to find the next block gives us the ability to keep the
        // generated IR in roughly program order. This ought not affect the performance
        // of the generated code (since we expect LLVM to reorder things) but it will
        // make IR dumps easier to read.
        m_out.appendTo(lowBlock, m_nextLowBlock);
        
200 201 202
        if (Options::ftlCrashes())
            m_out.crashNonTerminal();
        
203 204 205 206 207
        if (!m_highBlock->cfaHasVisited) {
            m_out.crash();
            return;
        }
        
208 209
        initializeOSRExitStateForBlock();
        
210
        m_live = block->ssa->liveAtHead;
211 212 213 214
        
        m_state.reset();
        m_state.beginBasicBlock(m_highBlock);
        
215 216 217 218
        for (m_nodeIndex = 0; m_nodeIndex < m_highBlock->size(); ++m_nodeIndex) {
            if (!compileNode(m_nodeIndex))
                break;
        }
219 220
    }
    
221
    bool compileNode(unsigned nodeIndex)
222
    {
223 224 225 226 227
        if (!m_state.isValid()) {
            m_out.unreachable();
            return false;
        }
        
228
        m_node = m_highBlock->at(nodeIndex);
229 230
        m_codeOriginForExitProfile = m_node->codeOrigin;
        m_codeOriginForExitTarget = m_node->codeOriginForExitTarget;
231 232 233 234
        
        if (verboseCompilationEnabled())
            dataLog("Lowering ", m_node, "\n");
        
235
        bool shouldExecuteEffects = m_interpreter.startExecuting(m_node);
236 237 238 239
        
        m_direction = (m_node->flags() & NodeExitsForward) ? ForwardSpeculation : BackwardSpeculation;
        
        switch (m_node->op()) {
240 241 242 243 244 245
        case Upsilon:
            compileUpsilon();
            break;
        case Phi:
            compilePhi();
            break;
246 247 248 249 250
        case JSConstant:
            break;
        case WeakJSConstant:
            compileWeakJSConstant();
            break;
251 252 253
        case GetArgument:
            compileGetArgument();
            break;
254 255 256
        case ExtractOSREntryLocal:
            compileExtractOSREntryLocal();
            break;
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
        case GetLocal:
            compileGetLocal();
            break;
        case SetLocal:
            compileSetLocal();
            break;
        case MovHint:
            compileMovHint();
            break;
        case ZombieHint:
            compileZombieHint();
            break;
        case MovHintAndCheck:
            compileMovHintAndCheck();
            break;
        case Phantom:
            compilePhantom();
            break;
        case Flush:
        case PhantomLocal:
        case SetArgument:
278
        case LoopHint:
279 280 281
            break;
        case ArithAdd:
        case ValueAdd:
282
            compileAddSub(Add);
283 284
            break;
        case ArithSub:
285
            compileAddSub(Sub);
286 287 288 289
            break;
        case ArithMul:
            compileArithMul();
            break;
290 291 292
        case ArithDiv:
            compileArithDiv();
            break;
293 294 295
        case ArithMod:
            compileArithMod();
            break;
296 297 298 299
        case ArithMin:
        case ArithMax:
            compileArithMinOrMax();
            break;
300 301 302
        case ArithAbs:
            compileArithAbs();
            break;
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
        case ArithNegate:
            compileArithNegate();
            break;
        case BitAnd:
            compileBitAnd();
            break;
        case BitOr:
            compileBitOr();
            break;
        case BitXor:
            compileBitXor();
            break;
        case BitRShift:
            compileBitRShift();
            break;
        case BitLShift:
            compileBitLShift();
            break;
        case BitURShift:
            compileBitURShift();
            break;
        case UInt32ToNumber:
            compileUInt32ToNumber();
            break;
327 328 329
        case Int32ToDouble:
            compileInt32ToDouble();
            break;
330 331 332 333 334 335
        case CheckStructure:
            compileCheckStructure();
            break;
        case StructureTransitionWatchpoint:
            compileStructureTransitionWatchpoint();
            break;
336 337 338
        case ArrayifyToStructure:
            compileArrayifyToStructure();
            break;
339 340 341 342 343 344 345 346 347
        case PutStructure:
            compilePutStructure();
            break;
        case PhantomPutStructure:
            compilePhantomPutStructure();
            break;
        case GetButterfly:
            compileGetButterfly();
            break;
348 349 350 351 352 353
        case GetIndexedPropertyStorage:
            compileGetIndexedPropertyStorage();
            break;
        case CheckArray:
            compileCheckArray();
            break;
354 355 356 357 358 359
        case GetArrayLength:
            compileGetArrayLength();
            break;
        case GetByVal:
            compileGetByVal();
            break;
360 361 362 363
        case PutByVal:
        case PutByValAlias:
            compilePutByVal();
            break;
364 365 366 367 368 369 370 371 372 373 374 375
        case GetByOffset:
            compileGetByOffset();
            break;
        case PutByOffset:
            compilePutByOffset();
            break;
        case GetGlobalVar:
            compileGetGlobalVar();
            break;
        case PutGlobalVar:
            compilePutGlobalVar();
            break;
376 377 378
        case GlobalVarWatchpoint:
            compileGlobalVarWatchpoint();
            break;
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393
        case GetMyScope:
            compileGetMyScope();
            break;
        case SkipScope:
            compileSkipScope();
            break;
        case GetClosureRegisters:
            compileGetClosureRegisters();
            break;
        case GetClosureVar:
            compileGetClosureVar();
            break;
        case PutClosureVar:
            compilePutClosureVar();
            break;
394 395 396
        case CompareEq:
            compileCompareEq();
            break;
397 398 399
        case CompareEqConstant:
            compileCompareEqConstant();
            break;
400 401 402
        case CompareStrictEq:
            compileCompareStrictEq();
            break;
403 404 405
        case CompareStrictEqConstant:
            compileCompareStrictEqConstant();
            break;
406 407 408
        case CompareLess:
            compileCompareLess();
            break;
409 410 411 412 413 414 415 416 417
        case CompareLessEq:
            compileCompareLessEq();
            break;
        case CompareGreater:
            compileCompareGreater();
            break;
        case CompareGreaterEq:
            compileCompareGreaterEq();
            break;
418 419 420
        case LogicalNot:
            compileLogicalNot();
            break;
421 422 423 424
        case Call:
        case Construct:
            compileCallOrConstruct();
            break;
425 426 427
        case Jump:
            compileJump();
            break;
428 429 430
        case Branch:
            compileBranch();
            break;
431 432 433
        case Switch:
            compileSwitch();
            break;
434 435 436 437 438 439
        case Return:
            compileReturn();
            break;
        case ForceOSRExit:
            compileForceOSRExit();
            break;
440 441 442 443 444 445 446 447
        default:
            RELEASE_ASSERT_NOT_REACHED();
            break;
        }
        
        if (m_node->shouldGenerate())
            DFG_NODE_DO_TO_CHILDREN(m_graph, m_node, use);
        
448 449
        if (m_node->adjustedRefCount())
            m_live.add(m_node);
450 451
        
        if (shouldExecuteEffects)
452
            m_interpreter.executeEffects(nodeIndex);
453 454
        
        return true;
455 456
    }
    
457 458 459 460 461 462 463 464 465 466 467
    void compileUpsilon()
    {
        LValue destination = m_phis.get(m_node->phi());
        
        switch (m_node->child1().useKind()) {
        case NumberUse:
            m_out.set(lowDouble(m_node->child1()), destination);
            break;
        case Int32Use:
            m_out.set(lowInt32(m_node->child1()), destination);
            break;
468 469 470
        case MachineIntUse:
            m_out.set(lowInt52(m_node->child1()), destination);
            break;
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
        case BooleanUse:
            m_out.set(lowBoolean(m_node->child1()), destination);
            break;
        case CellUse:
            m_out.set(lowCell(m_node->child1()), destination);
            break;
        case UntypedUse:
            m_out.set(lowJSValue(m_node->child1()), destination);
            break;
        default:
            RELEASE_ASSERT_NOT_REACHED();
            break;
        }
    }
    
    void compilePhi()
    {
        LValue source = m_phis.get(m_node);
        
        switch (m_node->flags() & NodeResultMask) {
        case NodeResultNumber:
            setDouble(m_out.get(source));
            break;
        case NodeResultInt32:
            setInt32(m_out.get(source));
            break;
497 498 499
        case NodeResultInt52:
            setInt52(m_out.get(source));
            break;
500 501 502 503 504 505 506 507 508 509 510 511
        case NodeResultBoolean:
            setBoolean(m_out.get(source));
            break;
        case NodeResultJS:
            setJSValue(m_out.get(source));
            break;
        default:
            RELEASE_ASSERT_NOT_REACHED();
            break;
        }
    }
    
512 513
    void compileJSConstant()
    {
514 515
        JSValue value = m_graph.valueOfJSConstant(m_node);
        if (value.isDouble())
516
            setDouble(m_out.constDouble(value.asDouble()));
517
        else
518
            setJSValue(m_out.constInt64(JSValue::encode(value)));
519 520 521 522
    }
    
    void compileWeakJSConstant()
    {
523 524 525 526 527 528
        setJSValue(weakPointer(m_node->weakConstant()));
    }
    
    void compileGetArgument()
    {
        VariableAccessData* variable = m_node->variableAccessData();
529
        VirtualRegister operand = variable->local();
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552

        LValue jsValue = m_out.load64(addressFor(operand));

        switch (useKindFor(variable->flushFormat())) {
        case Int32Use:
            speculateBackward(BadType, jsValueValue(jsValue), m_node, isNotInt32(jsValue));
            setInt32(unboxInt32(jsValue));
            break;
        case CellUse:
            speculateBackward(BadType, jsValueValue(jsValue), m_node, isNotCell(jsValue));
            setJSValue(jsValue);
            break;
        case BooleanUse:
            speculateBackward(BadType, jsValueValue(jsValue), m_node, isNotBoolean(jsValue));
            setBoolean(unboxBoolean(jsValue));
            break;
        case UntypedUse:
            setJSValue(jsValue);
            break;
        default:
            RELEASE_ASSERT_NOT_REACHED();
            break;
        }
553 554
    }
    
555 556 557 558
    void compileExtractOSREntryLocal()
    {
        EncodedJSValue* buffer = static_cast<EncodedJSValue*>(
            m_ftlState.jitCode->ftlForOSREntry()->entryBuffer()->dataBuffer());
559
        setJSValue(m_out.load64(m_out.absolute(buffer + m_node->unlinkedLocal().toLocal())));
560 561
    }
    
562 563
    void compileGetLocal()
    {
564
        // GetLocals arise only for captured variables.
565 566 567 568
        
        VariableAccessData* variable = m_node->variableAccessData();
        AbstractValue& value = m_state.variables().operand(variable->local());
        
569
        RELEASE_ASSERT(variable->isCaptured());
570
        
571
        if (isInt32Speculation(value.m_type))
572 573 574
            setInt32(m_out.load32(payloadFor(variable->local())));
        else
            setJSValue(m_out.load64(addressFor(variable->local())));
575 576 577 578 579 580 581
    }
    
    void compileSetLocal()
    {
        observeMovHint(m_node);
        
        VariableAccessData* variable = m_node->variableAccessData();
582 583 584 585 586 587 588
        switch (variable->flushFormat()) {
        case FlushedJSValue: {
            LValue value = lowJSValue(m_node->child1());
            m_out.store64(value, addressFor(variable->local()));
            m_valueSources.operand(variable->local()) = ValueSource(ValueInJSStack);
            return;
        }
589
            
590 591 592 593 594 595 596 597 598 599 600 601 602 603
        case FlushedDouble: {
            LValue value = lowDouble(m_node->child1());
            m_out.storeDouble(value, addressFor(variable->local()));
            m_valueSources.operand(variable->local()) = ValueSource(DoubleInJSStack);
            return;
        }
            
        case FlushedInt32: {
            LValue value = lowInt32(m_node->child1());
            m_out.store32(value, payloadFor(variable->local()));
            m_valueSources.operand(variable->local()) = ValueSource(Int32InJSStack);
            return;
        }
            
604 605 606 607 608 609 610
        case FlushedInt52: {
            LValue value = lowInt52(m_node->child1());
            m_out.store64(value, addressFor(variable->local()));
            m_valueSources.operand(variable->local()) = ValueSource(Int52InJSStack);
            return;
        }
            
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628
        case FlushedCell: {
            LValue value = lowCell(m_node->child1());
            m_out.store64(value, addressFor(variable->local()));
            m_valueSources.operand(variable->local()) = ValueSource(ValueInJSStack);
            return;
        }
            
        case FlushedBoolean: {
            speculateBoolean(m_node->child1());
            m_out.store64(
                lowJSValue(m_node->child1(), ManualOperandSpeculation),
                addressFor(variable->local()));
            m_valueSources.operand(variable->local()) = ValueSource(ValueInJSStack);
            return;
        }
            
        case DeadFlush:
            RELEASE_ASSERT_NOT_REACHED();
629 630
        }
        
631
        RELEASE_ASSERT_NOT_REACHED();
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656
    }
    
    void compileMovHint()
    {
        observeMovHint(m_node);
    }
    
    void compileZombieHint()
    {
        VariableAccessData* data = m_node->variableAccessData();
        m_lastSetOperand = data->local();
        m_valueSources.operand(data->local()) = ValueSource(SourceIsDead);
    }
    
    void compileMovHintAndCheck()
    {
        observeMovHint(m_node);
        speculate(m_node->child1());
    }
    
    void compilePhantom()
    {
        DFG_NODE_DO_TO_CHILDREN(m_graph, m_node, speculate);
    }
    
657 658
    enum AddOrSubKind {Add, Sub};
    void compileAddSub(AddOrSubKind opKind)
659
    {
660
        bool isSub = opKind == Sub;
661 662 663 664 665
        switch (m_node->binaryUseKind()) {
        case Int32Use: {
            LValue left = lowInt32(m_node->child1());
            LValue right = lowInt32(m_node->child2());
            
666
            if (bytecodeCanTruncateInteger(m_node->arithNodeFlags())) {
667
                setInt32(isSub ? m_out.sub(left, right) : m_out.add(left, right));
668 669
                break;
            }
670 671 672

            LValue result = isSub ? m_out.subWithOverflow32(left, right) : m_out.addWithOverflow32(left, right);

673
            speculate(Overflow, noValue(), 0, m_out.extractValue(result, 1));
674
            setInt32(m_out.extractValue(result, 0));
675 676 677
            break;
        }
            
678 679 680 681 682 683
        case MachineIntUse: {
            if (!m_state.forNode(m_node->child1()).couldBeType(SpecInt52)
                && !m_state.forNode(m_node->child2()).couldBeType(SpecInt52)) {
                Int52Kind kind;
                LValue left = lowWhicheverInt52(m_node->child1(), kind);
                LValue right = lowInt52(m_node->child2(), kind);
684
                setInt52(isSub ? m_out.sub(left, right) : m_out.add(left, right), kind);
685 686 687 688 689
                break;
            }
            
            LValue left = lowInt52(m_node->child1());
            LValue right = lowInt52(m_node->child2());
690
            LValue result = isSub ? m_out.subWithOverflow64(left, right) : m_out.addWithOverflow64(left, right);
691 692 693 694 695
            speculate(Int52Overflow, noValue(), 0, m_out.extractValue(result, 1));
            setInt52(m_out.extractValue(result, 0));
            break;
        }
            
696
        case NumberUse: {
697 698 699 700
            LValue C1 = lowDouble(m_node->child1());
            LValue C2 = lowDouble(m_node->child2());

            setDouble(isSub ? m_out.doubleSub(C1, C2) : m_out.doubleAdd(C1, C2));
701 702 703
            break;
        }
            
704 705 706 707 708 709 710 711 712 713 714 715 716 717
        default:
            RELEASE_ASSERT_NOT_REACHED();
            break;
        }
    }
    
    void compileArithMul()
    {
        switch (m_node->binaryUseKind()) {
        case Int32Use: {
            LValue left = lowInt32(m_node->child1());
            LValue right = lowInt32(m_node->child2());
            
            LValue result;
718
            if (bytecodeCanTruncateInteger(m_node->arithNodeFlags()))
719 720 721 722 723 724 725
                result = m_out.mul(left, right);
            else {
                LValue overflowResult = m_out.mulWithOverflow32(left, right);
                speculate(Overflow, noValue(), 0, m_out.extractValue(overflowResult, 1));
                result = m_out.extractValue(overflowResult, 0);
            }
            
726
            if (!bytecodeCanIgnoreNegativeZero(m_node->arithNodeFlags())) {
727 728 729
                LBasicBlock slowCase = FTL_NEW_BLOCK(m_out, ("ArithMul slow case"));
                LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("ArithMul continuation"));
                
730 731
                m_out.branch(m_out.notZero32(result), continuation, slowCase);
                
732
                LBasicBlock lastNext = m_out.appendTo(slowCase, continuation);
733 734
                LValue cond = m_out.bitOr(m_out.lessThan(left, m_out.int32Zero), m_out.lessThan(right, m_out.int32Zero));
                speculate(NegativeZero, noValue(), 0, cond);
735 736 737 738
                m_out.jump(continuation);
                m_out.appendTo(continuation, lastNext);
            }
            
739
            setInt32(result);
740 741 742
            break;
        }
            
743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758
        case MachineIntUse: {
            Int52Kind kind;
            LValue left = lowWhicheverInt52(m_node->child1(), kind);
            LValue right = lowInt52(m_node->child2(), opposite(kind));
            
            LValue overflowResult = m_out.mulWithOverflow64(left, right);
            speculate(Int52Overflow, noValue(), 0, m_out.extractValue(overflowResult, 1));
            LValue result = m_out.extractValue(overflowResult, 0);
            
            if (!bytecodeCanIgnoreNegativeZero(m_node->arithNodeFlags())) {
                LBasicBlock slowCase = FTL_NEW_BLOCK(m_out, ("ArithMul slow case"));
                LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("ArithMul continuation"));
                
                m_out.branch(m_out.notZero64(result), continuation, slowCase);
                
                LBasicBlock lastNext = m_out.appendTo(slowCase, continuation);
759 760
                LValue cond = m_out.bitOr(m_out.lessThan(left, m_out.int64Zero), m_out.lessThan(right, m_out.int64Zero));
                speculate(NegativeZero, noValue(), 0, cond);
761 762 763 764 765 766 767 768
                m_out.jump(continuation);
                m_out.appendTo(continuation, lastNext);
            }
            
            setInt52(result);
            break;
        }
            
769
        case NumberUse: {
770
            setDouble(
771 772 773 774
                m_out.doubleMul(lowDouble(m_node->child1()), lowDouble(m_node->child2())));
            break;
        }
            
775 776 777 778 779 780
        default:
            RELEASE_ASSERT_NOT_REACHED();
            break;
        }
    }
    
781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801
    void compileArithDiv()
    {
        switch (m_node->binaryUseKind()) {
        case Int32Use: {
            LValue numerator = lowInt32(m_node->child1());
            LValue denominator = lowInt32(m_node->child2());
            
            LBasicBlock unsafeDenominator = FTL_NEW_BLOCK(m_out, ("ArithDiv unsafe denominator"));
            LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("ArithDiv continuation"));
            LBasicBlock done = FTL_NEW_BLOCK(m_out, ("ArithDiv done"));
            
            Vector<ValueFromBlock, 3> results;
            
            LValue adjustedDenominator = m_out.add(denominator, m_out.int32One);
            
            m_out.branch(m_out.above(adjustedDenominator, m_out.int32One), continuation, unsafeDenominator);
            
            LBasicBlock lastNext = m_out.appendTo(unsafeDenominator, continuation);
            
            LValue neg2ToThe31 = m_out.constInt32(-2147483647-1);
            
802
            if (bytecodeUsesAsNumber(m_node->arithNodeFlags())) {
803 804
                LValue cond = m_out.bitOr(m_out.isZero32(denominator), m_out.equal(numerator, neg2ToThe31));
                speculate(Overflow, noValue(), 0, cond);
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831
                m_out.jump(continuation);
            } else {
                // This is the case where we convert the result to an int after we're done. So,
                // if the denominator is zero, then the result should be result should be zero.
                // If the denominator is not zero (i.e. it's -1 because we're guarded by the
                // check above) and the numerator is -2^31 then the result should be -2^31.
                
                LBasicBlock divByZero = FTL_NEW_BLOCK(m_out, ("ArithDiv divide by zero"));
                LBasicBlock notDivByZero = FTL_NEW_BLOCK(m_out, ("ArithDiv not divide by zero"));
                LBasicBlock neg2ToThe31ByNeg1 = FTL_NEW_BLOCK(m_out, ("ArithDiv -2^31/-1"));
                
                m_out.branch(m_out.isZero32(denominator), divByZero, notDivByZero);
                
                m_out.appendTo(divByZero, notDivByZero);
                results.append(m_out.anchor(m_out.int32Zero));
                m_out.jump(done);
                
                m_out.appendTo(notDivByZero, neg2ToThe31ByNeg1);
                m_out.branch(m_out.equal(numerator, neg2ToThe31), neg2ToThe31ByNeg1, continuation);
                
                m_out.appendTo(neg2ToThe31ByNeg1, continuation);
                results.append(m_out.anchor(neg2ToThe31));
                m_out.jump(done);
            }
            
            m_out.appendTo(continuation, done);
            
832
            if (!bytecodeCanIgnoreNegativeZero(m_node->arithNodeFlags())) {
833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849
                LBasicBlock zeroNumerator = FTL_NEW_BLOCK(m_out, ("ArithDiv zero numerator"));
                LBasicBlock numeratorContinuation = FTL_NEW_BLOCK(m_out, ("ArithDiv numerator continuation"));
                
                m_out.branch(m_out.isZero32(numerator), zeroNumerator, numeratorContinuation);
                
                LBasicBlock innerLastNext = m_out.appendTo(zeroNumerator, numeratorContinuation);
                
                speculate(
                    NegativeZero, noValue(), 0, m_out.lessThan(denominator, m_out.int32Zero));
                
                m_out.jump(numeratorContinuation);
                
                m_out.appendTo(numeratorContinuation, innerLastNext);
            }
            
            LValue divisionResult = m_out.div(numerator, denominator);
            
850
            if (bytecodeUsesAsNumber(m_node->arithNodeFlags())) {
851 852 853 854 855 856 857 858 859 860
                speculate(
                    Overflow, noValue(), 0,
                    m_out.notEqual(m_out.mul(divisionResult, denominator), numerator));
            }
            
            results.append(m_out.anchor(divisionResult));
            m_out.jump(done);
            
            m_out.appendTo(done, lastNext);
            
861
            setInt32(m_out.phi(m_out.int32, results));
862 863 864 865
            break;
        }
            
        case NumberUse: {
866
            setDouble(
867 868 869 870 871 872 873 874 875 876
                m_out.doubleDiv(lowDouble(m_node->child1()), lowDouble(m_node->child2())));
            break;
        }
            
        default:
            RELEASE_ASSERT_NOT_REACHED();
            break;
        }
    }
    
877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899
    void compileArithMod()
    {
        switch (m_node->binaryUseKind()) {
        case Int32Use: {
            LValue numerator = lowInt32(m_node->child1());
            LValue denominator = lowInt32(m_node->child2());
            
            LBasicBlock unsafeDenominator = FTL_NEW_BLOCK(m_out, ("ArithMod unsafe denominator"));
            LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("ArithMod continuation"));
            LBasicBlock done = FTL_NEW_BLOCK(m_out, ("ArithMod done"));
            
            Vector<ValueFromBlock, 3> results;
            
            LValue adjustedDenominator = m_out.add(denominator, m_out.int32One);
            
            m_out.branch(m_out.above(adjustedDenominator, m_out.int32One), continuation, unsafeDenominator);
            
            LBasicBlock lastNext = m_out.appendTo(unsafeDenominator, continuation);
            
            LValue neg2ToThe31 = m_out.constInt32(-2147483647-1);
            
            // FIXME: -2^31 / -1 will actually yield negative zero, so we could have a
            // separate case for that. But it probably doesn't matter so much.
900
            if (bytecodeUsesAsNumber(m_node->arithNodeFlags())) {
901 902
                LValue cond = m_out.bitOr(m_out.isZero32(denominator), m_out.equal(numerator, neg2ToThe31));
                speculate(Overflow, noValue(), 0, cond);
903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929
                m_out.jump(continuation);
            } else {
                // This is the case where we convert the result to an int after we're done. So,
                // if the denominator is zero, then the result should be result should be zero.
                // If the denominator is not zero (i.e. it's -1 because we're guarded by the
                // check above) and the numerator is -2^31 then the result should be -2^31.
                
                LBasicBlock modByZero = FTL_NEW_BLOCK(m_out, ("ArithMod modulo by zero"));
                LBasicBlock notModByZero = FTL_NEW_BLOCK(m_out, ("ArithMod not modulo by zero"));
                LBasicBlock neg2ToThe31ByNeg1 = FTL_NEW_BLOCK(m_out, ("ArithMod -2^31/-1"));
                
                m_out.branch(m_out.isZero32(denominator), modByZero, notModByZero);
                
                m_out.appendTo(modByZero, notModByZero);
                results.append(m_out.anchor(m_out.int32Zero));
                m_out.jump(done);
                
                m_out.appendTo(notModByZero, neg2ToThe31ByNeg1);
                m_out.branch(m_out.equal(numerator, neg2ToThe31), neg2ToThe31ByNeg1, continuation);
                
                m_out.appendTo(neg2ToThe31ByNeg1, continuation);
                results.append(m_out.anchor(m_out.int32Zero));
                m_out.jump(done);
            }
            
            m_out.appendTo(continuation, done);
            
930 931
            LValue remainder = m_out.rem(numerator, denominator);
            
932
            if (!bytecodeCanIgnoreNegativeZero(m_node->arithNodeFlags())) {
933
                LBasicBlock negativeNumerator = FTL_NEW_BLOCK(m_out, ("ArithMod negative numerator"));
934 935
                LBasicBlock numeratorContinuation = FTL_NEW_BLOCK(m_out, ("ArithMod numerator continuation"));
                
936 937 938
                m_out.branch(
                    m_out.lessThan(numerator, m_out.int32Zero),
                    negativeNumerator, numeratorContinuation);
939
                
940
                LBasicBlock innerLastNext = m_out.appendTo(negativeNumerator, numeratorContinuation);
941
                
942
                speculate(NegativeZero, noValue(), 0, m_out.isZero32(remainder));
943 944 945 946 947 948
                
                m_out.jump(numeratorContinuation);
                
                m_out.appendTo(numeratorContinuation, innerLastNext);
            }
            
949
            results.append(m_out.anchor(remainder));
950 951 952 953
            m_out.jump(done);
            
            m_out.appendTo(done, lastNext);
            
954
            setInt32(m_out.phi(m_out.int32, results));
955 956 957 958
            break;
        }
            
        case NumberUse: {
959
            setDouble(
960 961 962 963 964 965 966 967 968
                m_out.doubleRem(lowDouble(m_node->child1()), lowDouble(m_node->child2())));
            break;
        }
            
        default:
            RELEASE_ASSERT_NOT_REACHED();
            break;
        }
    }
969 970 971 972 973 974 975 976

    void compileArithMinOrMax()
    {
        switch (m_node->binaryUseKind()) {
        case Int32Use: {
            LValue left = lowInt32(m_node->child1());
            LValue right = lowInt32(m_node->child2());
            
977
            setInt32(
978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010
                m_out.select(
                    m_node->op() == ArithMin
                        ? m_out.lessThan(left, right)
                        : m_out.lessThan(right, left),
                    left, right));
            break;
        }
            
        case NumberUse: {
            LValue left = lowDouble(m_node->child1());
            LValue right = lowDouble(m_node->child2());
            
            LBasicBlock notLessThan = FTL_NEW_BLOCK(m_out, ("ArithMin/ArithMax not less than"));
            LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("ArithMin/ArithMax continuation"));
            
            Vector<ValueFromBlock, 2> results;
            
            results.append(m_out.anchor(left));
            m_out.branch(
                m_node->op() == ArithMin
                    ? m_out.doubleLessThan(left, right)
                    : m_out.doubleGreaterThan(left, right),
                continuation, notLessThan);
            
            LBasicBlock lastNext = m_out.appendTo(notLessThan, continuation);
            results.append(m_out.anchor(m_out.select(
                m_node->op() == ArithMin
                    ? m_out.doubleGreaterThanOrEqual(left, right)
                    : m_out.doubleLessThanOrEqual(left, right),
                right, m_out.constDouble(0.0 / 0.0))));
            m_out.jump(continuation);
            
            m_out.appendTo(continuation, lastNext);
1011
            setDouble(m_out.phi(m_out.doubleType, results));
1012 1013 1014 1015 1016 1017 1018 1019
            break;
        }
            
        default:
            RELEASE_ASSERT_NOT_REACHED();
            break;
        }
    }
1020
    
1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031
    void compileArithAbs()
    {
        switch (m_node->child1().useKind()) {
        case Int32Use: {
            LValue value = lowInt32(m_node->child1());
            
            LValue mask = m_out.aShr(value, m_out.constInt32(31));
            LValue result = m_out.bitXor(mask, m_out.add(mask, value));
            
            speculate(Overflow, noValue(), 0, m_out.equal(result, m_out.constInt32(1 << 31)));
            
1032
            setInt32(result);
1033 1034 1035 1036
            break;
        }
            
        case NumberUse: {
1037
            setDouble(m_out.doubleAbs(lowDouble(m_node->child1())));
1038 1039 1040 1041 1042 1043 1044 1045 1046
            break;
        }
            
        default:
            RELEASE_ASSERT_NOT_REACHED();
            break;
        }
    }
    
1047 1048 1049 1050 1051 1052 1053
    void compileArithNegate()
    {
        switch (m_node->child1().useKind()) {
        case Int32Use: {
            LValue value = lowInt32(m_node->child1());
            
            LValue result;
1054
            if (bytecodeCanTruncateInteger(m_node->arithNodeFlags()))
1055
                result = m_out.neg(value);
1056
            else if (bytecodeCanIgnoreNegativeZero(m_node->arithNodeFlags())) {
1057 1058 1059 1060 1061
                // We don't have a negate-with-overflow intrinsic. Hopefully this
                // does the trick, though.
                LValue overflowResult = m_out.subWithOverflow32(m_out.int32Zero, value);
                speculate(Overflow, noValue(), 0, m_out.extractValue(overflowResult, 1));
                result = m_out.extractValue(overflowResult, 0);
1062 1063 1064
            } else {
                speculate(Overflow, noValue(), 0, m_out.testIsZero32(value, m_out.constInt32(0x7fffffff)));
                result = m_out.neg(value);
1065 1066
            }
            
1067
            setInt32(result);
1068 1069 1070
            break;
        }
            
1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090
        case MachineIntUse: {
            if (!m_state.forNode(m_node->child1()).couldBeType(SpecInt52)) {
                Int52Kind kind;
                LValue value = lowWhicheverInt52(m_node->child1(), kind);
                LValue result = m_out.neg(value);
                if (!bytecodeCanIgnoreNegativeZero(m_node->arithNodeFlags()))
                    speculate(NegativeZero, noValue(), 0, m_out.isZero64(result));
                setInt52(result, kind);
                break;
            }
            
            LValue value = lowInt52(m_node->child1());
            LValue overflowResult = m_out.subWithOverflow64(m_out.int64Zero, value);
            speculate(Int52Overflow, noValue(), 0, m_out.extractValue(overflowResult, 1));
            LValue result = m_out.extractValue(overflowResult, 0);
            speculate(NegativeZero, noValue(), 0, m_out.isZero64(result));
            setInt52(result);
            break;
        }
            
1091
        case NumberUse: {
1092
            setDouble(m_out.doubleNeg(lowDouble(m_node->child1())));
1093 1094 1095
            break;
        }
            
1096 1097 1098 1099 1100 1101 1102 1103
        default:
            RELEASE_ASSERT_NOT_REACHED();
            break;
        }
    }
    
    void compileBitAnd()
    {
1104
        setInt32(m_out.bitAnd(lowInt32(m_node->child1()), lowInt32(m_node->child2())));
1105 1106 1107 1108
    }
    
    void compileBitOr()
    {
1109
        setInt32(m_out.bitOr(lowInt32(m_node->child1()), lowInt32(m_node->child2())));
1110 1111 1112 1113
    }
    
    void compileBitXor()
    {
1114
        setInt32(m_out.bitXor(lowInt32(m_node->child1()), lowInt32(m_node->child2())));
1115 1116 1117 1118
    }
    
    void compileBitRShift()
    {
1119 1120 1121
        setInt32(m_out.aShr(
            lowInt32(m_node->child1()),
            m_out.bitAnd(lowInt32(m_node->child2()), m_out.constInt32(31))));
1122 1123 1124 1125
    }
    
    void compileBitLShift()
    {
1126 1127 1128
        setInt32(m_out.shl(
            lowInt32(m_node->child1()),
            m_out.bitAnd(lowInt32(m_node->child2()), m_out.constInt32(31))));
1129 1130 1131 1132
    }
    
    void compileBitURShift()
    {
1133 1134 1135
        setInt32(m_out.lShr(
            lowInt32(m_node->child1()),
            m_out.bitAnd(lowInt32(m_node->child2()), m_out.constInt32(31))));
1136 1137 1138 1139
    }
    
    void compileUInt32ToNumber()
    {
1140 1141
        LValue value = lowInt32(m_node->child1());

1142
        if (!nodeCanSpeculateInt32(m_node->arithNodeFlags())) {
1143
            setDouble(m_out.unsignedToDouble(value));
1144 1145 1146 1147 1148 1149
            return;
        }
        
        speculateForward(
            Overflow, noValue(), 0, m_out.lessThan(value, m_out.int32Zero),
            FormattedValue(ValueFormatUInt32, value));
1150
        setInt32(value);
1151 1152
    }
    
1153 1154 1155 1156 1157 1158 1159 1160 1161
    void compileInt32ToDouble()
    {
        // This node is tricky to compile in the DFG backend because it tries to
        // avoid converting child1 to a double in-place, as that would make subsequent
        // int uses of of child1 fail. But the FTL needs no such special magic, since
        // unlike the DFG backend, the FTL allows each node to have multiple
        // contemporaneous low-level representations. So, this gives child1 a double
        // representation and then forwards that representation to m_node.
        
1162
        setDouble(lowDouble(m_node->child1()));
1163 1164
    }
    
1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212
    void compileCheckStructure()
    {
        LValue cell = lowCell(m_node->child1());
        
        ExitKind exitKind;
        if (m_node->child1()->op() == WeakJSConstant)
            exitKind = BadWeakConstantCache;
        else
            exitKind = BadCache;
        
        LValue structure = m_out.loadPtr(cell, m_heaps.JSCell_structure);
        
        if (m_node->structureSet().size() == 1) {
            speculate(
                exitKind, jsValueValue(cell), 0,
                m_out.notEqual(structure, weakPointer(m_node->structureSet()[0])));
            return;
        }
        
        LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("CheckStructure continuation"));
        
        LBasicBlock lastNext = m_out.insertNewBlocksBefore(continuation);
        for (unsigned i = 0; i < m_node->structureSet().size() - 1; ++i) {
            LBasicBlock nextStructure = FTL_NEW_BLOCK(m_out, ("CheckStructure nextStructure"));
            m_out.branch(
                m_out.equal(structure, weakPointer(m_node->structureSet()[i])),
                continuation, nextStructure);
            m_out.appendTo(nextStructure);
        }
        
        speculate(
            exitKind, jsValueValue(cell), 0,
            m_out.notEqual(structure, weakPointer(m_node->structureSet().last())));
        
        m_out.jump(continuation);
        m_out.appendTo(continuation, lastNext);
    }
    
    void compileStructureTransitionWatchpoint()
    {
        addWeakReference(m_node->structure());
        
        // FIXME: Implement structure transition watchpoints.
        // https://bugs.webkit.org/show_bug.cgi?id=113647
        
        speculateCell(m_node->child1());
    }
    
1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273
    void compileArrayifyToStructure()
    {
        LValue cell = lowCell(m_node->child1());
        LValue property = !!m_node->child2() ? lowInt32(m_node->child2()) : 0;
        
        LBasicBlock unexpectedStructure = FTL_NEW_BLOCK(m_out, ("ArrayifyToStructure unexpected structure"));
        LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("ArrayifyToStructure continuation"));
        
        LValue structure = m_out.loadPtr(cell, m_heaps.JSCell_structure);
        
        m_out.branch(
            m_out.notEqual(structure, weakPointer(m_node->structure())),
            unexpectedStructure, continuation);
        
        LBasicBlock lastNext = m_out.appendTo(unexpectedStructure, continuation);
        
        if (property) {
            switch (m_node->arrayMode().type()) {
            case Array::Int32:
            case Array::Double:
            case Array::Contiguous:
                speculate(
                    Uncountable, noValue(), 0,
                    m_out.aboveOrEqual(property, m_out.constInt32(MIN_SPARSE_ARRAY_INDEX)));
                break;
            default:
                break;
            }
        }
        
        switch (m_node->arrayMode().type()) {
        case Array::Int32:
            vmCall(m_out.operation(operationEnsureInt32), m_callFrame, cell);
            break;
        case Array::Double:
            vmCall(m_out.operation(operationEnsureDouble), m_callFrame, cell);
            break;
        case Array::Contiguous:
            if (m_node->arrayMode().conversion() == Array::RageConvert)
                vmCall(m_out.operation(operationRageEnsureContiguous), m_callFrame, cell);
            else
                vmCall(m_out.operation(operationEnsureContiguous), m_callFrame, cell);
            break;
        case Array::ArrayStorage:
        case Array::SlowPutArrayStorage:
            vmCall(m_out.operation(operationEnsureArrayStorage), m_callFrame, cell);
            break;
        default:
            RELEASE_ASSERT_NOT_REACHED();
            break;
        }
        
        structure = m_out.loadPtr(cell, m_heaps.JSCell_structure);
        speculate(
            BadIndexingType, jsValueValue(cell), 0,
            m_out.notEqual(structure, weakPointer(m_node->structure())));
        m_out.jump(continuation);
        
        m_out.appendTo(continuation, lastNext);
    }
    
1274 1275
    void compilePutStructure()
    {
1276
        m_ftlState.jitCode->common.notifyCompilingStructureTransition(m_graph.m_plan, codeBlock(), m_node);
1277 1278 1279 1280 1281 1282 1283 1284
        
        m_out.store64(
            m_out.constIntPtr(m_node->structureTransitionData().newStructure),
            lowCell(m_node->child1()), m_heaps.JSCell_structure);
    }
    
    void compilePhantomPutStructure()
    {
1285
        m_ftlState.jitCode->common.notifyCompilingStructureTransition(m_graph.m_plan, codeBlock(), m_node);
1286 1287 1288 1289
    }
    
    void compileGetButterfly()
    {