⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 codeblock.cpp

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 CPP
📖 第 1 页 / 共 5 页
字号:
        this, m_numParameters, m_numCalleeRegisters);    Vector<Instruction>::const_iterator begin = m_instructions.begin();    Vector<Instruction>::const_iterator end = m_instructions.end();    for (Vector<Instruction>::const_iterator it = begin; it != end; ++it)        dump(exec, begin, it);    if (!m_identifiers.isEmpty()) {        printf("\nIdentifiers:\n");        size_t i = 0;        do {            printf("  id%u = %s\n", static_cast<unsigned>(i), m_identifiers[i].ascii());            ++i;        } while (i != m_identifiers.size());    }    if (!m_constantRegisters.isEmpty()) {        printf("\nConstants:\n");        unsigned registerIndex = m_numVars;        size_t i = 0;        do {            printf("   r%u = %s\n", registerIndex, valueToSourceString(exec, m_constantRegisters[i].jsValue(exec)).ascii());            ++i;            ++registerIndex;        } while (i < m_constantRegisters.size());    }    if (m_rareData && !m_rareData->m_unexpectedConstants.isEmpty()) {        printf("\nUnexpected Constants:\n");        size_t i = 0;        do {            printf("  k%u = %s\n", static_cast<unsigned>(i), valueToSourceString(exec, m_rareData->m_unexpectedConstants[i]).ascii());            ++i;        } while (i < m_rareData->m_unexpectedConstants.size());    }        if (m_rareData && !m_rareData->m_regexps.isEmpty()) {        printf("\nm_regexps:\n");        size_t i = 0;        do {            printf("  re%u = %s\n", static_cast<unsigned>(i), regexpToSourceString(m_rareData->m_regexps[i].get()).ascii());            ++i;        } while (i < m_rareData->m_regexps.size());    }#if ENABLE(JIT)    if (!m_globalResolveInfos.isEmpty() || !m_structureStubInfos.isEmpty())        printf("\nStructures:\n");    if (!m_globalResolveInfos.isEmpty()) {        size_t i = 0;        do {             printGlobalResolveInfo(m_globalResolveInfos[i], instructionOffsetForNth(exec, m_instructions, i + 1, isGlobalResolve));             ++i;        } while (i < m_globalResolveInfos.size());    }    if (!m_structureStubInfos.isEmpty()) {        size_t i = 0;        do {            printStructureStubInfo(m_structureStubInfos[i], instructionOffsetForNth(exec, m_instructions, i + 1, isPropertyAccess));             ++i;        } while (i < m_structureStubInfos.size());    }#else    if (!m_globalResolveInstructions.isEmpty() || !m_propertyAccessInstructions.isEmpty())        printf("\nStructures:\n");    if (!m_globalResolveInstructions.isEmpty()) {        size_t i = 0;        do {             printStructures(&m_instructions[m_globalResolveInstructions[i]]);             ++i;        } while (i < m_globalResolveInstructions.size());    }    if (!m_propertyAccessInstructions.isEmpty()) {        size_t i = 0;        do {            printStructures(&m_instructions[m_propertyAccessInstructions[i]]);             ++i;        } while (i < m_propertyAccessInstructions.size());    }#endif    if (m_rareData && !m_rareData->m_exceptionHandlers.isEmpty()) {        printf("\nException Handlers:\n");        unsigned i = 0;        do {            printf("\t %d: { start: [%4d] end: [%4d] target: [%4d] }\n", i + 1, m_rareData->m_exceptionHandlers[i].start, m_rareData->m_exceptionHandlers[i].end, m_rareData->m_exceptionHandlers[i].target);            ++i;        } while (i < m_rareData->m_exceptionHandlers.size());    }        if (m_rareData && !m_rareData->m_immediateSwitchJumpTables.isEmpty()) {        printf("Immediate Switch Jump Tables:\n");        unsigned i = 0;        do {            printf("  %1d = {\n", i);            int entry = 0;            Vector<int32_t>::const_iterator end = m_rareData->m_immediateSwitchJumpTables[i].branchOffsets.end();            for (Vector<int32_t>::const_iterator iter = m_rareData->m_immediateSwitchJumpTables[i].branchOffsets.begin(); iter != end; ++iter, ++entry) {                if (!*iter)                    continue;                printf("\t\t%4d => %04d\n", entry + m_rareData->m_immediateSwitchJumpTables[i].min, *iter);            }            printf("      }\n");            ++i;        } while (i < m_rareData->m_immediateSwitchJumpTables.size());    }        if (m_rareData && !m_rareData->m_characterSwitchJumpTables.isEmpty()) {        printf("\nCharacter Switch Jump Tables:\n");        unsigned i = 0;        do {            printf("  %1d = {\n", i);            int entry = 0;            Vector<int32_t>::const_iterator end = m_rareData->m_characterSwitchJumpTables[i].branchOffsets.end();            for (Vector<int32_t>::const_iterator iter = m_rareData->m_characterSwitchJumpTables[i].branchOffsets.begin(); iter != end; ++iter, ++entry) {                if (!*iter)                    continue;                ASSERT(!((i + m_rareData->m_characterSwitchJumpTables[i].min) & ~0xFFFF));                UChar ch = static_cast<UChar>(entry + m_rareData->m_characterSwitchJumpTables[i].min);                printf("\t\t\"%s\" => %04d\n", UString(&ch, 1).ascii(), *iter);        }            printf("      }\n");            ++i;        } while (i < m_rareData->m_characterSwitchJumpTables.size());    }        if (m_rareData && !m_rareData->m_stringSwitchJumpTables.isEmpty()) {        printf("\nString Switch Jump Tables:\n");        unsigned i = 0;        do {            printf("  %1d = {\n", i);            StringJumpTable::StringOffsetTable::const_iterator end = m_rareData->m_stringSwitchJumpTables[i].offsetTable.end();            for (StringJumpTable::StringOffsetTable::const_iterator iter = m_rareData->m_stringSwitchJumpTables[i].offsetTable.begin(); iter != end; ++iter)                printf("\t\t\"%s\" => %04d\n", UString(iter->first).ascii(), iter->second.branchOffset);            printf("      }\n");            ++i;        } while (i < m_rareData->m_stringSwitchJumpTables.size());    }    printf("\n");}void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator& it) const{    int location = it - begin;    switch (exec->interpreter()->getOpcodeID(it->u.opcode)) {        case op_enter: {            printf("[%4d] enter\n", location);            break;        }        case op_enter_with_activation: {            int r0 = (++it)->u.operand;            printf("[%4d] enter_with_activation %s\n", location, registerName(r0).c_str());            break;        }        case op_create_arguments: {            printf("[%4d] create_arguments\n", location);            break;        }        case op_convert_this: {            int r0 = (++it)->u.operand;            printf("[%4d] convert_this %s\n", location, registerName(r0).c_str());            break;        }        case op_unexpected_load: {            int r0 = (++it)->u.operand;            int k0 = (++it)->u.operand;            printf("[%4d] unexpected_load\t %s, %s\n", location, registerName(r0).c_str(), constantName(exec, k0, unexpectedConstant(k0)).c_str());            break;        }        case op_new_object: {            int r0 = (++it)->u.operand;            printf("[%4d] new_object\t %s\n", location, registerName(r0).c_str());            break;        }        case op_new_array: {            int dst = (++it)->u.operand;            int argv = (++it)->u.operand;            int argc = (++it)->u.operand;            printf("[%4d] new_array\t %s, %s, %d\n", location, registerName(dst).c_str(), registerName(argv).c_str(), argc);            break;        }        case op_new_regexp: {            int r0 = (++it)->u.operand;            int re0 = (++it)->u.operand;            printf("[%4d] new_regexp\t %s, %s\n", location, registerName(r0).c_str(), regexpName(re0, regexp(re0)).c_str());            break;        }        case op_mov: {            int r0 = (++it)->u.operand;            int r1 = (++it)->u.operand;            printf("[%4d] mov\t\t %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str());            break;        }        case op_not: {            printUnaryOp(location, it, "not");            break;        }        case op_eq: {            printBinaryOp(location, it, "eq");            break;        }        case op_eq_null: {            printUnaryOp(location, it, "eq_null");            break;        }        case op_neq: {            printBinaryOp(location, it, "neq");            break;        }        case op_neq_null: {            printUnaryOp(location, it, "neq_null");            break;        }        case op_stricteq: {            printBinaryOp(location, it, "stricteq");            break;        }        case op_nstricteq: {            printBinaryOp(location, it, "nstricteq");            break;        }        case op_less: {            printBinaryOp(location, it, "less");            break;        }        case op_lesseq: {            printBinaryOp(location, it, "lesseq");            break;        }        case op_pre_inc: {            int r0 = (++it)->u.operand;            printf("[%4d] pre_inc\t\t %s\n", location, registerName(r0).c_str());            break;        }        case op_pre_dec: {            int r0 = (++it)->u.operand;            printf("[%4d] pre_dec\t\t %s\n", location, registerName(r0).c_str());            break;        }        case op_post_inc: {            printUnaryOp(location, it, "post_inc");            break;        }        case op_post_dec: {            printUnaryOp(location, it, "post_dec");            break;        }        case op_to_jsnumber: {            printUnaryOp(location, it, "to_jsnumber");            break;        }        case op_negate: {            printUnaryOp(location, it, "negate");            break;        }        case op_add: {            printBinaryOp(location, it, "add");            ++it;            break;        }        case op_mul: {            printBinaryOp(location, it, "mul");            ++it;            break;        }        case op_div: {            printBinaryOp(location, it, "div");            break;        }        case op_mod: {            printBinaryOp(location, it, "mod");            break;        }        case op_sub: {            printBinaryOp(location, it, "sub");            ++it;            break;        }        case op_lshift: {            printBinaryOp(location, it, "lshift");            break;                    }        case op_rshift: {            printBinaryOp(location, it, "rshift");            break;        }        case op_urshift: {            printBinaryOp(location, it, "urshift");            break;        }        case op_bitand: {            printBinaryOp(location, it, "bitand");            ++it;            break;        }        case op_bitxor: {            printBinaryOp(location, it, "bitxor");            ++it;            break;        }        case op_bitor: {            printBinaryOp(location, it, "bitor");            ++it;            break;        }        case op_bitnot: {            printUnaryOp(location, it, "bitnot");            break;        }        case op_instanceof: {            int r0 = (++it)->u.operand;            int r1 = (++it)->u.operand;            int r2 = (++it)->u.operand;            int r3 = (++it)->u.operand;            printf("[%4d] instanceof\t\t %s, %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), registerName(r2).c_str(), registerName(r3).c_str());            break;        }        case op_typeof: {            printUnaryOp(location, it, "typeof");            break;        }        case op_is_undefined: {            printUnaryOp(location, it, "is_undefined");            break;        }        case op_is_boolean: {            printUnaryOp(location, it, "is_boolean");            break;        }        case op_is_number: {            printUnaryOp(location, it, "is_number");            break;        }        case op_is_string: {            printUnaryOp(location, it, "is_string");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -