Ignore:
Timestamp:
Aug 12, 2013, 3:39:13 PM (12 years ago)
Author:
[email protected]
Message:

Stop making unnecessary copy of CodeBlock Identifier Vector
https://bugs.webkit.org/show_bug.cgi?id=119702

Reviewed by Michael Saboff.

Make CodeBlock simply use a separate Vector for additional Identifiers
and use the UnlinkedCodeBlock for the initial set of identifiers.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::printGetByIdOp):
(JSC::dumpStructure):
(JSC::dumpChain):
(JSC::CodeBlock::printGetByIdCacheStatus):
(JSC::CodeBlock::printPutByIdOp):
(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::shrinkToFit):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::numberOfIdentifiers):
(JSC::CodeBlock::numberOfAdditionalIdentifiers):
(JSC::CodeBlock::addAdditionalIdentifier):
(JSC::CodeBlock::identifier):

  • dfg/DFGDesiredIdentifiers.cpp:

(JSC::DFG::DesiredIdentifiers::reallyAdd):

  • jit/JIT.h:
  • jit/JITOpcodes.cpp:

(JSC::JIT::emitSlow_op_get_arguments_length):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emit_op_get_by_id):
(JSC::JIT::compileGetByIdHotPath):
(JSC::JIT::emitSlow_op_get_by_id):
(JSC::JIT::compileGetByIdSlowCase):
(JSC::JIT::emitSlow_op_put_by_id):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::emit_op_get_by_id):
(JSC::JIT::compileGetByIdHotPath):
(JSC::JIT::compileGetByIdSlowCase):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

File:
1 edited

