Ignore:
Timestamp:
Jul 4, 2011, 12:26:05 PM (14 years ago)
Author:
[email protected]
Message:

https://bugs.webkit.org/show_bug.cgi?id=63881
Need separate bytecodes for handling >, >= comparisons.

Reviewed by Oliver Hunt.

This clears the way to fix Bug#63880. We currently handle greater-than comparisons
as being using the corresponding op_less, etc opcodes. This is incorrect with
respect to evaluation ordering of the implicit conversions performed on operands -
we should be calling ToPrimitive on the LHS and RHS operands to the greater than,
but instead convert RHS then LHS.

This patch adds opcodes for greater-than comparisons mirroring existing ones used
for less-than.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::dump):

  • bytecode/Opcode.h:
  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitJumpIfTrue):
(JSC::BytecodeGenerator::emitJumpIfFalse):

  • bytecompiler/NodesCodegen.cpp:
  • dfg/DFGByteCodeParser.cpp:

(JSC::DFG::ByteCodeParser::parseBlock):

  • dfg/DFGNode.h:
  • dfg/DFGNonSpeculativeJIT.cpp:

(JSC::DFG::NonSpeculativeJIT::compare):
(JSC::DFG::NonSpeculativeJIT::compile):

  • dfg/DFGNonSpeculativeJIT.h:
  • dfg/DFGOperations.cpp:
  • dfg/DFGOperations.h:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compare):
(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT.h:
  • interpreter/Interpreter.cpp:

(JSC::Interpreter::privateExecute):

  • jit/JIT.cpp:

(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompileSlowCases):

  • jit/JIT.h:

(JSC::JIT::emit_op_loop_if_greater):
(JSC::JIT::emitSlow_op_loop_if_greater):
(JSC::JIT::emit_op_loop_if_greatereq):
(JSC::JIT::emitSlow_op_loop_if_greatereq):

  • jit/JITArithmetic.cpp:

(JSC::JIT::emit_op_jgreater):
(JSC::JIT::emit_op_jgreatereq):
(JSC::JIT::emit_op_jngreater):
(JSC::JIT::emit_op_jngreatereq):
(JSC::JIT::emitSlow_op_jgreater):
(JSC::JIT::emitSlow_op_jgreatereq):
(JSC::JIT::emitSlow_op_jngreater):
(JSC::JIT::emitSlow_op_jngreatereq):
(JSC::JIT::emit_compareAndJumpSlow):

  • jit/JITArithmetic32_64.cpp:

(JSC::JIT::emitBinaryDoubleOp):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • jit/JITStubs.h:
  • parser/NodeConstructors.h:

(JSC::GreaterNode::GreaterNode):
(JSC::GreaterEqNode::GreaterEqNode):

  • parser/Nodes.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r89885 r90371  
    587587            break;
    588588        }
     589        case op_greater: {
     590            printBinaryOp(exec, location, it, "greater");
     591            break;
     592        }
     593        case op_greatereq: {
     594            printBinaryOp(exec, location, it, "greatereq");
     595            break;
     596        }
    589597        case op_pre_inc: {
    590598            int r0 = (++it)->u.operand;
     
    9961004            break;
    9971005        }
     1006        case op_jless: {
     1007            int r0 = (++it)->u.operand;
     1008            int r1 = (++it)->u.operand;
     1009            int offset = (++it)->u.operand;
     1010            printf("[%4d] jless\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
     1011            break;
     1012        }
     1013        case op_jlesseq: {
     1014            int r0 = (++it)->u.operand;
     1015            int r1 = (++it)->u.operand;
     1016            int offset = (++it)->u.operand;
     1017            printf("[%4d] jlesseq\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
     1018            break;
     1019        }
     1020        case op_jgreater: {
     1021            int r0 = (++it)->u.operand;
     1022            int r1 = (++it)->u.operand;
     1023            int offset = (++it)->u.operand;
     1024            printf("[%4d] jgreater\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
     1025            break;
     1026        }
     1027        case op_jgreatereq: {
     1028            int r0 = (++it)->u.operand;
     1029            int r1 = (++it)->u.operand;
     1030            int offset = (++it)->u.operand;
     1031            printf("[%4d] jgreatereq\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
     1032            break;
     1033        }
    9981034        case op_jnless: {
    9991035            int r0 = (++it)->u.operand;
     
    10101046            break;
    10111047        }
     1048        case op_jngreater: {
     1049            int r0 = (++it)->u.operand;
     1050            int r1 = (++it)->u.operand;
     1051            int offset = (++it)->u.operand;
     1052            printf("[%4d] jngreater\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
     1053            break;
     1054        }
     1055        case op_jngreatereq: {
     1056            int r0 = (++it)->u.operand;
     1057            int r1 = (++it)->u.operand;
     1058            int offset = (++it)->u.operand;
     1059            printf("[%4d] jngreatereq\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
     1060            break;
     1061        }
    10121062        case op_loop_if_less: {
    10131063            int r0 = (++it)->u.operand;
     
    10171067            break;
    10181068        }
    1019         case op_jless: {
    1020             int r0 = (++it)->u.operand;
    1021             int r1 = (++it)->u.operand;
    1022             int offset = (++it)->u.operand;
    1023             printf("[%4d] jless\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
    1024             break;
    1025         }
    1026         case op_jlesseq: {
    1027             int r0 = (++it)->u.operand;
    1028             int r1 = (++it)->u.operand;
    1029             int offset = (++it)->u.operand;
    1030             printf("[%4d] jlesseq\t\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
    1031             break;
    1032         }
    10331069        case op_loop_if_lesseq: {
    10341070            int r0 = (++it)->u.operand;
     
    10361072            int offset = (++it)->u.operand;
    10371073            printf("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
     1074            break;
     1075        }
     1076        case op_loop_if_greater: {
     1077            int r0 = (++it)->u.operand;
     1078            int r1 = (++it)->u.operand;
     1079            int offset = (++it)->u.operand;
     1080            printf("[%4d] loop_if_greater\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
     1081            break;
     1082        }
     1083        case op_loop_if_greatereq: {
     1084            int r0 = (++it)->u.operand;
     1085            int r1 = (++it)->u.operand;
     1086            int offset = (++it)->u.operand;
     1087            printf("[%4d] loop_if_greatereq\t %s, %s, %d(->%d)\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), offset, location + offset);
    10381088            break;
    10391089        }
Note: See TracChangeset for help on using the changeset viewer.