Ignore:
Timestamp:
Jan 11, 2012, 5:00:58 PM (13 years ago)
Author:
[email protected]
Message:

Bytecode dumping is broken for call opcodes (due to two new operands)
https://bugs.webkit.org/show_bug.cgi?id=75886

Reviewed by Oliver Hunt.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::printCallOp): Made a helper function, so I wouldn't have
to fix this more than once. The helper function skips the extra two operands
at the end of the opcode, used for optimization.

(JSC::CodeBlock::dump): Used the helper function.

  • bytecode/CodeBlock.h: Declared the helper function.
File:
1 edited

Legend:

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

    r104646 r104770  
    184184}
    185185
     186void CodeBlock::printCallOp(ExecState* exec, int location, Vector<Instruction>::const_iterator& it, const char* op) const
     187{
     188    int func = (++it)->u.operand;
     189    int argCount = (++it)->u.operand;
     190    int registerOffset = (++it)->u.operand;
     191    printf("[%4d] %s\t %s, %d, %d\n", location, op, registerName(exec, func).data(), argCount, registerOffset);
     192    it += 2;
     193}
     194
    186195void CodeBlock::printPutByIdOp(ExecState* exec, int location, Vector<Instruction>::const_iterator& it, const char* op) const
    187196{
     
    523532        case op_convert_this: {
    524533            int r0 = (++it)->u.operand;
    525             printf("[%4d] convert_this %s\n", location, registerName(exec, r0).data());
     534            printf("[%4d] convert_this\t %s\n", location, registerName(exec, r0).data());
    526535            break;
    527536        }
     
    11201129        }
    11211130        case op_call: {
    1122             int func = (++it)->u.operand;
    1123             int argCount = (++it)->u.operand;
    1124             int registerOffset = (++it)->u.operand;
    1125             printf("[%4d] call\t\t %s, %d, %d\n", location, registerName(exec, func).data(), argCount, registerOffset);
     1131            printCallOp(exec, location, it, "call");
    11261132            break;
    11271133        }
    11281134        case op_call_eval: {
    1129             int func = (++it)->u.operand;
    1130             int argCount = (++it)->u.operand;
    1131             int registerOffset = (++it)->u.operand;
    1132             printf("[%4d] call_eval\t %s, %d, %d\n", location, registerName(exec, func).data(), argCount, registerOffset);
     1135            printCallOp(exec, location, it, "call_eval");
    11331136            break;
    11341137        }
     
    11491152        case op_tear_off_arguments: {
    11501153            int r0 = (++it)->u.operand;
    1151             printf("[%4d] tear_off_arguments\t %s\n", location, registerName(exec, r0).data());
     1154            printf("[%4d] tear_off_arguments %s\n", location, registerName(exec, r0).data());
    11521155            break;
    11531156        }
     
    11691172        }
    11701173        case op_construct: {
    1171             int func = (++it)->u.operand;
    1172             int argCount = (++it)->u.operand;
    1173             int registerOffset = (++it)->u.operand;
    1174             printf("[%4d] construct\t %s, %d, %d\n", location, registerName(exec, func).data(), argCount, registerOffset);
     1174            printCallOp(exec, location, it, "construct");
    11751175            break;
    11761176        }
Note: See TracChangeset for help on using the changeset viewer.