Legend:

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

    r153778 r153962  
    284284    int r1 = (++it)->u.operand;
    285285    int id0 = (++it)->u.operand;
    286     out.printf("[%4d] %s\t %s, %s, %s", location, op, registerName(r0).data(), registerName(r1).data(), idName(id0, m_identifiers[id0]).data());
     286    out.printf("[%4d] %s\t %s, %s, %s", location, op, registerName(r0).data(), registerName(r1).data(), idName(id0, identifier(id0)).data());
    287287    it += 4; // Increment up to the value profiler.
    288288}
    289289
    290290#if ENABLE(JIT) || ENABLE(LLINT) // unused in some configurations
    291 static void dumpStructure(PrintStream& out, const char* name, ExecState* exec, Structure* structure, Identifier& ident)
     291static void dumpStructure(PrintStream& out, const char* name, ExecState* exec, Structure* structure, const Identifier& ident)
    292292{
    293293    if (!structure)
     
    303303
    304304#if ENABLE(JIT) // unused when not ENABLE(JIT), leading to silly warnings
    305 static void dumpChain(PrintStream& out, ExecState* exec, StructureChain* chain, Identifier& ident)
     305static void dumpChain(PrintStream& out, ExecState* exec, StructureChain* chain, const Identifier& ident)
    306306{
    307307    out.printf("chain = %p: [", chain);
     
    324324    Instruction* instruction = instructions().begin() + location;
    325325
    326     Identifier& ident = identifier(instruction[3].u.operand);
     326    const Identifier& ident = identifier(instruction[3].u.operand);
    327327   
    328328    UNUSED_PARAM(ident); // tell the compiler to shut up in certain platform configurations.
     
    471471    int id0 = (++it)->u.operand;
    472472    int r1 = (++it)->u.operand;
    473     out.printf("[%4d] %s\t %s, %s, %s", location, op, registerName(r0).data(), idName(id0, m_identifiers[id0]).data(), registerName(r1).data());
     473    out.printf("[%4d] %s\t %s, %s, %s", location, op, registerName(r0).data(), idName(id0, identifier(id0)).data(), registerName(r1).data());
    474474    it += 5;
    475475}
     
    511511        dumpBytecode(out, exec, begin, it);
    512512
    513     if (!m_identifiers.isEmpty()) {
     513    if (numberOfIdentifiers()) {
    514514        out.printf("\nIdentifiers:\n");
    515515        size_t i = 0;
    516516        do {
    517             out.printf("  id%u = %s\n", static_cast<unsigned>(i), m_identifiers[i].string().utf8().data());
     517            out.printf("  id%u = %s\n", static_cast<unsigned>(i), identifier(i).string().utf8().data());
    518518            ++i;
    519         } while (i != m_identifiers.size());
     519        } while (i != numberOfIdentifiers());
    520520    }
    521521
     
    973973            int r1 = (++it)->u.operand;
    974974            int r2 = (++it)->u.operand;
    975             out.printf("[%4d] put_getter_setter\t %s, %s, %s, %s", location, registerName(r0).data(), idName(id0, m_identifiers[id0]).data(), registerName(r1).data(), registerName(r2).data());
     975            out.printf("[%4d] put_getter_setter\t %s, %s, %s, %s", location, registerName(r0).data(), idName(id0, identifier(id0)).data(), registerName(r1).data(), registerName(r2).data());
    976976            break;
    977977        }
     
    980980            int r1 = (++it)->u.operand;
    981981            int id0 = (++it)->u.operand;
    982             out.printf("[%4d] del_by_id\t %s, %s, %s", location, registerName(r0).data(), registerName(r1).data(), idName(id0, m_identifiers[id0]).data());
     982            out.printf("[%4d] del_by_id\t %s, %s, %s", location, registerName(r0).data(), registerName(r1).data(), idName(id0, identifier(id0)).data());
    983983            break;
    984984        }
     
    12471247            int r1 = (++it)->u.operand;
    12481248            unsigned attributes = (++it)->u.operand;
    1249             out.printf("[%4d] push_name_scope \t%s, %s, %u", location, idName(id0, m_identifiers[id0]).data(), registerName(r1).data(), attributes);
     1249            out.printf("[%4d] push_name_scope \t%s, %s, %u", location, idName(id0, identifier(id0)).data(), registerName(r1).data(), attributes);
    12501250            break;
    12511251        }
     
    12941294            ++it; // ResolveType
    12951295            ++it; // depth
    1296             out.printf("[%4d] resolve_scope\t %s, %s", location, registerName(r0).data(), idName(id0, m_identifiers[id0]).data());
     1296            out.printf("[%4d] resolve_scope\t %s, %s", location, registerName(r0).data(), idName(id0, identifier(id0)).data());
    12971297            break;
    12981298        }
     
    13051305            ++it; // Operand
    13061306            ++it; // Skip value profile.
    1307             out.printf("[%4d] get_from_scope\t %s, %s, %s, %d", location, registerName(r0).data(), registerName(r1).data(), idName(id0, m_identifiers[id0]).data(), resolveModeAndType);
     1307            out.printf("[%4d] get_from_scope\t %s, %s, %s, %d", location, registerName(r0).data(), registerName(r1).data(), idName(id0, identifier(id0)).data(), resolveModeAndType);
    13081308            break;
    13091309        }
     
    13151315            ++it; // Structure
    13161316            ++it; // Operand
    1317             out.printf("[%4d] put_to_scope\t %s, %s, %s, %d", location, registerName(r0).data(), idName(id0, m_identifiers[id0]).data(), registerName(r1).data(), resolveModeAndType);
     1317            out.printf("[%4d] put_to_scope\t %s, %s, %s, %d", location, registerName(r0).data(), idName(id0, identifier(id0)).data(), registerName(r1).data(), resolveModeAndType);
    13181318            break;
    13191319        }
     
    14921492    , m_firstLineColumnOffset(other.m_firstLineColumnOffset)
    14931493    , m_codeType(other.m_codeType)
    1494     , m_identifiers(other.m_identifiers)
     1494    , m_additionalIdentifiers(other.m_additionalIdentifiers)
    14951495    , m_constantRegisters(other.m_constantRegisters)
    14961496    , m_functionDecls(other.m_functionDecls)
     
    15521552    liveCodeBlockSet.add(this);
    15531553#endif
    1554     setIdentifiers(unlinkedCodeBlock->identifiers());
     1554
    15551555    setConstantRegisters(unlinkedCodeBlock->constantRegisters());
    15561556    if (unlinkedCodeBlock->usesGlobalObject())
     
    17651765
    17661766        case op_resolve_scope: {
    1767             Identifier& ident = identifier(pc[i + 2].u.operand);
     1767            const Identifier& ident = identifier(pc[i + 2].u.operand);
    17681768            ResolveType type = static_cast<ResolveType>(pc[i + 3].u.operand);
    17691769
     
    17831783
    17841784            // get_from_scope dst, scope, id, ResolveModeAndType, Structure, Operand
    1785             Identifier& ident = identifier(pc[i + 3].u.operand);
     1785            const Identifier& ident = identifier(pc[i + 3].u.operand);
    17861786            ResolveModeAndType modeAndType = ResolveModeAndType(pc[i + 4].u.operand);
    17871787            ResolveOp op = JSScope::abstractResolve(m_globalObject->globalExec(), scope, ident, Get, modeAndType.type());
     
    17961796        case op_put_to_scope: {
    17971797            // put_to_scope scope, id, value, ResolveModeAndType, Structure, Operand
    1798             Identifier& ident = identifier(pc[i + 2].u.operand);
     1798            const Identifier& ident = identifier(pc[i + 2].u.operand);
    17991799            ResolveModeAndType modeAndType = ResolveModeAndType(pc[i + 4].u.operand);
    18001800            ResolveOp op = JSScope::abstractResolve(m_globalObject->globalExec(), scope, ident, Put, modeAndType.type());
     
    24552455   
    24562456    if (shrinkMode == EarlyShrink) {
    2457         m_identifiers.shrinkToFit();
     2457        m_additionalIdentifiers.shrinkToFit();
    24582458        m_functionDecls.shrinkToFit();
    24592459        m_functionExprs.shrinkToFit();
Note: See TracChangeset for help on using the changeset viewer.