Example #1
0
void CodeBlock::dump(ExecState* exec) const
{
    Vector<Instruction>::const_iterator begin = instructions.begin();
    Vector<Instruction>::const_iterator end = instructions.end();

    size_t instructionCount = 0;
    for (Vector<Instruction>::const_iterator it = begin; it != end; ++it)
        if (exec->machine()->isOpcode(it->u.opcode))
            ++instructionCount;

    printf("%lu instructions; %lu bytes at %p; %d locals (%d parameters); %d temporaries\n\n",
        static_cast<unsigned long>(instructionCount),
        static_cast<unsigned long>(instructions.size() * sizeof(Instruction)),
        this, numLocals, numParameters, numTemporaries);
    
    for (Vector<Instruction>::const_iterator it = begin; it != end; ++it)
        dump(exec, begin, it);

    if (identifiers.size()) {
        printf("\nIdentifiers:\n");
        size_t i = 0;
        do {
            printf("  id%u = %s\n", static_cast<unsigned>(i), identifiers[i].ascii());
            ++i;
        } while (i != identifiers.size());
    }

    if (jsValues.size()) {
        printf("\nConstants:\n");
        size_t i = 0;
        do {
            printf("  k%u = %s\n", static_cast<unsigned>(i), valueToSourceString(exec, jsValues[i]).ascii());
            ++i;
        } while (i < jsValues.size());
    }
    
    if (regexps.size()) {
        printf("\nRegExps:\n");
        size_t i = 0;
        do {
            printf("  re%u = %s\n", static_cast<unsigned>(i), regexpToSourceString(regexps[i].get()).ascii());
            ++i;
        } while (i < regexps.size());
    }

    if (exceptionHandlers.size()) {
        printf("\nException Handlers:\n");
        unsigned i = 0;
        do {
            printf("\t %d: { start: [%4d] end: [%4d] target: [%4d] }\n", i+1, exceptionHandlers[i].start, exceptionHandlers[i].end, exceptionHandlers[i].target);
            ++i;
        } while (i < exceptionHandlers.size());
    }
        
    printf("\n");
}
Example #2
0
static CString regexpName(int re, RegExp* regexp)
{
    return (regexpToSourceString(regexp) + "(@re" + UString::from(re) + ")").UTF8String();
}
Example #3
0
void RegExp::dumpToStream(const JSCell* cell, PrintStream& out)
{
    out.print(regexpToSourceString(jsCast<const RegExp*>(cell)));
}