Changeset 36408 in webkit for trunk/JavaScriptCore/VM/CTI.cpp


Ignore:
Timestamp:
Sep 14, 2008, 4:01:03 PM (17 years ago)
Author:
[email protected]
Message:

2008-09-14 Cameron Zwarich <[email protected]>

Reviewed by Oliver Hunt.

Bug 20816: op_lesseq should be optimized
<https://bugs.webkit.org/show_bug.cgi?id=20816>

Add a loop_if_lesseq opcode that is similar to the loop_if_less opcode.

This is a 9.4% speedup on the V8 Crypto benchmark.

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

Legend:

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

    r36402 r36408  
    571571            break;
    572572        }
     573        case op_loop_if_lesseq: {
     574            emitSlowScriptCheck(i);
     575
     576            unsigned target = instruction[i + 3].u.operand;
     577            JSValue* src2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand);
     578            if (src2imm) {
     579                emitGetArg(instruction[i + 1].u.operand, X86::edx);
     580                emitJumpSlowCaseIfNotImm(X86::edx, i);
     581                m_jit.cmpl_i32r(reinterpret_cast<unsigned>(src2imm), X86::edx);
     582                m_jmpTable.append(JmpTable(m_jit.emitUnlinkedJle(), i + 3 + target));
     583            } else {
     584                emitGetArg(instruction[i + 1].u.operand, X86::eax);
     585                emitGetArg(instruction[i + 2].u.operand, X86::edx);
     586                emitJumpSlowCaseIfNotImm(X86::eax, i);
     587                emitJumpSlowCaseIfNotImm(X86::edx, i);
     588                m_jit.cmpl_rr(X86::edx, X86::eax);
     589                m_jmpTable.append(JmpTable(m_jit.emitUnlinkedJle(), i + 3 + target));
     590            }
     591            i += 4;
     592            break;
     593        }
    573594        case op_new_object: {
    574595            emitCall(i, Machine::cti_op_new_object);
     
    14461467            break;
    14471468        }
     1469        case op_loop_if_lesseq: {
     1470            emitSlowScriptCheck(i);
     1471
     1472            unsigned target = instruction[i + 3].u.operand;
     1473            JSValue* src2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand);
     1474            if (src2imm) {
     1475                m_jit.link(iter->from, m_jit.label());
     1476                emitPutArg(X86::edx, 0);
     1477                emitGetPutArg(instruction[i + 2].u.operand, 4, X86::ecx);
     1478                emitCall(i, Machine::cti_op_loop_if_lesseq);
     1479                m_jit.testl_rr(X86::eax, X86::eax);
     1480                m_jit.link(m_jit.emitUnlinkedJne(), m_labels[i + 3 + target]);
     1481            } else {
     1482                m_jit.link(iter->from, m_jit.label());
     1483                m_jit.link((++iter)->from, m_jit.label());
     1484                emitPutArg(X86::eax, 0);
     1485                emitPutArg(X86::edx, 4);
     1486                emitCall(i, Machine::cti_op_loop_if_lesseq);
     1487                m_jit.testl_rr(X86::eax, X86::eax);
     1488                m_jit.link(m_jit.emitUnlinkedJne(), m_labels[i + 3 + target]);
     1489            }
     1490            i += 4;
     1491            break;
     1492        }
    14481493        case op_pre_inc: {
    14491494            unsigned srcDst = instruction[i + 1].u.operand;
Note: See TracChangeset for help on using the changeset viewer.