Changeset 39070 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Dec 6, 2008, 2:01:05 PM (16 years ago)
Author:
[email protected]
Message:

2008-12-05 Sam Weinig <[email protected]>

Reviewed by Cameron Zwarich.

Fix for https://bugs.webkit.org/show_bug.cgi?id=22715
Encapsulate more CodeBlock members in preparation
of moving some of them to a rare data structure.

  • bytecode/CodeBlock.cpp: (JSC::locationForOffset): (JSC::printConditionalJump): (JSC::printGetByIdOp): (JSC::printPutByIdOp): (JSC::CodeBlock::printStructure): (JSC::CodeBlock::printStructures): (JSC::CodeBlock::dump): (JSC::CodeBlock::~CodeBlock): (JSC::CodeBlock::unlinkCallers): (JSC::CodeBlock::derefStructures): (JSC::CodeBlock::refStructures): (JSC::CodeBlock::mark): (JSC::CodeBlock::getHandlerForVPC): (JSC::CodeBlock::nativeExceptionCodeForHandlerVPC): (JSC::CodeBlock::lineNumberForVPC): (JSC::CodeBlock::expressionRangeForVPC): (JSC::CodeBlock::shrinkToFit):
  • bytecode/CodeBlock.h: (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::addCaller): (JSC::CodeBlock::removeCaller): (JSC::CodeBlock::isKnownNotImmediate): (JSC::CodeBlock::isConstantRegisterIndex): (JSC::CodeBlock::getConstant): (JSC::CodeBlock::isTemporaryRegisterIndex): (JSC::CodeBlock::getStubInfo): (JSC::CodeBlock::getCallLinkInfo): (JSC::CodeBlock::instructions): (JSC::CodeBlock::setJITCode): (JSC::CodeBlock::jitCode): (JSC::CodeBlock::ownerNode): (JSC::CodeBlock::setGlobalData): (JSC::CodeBlock::setThisRegister): (JSC::CodeBlock::thisRegister): (JSC::CodeBlock::setNeedsFullScopeChain): (JSC::CodeBlock::needsFullScopeChain): (JSC::CodeBlock::setUsesEval): (JSC::CodeBlock::usesEval): (JSC::CodeBlock::setUsesArguments): (JSC::CodeBlock::usesArguments): (JSC::CodeBlock::codeType): (JSC::CodeBlock::source): (JSC::CodeBlock::sourceOffset): (JSC::CodeBlock::addGlobalResolveInstruction): (JSC::CodeBlock::numberOfPropertyAccessInstructions): (JSC::CodeBlock::addPropertyAccessInstruction): (JSC::CodeBlock::propertyAccessInstruction): (JSC::CodeBlock::numberOfCallLinkInfos): (JSC::CodeBlock::addCallLinkInfo): (JSC::CodeBlock::callLinkInfo): (JSC::CodeBlock::numberOfJumpTargets): (JSC::CodeBlock::addJumpTarget): (JSC::CodeBlock::jumpTarget): (JSC::CodeBlock::lastJumpTarget): (JSC::CodeBlock::numberOfExceptionHandlers): (JSC::CodeBlock::addExceptionHandler): (JSC::CodeBlock::exceptionHandler): (JSC::CodeBlock::addExpressionInfo): (JSC::CodeBlock::numberOfLineInfos): (JSC::CodeBlock::addLineInfo): (JSC::CodeBlock::lastLineInfo): (JSC::CodeBlock::jitReturnAddressVPCMap): (JSC::CodeBlock::numberOfIdentifiers): (JSC::CodeBlock::addIdentifier): (JSC::CodeBlock::identifier): (JSC::CodeBlock::numberOfConstantRegisters): (JSC::CodeBlock::addConstantRegister): (JSC::CodeBlock::constantRegister): (JSC::CodeBlock::addFunction): (JSC::CodeBlock::function): (JSC::CodeBlock::addFunctionExpression): (JSC::CodeBlock::functionExpression): (JSC::CodeBlock::addUnexpectedConstant): (JSC::CodeBlock::unexpectedConstant): (JSC::CodeBlock::addRegExp): (JSC::CodeBlock::regexp): (JSC::CodeBlock::symbolTable): (JSC::CodeBlock::evalCodeCache): New inline setters/getters.

(JSC::ProgramCodeBlock::ProgramCodeBlock):
(JSC::ProgramCodeBlock::~ProgramCodeBlock):
(JSC::ProgramCodeBlock::clearGlobalObject):

  • bytecode/SamplingTool.cpp: (JSC::ScopeSampleRecord::sample): (JSC::SamplingTool::dump):
  • bytecompiler/BytecodeGenerator.cpp:
  • bytecompiler/BytecodeGenerator.h:
  • bytecompiler/Label.h:
  • interpreter/CallFrame.cpp:
  • interpreter/Interpreter.cpp:
  • jit/JIT.cpp:
  • jit/JITCall.cpp:
  • jit/JITInlineMethods.h:
  • jit/JITPropertyAccess.cpp:
  • parser/Nodes.cpp:
  • runtime/Arguments.h:
  • runtime/ExceptionHelpers.cpp:
  • runtime/JSActivation.cpp:
  • runtime/JSActivation.h:
  • runtime/JSGlobalObject.cpp: Change direct access to use new getter/setters.
