Ignore:
Timestamp:
Oct 22, 2008, 2:06:30 PM (17 years ago)
Author:
[email protected]
Message:

2008-10-22 Cameron Zwarich <[email protected]>

Reviewed by Geoff Garen.

Bug 21803: Fuse op_jfalse with op_eq_null and op_neq_null
<https://bugs.webkit.org/show_bug.cgi?id=21803>

Fuse op_jfalse with op_eq_null and op_neq_null to make the new opcodes
op_jeq_null and op_jneq_null.

This is a 2.6% speedup on the V8 Raytrace benchmark, and strangely also
a 4.7% speedup on the V8 Arguments benchmark, even though it uses
neither of the two new opcodes.

  • VM/CTI.cpp: (JSC::CTI::privateCompileMainPass):
  • VM/CodeBlock.cpp: (JSC::CodeBlock::dump):
  • VM/CodeGenerator.cpp: (JSC::CodeGenerator::emitJumpIfTrue): (JSC::CodeGenerator::emitJumpIfFalse):
  • VM/Machine.cpp: (JSC::Machine::privateExecute):
  • VM/Opcode.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/CodeGenerator.cpp

    r37755 r37789  
    547547            return target;
    548548        }
     549    } else if (m_lastOpcodeID == op_eq_null && target->isForwardLabel()) {
     550        int dstIndex;
     551        int srcIndex;
     552
     553        retrieveLastUnaryOp(dstIndex, srcIndex);
     554
     555        if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
     556            rewindUnaryOp();
     557            emitOpcode(op_jeq_null);
     558            instructions().append(srcIndex);
     559            instructions().append(target->offsetFrom(instructions().size()));
     560            return target;
     561        }
     562    } else if (m_lastOpcodeID == op_neq_null && target->isForwardLabel()) {
     563        int dstIndex;
     564        int srcIndex;
     565
     566        retrieveLastUnaryOp(dstIndex, srcIndex);
     567
     568        if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
     569            rewindUnaryOp();
     570            emitOpcode(op_jneq_null);
     571            instructions().append(srcIndex);
     572            instructions().append(target->offsetFrom(instructions().size()));
     573            return target;
     574        }
    549575    }
    550576
     
    586612            instructions().append(target->offsetFrom(instructions().size()));
    587613            return target;
    588         }       
     614        }
     615    } else if (m_lastOpcodeID == op_eq_null) {
     616        int dstIndex;
     617        int srcIndex;
     618
     619        retrieveLastUnaryOp(dstIndex, srcIndex);
     620
     621        if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
     622            rewindUnaryOp();
     623            emitOpcode(op_jneq_null);
     624            instructions().append(srcIndex);
     625            instructions().append(target->offsetFrom(instructions().size()));
     626            return target;
     627        }
     628    } else if (m_lastOpcodeID == op_neq_null) {
     629        int dstIndex;
     630        int srcIndex;
     631
     632        retrieveLastUnaryOp(dstIndex, srcIndex);
     633
     634        if (cond->index() == dstIndex && cond->isTemporary() && !cond->refCount()) {
     635            rewindUnaryOp();
     636            emitOpcode(op_jeq_null);
     637            instructions().append(srcIndex);
     638            instructions().append(target->offsetFrom(instructions().size()));
     639            return target;
     640        }
    589641    }
    590642
Note: See TracChangeset for help on using the changeset viewer.