Location:
trunk/JavaScriptCore
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r39063 r39070  
     12008-12-05  Sam Weinig  <[email protected]>
     2
     3        Reviewed by Cameron Zwarich.
     4
     5        Fix for https://bugs.webkit.org/show_bug.cgi?id=22715
     6        Encapsulate more CodeBlock members in preparation
     7        of moving some of them to a rare data structure.
     8
     9        * bytecode/CodeBlock.cpp:
     10        (JSC::locationForOffset):
     11        (JSC::printConditionalJump):
     12        (JSC::printGetByIdOp):
     13        (JSC::printPutByIdOp):
     14        (JSC::CodeBlock::printStructure):
     15        (JSC::CodeBlock::printStructures):
     16        (JSC::CodeBlock::dump):
     17        (JSC::CodeBlock::~CodeBlock):
     18        (JSC::CodeBlock::unlinkCallers):
     19        (JSC::CodeBlock::derefStructures):
     20        (JSC::CodeBlock::refStructures):
     21        (JSC::CodeBlock::mark):
     22        (JSC::CodeBlock::getHandlerForVPC):
     23        (JSC::CodeBlock::nativeExceptionCodeForHandlerVPC):
     24        (JSC::CodeBlock::lineNumberForVPC):
     25        (JSC::CodeBlock::expressionRangeForVPC):
     26        (JSC::CodeBlock::shrinkToFit):
     27        * bytecode/CodeBlock.h:
     28        (JSC::CodeBlock::CodeBlock):
     29        (JSC::CodeBlock::addCaller):
     30        (JSC::CodeBlock::removeCaller):
     31        (JSC::CodeBlock::isKnownNotImmediate):
     32        (JSC::CodeBlock::isConstantRegisterIndex):
     33        (JSC::CodeBlock::getConstant):
     34        (JSC::CodeBlock::isTemporaryRegisterIndex):
     35        (JSC::CodeBlock::getStubInfo):
     36        (JSC::CodeBlock::getCallLinkInfo):
     37        (JSC::CodeBlock::instructions):
     38        (JSC::CodeBlock::setJITCode):
     39        (JSC::CodeBlock::jitCode):
     40        (JSC::CodeBlock::ownerNode):
     41        (JSC::CodeBlock::setGlobalData):
     42        (JSC::CodeBlock::setThisRegister):
     43        (JSC::CodeBlock::thisRegister):
     44        (JSC::CodeBlock::setNeedsFullScopeChain):
     45        (JSC::CodeBlock::needsFullScopeChain):
     46        (JSC::CodeBlock::setUsesEval):
     47        (JSC::CodeBlock::usesEval):
     48        (JSC::CodeBlock::setUsesArguments):
     49        (JSC::CodeBlock::usesArguments):
     50        (JSC::CodeBlock::codeType):
     51        (JSC::CodeBlock::source):
     52        (JSC::CodeBlock::sourceOffset):
     53        (JSC::CodeBlock::addGlobalResolveInstruction):
     54        (JSC::CodeBlock::numberOfPropertyAccessInstructions):
     55        (JSC::CodeBlock::addPropertyAccessInstruction):
     56        (JSC::CodeBlock::propertyAccessInstruction):
     57        (JSC::CodeBlock::numberOfCallLinkInfos):
     58        (JSC::CodeBlock::addCallLinkInfo):
     59        (JSC::CodeBlock::callLinkInfo):
     60        (JSC::CodeBlock::numberOfJumpTargets):
     61        (JSC::CodeBlock::addJumpTarget):
     62        (JSC::CodeBlock::jumpTarget):
     63        (JSC::CodeBlock::lastJumpTarget):
     64        (JSC::CodeBlock::numberOfExceptionHandlers):
     65        (JSC::CodeBlock::addExceptionHandler):
     66        (JSC::CodeBlock::exceptionHandler):
     67        (JSC::CodeBlock::addExpressionInfo):
     68        (JSC::CodeBlock::numberOfLineInfos):
     69        (JSC::CodeBlock::addLineInfo):
     70        (JSC::CodeBlock::lastLineInfo):
     71        (JSC::CodeBlock::jitReturnAddressVPCMap):
     72        (JSC::CodeBlock::numberOfIdentifiers):
     73        (JSC::CodeBlock::addIdentifier):
     74        (JSC::CodeBlock::identifier):
     75        (JSC::CodeBlock::numberOfConstantRegisters):
     76        (JSC::CodeBlock::addConstantRegister):
     77        (JSC::CodeBlock::constantRegister):
     78        (JSC::CodeBlock::addFunction):
     79        (JSC::CodeBlock::function):
     80        (JSC::CodeBlock::addFunctionExpression):
     81        (JSC::CodeBlock::functionExpression):
     82        (JSC::CodeBlock::addUnexpectedConstant):
     83        (JSC::CodeBlock::unexpectedConstant):
     84        (JSC::CodeBlock::addRegExp):
     85        (JSC::CodeBlock::regexp):
     86        (JSC::CodeBlock::symbolTable):
     87        (JSC::CodeBlock::evalCodeCache):
     88        New inline setters/getters.
     89
     90        (JSC::ProgramCodeBlock::ProgramCodeBlock):
     91        (JSC::ProgramCodeBlock::~ProgramCodeBlock):
     92        (JSC::ProgramCodeBlock::clearGlobalObject):
     93        * bytecode/SamplingTool.cpp:
     94        (JSC::ScopeSampleRecord::sample):
     95        (JSC::SamplingTool::dump):
     96        * bytecompiler/BytecodeGenerator.cpp:
     97        * bytecompiler/BytecodeGenerator.h:
     98        * bytecompiler/Label.h:
     99        * interpreter/CallFrame.cpp:
     100        * interpreter/Interpreter.cpp:
     101        * jit/JIT.cpp:
     102        * jit/JITCall.cpp:
     103        * jit/JITInlineMethods.h:
     104        * jit/JITPropertyAccess.cpp:
     105        * parser/Nodes.cpp:
     106        * runtime/Arguments.h:
     107        * runtime/ExceptionHelpers.cpp:
     108        * runtime/JSActivation.cpp:
     109        * runtime/JSActivation.h:
     110        * runtime/JSGlobalObject.cpp:
     111        Change direct access to use new getter/setters.
     112
    11132008-12-05  Gavin Barraclough  <[email protected]>
    2114
  • trunk/JavaScriptCore/bytecode/CodeBlock.cpp

    r39038 r39070  
    128128}
    129129
    130 static int jumpTarget(const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator& it, int offset)
     130static int locationForOffset(const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator& it, int offset)
    131131{
    132132    return it - begin + offset;
     
    153153    int r0 = (++it)->u.operand;
    154154    int offset = (++it)->u.operand;
    155     printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(r0).c_str(), offset, jumpTarget(begin, it, offset));
    156 }
    157 
    158 static void printGetByIdOp(int location, Vector<Instruction>::const_iterator& it, const Vector<Identifier>& identifiers, const char* op)
     155    printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(r0).c_str(), offset, locationForOffset(begin, it, offset));
     156}
     157
     158static void printGetByIdOp(int location, Vector<Instruction>::const_iterator& it, const Vector<Identifier>& m_identifiers, const char* op)
    159159{
    160160    int r0 = (++it)->u.operand;
    161161    int r1 = (++it)->u.operand;
    162162    int id0 = (++it)->u.operand;
    163     printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str());
     163    printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str());
    164164    it += 4;
    165165}
    166166
    167 static void printPutByIdOp(int location, Vector<Instruction>::const_iterator& it, const Vector<Identifier>& identifiers, const char* op)
     167static void printPutByIdOp(int location, Vector<Instruction>::const_iterator& it, const Vector<Identifier>& m_identifiers, const char* op)
    168168{
    169169    int r0 = (++it)->u.operand;
    170170    int id0 = (++it)->u.operand;
    171171    int r1 = (++it)->u.operand;
    172     printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str());
     172    printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str());
    173173    it += 4;
    174174}
     
    176176void CodeBlock::printStructure(const char* name, const Instruction* vPC, int operand) const
    177177{
    178     unsigned instructionOffset = vPC - instructions.begin();
     178    unsigned instructionOffset = vPC - m_instructions.begin();
    179179    printf("  [%4d] %s: %s\n", instructionOffset, name, pointerToSourceString(vPC[operand].u.structure).UTF8String().c_str());
    180180}
     
    182182void CodeBlock::printStructures(const Instruction* vPC) const
    183183{
    184     Interpreter* interpreter = globalData->interpreter;
    185     unsigned instructionOffset = vPC - instructions.begin();
     184    Interpreter* interpreter = m_globalData->interpreter;
     185    unsigned instructionOffset = vPC - m_instructions.begin();
    186186
    187187    if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id)) {
     
    218218    }
    219219
    220     // These instructions doesn't ref Structures.
     220    // These m_instructions doesn't ref Structures.
    221221    ASSERT(vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_call) || vPC[0].u.opcode == interpreter->getOpcode(op_call_eval) || vPC[0].u.opcode == interpreter->getOpcode(op_construct));
    222222}
     
    224224void CodeBlock::dump(ExecState* exec) const
    225225{
    226     Vector<Instruction>::const_iterator begin = instructions.begin();
    227     Vector<Instruction>::const_iterator end = instructions.end();
     226    Vector<Instruction>::const_iterator begin = m_instructions.begin();
     227    Vector<Instruction>::const_iterator end = m_instructions.end();
    228228
    229229    size_t instructionCount = 0;
     
    232232            ++instructionCount;
    233233
    234     printf("%lu instructions; %lu bytes at %p; %d parameter(s); %d callee register(s)\n\n",
     234    printf("%lu m_instructions; %lu bytes at %p; %d parameter(s); %d callee register(s)\n\n",
    235235        static_cast<unsigned long>(instructionCount),
    236         static_cast<unsigned long>(instructions.size() * sizeof(Instruction)),
    237         this, numParameters, numCalleeRegisters);
     236        static_cast<unsigned long>(m_instructions.size() * sizeof(Instruction)),
     237        this, m_numParameters, m_numCalleeRegisters);
    238238   
    239239    for (Vector<Instruction>::const_iterator it = begin; it != end; ++it)
    240240        dump(exec, begin, it);
    241241
    242     if (identifiers.size()) {
     242    if (!m_identifiers.isEmpty()) {
    243243        printf("\nIdentifiers:\n");
    244244        size_t i = 0;
    245245        do {
    246             printf("  id%u = %s\n", static_cast<unsigned>(i), identifiers[i].ascii());
     246            printf("  id%u = %s\n", static_cast<unsigned>(i), m_identifiers[i].ascii());
    247247            ++i;
    248         } while (i != identifiers.size());
    249     }
    250 
    251     if (constantRegisters.size()) {
     248        } while (i != m_identifiers.size());
     249    }
     250
     251    if (!m_constantRegisters.isEmpty()) {
    252252        printf("\nConstants:\n");
    253         unsigned registerIndex = numVars;
     253        unsigned registerIndex = m_numVars;
    254254        size_t i = 0;
    255255        do {
    256             printf("   r%u = %s\n", registerIndex, valueToSourceString(exec, constantRegisters[i].jsValue(exec)).ascii());
     256            printf("   r%u = %s\n", registerIndex, valueToSourceString(exec, m_constantRegisters[i].jsValue(exec)).ascii());
    257257            ++i;
    258258            ++registerIndex;
    259         } while (i < constantRegisters.size());
    260     }
    261 
    262     if (unexpectedConstants.size()) {
     259        } while (i < m_constantRegisters.size());
     260    }
     261
     262    if (!m_unexpectedConstants.isEmpty()) {
    263263        printf("\nUnexpected Constants:\n");
    264264        size_t i = 0;
    265265        do {
    266             printf("  k%u = %s\n", static_cast<unsigned>(i), valueToSourceString(exec, unexpectedConstants[i]).ascii());
     266            printf("  k%u = %s\n", static_cast<unsigned>(i), valueToSourceString(exec, m_unexpectedConstants[i]).ascii());
    267267            ++i;
    268         } while (i < unexpectedConstants.size());
     268        } while (i < m_unexpectedConstants.size());
    269269    }
    270270   
    271     if (regexps.size()) {
    272         printf("\nRegExps:\n");
     271    if (!m_regexps.isEmpty()) {
     272        printf("\nm_regexps:\n");
    273273        size_t i = 0;
    274274        do {
    275             printf("  re%u = %s\n", static_cast<unsigned>(i), regexpToSourceString(regexps[i].get()).ascii());
     275            printf("  re%u = %s\n", static_cast<unsigned>(i), regexpToSourceString(m_regexps[i].get()).ascii());
    276276            ++i;
    277         } while (i < regexps.size());
    278     }
    279 
    280     if (globalResolveInstructions.size() || propertyAccessInstructions.size())
     277        } while (i < m_regexps.size());
     278    }
     279
     280    if (!m_globalResolveInstructions.isEmpty() || !m_propertyAccessInstructions.isEmpty())
    281281        printf("\nStructures:\n");
    282282
    283     if (globalResolveInstructions.size()) {
     283    if (!m_globalResolveInstructions.isEmpty()) {
    284284        size_t i = 0;
    285285        do {
    286              printStructures(&instructions[globalResolveInstructions[i]]);
     286             printStructures(&m_instructions[m_globalResolveInstructions[i]]);
    287287             ++i;
    288         } while (i < globalResolveInstructions.size());
    289     }
    290     if (propertyAccessInstructions.size()) {
     288        } while (i < m_globalResolveInstructions.size());
     289    }
     290    if (!m_propertyAccessInstructions.isEmpty()) {
    291291        size_t i = 0;
    292292        do {
    293              printStructures(&instructions[propertyAccessInstructions[i].bytecodeIndex]);
     293             printStructures(&m_instructions[m_propertyAccessInstructions[i].bytecodeIndex]);
    294294             ++i;
    295         } while (i < propertyAccessInstructions.size());
     295        } while (i < m_propertyAccessInstructions.size());
    296296    }
    297297 
    298     if (exceptionHandlers.size()) {
     298    if (!m_exceptionHandlers.isEmpty()) {
    299299        printf("\nException Handlers:\n");
    300300        unsigned i = 0;
    301301        do {
    302             printf("\t %d: { start: [%4d] end: [%4d] target: [%4d] }\n", i + 1, exceptionHandlers[i].start, exceptionHandlers[i].end, exceptionHandlers[i].target);
     302            printf("\t %d: { start: [%4d] end: [%4d] target: [%4d] }\n", i + 1, m_exceptionHandlers[i].start, m_exceptionHandlers[i].end, m_exceptionHandlers[i].target);
    303303            ++i;
    304         } while (i < exceptionHandlers.size());
     304        } while (i < m_exceptionHandlers.size());
    305305    }
    306306   
     
    382382            int r0 = (++it)->u.operand;
    383383            int k0 = (++it)->u.operand;
    384             printf("[%4d] unexpected_load\t %s, %s\n", location, registerName(r0).c_str(), constantName(exec, k0, unexpectedConstants[k0]).c_str());
     384            printf("[%4d] unexpected_load\t %s, %s\n", location, registerName(r0).c_str(), constantName(exec, k0, m_unexpectedConstants[k0]).c_str());
    385385            break;
    386386        }
     
    400400            int r0 = (++it)->u.operand;
    401401            int re0 = (++it)->u.operand;
    402             printf("[%4d] new_regexp\t %s, %s\n", location, registerName(r0).c_str(), regexpName(re0, regexps[re0].get()).c_str());
     402            printf("[%4d] new_regexp\t %s, %s\n", location, registerName(r0).c_str(), regexpName(re0, m_regexps[re0].get()).c_str());
    403403            break;
    404404        }
     
    568568            int r0 = (++it)->u.operand;
    569569            int id0 = (++it)->u.operand;
    570             printf("[%4d] resolve\t\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str());
     570            printf("[%4d] resolve\t\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str());
    571571            break;
    572572        }
     
    575575            int id0 = (++it)->u.operand;
    576576            int skipLevels = (++it)->u.operand;
    577             printf("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), skipLevels);
     577            printf("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), skipLevels);
    578578            break;
    579579        }
     
    582582            JSValue* scope = static_cast<JSValue*>((++it)->u.jsCell);
    583583            int id0 = (++it)->u.operand;
    584             printf("[%4d] resolve_global\t %s, %s, %s\n", location, registerName(r0).c_str(), valueToSourceString(exec, scope).ascii(), idName(id0, identifiers[id0]).c_str());
     584            printf("[%4d] resolve_global\t %s, %s, %s\n", location, registerName(r0).c_str(), valueToSourceString(exec, scope).ascii(), idName(id0, m_identifiers[id0]).c_str());
    585585            it += 2;
    586586            break;
     
    617617            int r0 = (++it)->u.operand;
    618618            int id0 = (++it)->u.operand;
    619             printf("[%4d] resolve_base\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str());
     619            printf("[%4d] resolve_base\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str());
    620620            break;
    621621        }
     
    624624            int r1 = (++it)->u.operand;
    625625            int id0 = (++it)->u.operand;
    626             printf("[%4d] resolve_with_base %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str());
     626            printf("[%4d] resolve_with_base %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str());
    627627            break;
    628628        }
     
    631631            int r1 = (++it)->u.operand;
    632632            int id0 = (++it)->u.operand;
    633             printf("[%4d] resolve_func\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str());
     633            printf("[%4d] resolve_func\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str());
    634634            break;
    635635        }
    636636        case op_get_by_id: {
    637             printGetByIdOp(location, it, identifiers, "get_by_id");
     637            printGetByIdOp(location, it, m_identifiers, "get_by_id");
    638638            break;
    639639        }
    640640        case op_get_by_id_self: {
    641             printGetByIdOp(location, it, identifiers, "get_by_id_self");
     641            printGetByIdOp(location, it, m_identifiers, "get_by_id_self");
    642642            break;
    643643        }
    644644        case op_get_by_id_self_list: {
    645             printGetByIdOp(location, it, identifiers, "get_by_id_self_list");
     645            printGetByIdOp(location, it, m_identifiers, "get_by_id_self_list");
    646646            break;
    647647        }
    648648        case op_get_by_id_proto: {
    649             printGetByIdOp(location, it, identifiers, "get_by_id_proto");
     649            printGetByIdOp(location, it, m_identifiers, "get_by_id_proto");
    650650            break;
    651651        }
    652652        case op_get_by_id_proto_list: {
    653             printGetByIdOp(location, it, identifiers, "op_get_by_id_proto_list");
     653            printGetByIdOp(location, it, m_identifiers, "op_get_by_id_proto_list");
    654654            break;
    655655        }
    656656        case op_get_by_id_chain: {
    657             printGetByIdOp(location, it, identifiers, "get_by_id_chain");
     657            printGetByIdOp(location, it, m_identifiers, "get_by_id_chain");
    658658            break;
    659659        }
    660660        case op_get_by_id_generic: {
    661             printGetByIdOp(location, it, identifiers, "get_by_id_generic");
     661            printGetByIdOp(location, it, m_identifiers, "get_by_id_generic");
    662662            break;
    663663        }
    664664        case op_get_array_length: {
    665             printGetByIdOp(location, it, identifiers, "get_array_length");
     665            printGetByIdOp(location, it, m_identifiers, "get_array_length");
    666666            break;
    667667        }
    668668        case op_get_string_length: {
    669             printGetByIdOp(location, it, identifiers, "get_string_length");
     669            printGetByIdOp(location, it, m_identifiers, "get_string_length");
    670670            break;
    671671        }
    672672        case op_put_by_id: {
    673             printPutByIdOp(location, it, identifiers, "put_by_id");
     673            printPutByIdOp(location, it, m_identifiers, "put_by_id");
    674674            break;
    675675        }
    676676        case op_put_by_id_replace: {
    677             printPutByIdOp(location, it, identifiers, "put_by_id_replace");
     677            printPutByIdOp(location, it, m_identifiers, "put_by_id_replace");
    678678            break;
    679679        }
    680680        case op_put_by_id_transition: {
    681             printPutByIdOp(location, it, identifiers, "put_by_id_transition");
     681            printPutByIdOp(location, it, m_identifiers, "put_by_id_transition");
    682682            break;
    683683        }
    684684        case op_put_by_id_generic: {
    685             printPutByIdOp(location, it, identifiers, "put_by_id_generic");
     685            printPutByIdOp(location, it, m_identifiers, "put_by_id_generic");
    686686            break;
    687687        }
     
    690690            int id0 = (++it)->u.operand;
    691691            int r1 = (++it)->u.operand;
    692             printf("[%4d] put_getter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str());
     692            printf("[%4d] put_getter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str());
    693693            break;
    694694        }
     
    697697            int id0 = (++it)->u.operand;
    698698            int r1 = (++it)->u.operand;
    699             printf("[%4d] put_setter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str());
     699            printf("[%4d] put_setter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str());
    700700            break;
    701701        }
     
    704704            int r1 = (++it)->u.operand;
    705705            int id0 = (++it)->u.operand;
    706             printf("[%4d] del_by_id\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str());
     706            printf("[%4d] del_by_id\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str());
    707707            break;
    708708        }
     
    737737        case op_jmp: {
    738738            int offset = (++it)->u.operand;
    739             printf("[%4d] jmp\t\t %d(->%d)\n", location, offset, jumpTarget(begin, it, offset));
     739            printf("[%4d] jmp\t\t %d(->%d)\n", location, offset, locationForOffset(begin, it, offset));
    740740            break;
    741741        }
    742742        case op_loop: {
    743743            int offset = (++it)->u.operand;
    744             printf("[%4d] loop\t\t %d(->%d)\n", location, offset, jumpTarget(begin, it, offset));
     744            printf("[%4d] loop\t\t %d(->%d)\n", location, offset, locationForOffset(begin, it, offset));
    745745            break;
    746746        }
     
    769769            int r1 = (++it)->u.operand;
    770770            int offset = (++it)->u.operand;
    771             printf("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, jumpTarget(begin, it, offset));
     771            printf("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, locationForOffset(begin, it, offset));
    772772            break;
    773773        }
     
    776776            int r1 = (++it)->u.operand;
    777777            int offset = (++it)->u.operand;
    778             printf("[%4d] loop_if_less\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, jumpTarget(begin, it, offset));
     778            printf("[%4d] loop_if_less\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, locationForOffset(begin, it, offset));
    779779            break;
    780780        }
     
    783783            int r1 = (++it)->u.operand;
    784784            int offset = (++it)->u.operand;
    785             printf("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, jumpTarget(begin, it, offset));
     785            printf("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, locationForOffset(begin, it, offset));
    786786            break;
    787787        }
     
    790790            int defaultTarget = (++it)->u.operand;
    791791            int scrutineeRegister = (++it)->u.operand;
    792             printf("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, jumpTarget(begin, it, defaultTarget), registerName(scrutineeRegister).c_str());
     792            printf("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, locationForOffset(begin, it, defaultTarget), registerName(scrutineeRegister).c_str());
    793793            break;
    794794        }
     
    797797            int defaultTarget = (++it)->u.operand;
    798798            int scrutineeRegister = (++it)->u.operand;
    799             printf("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, jumpTarget(begin, it, defaultTarget), registerName(scrutineeRegister).c_str());
     799            printf("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, locationForOffset(begin, it, defaultTarget), registerName(scrutineeRegister).c_str());
    800800            break;
    801801        }
     
    804804            int defaultTarget = (++it)->u.operand;
    805805            int scrutineeRegister = (++it)->u.operand;
    806             printf("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, jumpTarget(begin, it, defaultTarget), registerName(scrutineeRegister).c_str());
     806            printf("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, locationForOffset(begin, it, defaultTarget), registerName(scrutineeRegister).c_str());
    807807            break;
    808808        }
     
    875875            int iter = (++it)->u.operand;
    876876            int offset = (++it)->u.operand;
    877             printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(dest).c_str(), registerName(iter).c_str(), offset, jumpTarget(begin, it, offset));
     877            printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(dest).c_str(), registerName(iter).c_str(), offset, locationForOffset(begin, it, offset));
    878878            break;
    879879        }
     
    891891            int id0 = (++it)->u.operand;
    892892            int r1 = (++it)->u.operand;
    893             printf("[%4d] push_new_scope \t%s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str());
     893            printf("[%4d] push_new_scope \t%s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str());
    894894            break;
    895895        }
     
    897897            int scopeDelta = (++it)->u.operand;
    898898            int offset = (++it)->u.operand;
    899             printf("[%4d] jmp_scopes\t^%d, %d(->%d)\n", location, scopeDelta, offset, jumpTarget(begin, it, offset));
     899            printf("[%4d] jmp_scopes\t^%d, %d(->%d)\n", location, scopeDelta, offset, locationForOffset(begin, it, offset));
    900900            break;
    901901        }
     
    914914            int errorType = (++it)->u.operand;
    915915            int k0 = (++it)->u.operand;
    916             printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(r0).c_str(), errorType, constantName(exec, k0, unexpectedConstants[k0]).c_str());
     916            printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(r0).c_str(), errorType, constantName(exec, k0, m_unexpectedConstants[k0]).c_str());
    917917            break;
    918918        }
     
    920920            int retAddrDst = (++it)->u.operand;
    921921            int offset = (++it)->u.operand;
    922             printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName(retAddrDst).c_str(), offset, jumpTarget(begin, it, offset));
     922            printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName(retAddrDst).c_str(), offset, locationForOffset(begin, it, offset));
    923923            break;
    924924        }
     
    957957CodeBlock::~CodeBlock()
    958958{
    959     for (size_t size = globalResolveInstructions.size(), i = 0; i < size; ++i) {
    960         derefStructures(&instructions[globalResolveInstructions[i]]);
    961     }
    962 
    963     for (size_t size = propertyAccessInstructions.size(), i = 0; i < size; ++i) {
    964         derefStructures(&instructions[propertyAccessInstructions[i].bytecodeIndex]);
    965         if (propertyAccessInstructions[i].stubRoutine)
    966             WTF::fastFreeExecutable(propertyAccessInstructions[i].stubRoutine);
    967     }
    968 
    969     for (size_t size = callLinkInfos.size(), i = 0; i < size; ++i) {
    970         CallLinkInfo* callLinkInfo = &callLinkInfos[i];
     959    for (size_t size = m_globalResolveInstructions.size(), i = 0; i < size; ++i)
     960        derefStructures(&m_instructions[m_globalResolveInstructions[i]]);
     961
     962    for (size_t size = m_propertyAccessInstructions.size(), i = 0; i < size; ++i) {
     963        derefStructures(&m_instructions[m_propertyAccessInstructions[i].bytecodeIndex]);
     964        if (m_propertyAccessInstructions[i].stubRoutine)
     965            WTF::fastFreeExecutable(m_propertyAccessInstructions[i].stubRoutine);
     966    }
     967
     968    for (size_t size = m_callLinkInfos.size(), i = 0; i < size; ++i) {
     969        CallLinkInfo* callLinkInfo = &m_callLinkInfos[i];
    971970        if (callLinkInfo->isLinked())
    972971            callLinkInfo->callee->removeCaller(callLinkInfo);
     
    976975    unlinkCallers();
    977976
    978     if (ctiCode)
    979         WTF::fastFreeExecutable(ctiCode);
     977    if (m_jitCode)
     978        WTF::fastFreeExecutable(m_jitCode);
    980979#endif
    981980}
     
    984983void CodeBlock::unlinkCallers()
    985984{
    986     size_t size = linkedCallerList.size();
     985    size_t size = m_linkedCallerList.size();
    987986    for (size_t i = 0; i < size; ++i) {
    988         CallLinkInfo* currentCaller = linkedCallerList[i];
     987        CallLinkInfo* currentCaller = m_linkedCallerList[i];
    989988        JIT::unlinkCall(currentCaller);
    990989        currentCaller->setUnlinked();
    991990    }
    992     linkedCallerList.clear();
     991    m_linkedCallerList.clear();
    993992}
    994993#endif
     
    996995void CodeBlock::derefStructures(Instruction* vPC) const
    997996{
    998     Interpreter* interpreter = globalData->interpreter;
     997    Interpreter* interpreter = m_globalData->interpreter;
    999998
    1000999    if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) {
     
    10411040void CodeBlock::refStructures(Instruction* vPC) const
    10421041{
    1043     Interpreter* interpreter = globalData->interpreter;
     1042    Interpreter* interpreter = m_globalData->interpreter;
    10441043
    10451044    if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) {
     
    10741073void CodeBlock::mark()
    10751074{
    1076     for (size_t i = 0; i < constantRegisters.size(); ++i)
    1077         if (!constantRegisters[i].marked())
    1078             constantRegisters[i].mark();
    1079 
    1080     for (size_t i = 0; i < unexpectedConstants.size(); ++i)
    1081         if (!unexpectedConstants[i]->marked())
    1082             unexpectedConstants[i]->mark();
    1083 
    1084     for (size_t i = 0; i < functions.size(); ++i)
    1085         functions[i]->body()->mark();
    1086 
    1087     for (size_t i = 0; i < functionExpressions.size(); ++i)
    1088         functionExpressions[i]->body()->mark();
     1075    for (size_t i = 0; i < m_constantRegisters.size(); ++i)
     1076        if (!m_constantRegisters[i].marked())
     1077            m_constantRegisters[i].mark();
     1078
     1079    for (size_t i = 0; i < m_unexpectedConstants.size(); ++i)
     1080        if (!m_unexpectedConstants[i]->marked())
     1081            m_unexpectedConstants[i]->mark();
     1082
     1083    for (size_t i = 0; i < m_functions.size(); ++i)
     1084        m_functions[i]->body()->mark();
     1085
     1086    for (size_t i = 0; i < m_functionExpressions.size(); ++i)
     1087        m_functionExpressions[i]->body()->mark();
    10891088}
    10901089
    10911090bool CodeBlock::getHandlerForVPC(const Instruction* vPC, Instruction*& target, int& scopeDepth)
    10921091{
    1093     Vector<HandlerInfo>::iterator ptr = exceptionHandlers.begin();
    1094     Vector<HandlerInfo>::iterator end = exceptionHandlers.end();
    1095     unsigned addressOffset = vPC - instructions.begin();
    1096     ASSERT(addressOffset < instructions.size());
     1092    Vector<HandlerInfo>::iterator ptr = m_exceptionHandlers.begin();
     1093    Vector<HandlerInfo>::iterator end = m_exceptionHandlers.end();
     1094    unsigned addressOffset = vPC - m_instructions.begin();
     1095    ASSERT(addressOffset < m_instructions.size());
    10971096   
    10981097    for (; ptr != end; ++ptr) {
     
    11011100        if (ptr->start <= addressOffset && ptr->end >= addressOffset) {
    11021101            scopeDepth = ptr->scopeDepth;
    1103             target = instructions.begin() + ptr->target;
     1102            target = m_instructions.begin() + ptr->target;
    11041103            return true;
    11051104        }
     
    11101109void* CodeBlock::nativeExceptionCodeForHandlerVPC(const Instruction* handlerVPC)
    11111110{
    1112     Vector<HandlerInfo>::iterator ptr = exceptionHandlers.begin();
    1113     Vector<HandlerInfo>::iterator end = exceptionHandlers.end();
     1111    Vector<HandlerInfo>::iterator ptr = m_exceptionHandlers.begin();
     1112    Vector<HandlerInfo>::iterator end = m_exceptionHandlers.end();
    11141113   
    11151114    for (; ptr != end; ++ptr) {
    1116         Instruction*target = instructions.begin() + ptr->target;
     1115        Instruction*target = m_instructions.begin() + ptr->target;
    11171116        if (handlerVPC == target)
    11181117            return ptr->nativeCode;
     
    11241123int CodeBlock::lineNumberForVPC(const Instruction* vPC)
    11251124{
    1126     unsigned instructionOffset = vPC - instructions.begin();
    1127     ASSERT(instructionOffset < instructions.size());
    1128 
    1129     if (!lineInfo.size())
    1130         return ownerNode->source().firstLine(); // Empty function
     1125    unsigned instructionOffset = vPC - m_instructions.begin();
     1126    ASSERT(instructionOffset < m_instructions.size());
     1127
     1128    if (!m_lineInfo.size())
     1129        return m_ownerNode->source().firstLine(); // Empty function
    11311130
    11321131    int low = 0;
    1133     int high = lineInfo.size();
     1132    int high = m_lineInfo.size();
    11341133    while (low < high) {
    11351134        int mid = low + (high - low) / 2;
    1136         if (lineInfo[mid].instructionOffset <= instructionOffset)
     1135        if (m_lineInfo[mid].instructionOffset <= instructionOffset)
    11371136            low = mid + 1;
    11381137        else
     
    11411140   
    11421141    if (!low)
    1143         return ownerNode->source().firstLine();
    1144     return lineInfo[low - 1].lineNumber;
     1142        return m_ownerNode->source().firstLine();
     1143    return m_lineInfo[low - 1].lineNumber;
    11451144}
    11461145
    11471146int CodeBlock::expressionRangeForVPC(const Instruction* vPC, int& divot, int& startOffset, int& endOffset)
    11481147{
    1149     unsigned instructionOffset = vPC - instructions.begin();
    1150     ASSERT(instructionOffset < instructions.size());
    1151 
    1152     if (!expressionInfo.size()) {
     1148    unsigned instructionOffset = vPC - m_instructions.begin();
     1149    ASSERT(instructionOffset < m_instructions.size());
     1150
     1151    if (!m_expressionInfo.size()) {
    11531152        // We didn't think anything could throw.  Apparently we were wrong.
    11541153        startOffset = 0;
     
    11591158
    11601159    int low = 0;
    1161     int high = expressionInfo.size();
     1160    int high = m_expressionInfo.size();
    11621161    while (low < high) {
    11631162        int mid = low + (high - low) / 2;
    1164         if (expressionInfo[mid].instructionOffset <= instructionOffset)
     1163        if (m_expressionInfo[mid].instructionOffset <= instructionOffset)
    11651164            low = mid + 1;
    11661165        else
     
    11761175    }
    11771176
    1178     startOffset = expressionInfo[low - 1].startOffset;
    1179     endOffset = expressionInfo[low - 1].endOffset;
    1180     divot = expressionInfo[low - 1].divotPoint + sourceOffset;
     1177    startOffset = m_expressionInfo[low - 1].startOffset;
     1178    endOffset = m_expressionInfo[low - 1].endOffset;
     1179    divot = m_expressionInfo[low - 1].divotPoint + m_sourceOffset;
    11811180    return lineNumberForVPC(vPC);
    11821181}
     
    11841183void CodeBlock::shrinkToFit()
    11851184{
    1186     instructions.shrinkToFit();
    1187     globalResolveInstructions.shrinkToFit();
    1188     propertyAccessInstructions.shrinkToFit();
    1189     callLinkInfos.shrinkToFit();
    1190     linkedCallerList.shrinkToFit();
    1191     identifiers.shrinkToFit();
    1192     functions.shrinkToFit();
    1193     functionExpressions.shrinkToFit();
    1194     constantRegisters.shrinkToFit();
    1195     unexpectedConstants.shrinkToFit();
    1196     regexps.shrinkToFit();
    1197     exceptionHandlers.shrinkToFit();
    1198     expressionInfo.shrinkToFit();
    1199     lineInfo.shrinkToFit();
     1185    m_instructions.shrinkToFit();
     1186
     1187    m_globalResolveInstructions.shrinkToFit();
     1188    m_propertyAccessInstructions.shrinkToFit();
     1189    m_callLinkInfos.shrinkToFit();
     1190    m_linkedCallerList.shrinkToFit();
     1191
     1192    m_exceptionHandlers.shrinkToFit();
     1193    m_expressionInfo.shrinkToFit();
     1194    m_lineInfo.shrinkToFit();
     1195
     1196    m_identifiers.shrinkToFit();
     1197    m_functions.shrinkToFit();
     1198    m_functionExpressions.shrinkToFit();
     1199    m_constantRegisters.shrinkToFit();
     1200    m_unexpectedConstants.shrinkToFit();
     1201    m_regexps.shrinkToFit();
     1202
    12001203    m_immediateSwitchJumpTables.shrinkToFit();
    12011204    m_characterSwitchJumpTables.shrinkToFit();
  • trunk/JavaScriptCore/bytecode/CodeBlock.h

    r39038 r39070  
    216216    };
    217217
    218     struct CodeBlock {
     218    class CodeBlock {
     219        friend class JIT;
     220    public:
    219221        CodeBlock(ScopeNode* ownerNode, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset)
    220             : ownerNode(ownerNode)
    221             , globalData(0)
    222 #if ENABLE(JIT)
    223             , ctiCode(0)
    224 #endif
    225             , numCalleeRegisters(0)
    226             , numConstants(0)
    227             , numVars(0)
    228             , numParameters(0)
    229             , needsFullScopeChain(ownerNode->needsActivation())
    230             , usesEval(ownerNode->usesEval())
    231             , codeType(codeType)
    232             , source(sourceProvider)
    233             , sourceOffset(sourceOffset)
    234         {
    235             ASSERT(source);
     222            : m_numCalleeRegisters(0)
     223            , m_numConstants(0)
     224            , m_numVars(0)
     225            , m_numParameters(0)
     226            , m_ownerNode(ownerNode)
     227            , m_globalData(0)
     228#if ENABLE(JIT)
     229            , m_jitCode(0)
     230#endif
     231            , m_needsFullScopeChain(ownerNode->needsActivation())
     232            , m_usesEval(ownerNode->usesEval())
     233            , m_codeType(codeType)
     234            , m_source(sourceProvider)
     235            , m_sourceOffset(sourceOffset)
     236        {
     237            ASSERT(m_source);
    236238        }
    237239
     
    245247        {
    246248            caller->callee = this;
    247             caller->position = linkedCallerList.size();
    248             linkedCallerList.append(caller);
     249            caller->position = m_linkedCallerList.size();
     250            m_linkedCallerList.append(caller);
    249251        }
    250252
     
    252254        {
    253255            unsigned pos = caller->position;
    254             unsigned lastPos = linkedCallerList.size() - 1;
     256            unsigned lastPos = m_linkedCallerList.size() - 1;
    255257
    256258            if (pos != lastPos) {
    257                 linkedCallerList[pos] = linkedCallerList[lastPos];
    258                 linkedCallerList[pos]->position = pos;
     259                m_linkedCallerList[pos] = m_linkedCallerList[lastPos];
     260                m_linkedCallerList[pos]->position = pos;
    259261            }
    260             linkedCallerList.shrink(lastPos);
     262            m_linkedCallerList.shrink(lastPos);
    261263        }
    262264
    263265        inline bool isKnownNotImmediate(int index)
    264266        {
    265             if (index == thisRegister)
     267            if (index == m_thisRegister)
    266268                return true;
    267269
     
    274276        ALWAYS_INLINE bool isConstantRegisterIndex(int index)
    275277        {
    276             return index >= numVars && index < numVars + numConstants;
     278            return index >= m_numVars && index < m_numVars + m_numConstants;
    277279        }
    278280
    279281        ALWAYS_INLINE JSValue* getConstant(int index)
    280282        {
    281             return constantRegisters[index - numVars].getJSValue();
     283            return m_constantRegisters[index - m_numVars].getJSValue();
    282284        }
    283285
    284286        ALWAYS_INLINE bool isTemporaryRegisterIndex(int index)
    285287        {
    286             return index >= numVars + numConstants;
     288            return index >= m_numVars + m_numConstants;
    287289        }
    288290
     
    303305        StructureStubInfo& getStubInfo(void* returnAddress)
    304306        {
    305             return *(binaryChop<StructureStubInfo, void*, getStructureStubInfoReturnLocation>(propertyAccessInstructions.begin(), propertyAccessInstructions.size(), returnAddress));
     307            return *(binaryChop<StructureStubInfo, void*, getStructureStubInfoReturnLocation>(m_propertyAccessInstructions.begin(), m_propertyAccessInstructions.size(), returnAddress));
    306308        }
    307309
    308310        CallLinkInfo& getCallLinkInfo(void* returnAddress)
    309311        {
    310             return *(binaryChop<CallLinkInfo, void*, getCallLinkInfoReturnLocation>(callLinkInfos.begin(), callLinkInfos.size(), returnAddress));
    311         }
    312 
    313         void shrinkToFit();
     312            return *(binaryChop<CallLinkInfo, void*, getCallLinkInfoReturnLocation>(m_callLinkInfos.begin(), m_callLinkInfos.size(), returnAddress));
     313        }
     314
     315
     316        Vector<Instruction>& instructions() { return m_instructions; }
     317#if ENABLE(JIT)
     318        void setJITCode(void* jitCode) { m_jitCode = jitCode; }
     319        void* jitCode() { return m_jitCode; }
     320#endif
     321
     322        ScopeNode* ownerNode() const { return m_ownerNode; }
     323
     324        void setGlobalData(JSGlobalData* globalData) { m_globalData = globalData; }
     325
     326        void setThisRegister(int thisRegister) { m_thisRegister = thisRegister; }
     327        int thisRegister() const { return m_thisRegister; }
     328
     329        void setNeedsFullScopeChain(bool needsFullScopeChain) { m_needsFullScopeChain = needsFullScopeChain; }
     330        bool needsFullScopeChain() const { return m_needsFullScopeChain; }
     331        void setUsesEval(bool usesEval) { m_usesEval = usesEval; }
     332        bool usesEval() const { return m_usesEval; }
     333        void setUsesArguments(bool usesArguments) { m_usesArguments = usesArguments; }
     334        bool usesArguments() const { return m_usesArguments; }
     335
     336        CodeType codeType() const { return m_codeType; }
     337
     338        SourceProvider* source() const { return m_source.get(); }
     339        unsigned sourceOffset() const { return m_sourceOffset; }
     340
     341        void addGlobalResolveInstruction(unsigned globalResolveInstructions) { m_globalResolveInstructions.append(globalResolveInstructions); }
     342
     343        size_t numberOfPropertyAccessInstructions() const { return m_propertyAccessInstructions.size(); }
     344        void addPropertyAccessInstruction(unsigned propertyAccessInstructions) { m_propertyAccessInstructions.append(StructureStubInfo(propertyAccessInstructions)); }
     345        StructureStubInfo& propertyAccessInstruction(int index) { return m_propertyAccessInstructions[index]; }
     346
     347        size_t numberOfCallLinkInfos() const { return m_callLinkInfos.size(); }
     348        void addCallLinkInfo() { m_callLinkInfos.append(CallLinkInfo()); }
     349        CallLinkInfo& callLinkInfo(int index) { return m_callLinkInfos[index]; }
     350
     351        size_t numberOfJumpTargets() const { return m_jumpTargets.size(); }
     352        void addJumpTarget(unsigned jumpTarget) { m_jumpTargets.append(jumpTarget); }
     353        unsigned jumpTarget(int index) const { return m_jumpTargets[index]; }
     354        unsigned lastJumpTarget() const { return m_jumpTargets.last(); }
     355
     356        size_t numberOfExceptionHandlers() const { return m_exceptionHandlers.size(); }
     357        void addExceptionHandler(const HandlerInfo& hanler) { return m_exceptionHandlers.append(hanler); }
     358        HandlerInfo& exceptionHandler(int index) { return m_exceptionHandlers[index]; }
     359
     360        void addExpressionInfo(const ExpressionRangeInfo& expressionInfo) { return m_expressionInfo.append(expressionInfo); }
     361
     362        size_t numberOfLineInfos() const { return m_lineInfo.size(); }
     363        void addLineInfo(const LineInfo& lineInfo) { return m_lineInfo.append(lineInfo); }
     364        LineInfo& lastLineInfo() { return m_lineInfo.last(); }
     365
     366#if ENABLE(JIT)
     367        HashMap<void*, unsigned>& jitReturnAddressVPCMap() { return m_jitReturnAddressVPCMap; }
     368#endif
     369
     370        // Constant Pool
     371
     372        size_t numberOfIdentifiers() const { return m_identifiers.size(); }
     373        void addIdentifier(const Identifier& i) { return m_identifiers.append(i); }
     374        Identifier& identifier(int index) { return m_identifiers[index]; }
     375
     376        size_t numberOfConstantRegisters() const { return m_constantRegisters.size(); }
     377        void addConstantRegister(const Register& r) { return m_constantRegisters.append(r); }
     378        Register& constantRegister(int index) { return m_constantRegisters[index]; }
     379
     380        unsigned addFunction(FuncDeclNode* n) { unsigned size = m_functions.size(); m_functions.append(n); return size; }
     381        FuncDeclNode* function(int index) const { return m_functions[index].get(); }
     382
     383        unsigned addFunctionExpression(FuncExprNode* n) { unsigned size = m_functionExpressions.size(); m_functionExpressions.append(n); return size; }
     384        FuncExprNode* functionExpression(int index) const { return m_functionExpressions[index].get(); }
     385
     386        unsigned addUnexpectedConstant(JSValue* v) { unsigned size = m_unexpectedConstants.size(); m_unexpectedConstants.append(v); return size; }
     387        JSValue* unexpectedConstant(int index) const { return m_unexpectedConstants[index]; }
     388
     389        unsigned addRegExp(RegExp* r) { unsigned size = m_regexps.size(); m_regexps.append(r); return size; }
     390        RegExp* regexp(int index) const { return m_regexps[index].get(); }
     391
     392        // Jump Tables
    314393
    315394        size_t numberOfImmediateSwitchJumpTables() const { return m_immediateSwitchJumpTables.size(); }
     
    325404        StringJumpTable& stringSwitchJumpTable(int tableIndex) { return m_stringSwitchJumpTables[tableIndex]; }
    326405
    327         ScopeNode* ownerNode;
    328         JSGlobalData* globalData;
    329 #if ENABLE(JIT)
    330         void* ctiCode;
    331 #endif
    332 
    333         int numCalleeRegisters;
    334 
     406
     407        SymbolTable& symbolTable() { return m_symbolTable; }
     408        EvalCodeCache& evalCodeCache() { return m_evalCodeCache; }
     409
     410        void shrinkToFit();
     411
     412        // FIXME: Make these remaining members private.
     413
     414        int m_numCalleeRegisters;
    335415        // NOTE: numConstants holds the number of constant registers allocated
    336416        // by the code generator, not the number of constant registers used.
    337417        // (Duplicate constants are uniqued during code generation, and spare
    338418        // constant registers may be allocated.)
    339         int numConstants;
    340         int numVars;
    341         int numParameters;
    342         int thisRegister;
    343         bool needsFullScopeChain;
    344         bool usesEval;
    345         bool usesArguments;
    346         CodeType codeType;
    347         RefPtr<SourceProvider> source;
    348         unsigned sourceOffset;
    349 
    350         Vector<Instruction> instructions;
    351         Vector<unsigned> globalResolveInstructions;
    352         Vector<StructureStubInfo> propertyAccessInstructions;
    353         Vector<CallLinkInfo> callLinkInfos;
    354         Vector<CallLinkInfo*> linkedCallerList;
    355 
    356         // Constant pool
    357         Vector<Identifier> identifiers;
    358         Vector<RefPtr<FuncDeclNode> > functions;
    359         Vector<RefPtr<FuncExprNode> > functionExpressions;
    360         Vector<Register> constantRegisters;
    361         Vector<JSValue*> unexpectedConstants;
    362         Vector<RefPtr<RegExp> > regexps;
    363         Vector<HandlerInfo> exceptionHandlers;
    364         Vector<ExpressionRangeInfo> expressionInfo;
    365         Vector<LineInfo> lineInfo;
    366 
    367 #if ENABLE(JIT)
    368         HashMap<void*, unsigned> ctiReturnAddressVPCMap;
    369 #endif
    370 
    371         Vector<unsigned> jumpTargets;
    372 
    373         EvalCodeCache evalCodeCache;
    374 
    375         SymbolTable symbolTable;
     419        int m_numConstants;
     420        int m_numVars;
     421        int m_numParameters;
     422
    376423    private:
    377424#if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING)
     
    379426#endif
    380427
     428        ScopeNode* m_ownerNode;
     429        JSGlobalData* m_globalData;
     430
     431        Vector<Instruction> m_instructions;
     432#if ENABLE(JIT)
     433        void* m_jitCode;
     434#endif
     435
     436        int m_thisRegister;
     437
     438        bool m_needsFullScopeChain;
     439        bool m_usesEval;
     440        bool m_usesArguments;
     441
     442        CodeType m_codeType;
     443
     444        RefPtr<SourceProvider> m_source;
     445        unsigned m_sourceOffset;
     446
     447        Vector<unsigned> m_globalResolveInstructions;
     448        Vector<StructureStubInfo> m_propertyAccessInstructions;
     449        Vector<CallLinkInfo> m_callLinkInfos;
     450        Vector<CallLinkInfo*> m_linkedCallerList;
     451
     452        Vector<unsigned> m_jumpTargets;
     453
     454        Vector<HandlerInfo> m_exceptionHandlers;
     455        Vector<ExpressionRangeInfo> m_expressionInfo;
     456        Vector<LineInfo> m_lineInfo;
     457
     458#if ENABLE(JIT)
     459        HashMap<void*, unsigned> m_jitReturnAddressVPCMap;
     460#endif
     461
     462        // Constant Pool
     463        Vector<Identifier> m_identifiers;
     464        Vector<Register> m_constantRegisters;
     465        Vector<RefPtr<FuncDeclNode> > m_functions;
     466        Vector<RefPtr<FuncExprNode> > m_functionExpressions;
     467        Vector<JSValue*> m_unexpectedConstants;
     468        Vector<RefPtr<RegExp> > m_regexps;
     469
     470        // Jump Tables
    381471        Vector<SimpleJumpTable> m_immediateSwitchJumpTables;
    382472        Vector<SimpleJumpTable> m_characterSwitchJumpTables;
    383473        Vector<StringJumpTable> m_stringSwitchJumpTables;
     474
     475        SymbolTable m_symbolTable;
     476
     477        EvalCodeCache m_evalCodeCache;
    384478    };
    385479
     
    387481    // responsible for marking it.
    388482
    389     struct ProgramCodeBlock : public CodeBlock {
     483    class ProgramCodeBlock : public CodeBlock {
     484    public:
    390485        ProgramCodeBlock(ScopeNode* ownerNode, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider)
    391486            : CodeBlock(ownerNode, codeType, sourceProvider, 0)
    392             , globalObject(globalObject)
    393         {
    394             globalObject->codeBlocks().add(this);
     487            , m_globalObject(globalObject)
     488        {
     489            m_globalObject->codeBlocks().add(this);
    395490        }
    396491
    397492        ~ProgramCodeBlock()
    398493        {
    399             if (globalObject)
    400                 globalObject->codeBlocks().remove(this);
    401         }
    402 
    403         JSGlobalObject* globalObject; // For program and eval nodes, the global object that marks the constant pool.
    404     };
    405 
    406     struct EvalCodeBlock : public ProgramCodeBlock {
     494            if (m_globalObject)
     495                m_globalObject->codeBlocks().remove(this);
     496        }
     497
     498        void clearGlobalObject() { m_globalObject = 0; }
     499
     500    private:
     501        JSGlobalObject* m_globalObject; // For program and eval nodes, the global object that marks the constant pool.
     502    };
     503
     504    class EvalCodeBlock : public ProgramCodeBlock {
     505    public:
    407506        EvalCodeBlock(ScopeNode* ownerNode, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider)
    408507            : ProgramCodeBlock(ownerNode, EvalCode, globalObject, sourceProvider)
  • trunk/JavaScriptCore/bytecode/SamplingTool.cpp

    r38523 r39070  
    4343{
    4444    if (!m_samples) {
    45         m_size = codeBlock->instructions.size();
     45        m_size = codeBlock->instructions().size();
    4646        m_samples = static_cast<int*>(calloc(m_size, sizeof(int)));
    4747        m_codeBlock = codeBlock;
     
    5050    ++m_sampleCount;
    5151
    52     unsigned offest = vPC - codeBlock->instructions.begin();
     52    unsigned offest = vPC - codeBlock->instructions().begin();
    5353    // Since we don't read and write codeBlock and vPC atomically, this check
    5454    // can fail if we sample mid op_call / op_ret.
     
    249249
    250250        if (blockPercent >= 1) {
    251             Instruction* code = codeBlock->instructions.begin();
     251            Instruction* code = codeBlock->instructions().begin();
    252252            printf("#%d: %s:%d: %d / %lld (%.3f%%)\n", i + 1, record->m_scope->sourceURL().UTF8String().c_str(), codeBlock->lineNumberForVPC(code), record->m_sampleCount, m_sampleCount, blockPercent);
    253253            if (i < 10) {
  • trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r39038 r39070  
    130130void BytecodeGenerator::generate()
    131131{
    132     m_codeBlock->thisRegister = m_thisRegister.index();
     132    m_codeBlock->setThisRegister(m_thisRegister.index());
    133133
    134134    m_scopeNode->emitBytecode(*this);
     
    155155    }
    156156
    157     ++m_codeBlock->numVars;
     157    ++m_codeBlock->m_numVars;
    158158    r0 = newRegister();
    159159    return true;
     
    179179void BytecodeGenerator::allocateConstants(size_t count)
    180180{
    181     m_codeBlock->numConstants = count;
     181    m_codeBlock->m_numConstants = count;
    182182    if (!count)
    183183        return;
     
    207207{
    208208    if (m_shouldEmitDebugHooks)
    209         m_codeBlock->needsFullScopeChain = true;
     209        m_codeBlock->setNeedsFullScopeChain(true);
    210210
    211211    emitOpcode(op_enter);
    212     codeBlock->globalData = m_globalData;
     212    codeBlock->setGlobalData(m_globalData);
    213213
    214214    // FIXME: Move code that modifies the global object to Interpreter::execute.
    215215   
    216     m_codeBlock->numParameters = 1; // Allocate space for "this"
     216    m_codeBlock->m_numParameters = 1; // Allocate space for "this"
    217217
    218218    JSGlobalObject* globalObject = scopeChain.globalObject();
     
    221221   
    222222    // Shift register indexes in generated code to elide registers allocated by intermediate stack frames.
    223     m_globalVarStorageOffset = -RegisterFile::CallFrameHeaderSize - m_codeBlock->numParameters - registerFile->size();
     223    m_globalVarStorageOffset = -RegisterFile::CallFrameHeaderSize - m_codeBlock->m_numParameters - registerFile->size();
    224224
    225225    // Add previously defined symbols to bookkeeping.
     
    286286{
    287287    if (m_shouldEmitDebugHooks)
    288         m_codeBlock->needsFullScopeChain = true;
    289 
    290     codeBlock->globalData = m_globalData;
     288        m_codeBlock->setNeedsFullScopeChain(true);
     289
     290    codeBlock->setGlobalData(m_globalData);
    291291
    292292    bool usesArguments = functionBody->usesArguments();
    293     codeBlock->usesArguments = usesArguments;
     293    codeBlock->setUsesArguments(usesArguments);
    294294    if (usesArguments) {
    295295        m_argumentsRegister.setIndex(RegisterFile::OptionalCalleeArguments);
     
    297297    }
    298298
    299     if (m_codeBlock->needsFullScopeChain) {
    300         ++m_codeBlock->numVars;
     299    if (m_codeBlock->needsFullScopeChain()) {
     300        ++m_codeBlock->m_numVars;
    301301        m_activationRegisterIndex = newRegister()->index();
    302302        emitOpcode(op_enter_with_activation);
     
    328328    m_thisRegister.setIndex(m_nextParameterIndex);
    329329    ++m_nextParameterIndex;
    330     ++m_codeBlock->numParameters;
     330    ++m_codeBlock->m_numParameters;
    331331
    332332    if (functionBody->usesThis()) {
     
    357357{
    358358    if (m_shouldEmitDebugHooks)
    359         m_codeBlock->needsFullScopeChain = true;
     359        m_codeBlock->setNeedsFullScopeChain(true);
    360360
    361361    emitOpcode(op_enter);
    362     codeBlock->globalData = m_globalData;
    363     m_codeBlock->numParameters = 1; // Allocate space for "this"
     362    codeBlock->setGlobalData(m_globalData);
     363    m_codeBlock->m_numParameters = 1; // Allocate space for "this"
    364364
    365365    allocateConstants(evalNode->neededConstants());
     
    381381    // each parameter, even if the parameter doesn't make it into the symbol table.
    382382    ++m_nextParameterIndex;
    383     ++m_codeBlock->numParameters;
     383    ++m_codeBlock->m_numParameters;
    384384    return result;
    385385}
     
    427427{
    428428    m_calleeRegisters.append(m_calleeRegisters.size());
    429     m_codeBlock->numCalleeRegisters = max<int>(m_codeBlock->numCalleeRegisters, m_calleeRegisters.size());
     429    m_codeBlock->m_numCalleeRegisters = max<int>(m_codeBlock->m_numCalleeRegisters, m_calleeRegisters.size());
    430430    return &m_calleeRegisters.last();
    431431}
     
    444444RegisterID* BytecodeGenerator::highestUsedRegister()
    445445{
    446     size_t count = m_codeBlock->numCalleeRegisters;
     446    size_t count = m_codeBlock->m_numCalleeRegisters;
    447447    while (m_calleeRegisters.size() < count)
    448448        newRegister();
     
    478478    l0->setLocation(newLabelIndex);
    479479
    480     if (m_codeBlock->jumpTargets.size() != 0) {
    481         unsigned lastLabelIndex = m_codeBlock->jumpTargets.last();
     480    if (m_codeBlock->numberOfJumpTargets()) {
     481        unsigned lastLabelIndex = m_codeBlock->lastJumpTarget();
    482482        ASSERT(lastLabelIndex <= newLabelIndex);
    483483        if (newLabelIndex == lastLabelIndex) {
    484484            // Peephole optimizations have already been disabled by emitting the last label
    485             return l0;           
    486         }
    487     }
    488 
    489     m_codeBlock->jumpTargets.append(newLabelIndex);
     485            return l0;
     486        }
     487    }
     488
     489    m_codeBlock->addJumpTarget(newLabelIndex);
    490490
    491491    // This disables peephole optimizations when an instruction is a jump target
     
    671671{
    672672    // No need to explicitly unique function body nodes -- they're unique already.
    673     int index = m_codeBlock->functions.size();
    674     m_codeBlock->functions.append(n);
    675     return index;
     673    return m_codeBlock->addFunction(n);
    676674}
    677675
     
    679677{
    680678    // No need to explicitly unique function expression nodes -- they're unique already.
    681     int index = m_codeBlock->functionExpressions.size();
    682     m_codeBlock->functionExpressions.append(n);
    683     return index;
     679    return m_codeBlock->addFunctionExpression(n);
    684680}
    685681
     
    687683{
    688684    UString::Rep* rep = ident.ustring().rep();
    689     pair<IdentifierMap::iterator, bool> result = m_identifierMap.add(rep, m_codeBlock->identifiers.size());
     685    pair<IdentifierMap::iterator, bool> result = m_identifierMap.add(rep, m_codeBlock->numberOfIdentifiers());
    690686    if (result.second) // new entry
    691         m_codeBlock->identifiers.append(Identifier(m_globalData, rep));
     687        m_codeBlock->addIdentifier(Identifier(m_globalData, rep));
    692688
    693689    return result.first->second;
     
    702698        ++m_nextConstantIndex;
    703699
    704         m_codeBlock->constantRegisters.append(v);
     700        m_codeBlock->addConstantRegister(v);
    705701        return &constant;
    706702    }
     
    711707unsigned BytecodeGenerator::addUnexpectedConstant(JSValue* v)
    712708{
    713     int index = m_codeBlock->unexpectedConstants.size();
    714     m_codeBlock->unexpectedConstants.append(v);
    715     return index;
     709    return m_codeBlock->addUnexpectedConstant(v);
    716710}
    717711
    718712unsigned BytecodeGenerator::addRegExp(RegExp* r)
    719713{
    720     int index = m_codeBlock->regexps.size();
    721     m_codeBlock->regexps.append(r);
    722     return index;
     714    return m_codeBlock->addRegExp(r);
    723715}
    724716
     
    795787            && src1->isTemporary()
    796788            && m_codeBlock->isConstantRegisterIndex(src2->index())
    797             && m_codeBlock->constantRegisters[src2->index() - m_codeBlock->numVars].jsValue(m_scopeChain->globalObject()->globalExec())->isString()) {
    798             const UString& value = asString(m_codeBlock->constantRegisters[src2->index() - m_codeBlock->numVars].jsValue(m_scopeChain->globalObject()->globalExec()))->value();
     789            && m_codeBlock->constantRegister(src2->index() - m_codeBlock->m_numVars).jsValue(m_scopeChain->globalObject()->globalExec())->isString()) {
     790            const UString& value = asString(m_codeBlock->constantRegister(src2->index() - m_codeBlock->m_numVars).jsValue(m_scopeChain->globalObject()->globalExec()))->value();
    799791            if (value == "undefined") {
    800792                rewindUnaryOp();
     
    987979
    988980    if (globalObject) {
    989         m_codeBlock->globalResolveInstructions.append(instructions().size());
     981        m_codeBlock->addGlobalResolveInstruction(instructions().size());
    990982        emitOpcode(op_resolve_global);
    991983        instructions().append(dst->index());
     
    10671059RegisterID* BytecodeGenerator::emitGetById(RegisterID* dst, RegisterID* base, const Identifier& property)
    10681060{
    1069     m_codeBlock->propertyAccessInstructions.append(instructions().size());
     1061    m_codeBlock->addPropertyAccessInstruction(instructions().size());
    10701062
    10711063    emitOpcode(op_get_by_id);
     
    10821074RegisterID* BytecodeGenerator::emitPutById(RegisterID* base, const Identifier& property, RegisterID* value)
    10831075{
    1084     m_codeBlock->propertyAccessInstructions.append(instructions().size());
     1076    m_codeBlock->addPropertyAccessInstruction(instructions().size());
    10851077
    10861078    emitOpcode(op_put_by_id);
     
    12541246
    12551247    emitExpressionInfo(divot, startOffset, endOffset);
    1256     m_codeBlock->callLinkInfos.append(CallLinkInfo());
     1248    m_codeBlock->addCallLinkInfo();
    12571249
    12581250    // Emit call.
     
    12781270RegisterID* BytecodeGenerator::emitReturn(RegisterID* src)
    12791271{
    1280     if (m_codeBlock->needsFullScopeChain) {
     1272    if (m_codeBlock->needsFullScopeChain()) {
    12811273        emitOpcode(op_tear_off_activation);
    12821274        instructions().append(m_activationRegisterIndex);
    1283     } else if (m_codeBlock->usesArguments && m_codeBlock->numParameters > 1)
     1275    } else if (m_codeBlock->usesArguments() && m_codeBlock->m_numParameters > 1)
    12841276        emitOpcode(op_tear_off_arguments);
    12851277
     
    13331325
    13341326    emitExpressionInfo(divot, startOffset, endOffset);
    1335     m_codeBlock->callLinkInfos.append(CallLinkInfo());
     1327    m_codeBlock->addCallLinkInfo();
    13361328
    13371329    emitOpcode(op_construct);
     
    15521544{
    15531545    HandlerInfo info = { start->offsetFrom(0), end->offsetFrom(0), instructions().size(), m_dynamicScopeDepth, 0 };
    1554     exceptionHandlers().append(info);
     1546    m_codeBlock->addExceptionHandler(info);
    15551547    emitOpcode(op_catch);
    15561548    instructions().append(targetRegister->index());
  • trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r38930 r39070  
    141141        RegisterID* destinationForAssignResult(RegisterID* dst)
    142142        {
    143             if (dst && dst != ignoredResult() && m_codeBlock->needsFullScopeChain)
     143            if (dst && dst != ignoredResult() && m_codeBlock->needsFullScopeChain())
    144144                return dst->isTemporary() ? dst : newTemporary();
    145145            return 0;
     
    164164            // Node::emitCode assumes that dst, if provided, is either a local or a referenced temporary.
    165165            ASSERT(!dst || dst == ignoredResult() || !dst->isTemporary() || dst->refCount());
    166             if (!m_codeBlock->lineInfo.size() || m_codeBlock->lineInfo.last().lineNumber != n->lineNo()) {
     166            if (!m_codeBlock->numberOfLineInfos() || m_codeBlock->lastLineInfo().lineNumber != n->lineNo()) {
    167167                LineInfo info = { instructions().size(), n->lineNo() };
    168                 m_codeBlock->lineInfo.append(info);
     168                m_codeBlock->addLineInfo(info);
    169169            }
    170170            if (m_emitNodeDepth >= s_maxEmitNodeDepth)
     
    183183        void emitExpressionInfo(unsigned divot, unsigned startOffset, unsigned endOffset)
    184184        {
    185             divot -= m_codeBlock->sourceOffset;
     185            divot -= m_codeBlock->sourceOffset();
    186186            if (divot > ExpressionRangeInfo::MaxDivot) {
    187187                // Overflow has occurred, we can only give line number info for errors for this region
     
    207207            info.startOffset = startOffset;
    208208            info.endOffset = endOffset;
    209             m_codeBlock->expressionInfo.append(info);
     209            m_codeBlock->addExpressionInfo(info);
    210210        }
    211211       
    212212        ALWAYS_INLINE bool leftHandSideNeedsCopy(bool rightHasAssignments, bool rightIsPure)
    213213        {
    214             return (m_codeType != FunctionCode || m_codeBlock->needsFullScopeChain || rightHasAssignments) && !rightIsPure;
     214            return (m_codeType != FunctionCode || m_codeBlock->needsFullScopeChain() || rightHasAssignments) && !rightIsPure;
    215215        }
    216216
     
    399399        unsigned addRegExp(RegExp*);
    400400
    401         Vector<Instruction>& instructions() { return m_codeBlock->instructions; }
     401        Vector<Instruction>& instructions() { return m_codeBlock->instructions(); }
    402402        SymbolTable& symbolTable() { return *m_symbolTable; }
    403         Vector<HandlerInfo>& exceptionHandlers() { return m_codeBlock->exceptionHandlers; }
    404403
    405404        bool shouldOptimizeLocals() { return (m_codeType != EvalCode) && !m_dynamicScopeDepth; }
    406         bool canOptimizeNonLocals() { return (m_codeType == FunctionCode) && !m_dynamicScopeDepth && !m_codeBlock->usesEval; }
     405        bool canOptimizeNonLocals() { return (m_codeType == FunctionCode) && !m_dynamicScopeDepth && !m_codeBlock->usesEval(); }
    407406
    408407        RegisterID* emitThrowExpressionTooDeepException();
  • trunk/JavaScriptCore/bytecompiler/Label.h

    r38494 r39070  
    5454            for (unsigned i = 0; i < size; ++i) {
    5555                unsigned j = m_unresolvedJumps[i];
    56                 m_codeBlock->instructions[j].u.operand = m_location - j;
     56                m_codeBlock->instructions()[j].u.operand = m_location - j;
    5757            }
    5858        }
  • trunk/JavaScriptCore/interpreter/CallFrame.cpp

    r38528 r39070  
    3333JSValue* CallFrame::thisValue()
    3434{
    35     return this[codeBlock()->thisRegister].jsValue(this);
     35    return this[codeBlock()->thisRegister()].jsValue(this);
    3636}
    3737
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r39039 r39070  
    9393static ALWAYS_INLINE Instruction* vPCForPC(CodeBlock* codeBlock, void* pc)
    9494{
    95     if (pc >= codeBlock->instructions.begin() && pc < codeBlock->instructions.end())
     95    if (pc >= codeBlock->instructions().begin() && pc < codeBlock->instructions().end())
    9696        return static_cast<Instruction*>(pc);
    9797
    98     ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(pc));
    99     unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(pc);
    100     return codeBlock->instructions.begin() + vPCIndex;
     98    ASSERT(codeBlock->jitReturnAddressVPCMap().contains(pc));
     99    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(pc);
     100    return codeBlock->instructions().begin() + vPCIndex;
    101101}
    102102
     
    113113static int depth(CodeBlock* codeBlock, ScopeChain& sc)
    114114{
    115     if (!codeBlock->needsFullScopeChain)
     115    if (!codeBlock->needsFullScopeChain())
    116116        return 0;
    117117    int scopeDepth = 0;
     
    334334
    335335    CodeBlock* codeBlock = callFrame->codeBlock();
    336     Identifier& ident = codeBlock->identifiers[property];
     336    Identifier& ident = codeBlock->identifier(property);
    337337    do {
    338338        JSObject* o = *iter;
     
    357357    int dst = (vPC + 1)->u.operand;
    358358    int property = (vPC + 2)->u.operand;
    359     int skip = (vPC + 3)->u.operand + codeBlock->needsFullScopeChain;
     359    int skip = (vPC + 3)->u.operand + codeBlock->needsFullScopeChain();
    360360
    361361    ScopeChainNode* scopeChain = callFrame->scopeChain();
     
    367367        ASSERT(iter != end);
    368368    }
    369     Identifier& ident = codeBlock->identifiers[property];
     369    Identifier& ident = codeBlock->identifier(property);
    370370    do {
    371371        JSObject* o = *iter;
     
    399399
    400400    CodeBlock* codeBlock = callFrame->codeBlock();
    401     Identifier& ident = codeBlock->identifiers[property];
     401    Identifier& ident = codeBlock->identifier(property);
    402402    PropertySlot slot(globalObject);
    403403    if (globalObject->getPropertySlot(callFrame, ident, slot)) {
     
    451451    int dst = (vPC + 1)->u.operand;
    452452    int property = (vPC + 2)->u.operand;
    453     callFrame[dst] = inlineResolveBase(callFrame, callFrame->codeBlock()->identifiers[property], callFrame->scopeChain());
     453    callFrame[dst] = inlineResolveBase(callFrame, callFrame->codeBlock()->identifier(property), callFrame->scopeChain());
    454454}
    455455
     
    469469
    470470    CodeBlock* codeBlock = callFrame->codeBlock();
    471     Identifier& ident = codeBlock->identifiers[property];
     471    Identifier& ident = codeBlock->identifier(property);
    472472    JSObject* base;
    473473    do {
     
    505505
    506506    CodeBlock* codeBlock = callFrame->codeBlock();
    507     Identifier& ident = codeBlock->identifiers[property];
     507    Identifier& ident = codeBlock->identifier(property);
    508508    JSObject* base;
    509509    do {
     
    538538{
    539539    Register* r = callFrame->registers();
    540     Register* newEnd = r + registerOffset + newCodeBlock->numCalleeRegisters;
    541 
    542     if (LIKELY(argc == newCodeBlock->numParameters)) { // correct number of arguments
     540    Register* newEnd = r + registerOffset + newCodeBlock->m_numCalleeRegisters;
     541
     542    if (LIKELY(argc == newCodeBlock->m_numParameters)) { // correct number of arguments
    543543        if (UNLIKELY(!registerFile->grow(newEnd)))
    544544            return 0;
    545545        r += registerOffset;
    546     } else if (argc < newCodeBlock->numParameters) { // too few arguments -- fill in the blanks
    547         size_t omittedArgCount = newCodeBlock->numParameters - argc;
     546    } else if (argc < newCodeBlock->m_numParameters) { // too few arguments -- fill in the blanks
     547        size_t omittedArgCount = newCodeBlock->m_numParameters - argc;
    548548        registerOffset += omittedArgCount;
    549549        newEnd += omittedArgCount;
     
    556556            argv[i] = jsUndefined();
    557557    } else { // too many arguments -- copy expected arguments, leaving the extra arguments behind
    558         size_t numParameters = newCodeBlock->numParameters;
     558        size_t numParameters = newCodeBlock->m_numParameters;
    559559        registerOffset += numParameters;
    560560        newEnd += numParameters;
     
    594594    ScopeChainNode* scopeChain = callFrame->scopeChain();
    595595    CodeBlock* codeBlock = callFrame->codeBlock();
    596     RefPtr<EvalNode> evalNode = codeBlock->evalCodeCache.get(callFrame, programSource, scopeChain, exceptionValue);
     596    RefPtr<EvalNode> evalNode = codeBlock->evalCodeCache().get(callFrame, programSource, scopeChain, exceptionValue);
    597597
    598598    JSValue* result = jsUndefined();
     
    676676    const Register* end;
    677677
    678     if (codeBlock->codeType == GlobalCode) {
     678    if (codeBlock->codeType() == GlobalCode) {
    679679        it = registerFile->lastGlobal();
    680680        end = it + registerFile->numGlobals();
     
    686686    }
    687687   
    688     it = callFrame->registers() - RegisterFile::CallFrameHeaderSize - codeBlock->numParameters;
     688    it = callFrame->registers() - RegisterFile::CallFrameHeaderSize - codeBlock->m_numParameters;
    689689    printf("[this]                     | %10p | %10p \n", it, (*it).v()); ++it;
    690     end = it + max(codeBlock->numParameters - 1, 0); // - 1 to skip "this"
     690    end = it + max(codeBlock->m_numParameters - 1, 0); // - 1 to skip "this"
    691691    if (it != end) {
    692692        do {
     
    709709    int registerCount = 0;
    710710
    711     end = it + codeBlock->numVars;
     711    end = it + codeBlock->m_numVars;
    712712    if (it != end) {
    713713        do {
     
    719719    printf("----------------------------------------------------\n");
    720720
    721     end = it + codeBlock->numConstants;
     721    end = it + codeBlock->m_numConstants;
    722722    if (it != end) {
    723723        do {
     
    729729    printf("----------------------------------------------------\n");
    730730
    731     end = it + codeBlock->numCalleeRegisters - codeBlock->numConstants - codeBlock->numVars;
     731    end = it + codeBlock->m_numCalleeRegisters - codeBlock->m_numConstants - codeBlock->m_numVars;
    732732    if (it != end) {
    733733        do {
     
    761761        DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue);
    762762        if (callFrame->callee())
    763             debugger->returnEvent(debuggerCallFrame, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->lastLine());
     763            debugger->returnEvent(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->lastLine());
    764764        else
    765             debugger->didExecuteProgram(debuggerCallFrame, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->lastLine());
     765            debugger->didExecuteProgram(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->lastLine());
    766766    }
    767767
     
    770770            profiler->didExecute(callFrame, callFrame->callee());
    771771        else
    772             profiler->didExecute(callFrame, codeBlock->ownerNode->sourceURL(), codeBlock->ownerNode->lineNo());
     772            profiler->didExecute(callFrame, codeBlock->ownerNode()->sourceURL(), codeBlock->ownerNode()->lineNo());
    773773    }
    774774
    775775    // If this call frame created an activation or an 'arguments' object, tear it off.
    776     if (oldCodeBlock->codeType == FunctionCode && oldCodeBlock->needsFullScopeChain) {
     776    if (oldCodeBlock->codeType() == FunctionCode && oldCodeBlock->needsFullScopeChain()) {
    777777        while (!scopeChain->object->isObject(&JSActivation::info))
    778778            scopeChain = scopeChain->pop();
     
    783783    }
    784784
    785     if (oldCodeBlock->needsFullScopeChain)
     785    if (oldCodeBlock->needsFullScopeChain())
    786786        scopeChain->deref();
    787787
     
    826826                } else
    827827                    exception->putWithAttributes(callFrame, Identifier(callFrame, "line"), jsNumber(callFrame, codeBlock->lineNumberForVPC(vPC)), ReadOnly | DontDelete);
    828                 exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceId"), jsNumber(callFrame, codeBlock->ownerNode->sourceID()), ReadOnly | DontDelete);
    829                 exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceURL"), jsOwnedString(callFrame, codeBlock->ownerNode->sourceURL()), ReadOnly | DontDelete);
     828                exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceId"), jsNumber(callFrame, codeBlock->ownerNode()->sourceID()), ReadOnly | DontDelete);
     829                exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceURL"), jsOwnedString(callFrame, codeBlock->ownerNode()->sourceURL()), ReadOnly | DontDelete);
    830830            }
    831831           
     
    841841    if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) {
    842842        DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue);
    843         debugger->exception(debuggerCallFrame, codeBlock->ownerNode->sourceID(), codeBlock->lineNumberForVPC(vPC));
     843        debugger->exception(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->lineNumberForVPC(vPC));
    844844    }
    845845
     
    907907
    908908    Register* oldEnd = m_registerFile.end();
    909     Register* newEnd = oldEnd + codeBlock->numParameters + RegisterFile::CallFrameHeaderSize + codeBlock->numCalleeRegisters;
     909    Register* newEnd = oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters;
    910910    if (!m_registerFile.grow(newEnd)) {
    911911        *exception = createStackOverflowError(callFrame);
     
    919919    globalObject->copyGlobalsTo(m_registerFile);
    920920
    921     CallFrame* newCallFrame = CallFrame::create(oldEnd + codeBlock->numParameters + RegisterFile::CallFrameHeaderSize);
    922     newCallFrame[codeBlock->thisRegister] = thisObj;
     921    CallFrame* newCallFrame = CallFrame::create(oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize);
     922    newCallFrame[codeBlock->thisRegister()] = thisObj;
    923923    newCallFrame->init(codeBlock, 0, scopeChain, CallFrame::noCaller(), 0, 0, 0);
    924924
    925     if (codeBlock->needsFullScopeChain)
     925    if (codeBlock->needsFullScopeChain())
    926926        scopeChain->ref();
    927927
     
    936936        m_reentryDepth++;
    937937#if ENABLE(JIT)
    938         if (!codeBlock->ctiCode)
     938        if (!codeBlock->jitCode())
    939939            JIT::compile(scopeChain->globalData, codeBlock);
    940         result = JIT::execute(codeBlock->ctiCode, &m_registerFile, newCallFrame, scopeChain->globalData, exception);
     940        result = JIT::execute(codeBlock->jitCode(), &m_registerFile, newCallFrame, scopeChain->globalData, exception);
    941941#else
    942942        result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
     
    10021002        m_reentryDepth++;
    10031003#if ENABLE(JIT)
    1004         if (!codeBlock->ctiCode)
     1004        if (!codeBlock->jitCode())
    10051005            JIT::compile(scopeChain->globalData, codeBlock);
    1006         result = JIT::execute(codeBlock->ctiCode, &m_registerFile, newCallFrame, scopeChain->globalData, exception);
     1006        result = JIT::execute(codeBlock->jitCode(), &m_registerFile, newCallFrame, scopeChain->globalData, exception);
    10071007#else
    10081008        result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
     
    10201020JSValue* Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue** exception)
    10211021{
    1022     return execute(evalNode, callFrame, thisObj, m_registerFile.size() + evalNode->bytecode(scopeChain).numParameters + RegisterFile::CallFrameHeaderSize, scopeChain, exception);
     1022    return execute(evalNode, callFrame, thisObj, m_registerFile.size() + evalNode->bytecode(scopeChain).m_numParameters + RegisterFile::CallFrameHeaderSize, scopeChain, exception);
    10231023}
    10241024
     
    10491049        BatchedTransitionOptimizer optimizer(variableObject);
    10501050
    1051         const DeclarationStacks::VarStack& varStack = codeBlock->ownerNode->varStack();
     1051        const DeclarationStacks::VarStack& varStack = codeBlock->ownerNode()->varStack();
    10521052        DeclarationStacks::VarStack::const_iterator varStackEnd = varStack.end();
    10531053        for (DeclarationStacks::VarStack::const_iterator it = varStack.begin(); it != varStackEnd; ++it) {
     
    10591059        }
    10601060
    1061         const DeclarationStacks::FunctionStack& functionStack = codeBlock->ownerNode->functionStack();
     1061        const DeclarationStacks::FunctionStack& functionStack = codeBlock->ownerNode()->functionStack();
    10621062        DeclarationStacks::FunctionStack::const_iterator functionStackEnd = functionStack.end();
    10631063        for (DeclarationStacks::FunctionStack::const_iterator it = functionStack.begin(); it != functionStackEnd; ++it) {
     
    10691069
    10701070    Register* oldEnd = m_registerFile.end();
    1071     Register* newEnd = m_registerFile.start() + globalRegisterOffset + codeBlock->numCalleeRegisters;
     1071    Register* newEnd = m_registerFile.start() + globalRegisterOffset + codeBlock->m_numCalleeRegisters;
    10721072    if (!m_registerFile.grow(newEnd)) {
    10731073        *exception = createStackOverflowError(callFrame);
     
    10781078
    10791079    // a 0 codeBlock indicates a built-in caller
    1080     newCallFrame[codeBlock->thisRegister] = thisObj;
     1080    newCallFrame[codeBlock->thisRegister()] = thisObj;
    10811081    newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), 0, 0, 0);
    10821082
    1083     if (codeBlock->needsFullScopeChain)
     1083    if (codeBlock->needsFullScopeChain())
    10841084        scopeChain->ref();
    10851085
     
    10941094        m_reentryDepth++;
    10951095#if ENABLE(JIT)
    1096         if (!codeBlock->ctiCode)
     1096        if (!codeBlock->jitCode())
    10971097            JIT::compile(scopeChain->globalData, codeBlock);
    1098         result = JIT::execute(codeBlock->ctiCode, &m_registerFile, newCallFrame, scopeChain->globalData, exception);
     1098        result = JIT::execute(codeBlock->jitCode(), &m_registerFile, newCallFrame, scopeChain->globalData, exception);
    10991099#else
    11001100        result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
     
    11181118    switch (debugHookID) {
    11191119        case DidEnterCallFrame:
    1120             debugger->callEvent(callFrame, callFrame->codeBlock()->ownerNode->sourceID(), firstLine);
     1120            debugger->callEvent(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine);
    11211121            return;
    11221122        case WillLeaveCallFrame:
    1123             debugger->returnEvent(callFrame, callFrame->codeBlock()->ownerNode->sourceID(), lastLine);
     1123            debugger->returnEvent(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine);
    11241124            return;
    11251125        case WillExecuteStatement:
    1126             debugger->atStatement(callFrame, callFrame->codeBlock()->ownerNode->sourceID(), firstLine);
     1126            debugger->atStatement(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine);
    11271127            return;
    11281128        case WillExecuteProgram:
    1129             debugger->willExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode->sourceID(), firstLine);
     1129            debugger->willExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine);
    11301130            return;
    11311131        case DidExecuteProgram:
    1132             debugger->didExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode->sourceID(), lastLine);
     1132            debugger->didExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine);
    11331133            return;
    11341134        case DidReachBreakpoint:
    1135             debugger->didReachBreakpoint(callFrame, callFrame->codeBlock()->ownerNode->sourceID(), lastLine);
     1135            debugger->didReachBreakpoint(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine);
    11361136            return;
    11371137    }
     
    12271227    int dst = (++vPC)->u.operand;
    12281228    CodeBlock* codeBlock = callFrame->codeBlock();
    1229     Identifier& property = codeBlock->identifiers[(++vPC)->u.operand];
     1229    Identifier& property = codeBlock->identifier((++vPC)->u.operand);
    12301230    JSValue* value = callFrame[(++vPC)->u.operand].jsValue(callFrame);
    12311231    JSObject* scope = new (callFrame) JSStaticScopeObject(callFrame, property, value, DontDelete);
     
    14861486    Instruction* handlerVPC = 0;
    14871487
    1488     Instruction* vPC = callFrame->codeBlock()->instructions.begin();
     1488    Instruction* vPC = callFrame->codeBlock()->instructions().begin();
    14891489    Profiler** enabledProfilerReference = Profiler::enabledProfilerReference();
    14901490    unsigned tickCount = m_ticksUntilNextTimeoutCheck + 1;
     
    15751575        int dst = (++vPC)->u.operand;
    15761576        int regExp = (++vPC)->u.operand;
    1577         callFrame[dst] = new (globalData) RegExpObject(callFrame->scopeChain()->globalObject()->regExpStructure(), callFrame->codeBlock()->regexps[regExp]);
     1577        callFrame[dst] = new (globalData) RegExpObject(callFrame->scopeChain()->globalObject()->regExpStructure(), callFrame->codeBlock()->regexp(regExp));
    15781578
    15791579        ++vPC;
     
    24132413        int dst = (++vPC)->u.operand;
    24142414        int index = (++vPC)->u.operand;
    2415         int skip = (++vPC)->u.operand + callFrame->codeBlock()->needsFullScopeChain;
     2415        int skip = (++vPC)->u.operand + callFrame->codeBlock()->needsFullScopeChain();
    24162416
    24172417        ScopeChainNode* scopeChain = callFrame->scopeChain();
     
    24352435         */
    24362436        int index = (++vPC)->u.operand;
    2437         int skip = (++vPC)->u.operand + callFrame->codeBlock()->needsFullScopeChain;
     2437        int skip = (++vPC)->u.operand + callFrame->codeBlock()->needsFullScopeChain();
    24382438        int value = (++vPC)->u.operand;
    24392439
     
    25162516
    25172517        CodeBlock* codeBlock = callFrame->codeBlock();
    2518         Identifier& ident = codeBlock->identifiers[property];
     2518        Identifier& ident = codeBlock->identifier(property);
    25192519        JSValue* baseValue = callFrame[base].jsValue(callFrame);
    25202520        PropertySlot slot(baseValue);
     
    25482548                int offset = vPC[5].u.operand;
    25492549
    2550                 ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifiers[vPC[3].u.operand]) == baseObject->getDirectOffset(offset));
     2550                ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
    25512551                callFrame[dst] = baseObject->getDirectOffset(offset);
    25522552
     
    25822582                    int offset = vPC[6].u.operand;
    25832583
    2584                     ASSERT(protoObject->get(callFrame, callFrame->codeBlock()->identifiers[vPC[3].u.operand]) == protoObject->getDirectOffset(offset));
     2584                    ASSERT(protoObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == protoObject->getDirectOffset(offset));
    25852585                    callFrame[dst] = protoObject->getDirectOffset(offset);
    25862586
     
    26372637                        int offset = vPC[7].u.operand;
    26382638
    2639                         ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifiers[vPC[3].u.operand]) == baseObject->getDirectOffset(offset));
     2639                        ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
    26402640                        callFrame[dst] = baseObject->getDirectOffset(offset);
    26412641
     
    26602660        int property = vPC[3].u.operand;
    26612661
    2662         Identifier& ident = callFrame->codeBlock()->identifiers[property];
     2662        Identifier& ident = callFrame->codeBlock()->identifier(property);
    26632663        JSValue* baseValue = callFrame[base].jsValue(callFrame);
    26642664        PropertySlot slot(baseValue);
     
    27262726        CodeBlock* codeBlock = callFrame->codeBlock();
    27272727        JSValue* baseValue = callFrame[base].jsValue(callFrame);
    2728         Identifier& ident = codeBlock->identifiers[property];
     2728        Identifier& ident = codeBlock->identifier(property);
    27292729        PutPropertySlot slot;
    27302730        baseValue->put(callFrame, ident, callFrame[value].jsValue(callFrame), slot);
     
    27752775                int value = vPC[3].u.operand;
    27762776                unsigned offset = vPC[7].u.operand;
    2777                 ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifiers[vPC[2].u.operand])) == offset);
     2777                ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifier(vPC[2].u.operand))) == offset);
    27782778                baseObject->putDirectOffset(offset, callFrame[value].jsValue(callFrame));
    27792779
     
    28102810                unsigned offset = vPC[5].u.operand;
    28112811               
    2812                 ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifiers[vPC[2].u.operand])) == offset);
     2812                ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifier(vPC[2].u.operand))) == offset);
    28132813                baseObject->putDirectOffset(offset, callFrame[value].jsValue(callFrame));
    28142814
     
    28352835
    28362836        JSValue* baseValue = callFrame[base].jsValue(callFrame);
    2837         Identifier& ident = callFrame->codeBlock()->identifiers[property];
     2837        Identifier& ident = callFrame->codeBlock()->identifier(property);
    28382838        PutPropertySlot slot;
    28392839        baseValue->put(callFrame, ident, callFrame[value].jsValue(callFrame), slot);
     
    28562856
    28572857        JSObject* baseObj = callFrame[base].jsValue(callFrame)->toObject(callFrame);
    2858         Identifier& ident = callFrame->codeBlock()->identifiers[property];
     2858        Identifier& ident = callFrame->codeBlock()->identifier(property);
    28592859        JSValue* result = jsBoolean(baseObj->deleteProperty(callFrame, ident));
    28602860        CHECK_FOR_EXCEPTION();
     
    32653265        int func = (++vPC)->u.operand;
    32663266
    3267         callFrame[dst] = callFrame->codeBlock()->functions[func]->makeFunction(callFrame, callFrame->scopeChain());
     3267        callFrame[dst] = callFrame->codeBlock()->function(func)->makeFunction(callFrame, callFrame->scopeChain());
    32683268
    32693269        ++vPC;
     
    32813281        int func = (++vPC)->u.operand;
    32823282
    3283         callFrame[dst] = callFrame->codeBlock()->functionExpressions[func]->makeFunction(callFrame, callFrame->scopeChain());
     3283        callFrame[dst] = callFrame->codeBlock()->functionExpression(func)->makeFunction(callFrame, callFrame->scopeChain());
    32843284
    32853285        ++vPC;
     
    33603360
    33613361            callFrame->init(newCodeBlock, vPC + 5, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v));
    3362             vPC = newCodeBlock->instructions.begin();
     3362            vPC = newCodeBlock->instructions().begin();
    33633363
    33643364#if ENABLE(OPCODE_STATS)
     
    34143414
    34153415        int src = (++vPC)->u.operand;
    3416         ASSERT(callFrame->codeBlock()->needsFullScopeChain);
     3416        ASSERT(callFrame->codeBlock()->needsFullScopeChain());
    34173417
    34183418        asActivation(callFrame[src].getJSValue())->copyRegisters(callFrame->optionalCalleeArguments());
     
    34343434        */
    34353435
    3436         ASSERT(callFrame->codeBlock()->usesArguments && !callFrame->codeBlock()->needsFullScopeChain);
     3436        ASSERT(callFrame->codeBlock()->usesArguments() && !callFrame->codeBlock()->needsFullScopeChain());
    34373437
    34383438        callFrame->optionalCalleeArguments()->copyRegisters();
     
    34533453        int result = (++vPC)->u.operand;
    34543454
    3455         if (callFrame->codeBlock()->needsFullScopeChain)
     3455        if (callFrame->codeBlock()->needsFullScopeChain())
    34563456            callFrame->scopeChain()->deref();
    34573457
     
    34833483        CodeBlock* codeBlock = callFrame->codeBlock();
    34843484       
    3485         for (size_t count = codeBlock->numVars; i < count; ++i)
     3485        for (size_t count = codeBlock->m_numVars; i < count; ++i)
    34863486            callFrame[i] = jsUndefined();
    34873487
    3488         for (size_t count = codeBlock->constantRegisters.size(), j = 0; j < count; ++i, ++j)
    3489             callFrame[i] = codeBlock->constantRegisters[j];
     3488        for (size_t count = codeBlock->numberOfConstantRegisters(), j = 0; j < count; ++i, ++j)
     3489            callFrame[i] = codeBlock->constantRegister(j);
    34903490
    34913491        ++vPC;
     
    35083508        CodeBlock* codeBlock = callFrame->codeBlock();
    35093509
    3510         for (size_t count = codeBlock->numVars; i < count; ++i)
     3510        for (size_t count = codeBlock->m_numVars; i < count; ++i)
    35113511            callFrame[i] = jsUndefined();
    35123512
    3513         for (size_t count = codeBlock->constantRegisters.size(), j = 0; j < count; ++i, ++j)
    3514             callFrame[i] = codeBlock->constantRegisters[j];
     3513        for (size_t count = codeBlock->numberOfConstantRegisters(), j = 0; j < count; ++i, ++j)
     3514            callFrame[i] = codeBlock->constantRegister(j);
    35153515
    35163516        int dst = (++vPC)->u.operand;
    3517         JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionBodyNode*>(codeBlock->ownerNode));
     3517        JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionBodyNode*>(codeBlock->ownerNode()));
    35183518        callFrame[dst] = activation;
    35193519        callFrame->setScopeChain(callFrame->scopeChain()->copy()->push(activation));
     
    36123612
    36133613            callFrame->init(newCodeBlock, vPC + 7, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v));
    3614             vPC = newCodeBlock->instructions.begin();
     3614            vPC = newCodeBlock->instructions().begin();
    36153615
    36163616#if ENABLE(OPCODE_STATS)
     
    38133813        int dst = (++vPC)->u.operand;
    38143814        int src = (++vPC)->u.operand;
    3815         callFrame[dst] = callFrame->codeBlock()->unexpectedConstants[src];
     3815        callFrame[dst] = callFrame->codeBlock()->unexpectedConstant(src);
    38163816
    38173817        ++vPC;
     
    38313831
    38323832        CodeBlock* codeBlock = callFrame->codeBlock();
    3833         callFrame[dst] = Error::create(callFrame, (ErrorType)type, codeBlock->unexpectedConstants[message]->toString(callFrame), codeBlock->lineNumberForVPC(vPC), codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->sourceURL());
     3833        callFrame[dst] = Error::create(callFrame, (ErrorType)type, codeBlock->unexpectedConstant(message)->toString(callFrame), codeBlock->lineNumberForVPC(vPC), codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
    38343834
    38353835        ++vPC;
     
    38433843        */
    38443844
    3845         if (callFrame->codeBlock()->needsFullScopeChain) {
     3845        if (callFrame->codeBlock()->needsFullScopeChain()) {
    38463846            ScopeChainNode* scopeChain = callFrame->scopeChain();
    38473847            ASSERT(scopeChain->refCount > 1);
     
    38683868        ASSERT(callFrame[base].jsValue(callFrame)->isObject());
    38693869        JSObject* baseObj = asObject(callFrame[base].jsValue(callFrame));
    3870         Identifier& ident = callFrame->codeBlock()->identifiers[property];
     3870        Identifier& ident = callFrame->codeBlock()->identifier(property);
    38713871        ASSERT(callFrame[function].jsValue(callFrame)->isObject());
    38723872        baseObj->defineGetter(callFrame, ident, asObject(callFrame[function].jsValue(callFrame)));
     
    38923892        ASSERT(callFrame[base].jsValue(callFrame)->isObject());
    38933893        JSObject* baseObj = asObject(callFrame[base].jsValue(callFrame));
    3894         Identifier& ident = callFrame->codeBlock()->identifiers[property];
     3894        Identifier& ident = callFrame->codeBlock()->identifier(property);
    38953895        ASSERT(callFrame[function].jsValue(callFrame)->isObject());
    38963896        baseObj->defineSetter(callFrame, ident, asObject(callFrame[function].jsValue(callFrame)));
     
    39983998
    39993999    CodeBlock* codeBlock = functionCallFrame->codeBlock();
    4000     if (codeBlock->usesArguments) {
    4001         ASSERT(codeBlock->codeType == FunctionCode);
    4002         SymbolTable& symbolTable = codeBlock->symbolTable;
     4000    if (codeBlock->usesArguments()) {
     4001        ASSERT(codeBlock->codeType() == FunctionCode);
     4002        SymbolTable& symbolTable = codeBlock->symbolTable();
    40034003        int argumentsIndex = symbolTable.get(functionCallFrame->propertyNames().arguments.ustring().rep()).getIndex();
    40044004        return functionCallFrame[argumentsIndex].jsValue(callFrame);
     
    40484048    Instruction* vPC = vPCForPC(callerCodeBlock, callFrame->returnPC());
    40494049    lineNumber = callerCodeBlock->lineNumberForVPC(vPC - 1);
    4050     sourceID = callerCodeBlock->ownerNode->sourceID();
    4051     sourceURL = callerCodeBlock->ownerNode->sourceURL();
     4050    sourceID = callerCodeBlock->ownerNode()->sourceID();
     4051    sourceURL = callerCodeBlock->ownerNode()->sourceURL();
    40524052    function = callerFrame->callee();
    40534053}
     
    40884088    // *_second method to achieve a similar (but not quite the same) effect.
    40894089
    4090     unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(returnAddress);
    4091     Instruction* vPC = codeBlock->instructions.begin() + vPCIndex;
     4090    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(returnAddress);
     4091    Instruction* vPC = codeBlock->instructions().begin() + vPCIndex;
    40924092
    40934093    // Cache hit: Specialize instruction and ref Structures.
     
    41764176    // *_second method to achieve a similar (but not quite the same) effect.
    41774177
    4178     unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(returnAddress);
    4179     Instruction* vPC = codeBlock->instructions.begin() + vPCIndex;
     4178    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(returnAddress);
     4179    Instruction* vPC = codeBlock->instructions().begin() + vPCIndex;
    41804180
    41814181    // Cache hit: Specialize instruction and ref Structures.
     
    44254425    CTI_STACK_HACK();
    44264426
    4427     if (LIKELY(ARG_registerFile->grow(ARG_callFrame + ARG_callFrame->codeBlock()->numCalleeRegisters)))
     4427    if (LIKELY(ARG_registerFile->grow(ARG_callFrame + ARG_callFrame->codeBlock()->m_numCalleeRegisters)))
    44284428        return;
    44294429
     
    45834583
    45844584        CodeBlock* codeBlock = callFrame->codeBlock();
    4585         unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
    4586         Instruction* vPC = codeBlock->instructions.begin() + vPCIndex;
     4585        unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
     4586        Instruction* vPC = codeBlock->instructions().begin() + vPCIndex;
    45874587
    45884588        ASSERT(slot.slotBase()->isObject());
     
    46674667    Structure* structure = asCell(baseValue)->structure();
    46684668    CodeBlock* codeBlock = callFrame->codeBlock();
    4669     Instruction* vPC = codeBlock->instructions.begin() + codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
     4669    Instruction* vPC = codeBlock->instructions().begin() + codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
    46704670
    46714671    ASSERT(slot.slotBase()->isObject());
     
    47764776        CallFrame* callFrame = ARG_callFrame;
    47774777        CodeBlock* codeBlock = callFrame->codeBlock();
    4778         ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
    4779         unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
    4780         ARG_globalData->exception = createInvalidParamError(callFrame, "instanceof", baseVal, codeBlock->instructions.begin() + vPCIndex, codeBlock);
     4778        ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
     4779        unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
     4780        ARG_globalData->exception = createInvalidParamError(callFrame, "instanceof", baseVal, codeBlock->instructions().begin() + vPCIndex, codeBlock);
    47814781        VM_THROW_EXCEPTION();
    47824782    }
     
    48494849    CodeBlock* newCodeBlock = &asFunction(ARG_src1)->body()->bytecode(callDataScopeChain);
    48504850
    4851     if (!newCodeBlock->ctiCode)
     4851    if (!newCodeBlock->jitCode())
    48524852        JIT::compile(ARG_globalData, newCodeBlock);
    48534853
     
    48634863    int argCount = ARG_int3;
    48644864
    4865     ASSERT(argCount != newCodeBlock->numParameters);
     4865    ASSERT(argCount != newCodeBlock->m_numParameters);
    48664866
    48674867    CallFrame* oldCallFrame = callFrame->callerFrame();
    48684868
    4869     if (argCount > newCodeBlock->numParameters) {
    4870         size_t numParameters = newCodeBlock->numParameters;
     4869    if (argCount > newCodeBlock->m_numParameters) {
     4870        size_t numParameters = newCodeBlock->m_numParameters;
    48714871        Register* r = callFrame->registers() + numParameters;
    48724872
     
    48784878        callFrame->setCallerFrame(oldCallFrame);
    48794879    } else {
    4880         size_t omittedArgCount = newCodeBlock->numParameters - argCount;
     4880        size_t omittedArgCount = newCodeBlock->m_numParameters - argCount;
    48814881        Register* r = callFrame->registers() + omittedArgCount;
    4882         Register* newEnd = r + newCodeBlock->numCalleeRegisters;
     4882        Register* newEnd = r + newCodeBlock->m_numCalleeRegisters;
    48834883        if (!ARG_registerFile->grow(newEnd)) {
    48844884            // Rewind to the previous call frame because op_call already optimistically
     
    49084908    JSFunction* callee = asFunction(ARG_src1);
    49094909    CodeBlock* codeBlock = &callee->body()->bytecode(callee->m_scopeChain.node());
    4910     if (!codeBlock->ctiCode)
     4910    if (!codeBlock->jitCode())
    49114911        JIT::compile(ARG_globalData, codeBlock);
    49124912
    49134913    ctiRepatchCallByReturnAddress(ARG_returnAddress2, ARG_globalData->interpreter->m_ctiVirtualCallLink);
    49144914
    4915     return codeBlock->ctiCode;
     4915    return codeBlock->jitCode();
    49164916}
    49174917
     
    49224922    JSFunction* callee = asFunction(ARG_src1);
    49234923    CodeBlock* codeBlock = &callee->body()->bytecode(callee->m_scopeChain.node());
    4924     if (!codeBlock->ctiCode)
     4924    if (!codeBlock->jitCode())
    49254925        JIT::compile(ARG_globalData, codeBlock);
    49264926
    49274927    CallLinkInfo* callLinkInfo = &ARG_callFrame->callerFrame()->codeBlock()->getCallLinkInfo(ARG_returnAddress2);
    4928     JIT::linkCall(callee, codeBlock, codeBlock->ctiCode, callLinkInfo, ARG_int3);
    4929 
    4930     return codeBlock->ctiCode;
     4928    JIT::linkCall(callee, codeBlock, codeBlock->jitCode(), callLinkInfo, ARG_int3);
     4929
     4930    return codeBlock->jitCode();
    49314931}
    49324932
     
    49354935    CTI_STACK_HACK();
    49364936
    4937     JSActivation* activation = new (ARG_globalData) JSActivation(ARG_callFrame, static_cast<FunctionBodyNode*>(ARG_callFrame->codeBlock()->ownerNode));
     4937    JSActivation* activation = new (ARG_globalData) JSActivation(ARG_callFrame, static_cast<FunctionBodyNode*>(ARG_callFrame->codeBlock()->ownerNode()));
    49384938    ARG_callFrame->setScopeChain(ARG_callFrame->scopeChain()->copy()->push(activation));
    49394939    return activation;
     
    50085008    CTI_STACK_HACK();
    50095009
    5010     ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain);
     5010    ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain());
    50115011    asActivation(ARG_src1)->copyRegisters(ARG_callFrame->optionalCalleeArguments());
    50125012}
     
    50165016    CTI_STACK_HACK();
    50175017
    5018     ASSERT(ARG_callFrame->codeBlock()->usesArguments && !ARG_callFrame->codeBlock()->needsFullScopeChain);
     5018    ASSERT(ARG_callFrame->codeBlock()->usesArguments() && !ARG_callFrame->codeBlock()->needsFullScopeChain());
    50195019    ARG_callFrame->optionalCalleeArguments()->copyRegisters();
    50205020}
     
    50405040    CTI_STACK_HACK();
    50415041
    5042     ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain);
     5042    ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain());
    50435043    ARG_callFrame->scopeChain()->deref();
    50445044}
     
    50755075
    50765076    CodeBlock* codeBlock = callFrame->codeBlock();
    5077     ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
    5078     unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
    5079     ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions.begin() + vPCIndex, codeBlock);
     5077    ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
     5078    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
     5079    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock);
    50805080    VM_THROW_EXCEPTION();
    50815081}
     
    52025202
    52035203    CodeBlock* codeBlock = callFrame->codeBlock();
    5204     ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
    5205     unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
    5206     ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions.begin() + vPCIndex, codeBlock);
     5204    ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
     5205    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
     5206    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock);
    52075207    VM_THROW_EXCEPTION_2();
    52085208}
     
    53605360
    53615361    CodeBlock* codeBlock = callFrame->codeBlock();
    5362     ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
    5363     unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
    5364     ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions.begin() + vPCIndex, codeBlock);
     5362    ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
     5363    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
     5364    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock);
    53655365    VM_THROW_EXCEPTION();
    53665366}
     
    55995599
    56005600    CodeBlock* codeBlock = callFrame->codeBlock();
    5601     ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
    5602     unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
    5603     ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions.begin() + vPCIndex, codeBlock);
     5601    ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
     5602    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
     5603    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock);
    56045604    VM_THROW_EXCEPTION_2();
    56055605}
     
    57575757    CodeBlock* codeBlock = callFrame->codeBlock();
    57585758
    5759     ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
    5760     unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
     5759    ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
     5760    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
    57615761
    57625762    JSValue* exceptionValue = ARG_src1;
    57635763    ASSERT(exceptionValue);
    57645764
    5765     Instruction* handlerVPC = ARG_globalData->interpreter->throwException(callFrame, exceptionValue, codeBlock->instructions.begin() + vPCIndex, true);
     5765    Instruction* handlerVPC = ARG_globalData->interpreter->throwException(callFrame, exceptionValue, codeBlock->instructions().begin() + vPCIndex, true);
    57665766
    57675767    if (!handlerVPC) {
     
    59115911        CallFrame* callFrame = ARG_callFrame;
    59125912        CodeBlock* codeBlock = callFrame->codeBlock();
    5913         ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
    5914         unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
    5915         ARG_globalData->exception = createInvalidParamError(callFrame, "in", baseVal, codeBlock->instructions.begin() + vPCIndex, codeBlock);
     5913        ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
     5914        unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
     5915        ARG_globalData->exception = createInvalidParamError(callFrame, "in", baseVal, codeBlock->instructions().begin() + vPCIndex, codeBlock);
    59165916        VM_THROW_EXCEPTION();
    59175917    }
     
    60786078    unsigned lineNumber = ARG_int3;
    60796079
    6080     return Error::create(callFrame, static_cast<ErrorType>(type), message->toString(callFrame), lineNumber, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->sourceURL());
     6080    return Error::create(callFrame, static_cast<ErrorType>(type), message->toString(callFrame), lineNumber, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
    60816081}
    60826082
     
    61026102    JSGlobalData* globalData = ARG_globalData;
    61036103
    6104     ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(globalData->exceptionLocation));
    6105     unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(globalData->exceptionLocation);
     6104    ASSERT(codeBlock->jitReturnAddressVPCMap().contains(globalData->exceptionLocation));
     6105    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(globalData->exceptionLocation);
    61066106
    61076107    JSValue* exceptionValue = globalData->exception;
     
    61096109    globalData->exception = noValue();
    61106110
    6111     Instruction* handlerVPC = globalData->interpreter->throwException(callFrame, exceptionValue, codeBlock->instructions.begin() + vPCIndex, false);
     6111    Instruction* handlerVPC = globalData->interpreter->throwException(callFrame, exceptionValue, codeBlock->instructions().begin() + vPCIndex, false);
    61126112
    61136113    if (!handlerVPC) {
  • trunk/JavaScriptCore/jit/JIT.cpp

    r39061 r39070  
    185185    , m_globalData(globalData)
    186186    , m_codeBlock(codeBlock)
    187     , m_labels(codeBlock ? codeBlock->instructions.size() : 0)
    188     , m_propertyAccessCompilationInfo(codeBlock ? codeBlock->propertyAccessInstructions.size() : 0)
    189     , m_callStructureStubCompilationInfo(codeBlock ? codeBlock->callLinkInfos.size() : 0)
     187    , m_labels(codeBlock ? codeBlock->instructions().size() : 0)
     188    , m_propertyAccessCompilationInfo(codeBlock ? codeBlock->numberOfPropertyAccessInstructions() : 0)
     189    , m_callStructureStubCompilationInfo(codeBlock ? codeBlock->numberOfCallLinkInfos() : 0)
    190190    , m_lastResultBytecodeRegister(std::numeric_limits<int>::max())
    191191    , m_jumpTargetsPosition(0)
     
    266266void JIT::privateCompileMainPass()
    267267{
    268     Instruction* instruction = m_codeBlock->instructions.begin();
    269     unsigned instructionCount = m_codeBlock->instructions.size();
     268    Instruction* instruction = m_codeBlock->instructions().begin();
     269    unsigned instructionCount = m_codeBlock->instructions().size();
    270270
    271271    unsigned propertyAccessInstructionIndex = 0;
     
    320320        }
    321321        case op_end: {
    322             if (m_codeBlock->needsFullScopeChain)
     322            if (m_codeBlock->needsFullScopeChain())
    323323                emitCTICall(i, Interpreter::cti_op_end);
    324324            emitGetVirtualRegister(instruction[i + 1].u.operand, X86::eax, i);
     
    394394        }
    395395        case op_put_by_id: {
    396             compilePutByIdHotPath(instruction[i + 1].u.operand, &(m_codeBlock->identifiers[instruction[i + 2].u.operand]), instruction[i + 3].u.operand, i, propertyAccessInstructionIndex++);
     396            compilePutByIdHotPath(instruction[i + 1].u.operand, &(m_codeBlock->identifier(instruction[i + 2].u.operand)), instruction[i + 3].u.operand, i, propertyAccessInstructionIndex++);
    397397            i += 8;
    398398            break;
    399399        }
    400400        case op_get_by_id: {
    401             compileGetByIdHotPath(instruction[i + 1].u.operand, instruction[i + 2].u.operand, &(m_codeBlock->identifiers[instruction[i + 3].u.operand]), i, propertyAccessInstructionIndex++);
     401            compileGetByIdHotPath(instruction[i + 1].u.operand, instruction[i + 2].u.operand, &(m_codeBlock->identifier(instruction[i + 3].u.operand)), i, propertyAccessInstructionIndex++);
    402402            i += 8;
    403403            break;
     
    464464        case op_del_by_id: {
    465465            emitPutCTIArgFromVirtualRegister(instruction[i + 2].u.operand, 0, X86::ecx);
    466             Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 3].u.operand]);
     466            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 3].u.operand));
    467467            emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 4);
    468468            emitCTICall(i, Interpreter::cti_op_del_by_id);
     
    501501        }
    502502        case op_new_func: {
    503             FuncDeclNode* func = (m_codeBlock->functions[instruction[i + 2].u.operand]).get();
     503            FuncDeclNode* func = m_codeBlock->function(instruction[i + 2].u.operand);
    504504            emitPutCTIArgConstant(reinterpret_cast<unsigned>(func), 0);
    505505            emitCTICall(i, Interpreter::cti_op_new_func);
     
    532532        }
    533533        case op_get_scoped_var: {
    534             int skip = instruction[i + 3].u.operand + m_codeBlock->needsFullScopeChain;
     534            int skip = instruction[i + 3].u.operand + m_codeBlock->needsFullScopeChain();
    535535
    536536            emitGetFromCallFrameHeader(RegisterFile::ScopeChain, X86::eax);
     
    545545        }
    546546        case op_put_scoped_var: {
    547             int skip = instruction[i + 2].u.operand + m_codeBlock->needsFullScopeChain;
     547            int skip = instruction[i + 2].u.operand + m_codeBlock->needsFullScopeChain();
    548548
    549549            emitGetFromCallFrameHeader(RegisterFile::ScopeChain, X86::edx);
     
    570570        case op_ret: {
    571571            // We could JIT generate the deref, only calling out to C when the refcount hits zero.
    572             if (m_codeBlock->needsFullScopeChain)
     572            if (m_codeBlock->needsFullScopeChain())
    573573                emitCTICall(i, Interpreter::cti_op_ret_scopeChain);
    574574
     
    599599        }
    600600        case op_resolve: {
    601             Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 2].u.operand]);
     601            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand));
    602602            emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0);
    603603            emitCTICall(i, Interpreter::cti_op_resolve);
     
    642642        }
    643643        case op_resolve_func: {
    644             Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 3].u.operand]);
     644            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 3].u.operand));
    645645            emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0);
    646646            emitCTICall(i, Interpreter::cti_op_resolve_func);
     
    705705        };
    706706        case op_resolve_base: {
    707             Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 2].u.operand]);
     707            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand));
    708708            emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0);
    709709            emitCTICall(i, Interpreter::cti_op_resolve_base);
     
    720720        }
    721721        case op_resolve_skip: {
    722             Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 2].u.operand]);
     722            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand));
    723723            emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0);
    724             emitPutCTIArgConstant(instruction[i + 3].u.operand + m_codeBlock->needsFullScopeChain, 4);
     724            emitPutCTIArgConstant(instruction[i + 3].u.operand + m_codeBlock->needsFullScopeChain(), 4);
    725725            emitCTICall(i, Interpreter::cti_op_resolve_skip);
    726726            emitPutVirtualRegister(instruction[i + 1].u.operand);
     
    731731            // Fast case
    732732            unsigned globalObject = asInteger(instruction[i + 2].u.jsCell);
    733             Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 3].u.operand]);
     733            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 3].u.operand));
    734734            void* structureAddress = reinterpret_cast<void*>(instruction + i + 4);
    735735            void* offsetAddr = reinterpret_cast<void*>(instruction + i + 5);
     
    887887        }
    888888        case op_unexpected_load: {
    889             JSValue* v = m_codeBlock->unexpectedConstants[instruction[i + 2].u.operand];
     889            JSValue* v = m_codeBlock->unexpectedConstant(instruction[i + 2].u.operand);
    890890            __ movl_i32r(asInteger(v), X86::eax);
    891891            emitPutVirtualRegister(instruction[i + 1].u.operand);
     
    984984        }
    985985        case op_resolve_with_base: {
    986             Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 3].u.operand]);
     986            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 3].u.operand));
    987987            emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0);
    988988            emitCTICall(i, Interpreter::cti_op_resolve_with_base);
     
    993993        }
    994994        case op_new_func_exp: {
    995             FuncExprNode* func = (m_codeBlock->functionExpressions[instruction[i + 2].u.operand]).get();
     995            FuncExprNode* func = m_codeBlock->functionExpression(instruction[i + 2].u.operand);
    996996            emitPutCTIArgConstant(reinterpret_cast<unsigned>(func), 0);
    997997            emitCTICall(i, Interpreter::cti_op_new_func_exp);
     
    10701070        }
    10711071        case op_new_regexp: {
    1072             RegExp* regExp = m_codeBlock->regexps[instruction[i + 2].u.operand].get();
     1072            RegExp* regExp = m_codeBlock->regexp(instruction[i + 2].u.operand);
    10731073            emitPutCTIArgConstant(reinterpret_cast<unsigned>(regExp), 0);
    10741074            emitCTICall(i, Interpreter::cti_op_new_regexp);
     
    11721172        }
    11731173        case op_push_new_scope: {
    1174             Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 2].u.operand]);
     1174            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand));
    11751175            emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0);
    11761176            emitPutCTIArgFromVirtualRegister(instruction[i + 3].u.operand, 4, X86::ecx);
     
    12631263        case op_put_getter: {
    12641264            emitPutCTIArgFromVirtualRegister(instruction[i + 1].u.operand, 0, X86::ecx);
    1265             Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 2].u.operand]);
     1265            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand));
    12661266            emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 4);
    12671267            emitPutCTIArgFromVirtualRegister(instruction[i + 3].u.operand, 8, X86::ecx);
     
    12721272        case op_put_setter: {
    12731273            emitPutCTIArgFromVirtualRegister(instruction[i + 1].u.operand, 0, X86::ecx);
    1274             Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 2].u.operand]);
     1274            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand));
    12751275            emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 4);
    12761276            emitPutCTIArgFromVirtualRegister(instruction[i + 3].u.operand, 8, X86::ecx);
     
    12801280        }
    12811281        case op_new_error: {
    1282             JSValue* message = m_codeBlock->unexpectedConstants[instruction[i + 3].u.operand];
     1282            JSValue* message = m_codeBlock->unexpectedConstant(instruction[i + 3].u.operand);
    12831283            emitPutCTIArgConstant(instruction[i + 2].u.operand, 0);
    12841284            emitPutCTIArgConstant(asInteger(message), 4);
     
    13591359            // registers to zap stale pointers, to avoid unnecessarily prolonging
    13601360            // object lifetime and increasing GC pressure.
    1361             size_t count = m_codeBlock->numVars + m_codeBlock->constantRegisters.size();
     1361            size_t count = m_codeBlock->m_numVars + m_codeBlock->numberOfConstantRegisters();
    13621362            for (size_t j = 0; j < count; ++j)
    13631363                emitInitRegister(j);
     
    13701370            // registers to zap stale pointers, to avoid unnecessarily prolonging
    13711371            // object lifetime and increasing GC pressure.
    1372             size_t count = m_codeBlock->numVars + m_codeBlock->constantRegisters.size();
     1372            size_t count = m_codeBlock->m_numVars + m_codeBlock->numberOfConstantRegisters();
    13731373            for (size_t j = 0; j < count; ++j)
    13741374                emitInitRegister(j);
     
    13811381        }
    13821382        case op_create_arguments: {
    1383             emitCTICall(i, (m_codeBlock->numParameters == 1) ? Interpreter::cti_op_create_arguments_no_params : Interpreter::cti_op_create_arguments);
     1383            emitCTICall(i, (m_codeBlock->m_numParameters == 1) ? Interpreter::cti_op_create_arguments_no_params : Interpreter::cti_op_create_arguments);
    13841384            i += 1;
    13851385            break;
     
    14331433    }
    14341434
    1435     ASSERT(propertyAccessInstructionIndex == m_codeBlock->propertyAccessInstructions.size());
    1436     ASSERT(callLinkInfoIndex == m_codeBlock->callLinkInfos.size());
     1435    ASSERT(propertyAccessInstructionIndex == m_codeBlock->numberOfPropertyAccessInstructions());
     1436    ASSERT(callLinkInfoIndex == m_codeBlock->numberOfCallLinkInfos());
    14371437}
    14381438
     
    14621462    unsigned callLinkInfoIndex = 0;
    14631463
    1464     Instruction* instruction = m_codeBlock->instructions.begin();
     1464    Instruction* instruction = m_codeBlock->instructions().begin();
    14651465    for (Vector<SlowCaseEntry>::iterator iter = m_slowCases.begin(); iter != m_slowCases.end(); ++iter) {
    14661466        // FIXME: enable peephole optimizations for slow cases when applicable
     
    16051605        }
    16061606        case op_put_by_id: {
    1607             compilePutByIdSlowCase(instruction[i + 1].u.operand, &(m_codeBlock->identifiers[instruction[i + 2].u.operand]), instruction[i + 3].u.operand, i, iter, propertyAccessInstructionIndex++);
     1607            compilePutByIdSlowCase(instruction[i + 1].u.operand, &(m_codeBlock->identifier(instruction[i + 2].u.operand)), instruction[i + 3].u.operand, i, iter, propertyAccessInstructionIndex++);
    16081608            i += 8;
    16091609            break;
    16101610        }
    16111611        case op_get_by_id: {
    1612             compileGetByIdSlowCase(instruction[i + 1].u.operand, instruction[i + 2].u.operand, &(m_codeBlock->identifiers[instruction[i + 3].u.operand]), i, iter, propertyAccessInstructionIndex++);
     1612            compileGetByIdSlowCase(instruction[i + 1].u.operand, instruction[i + 2].u.operand, &(m_codeBlock->identifier(instruction[i + 3].u.operand)), i, iter, propertyAccessInstructionIndex++);
    16131613            i += 8;
    16141614            break;
     
    19481948    }
    19491949
    1950     ASSERT(propertyAccessInstructionIndex == m_codeBlock->propertyAccessInstructions.size());
    1951     ASSERT(callLinkInfoIndex == m_codeBlock->callLinkInfos.size());
     1950    ASSERT(propertyAccessInstructionIndex == m_codeBlock->numberOfPropertyAccessInstructions());
     1951    ASSERT(callLinkInfoIndex == m_codeBlock->numberOfCallLinkInfos());
    19521952}
    19531953
     
    19581958#endif
    19591959#if ENABLE(OPCODE_SAMPLING)
    1960         __ movl_i32m(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin()), m_interpreter->sampler()->sampleSlot());
     1960        __ movl_i32m(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin()), m_interpreter->sampler()->sampleSlot());
    19611961#endif
    19621962
     
    19671967    JmpSrc slowRegisterFileCheck;
    19681968    JmpDst afterRegisterFileCheck;
    1969     if (m_codeBlock->codeType == FunctionCode) {
     1969    if (m_codeBlock->codeType() == FunctionCode) {
    19701970        // In the case of a fast linked call, we do not set this up in the caller.
    19711971        emitPutImmediateToCallFrameHeader(m_codeBlock, RegisterFile::CodeBlock);
    19721972
    19731973        emitGetCTIParam(CTI_ARGS_registerFile, X86::eax);
    1974         __ leal_mr(m_codeBlock->numCalleeRegisters * sizeof(Register), X86::edi, X86::edx);
     1974        __ leal_mr(m_codeBlock->m_numCalleeRegisters * sizeof(Register), X86::edi, X86::edx);
    19751975        __ cmpl_mr(FIELD_OFFSET(RegisterFile, m_end), X86::eax, X86::edx);
    19761976        slowRegisterFileCheck = __ jg();
     
    19821982    privateCompileSlowCases();
    19831983
    1984     if (m_codeBlock->codeType == FunctionCode) {
     1984    if (m_codeBlock->codeType() == FunctionCode) {
    19851985        __ link(slowRegisterFileCheck, __ label());
    19861986        emitCTICall(0, Interpreter::cti_register_file_check);
     
    20212021    }
    20222022
    2023     for (Vector<HandlerInfo>::iterator iter = m_codeBlock->exceptionHandlers.begin(); iter != m_codeBlock->exceptionHandlers.end(); ++iter)
    2024          iter->nativeCode = __ getRelocatedAddress(code, m_labels[iter->target]);
     2023    for (size_t i = 0; i < m_codeBlock->numberOfExceptionHandlers(); ++i) {
     2024        HandlerInfo& handler = m_codeBlock->exceptionHandler(i);
     2025        handler.nativeCode = __ getRelocatedAddress(code, m_labels[handler.target]);
     2026    }
    20252027
    20262028    for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) {
    20272029        if (iter->to)
    20282030            X86Assembler::link(code, iter->from, iter->to);
    2029         m_codeBlock->ctiReturnAddressVPCMap.add(__ getRelocatedAddress(code, iter->from), iter->bytecodeIndex);
     2031        m_codeBlock->jitReturnAddressVPCMap().add(__ getRelocatedAddress(code, iter->from), iter->bytecodeIndex);
    20302032    }
    20312033
     
    20342036        X86Assembler::linkAbsoluteAddress(code, iter->addrPosition, iter->target);
    20352037
    2036     for (unsigned i = 0; i < m_codeBlock->propertyAccessInstructions.size(); ++i) {
    2037         StructureStubInfo& info = m_codeBlock->propertyAccessInstructions[i];
     2038    for (unsigned i = 0; i < m_codeBlock->numberOfPropertyAccessInstructions(); ++i) {
     2039        StructureStubInfo& info = m_codeBlock->propertyAccessInstruction(i);
    20382040        info.callReturnLocation = X86Assembler::getRelocatedAddress(code, m_propertyAccessCompilationInfo[i].callReturnLocation);
    20392041        info.hotPathBegin = X86Assembler::getRelocatedAddress(code, m_propertyAccessCompilationInfo[i].hotPathBegin);
    20402042    }
    2041     for (unsigned i = 0; i < m_codeBlock->callLinkInfos.size(); ++i) {
    2042         CallLinkInfo& info = m_codeBlock->callLinkInfos[i];
     2043    for (unsigned i = 0; i < m_codeBlock->numberOfCallLinkInfos(); ++i) {
     2044        CallLinkInfo& info = m_codeBlock->callLinkInfo(i);
    20432045        info.callReturnLocation = X86Assembler::getRelocatedAddress(code, m_callStructureStubCompilationInfo[i].callReturnLocation);
    20442046        info.hotPathBegin = X86Assembler::getRelocatedAddress(code, m_callStructureStubCompilationInfo[i].hotPathBegin);
     
    20472049    }
    20482050
    2049     m_codeBlock->ctiCode = code;
     2051    m_codeBlock->setJITCode(code);
    20502052}
    20512053
     
    21112113
    21122114    // Check argCount matches callee arity.
    2113     __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, numParameters), X86::eax);
     2115    __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, m_numParameters), X86::eax);
    21142116    JmpSrc arityCheckOkay1 = __ je();
    21152117    __ popl_r(X86::ebx);
     
    21532155
    21542156    // Check argCount matches callee arity.
    2155     __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, numParameters), X86::eax);
     2157    __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, m_numParameters), X86::eax);
    21562158    JmpSrc arityCheckOkay2 = __ je();
    21572159    __ popl_r(X86::ebx);
     
    21952197
    21962198    // Check argCount matches callee arity.
    2197     __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, numParameters), X86::eax);
     2199    __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, m_numParameters), X86::eax);
    21982200    JmpSrc arityCheckOkay3 = __ je();
    21992201    __ popl_r(X86::ebx);
     
    22122214
    22132215    // load ctiCode from the new codeBlock.
    2214     __ movl_mr(FIELD_OFFSET(CodeBlock, ctiCode), X86::eax, X86::eax);
     2216    __ movl_mr(FIELD_OFFSET(CodeBlock, m_jitCode), X86::eax, X86::eax);
    22152217
    22162218    __ jmp_r(X86::eax);
  • trunk/JavaScriptCore/jit/JITCall.cpp

    r38984 r39070  
    5656{
    5757    // Currently we only link calls with the exact number of arguments.
    58     if (callerArgCount == calleeCodeBlock->numParameters) {
     58    if (callerArgCount == calleeCodeBlock->m_numParameters) {
    5959        ASSERT(!callLinkInfo->isLinked());
    6060   
  • trunk/JavaScriptCore/jit/JITInlineMethods.h

    r39058 r39070  
    6969    if (src == m_lastResultBytecodeRegister && m_codeBlock->isTemporaryRegisterIndex(src)) {
    7070        bool atJumpTarget = false;
    71         while (m_jumpTargetsPosition < m_codeBlock->jumpTargets.size() && m_codeBlock->jumpTargets[m_jumpTargetsPosition] <= currentInstructionIndex) {
    72             if (m_codeBlock->jumpTargets[m_jumpTargetsPosition] == currentInstructionIndex)
     71        while (m_jumpTargetsPosition < m_codeBlock->numberOfJumpTargets() && m_codeBlock->jumpTarget(m_jumpTargetsPosition) <= currentInstructionIndex) {
     72            if (m_codeBlock->jumpTarget(m_jumpTargetsPosition) == currentInstructionIndex)
    7373                atJumpTarget = true;
    7474            ++m_jumpTargetsPosition;
     
    225225{
    226226#if ENABLE(OPCODE_SAMPLING)
    227     store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
    228 #endif
    229     restoreArgumentReference();
    230     emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
    231     JmpSrc ctiCall = call();
    232     m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
    233 #if ENABLE(OPCODE_SAMPLING)
    234     store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
     227    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
     228#endif
     229    restoreArgumentReference();
     230    emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
     231    JmpSrc ctiCall = call();
     232    m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
     233#if ENABLE(OPCODE_SAMPLING)
     234    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
    235235#endif
    236236    killLastResultRegister();
     
    242242{
    243243#if ENABLE(OPCODE_SAMPLING)
    244     store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
    245 #endif
    246     restoreArgumentReference();
    247     emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
    248     JmpSrc ctiCall = call();
    249     m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
    250 #if ENABLE(OPCODE_SAMPLING)
    251     store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
     244    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
     245#endif
     246    restoreArgumentReference();
     247    emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
     248    JmpSrc ctiCall = call();
     249    m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
     250#if ENABLE(OPCODE_SAMPLING)
     251    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
    252252#endif
    253253    killLastResultRegister();
     
    259259{
    260260#if ENABLE(OPCODE_SAMPLING)
    261     store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
    262 #endif
    263     restoreArgumentReference();
    264     emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
    265     JmpSrc ctiCall = call();
    266     m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
    267 #if ENABLE(OPCODE_SAMPLING)
    268     store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
     261    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
     262#endif
     263    restoreArgumentReference();
     264    emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
     265    JmpSrc ctiCall = call();
     266    m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
     267#if ENABLE(OPCODE_SAMPLING)
     268    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
    269269#endif
    270270    killLastResultRegister();
     
    276276{
    277277#if ENABLE(OPCODE_SAMPLING)
    278     store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
    279 #endif
    280     restoreArgumentReference();
    281     emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
    282     JmpSrc ctiCall = call();
    283     m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
    284 #if ENABLE(OPCODE_SAMPLING)
    285     store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
     278    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
     279#endif
     280    restoreArgumentReference();
     281    emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
     282    JmpSrc ctiCall = call();
     283    m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
     284#if ENABLE(OPCODE_SAMPLING)
     285    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
    286286#endif
    287287    killLastResultRegister();
     
    293293{
    294294#if ENABLE(OPCODE_SAMPLING)
    295     store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
    296 #endif
    297     restoreArgumentReference();
    298     emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
    299     JmpSrc ctiCall = call();
    300     m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
    301 #if ENABLE(OPCODE_SAMPLING)
    302     store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
     295    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
     296#endif
     297    restoreArgumentReference();
     298    emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
     299    JmpSrc ctiCall = call();
     300    m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
     301#if ENABLE(OPCODE_SAMPLING)
     302    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
    303303#endif
    304304    killLastResultRegister();
     
    310310{
    311311#if ENABLE(OPCODE_SAMPLING)
    312     store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
    313 #endif
    314     restoreArgumentReference();
    315     emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
    316     JmpSrc ctiCall = call();
    317     m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
    318 #if ENABLE(OPCODE_SAMPLING)
    319     store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
     312    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
     313#endif
     314    restoreArgumentReference();
     315    emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
     316    JmpSrc ctiCall = call();
     317    m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
     318#if ENABLE(OPCODE_SAMPLING)
     319    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
    320320#endif
    321321    killLastResultRegister();
     
    327327{
    328328#if ENABLE(OPCODE_SAMPLING)
    329     store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
    330 #endif
    331     restoreArgumentReference();
    332     emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
    333     JmpSrc ctiCall = call();
    334     m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
    335 #if ENABLE(OPCODE_SAMPLING)
    336     store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
     329    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
     330#endif
     331    restoreArgumentReference();
     332    emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
     333    JmpSrc ctiCall = call();
     334    m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
     335#if ENABLE(OPCODE_SAMPLING)
     336    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
    337337#endif
    338338    killLastResultRegister();
  • trunk/JavaScriptCore/jit/JITPropertyAccess.cpp

    r39020 r39070  
    115115    emitGetVirtualRegister(baseVReg, X86::eax, i);
    116116
    117     ASSERT(m_codeBlock->propertyAccessInstructions[propertyAccessInstructionIndex].bytecodeIndex == i);
     117    ASSERT(m_codeBlock->propertyAccessInstruction(propertyAccessInstructionIndex).bytecodeIndex == i);
    118118
    119119    emitJumpSlowCaseIfNotJSCell(X86::eax, i, baseVReg);
     
    156156
    157157    // Track the location of the call; this will be used to recover repatch information.
    158     ASSERT(m_codeBlock->propertyAccessInstructions[propertyAccessInstructionIndex].bytecodeIndex == i);
     158    ASSERT(m_codeBlock->propertyAccessInstruction(propertyAccessInstructionIndex).bytecodeIndex == i);
    159159    m_propertyAccessCompilationInfo[propertyAccessInstructionIndex].callReturnLocation = call;
    160160}
     
    168168    emitGetVirtualRegisters(baseVReg, X86::eax, valueVReg, X86::edx, i);
    169169
    170     ASSERT(m_codeBlock->propertyAccessInstructions[propertyAccessInstructionIndex].bytecodeIndex == i);
     170    ASSERT(m_codeBlock->propertyAccessInstruction(propertyAccessInstructionIndex).bytecodeIndex == i);
    171171
    172172    // Jump to a slow case if either the base object is an immediate, or if the Structure does not match.
     
    199199
    200200    // Track the location of the call; this will be used to recover repatch information.
    201     ASSERT(m_codeBlock->propertyAccessInstructions[propertyAccessInstructionIndex].bytecodeIndex == i);
     201    ASSERT(m_codeBlock->propertyAccessInstruction(propertyAccessInstructionIndex).bytecodeIndex == i);
    202202    m_propertyAccessCompilationInfo[propertyAccessInstructionIndex].callReturnLocation = call;
    203203}
  • trunk/JavaScriptCore/parser/Nodes.cpp

    r38975 r39070  
    24662466    m_code.set(new EvalCodeBlock(this, globalObject, source().provider()));
    24672467
    2468     BytecodeGenerator generator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable, m_code.get());
     2468    BytecodeGenerator generator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable(), m_code.get());
    24692469    generator.generate();
    24702470
     
    25502550    m_code.set(new CodeBlock(this, FunctionCode, source().provider(), source().startOffset()));
    25512551
    2552     BytecodeGenerator generator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable, m_code.get());
     2552    BytecodeGenerator generator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable(), m_code.get());
    25532553    generator.generate();
    25542554
  • trunk/JavaScriptCore/runtime/Arguments.h

    r38825 r39070  
    108108   
    109109        CodeBlock* codeBlock = &function->body()->generatedBytecode();
    110         int numParameters = codeBlock->numParameters;
     110        int numParameters = codeBlock->m_numParameters;
    111111        argc = callFrame->argumentCount();
    112112
     
    207207        ASSERT(!d()->registerArray);
    208208
    209         size_t numParametersMinusThis = d()->functionBody->generatedBytecode().numParameters - 1;
    210         size_t numVars = d()->functionBody->generatedBytecode().numVars;
     209        size_t numParametersMinusThis = d()->functionBody->generatedBytecode().m_numParameters - 1;
     210        size_t numVars = d()->functionBody->generatedBytecode().m_numVars;
    211211        size_t numLocals = numVars + numParametersMinusThis;
    212212
  • trunk/JavaScriptCore/runtime/ExceptionHelpers.cpp

    r38528 r39070  
    9696    UString message = "Can't find variable: ";
    9797    message.append(ident.ustring());
    98     JSObject* exception = Error::create(exec, ReferenceError, message, line, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->sourceURL());
     98    JSObject* exception = Error::create(exec, ReferenceError, message, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
    9999    exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
    100100    exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
     
    107107static UString createErrorMessage(ExecState* exec, CodeBlock* codeBlock, int, int expressionStart, int expressionStop, JSValue* value, UString error)
    108108{
    109     if (!expressionStop || expressionStart > codeBlock->source->length()) {
     109    if (!expressionStop || expressionStart > codeBlock->source()->length()) {
    110110        UString errorText = value->toString(exec);
    111111        errorText.append(" is ");
     
    118118    if (expressionStart < expressionStop) {
    119119        errorText.append('\'');
    120         errorText.append(codeBlock->source->getRange(expressionStart, expressionStop));
     120        errorText.append(codeBlock->source()->getRange(expressionStart, expressionStop));
    121121        errorText.append("' [");
    122122        errorText.append(value->toString(exec));
     
    124124    } else {
    125125        // No range information, so give a few characters of context
    126         const UChar* data = codeBlock->source->data();
    127         int dataLength = codeBlock->source->length();
     126        const UChar* data = codeBlock->source()->data();
     127        int dataLength = codeBlock->source()->length();
    128128        int start = expressionStart;
    129129        int stop = expressionStart;
     
    139139            stop--;
    140140        errorText.append("near '...");
    141         errorText.append(codeBlock->source->getRange(start, stop));
     141        errorText.append(codeBlock->source()->getRange(start, stop));
    142142        errorText.append("...' [");
    143143        errorText.append(value->toString(exec));
     
    160160    int line = codeBlock->expressionRangeForVPC(vPC, divotPoint, startOffset, endOffset);
    161161    UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint, divotPoint + endOffset, value, message);
    162     JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->sourceURL());
     162    JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
    163163    exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
    164164    exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
     
    176176    // We're in a "new" expression, so we need to skip over the "new.." part
    177177    int startPoint = divotPoint - (startOffset ? startOffset - 4 : 0); // -4 for "new "
    178     const UChar* data = codeBlock->source->data();
     178    const UChar* data = codeBlock->source()->data();
    179179    while (startPoint < divotPoint && isStrWhiteSpace(data[startPoint]))
    180180        startPoint++;
    181181   
    182182    UString errorMessage = createErrorMessage(exec, codeBlock, line, startPoint, divotPoint, value, "not a constructor");
    183     JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->sourceURL());
     183    JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
    184184    exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
    185185    exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
     
    195195    int line = codeBlock->expressionRangeForVPC(vPC, divotPoint, startOffset, endOffset);
    196196    UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, value, "not a function");
    197     JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->sourceURL());   
     197    JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());   
    198198    exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
    199199    exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
     
    219219    int line = codeBlock->expressionRangeForVPC(vPC, divotPoint, startOffset, endOffset);
    220220    UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, error->isNull() ? jsNull() : jsUndefined(), "not an object");
    221     JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->sourceURL());
     221    JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
    222222    exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
    223223    exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
  • trunk/JavaScriptCore/runtime/JSActivation.cpp

    r38511 r39070  
    5858        return;
    5959
    60     size_t numParametersMinusThis = d()->functionBody->generatedBytecode().numParameters - 1;
     60    size_t numParametersMinusThis = d()->functionBody->generatedBytecode().m_numParameters - 1;
    6161
    6262    size_t i = 0;
     
    6868    }
    6969
    70     size_t numVars = d()->functionBody->generatedBytecode().numVars;
     70    size_t numVars = d()->functionBody->generatedBytecode().m_numVars;
    7171
    7272    // Skip the call frame, which sits between the parameters and vars.
  • trunk/JavaScriptCore/runtime/JSActivation.h

    r38440 r39070  
    7070        struct JSActivationData : public JSVariableObjectData {
    7171            JSActivationData(PassRefPtr<FunctionBodyNode> functionBody, Register* registers)
    72                 : JSVariableObjectData(&functionBody->generatedBytecode().symbolTable, registers)
     72                : JSVariableObjectData(&functionBody->generatedBytecode().symbolTable(), registers)
    7373                , functionBody(functionBody)
    7474            {
  • trunk/JavaScriptCore/runtime/JSGlobalObject.cpp

    r38511 r39070  
    113113    HashSet<ProgramCodeBlock*>::const_iterator end = codeBlocks().end();
    114114    for (HashSet<ProgramCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
    115         (*it)->globalObject = 0;
     115        (*it)->clearGlobalObject();
    116116       
    117117    RegisterFile& registerFile = globalData()->interpreter->registerFile();
Note: See TracChangeset for help on using the changeset viewer.