2008-12-05 Sam Weinig <sam@webkit.org>
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 6 Dec 2008 22:01:05 +0000 (22:01 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 6 Dec 2008 22:01:05 +0000 (22:01 +0000)
        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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@39070 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/bytecode/CodeBlock.cpp
JavaScriptCore/bytecode/CodeBlock.h
JavaScriptCore/bytecode/SamplingTool.cpp
JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
JavaScriptCore/bytecompiler/BytecodeGenerator.h
JavaScriptCore/bytecompiler/Label.h
JavaScriptCore/interpreter/CallFrame.cpp
JavaScriptCore/interpreter/Interpreter.cpp
JavaScriptCore/jit/JIT.cpp
JavaScriptCore/jit/JITCall.cpp
JavaScriptCore/jit/JITInlineMethods.h
JavaScriptCore/jit/JITPropertyAccess.cpp
JavaScriptCore/parser/Nodes.cpp
JavaScriptCore/runtime/Arguments.h
JavaScriptCore/runtime/ExceptionHelpers.cpp
JavaScriptCore/runtime/JSActivation.cpp
JavaScriptCore/runtime/JSActivation.h
JavaScriptCore/runtime/JSGlobalObject.cpp

index 672f04f..06cced3 100644 (file)
@@ -1,3 +1,115 @@
+2008-12-05  Sam Weinig  <sam@webkit.org>
+
+        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.
+
 2008-12-05  Gavin Barraclough  <barraclough@apple.com>
 
         Reviewed by Oliver Hunt.
index be4a10e..66c17f7 100644 (file)
@@ -127,7 +127,7 @@ NEVER_INLINE static const char* debugHookName(int debugHookID)
     return "";
 }
 
-static int jumpTarget(const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator& it, int offset)
+static int locationForOffset(const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator& it, int offset)
 {
     return it - begin + offset;
 }
@@ -152,37 +152,37 @@ static void printConditionalJump(const Vector<Instruction>::const_iterator& begi
 {
     int r0 = (++it)->u.operand;
     int offset = (++it)->u.operand;
-    printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(r0).c_str(), offset, jumpTarget(begin, it, offset));
+    printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(r0).c_str(), offset, locationForOffset(begin, it, offset));
 }
 
-static void printGetByIdOp(int location, Vector<Instruction>::const_iterator& it, const Vector<Identifier>& identifiers, const char* op)
+static void printGetByIdOp(int location, Vector<Instruction>::const_iterator& it, const Vector<Identifier>& m_identifiers, const char* op)
 {
     int r0 = (++it)->u.operand;
     int r1 = (++it)->u.operand;
     int id0 = (++it)->u.operand;
-    printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str());
+    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());
     it += 4;
 }
 
-static void printPutByIdOp(int location, Vector<Instruction>::const_iterator& it, const Vector<Identifier>& identifiers, const char* op)
+static void printPutByIdOp(int location, Vector<Instruction>::const_iterator& it, const Vector<Identifier>& m_identifiers, const char* op)
 {
     int r0 = (++it)->u.operand;
     int id0 = (++it)->u.operand;
     int r1 = (++it)->u.operand;
-    printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str());
+    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());
     it += 4;
 }
 
 void CodeBlock::printStructure(const char* name, const Instruction* vPC, int operand) const
 {
-    unsigned instructionOffset = vPC - instructions.begin();
+    unsigned instructionOffset = vPC - m_instructions.begin();
     printf("  [%4d] %s: %s\n", instructionOffset, name, pointerToSourceString(vPC[operand].u.structure).UTF8String().c_str());
 }
 
 void CodeBlock::printStructures(const Instruction* vPC) const
 {
-    Interpreter* interpreter = globalData->interpreter;
-    unsigned instructionOffset = vPC - instructions.begin();
+    Interpreter* interpreter = m_globalData->interpreter;
+    unsigned instructionOffset = vPC - m_instructions.begin();
 
     if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id)) {
         printStructure("get_by_id", vPC, 4);
@@ -217,91 +217,91 @@ void CodeBlock::printStructures(const Instruction* vPC) const
         return;
     }
 
-    // These instructions doesn't ref Structures.
+    // These m_instructions doesn't ref Structures.
     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));
 }
 
 void CodeBlock::dump(ExecState* exec) const
 {
-    Vector<Instruction>::const_iterator begin = instructions.begin();
-    Vector<Instruction>::const_iterator end = instructions.end();
+    Vector<Instruction>::const_iterator begin = m_instructions.begin();
+    Vector<Instruction>::const_iterator end = m_instructions.end();
 
     size_t instructionCount = 0;
     for (Vector<Instruction>::const_iterator it = begin; it != end; ++it)
         if (exec->interpreter()->isOpcode(it->u.opcode))
             ++instructionCount;
 
-    printf("%lu instructions; %lu bytes at %p; %d parameter(s); %d callee register(s)\n\n",
+    printf("%lu m_instructions; %lu bytes at %p; %d parameter(s); %d callee register(s)\n\n",
         static_cast<unsigned long>(instructionCount),
-        static_cast<unsigned long>(instructions.size() * sizeof(Instruction)),
-        this, numParameters, numCalleeRegisters);
+        static_cast<unsigned long>(m_instructions.size() * sizeof(Instruction)),
+        this, m_numParameters, m_numCalleeRegisters);
     
     for (Vector<Instruction>::const_iterator it = begin; it != end; ++it)
         dump(exec, begin, it);
 
-    if (identifiers.size()) {
+    if (!m_identifiers.isEmpty()) {
         printf("\nIdentifiers:\n");
         size_t i = 0;
         do {
-            printf("  id%u = %s\n", static_cast<unsigned>(i), identifiers[i].ascii());
+            printf("  id%u = %s\n", static_cast<unsigned>(i), m_identifiers[i].ascii());
             ++i;
-        } while (i != identifiers.size());
+        } while (i != m_identifiers.size());
     }
 
-    if (constantRegisters.size()) {
+    if (!m_constantRegisters.isEmpty()) {
         printf("\nConstants:\n");
-        unsigned registerIndex = numVars;
+        unsigned registerIndex = m_numVars;
         size_t i = 0;
         do {
-            printf("   r%u = %s\n", registerIndex, valueToSourceString(exec, constantRegisters[i].jsValue(exec)).ascii());
+            printf("   r%u = %s\n", registerIndex, valueToSourceString(exec, m_constantRegisters[i].jsValue(exec)).ascii());
             ++i;
             ++registerIndex;
-        } while (i < constantRegisters.size());
+        } while (i < m_constantRegisters.size());
     }
 
-    if (unexpectedConstants.size()) {
+    if (!m_unexpectedConstants.isEmpty()) {
         printf("\nUnexpected Constants:\n");
         size_t i = 0;
         do {
-            printf("  k%u = %s\n", static_cast<unsigned>(i), valueToSourceString(exec, unexpectedConstants[i]).ascii());
+            printf("  k%u = %s\n", static_cast<unsigned>(i), valueToSourceString(exec, m_unexpectedConstants[i]).ascii());
             ++i;
-        } while (i < unexpectedConstants.size());
+        } while (i < m_unexpectedConstants.size());
     }
     
-    if (regexps.size()) {
-        printf("\nRegExps:\n");
+    if (!m_regexps.isEmpty()) {
+        printf("\nm_regexps:\n");
         size_t i = 0;
         do {
-            printf("  re%u = %s\n", static_cast<unsigned>(i), regexpToSourceString(regexps[i].get()).ascii());
+            printf("  re%u = %s\n", static_cast<unsigned>(i), regexpToSourceString(m_regexps[i].get()).ascii());
             ++i;
-        } while (i < regexps.size());
+        } while (i < m_regexps.size());
     }
 
-    if (globalResolveInstructions.size() || propertyAccessInstructions.size())
+    if (!m_globalResolveInstructions.isEmpty() || !m_propertyAccessInstructions.isEmpty())
         printf("\nStructures:\n");
 
-    if (globalResolveInstructions.size()) {
+    if (!m_globalResolveInstructions.isEmpty()) {
         size_t i = 0;
         do {
-             printStructures(&instructions[globalResolveInstructions[i]]);
+             printStructures(&m_instructions[m_globalResolveInstructions[i]]);
              ++i;
-        } while (i < globalResolveInstructions.size());
+        } while (i < m_globalResolveInstructions.size());
     }
-    if (propertyAccessInstructions.size()) {
+    if (!m_propertyAccessInstructions.isEmpty()) {
         size_t i = 0;
         do {
-             printStructures(&instructions[propertyAccessInstructions[i].bytecodeIndex]);
+             printStructures(&m_instructions[m_propertyAccessInstructions[i].bytecodeIndex]);
              ++i;
-        } while (i < propertyAccessInstructions.size());
+        } while (i < m_propertyAccessInstructions.size());
     }
  
-    if (exceptionHandlers.size()) {
+    if (!m_exceptionHandlers.isEmpty()) {
         printf("\nException Handlers:\n");
         unsigned i = 0;
         do {
-            printf("\t %d: { start: [%4d] end: [%4d] target: [%4d] }\n", i + 1, exceptionHandlers[i].start, exceptionHandlers[i].end, exceptionHandlers[i].target);
+            printf("\t %d: { start: [%4d] end: [%4d] target: [%4d] }\n", i + 1, m_exceptionHandlers[i].start, m_exceptionHandlers[i].end, m_exceptionHandlers[i].target);
             ++i;
-        } while (i < exceptionHandlers.size());
+        } while (i < m_exceptionHandlers.size());
     }
     
     if (!m_immediateSwitchJumpTables.isEmpty()) {
@@ -381,7 +381,7 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
         case op_unexpected_load: {
             int r0 = (++it)->u.operand;
             int k0 = (++it)->u.operand;
-            printf("[%4d] unexpected_load\t %s, %s\n", location, registerName(r0).c_str(), constantName(exec, k0, unexpectedConstants[k0]).c_str());
+            printf("[%4d] unexpected_load\t %s, %s\n", location, registerName(r0).c_str(), constantName(exec, k0, m_unexpectedConstants[k0]).c_str());
             break;
         }
         case op_new_object: {
@@ -399,7 +399,7 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
         case op_new_regexp: {
             int r0 = (++it)->u.operand;
             int re0 = (++it)->u.operand;
-            printf("[%4d] new_regexp\t %s, %s\n", location, registerName(r0).c_str(), regexpName(re0, regexps[re0].get()).c_str());
+            printf("[%4d] new_regexp\t %s, %s\n", location, registerName(r0).c_str(), regexpName(re0, m_regexps[re0].get()).c_str());
             break;
         }
         case op_mov: {
@@ -567,21 +567,21 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
         case op_resolve: {
             int r0 = (++it)->u.operand;
             int id0 = (++it)->u.operand;
-            printf("[%4d] resolve\t\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str());
+            printf("[%4d] resolve\t\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str());
             break;
         }
         case op_resolve_skip: {
             int r0 = (++it)->u.operand;
             int id0 = (++it)->u.operand;
             int skipLevels = (++it)->u.operand;
-            printf("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), skipLevels);
+            printf("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), skipLevels);
             break;
         }
         case op_resolve_global: {
             int r0 = (++it)->u.operand;
             JSValue* scope = static_cast<JSValue*>((++it)->u.jsCell);
             int id0 = (++it)->u.operand;
-            printf("[%4d] resolve_global\t %s, %s, %s\n", location, registerName(r0).c_str(), valueToSourceString(exec, scope).ascii(), idName(id0, identifiers[id0]).c_str());
+            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());
             it += 2;
             break;
         }
@@ -616,94 +616,94 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
         case op_resolve_base: {
             int r0 = (++it)->u.operand;
             int id0 = (++it)->u.operand;
-            printf("[%4d] resolve_base\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str());
+            printf("[%4d] resolve_base\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str());
             break;
         }
         case op_resolve_with_base: {
             int r0 = (++it)->u.operand;
             int r1 = (++it)->u.operand;
             int id0 = (++it)->u.operand;
-            printf("[%4d] resolve_with_base %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str());
+            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());
             break;
         }
         case op_resolve_func: {
             int r0 = (++it)->u.operand;
             int r1 = (++it)->u.operand;
             int id0 = (++it)->u.operand;
-            printf("[%4d] resolve_func\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str());
+            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());
             break;
         }
         case op_get_by_id: {
-            printGetByIdOp(location, it, identifiers, "get_by_id");
+            printGetByIdOp(location, it, m_identifiers, "get_by_id");
             break;
         }
         case op_get_by_id_self: {
-            printGetByIdOp(location, it, identifiers, "get_by_id_self");
+            printGetByIdOp(location, it, m_identifiers, "get_by_id_self");
             break;
         }
         case op_get_by_id_self_list: {
-            printGetByIdOp(location, it, identifiers, "get_by_id_self_list");
+            printGetByIdOp(location, it, m_identifiers, "get_by_id_self_list");
             break;
         }
         case op_get_by_id_proto: {
-            printGetByIdOp(location, it, identifiers, "get_by_id_proto");
+            printGetByIdOp(location, it, m_identifiers, "get_by_id_proto");
             break;
         }
         case op_get_by_id_proto_list: {
-            printGetByIdOp(location, it, identifiers, "op_get_by_id_proto_list");
+            printGetByIdOp(location, it, m_identifiers, "op_get_by_id_proto_list");
             break;
         }
         case op_get_by_id_chain: {
-            printGetByIdOp(location, it, identifiers, "get_by_id_chain");
+            printGetByIdOp(location, it, m_identifiers, "get_by_id_chain");
             break;
         }
         case op_get_by_id_generic: {
-            printGetByIdOp(location, it, identifiers, "get_by_id_generic");
+            printGetByIdOp(location, it, m_identifiers, "get_by_id_generic");
             break;
         }
         case op_get_array_length: {
-            printGetByIdOp(location, it, identifiers, "get_array_length");
+            printGetByIdOp(location, it, m_identifiers, "get_array_length");
             break;
         }
         case op_get_string_length: {
-            printGetByIdOp(location, it, identifiers, "get_string_length");
+            printGetByIdOp(location, it, m_identifiers, "get_string_length");
             break;
         }
         case op_put_by_id: {
-            printPutByIdOp(location, it, identifiers, "put_by_id");
+            printPutByIdOp(location, it, m_identifiers, "put_by_id");
             break;
         }
         case op_put_by_id_replace: {
-            printPutByIdOp(location, it, identifiers, "put_by_id_replace");
+            printPutByIdOp(location, it, m_identifiers, "put_by_id_replace");
             break;
         }
         case op_put_by_id_transition: {
-            printPutByIdOp(location, it, identifiers, "put_by_id_transition");
+            printPutByIdOp(location, it, m_identifiers, "put_by_id_transition");
             break;
         }
         case op_put_by_id_generic: {
-            printPutByIdOp(location, it, identifiers, "put_by_id_generic");
+            printPutByIdOp(location, it, m_identifiers, "put_by_id_generic");
             break;
         }
         case op_put_getter: {
             int r0 = (++it)->u.operand;
             int id0 = (++it)->u.operand;
             int r1 = (++it)->u.operand;
-            printf("[%4d] put_getter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str());
+            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());
             break;
         }
         case op_put_setter: {
             int r0 = (++it)->u.operand;
             int id0 = (++it)->u.operand;
             int r1 = (++it)->u.operand;
-            printf("[%4d] put_setter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str());
+            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());
             break;
         }
         case op_del_by_id: {
             int r0 = (++it)->u.operand;
             int r1 = (++it)->u.operand;
             int id0 = (++it)->u.operand;
-            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());
+            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());
             break;
         }
         case op_get_by_val: {
@@ -736,12 +736,12 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
         }
         case op_jmp: {
             int offset = (++it)->u.operand;
-            printf("[%4d] jmp\t\t %d(->%d)\n", location, offset, jumpTarget(begin, it, offset));
+            printf("[%4d] jmp\t\t %d(->%d)\n", location, offset, locationForOffset(begin, it, offset));
             break;
         }
         case op_loop: {
             int offset = (++it)->u.operand;
-            printf("[%4d] loop\t\t %d(->%d)\n", location, offset, jumpTarget(begin, it, offset));
+            printf("[%4d] loop\t\t %d(->%d)\n", location, offset, locationForOffset(begin, it, offset));
             break;
         }
         case op_jtrue: {
@@ -768,42 +768,42 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
             int r0 = (++it)->u.operand;
             int r1 = (++it)->u.operand;
             int offset = (++it)->u.operand;
-            printf("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, jumpTarget(begin, it, offset));
+            printf("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, locationForOffset(begin, it, offset));
             break;
         }
         case op_loop_if_less: {
             int r0 = (++it)->u.operand;
             int r1 = (++it)->u.operand;
             int offset = (++it)->u.operand;
-            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));
+            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));
             break;
         }
         case op_loop_if_lesseq: {
             int r0 = (++it)->u.operand;
             int r1 = (++it)->u.operand;
             int offset = (++it)->u.operand;
-            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));
+            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));
             break;
         }
         case op_switch_imm: {
             int tableIndex = (++it)->u.operand;
             int defaultTarget = (++it)->u.operand;
             int scrutineeRegister = (++it)->u.operand;
-            printf("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, jumpTarget(begin, it, defaultTarget), registerName(scrutineeRegister).c_str());
+            printf("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, locationForOffset(begin, it, defaultTarget), registerName(scrutineeRegister).c_str());
             break;
         }
         case op_switch_char: {
             int tableIndex = (++it)->u.operand;
             int defaultTarget = (++it)->u.operand;
             int scrutineeRegister = (++it)->u.operand;
-            printf("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, jumpTarget(begin, it, defaultTarget), registerName(scrutineeRegister).c_str());
+            printf("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, locationForOffset(begin, it, defaultTarget), registerName(scrutineeRegister).c_str());
             break;
         }
         case op_switch_string: {
             int tableIndex = (++it)->u.operand;
             int defaultTarget = (++it)->u.operand;
             int scrutineeRegister = (++it)->u.operand;
-            printf("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, jumpTarget(begin, it, defaultTarget), registerName(scrutineeRegister).c_str());
+            printf("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, locationForOffset(begin, it, defaultTarget), registerName(scrutineeRegister).c_str());
             break;
         }
         case op_new_func: {
@@ -874,7 +874,7 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
             int dest = (++it)->u.operand;
             int iter = (++it)->u.operand;
             int offset = (++it)->u.operand;
-            printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(dest).c_str(), registerName(iter).c_str(), offset, jumpTarget(begin, it, offset));
+            printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(dest).c_str(), registerName(iter).c_str(), offset, locationForOffset(begin, it, offset));
             break;
         }
         case op_push_scope: {
@@ -890,13 +890,13 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
             int r0 = (++it)->u.operand;
             int id0 = (++it)->u.operand;
             int r1 = (++it)->u.operand;
-            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());
+            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());
             break;
         }
         case op_jmp_scopes: {
             int scopeDelta = (++it)->u.operand;
             int offset = (++it)->u.operand;
-            printf("[%4d] jmp_scopes\t^%d, %d(->%d)\n", location, scopeDelta, offset, jumpTarget(begin, it, offset));
+            printf("[%4d] jmp_scopes\t^%d, %d(->%d)\n", location, scopeDelta, offset, locationForOffset(begin, it, offset));
             break;
         }
         case op_catch: {
@@ -913,13 +913,13 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
             int r0 = (++it)->u.operand;
             int errorType = (++it)->u.operand;
             int k0 = (++it)->u.operand;
-            printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(r0).c_str(), errorType, constantName(exec, k0, unexpectedConstants[k0]).c_str());
+            printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(r0).c_str(), errorType, constantName(exec, k0, m_unexpectedConstants[k0]).c_str());
             break;
         }
         case op_jsr: {
             int retAddrDst = (++it)->u.operand;
             int offset = (++it)->u.operand;
-            printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName(retAddrDst).c_str(), offset, jumpTarget(begin, it, offset));
+            printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName(retAddrDst).c_str(), offset, locationForOffset(begin, it, offset));
             break;
         }
         case op_sret: {
@@ -956,18 +956,17 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator&
 
 CodeBlock::~CodeBlock()
 {
-    for (size_t size = globalResolveInstructions.size(), i = 0; i < size; ++i) {
-        derefStructures(&instructions[globalResolveInstructions[i]]);
-    }
+    for (size_t size = m_globalResolveInstructions.size(), i = 0; i < size; ++i)
+        derefStructures(&m_instructions[m_globalResolveInstructions[i]]);
 
-    for (size_t size = propertyAccessInstructions.size(), i = 0; i < size; ++i) {
-        derefStructures(&instructions[propertyAccessInstructions[i].bytecodeIndex]);
-        if (propertyAccessInstructions[i].stubRoutine)
-            WTF::fastFreeExecutable(propertyAccessInstructions[i].stubRoutine);
+    for (size_t size = m_propertyAccessInstructions.size(), i = 0; i < size; ++i) {
+        derefStructures(&m_instructions[m_propertyAccessInstructions[i].bytecodeIndex]);
+        if (m_propertyAccessInstructions[i].stubRoutine)
+            WTF::fastFreeExecutable(m_propertyAccessInstructions[i].stubRoutine);
     }
 
-    for (size_t size = callLinkInfos.size(), i = 0; i < size; ++i) {
-        CallLinkInfo* callLinkInfo = &callLinkInfos[i];
+    for (size_t size = m_callLinkInfos.size(), i = 0; i < size; ++i) {
+        CallLinkInfo* callLinkInfo = &m_callLinkInfos[i];
         if (callLinkInfo->isLinked())
             callLinkInfo->callee->removeCaller(callLinkInfo);
     }
@@ -975,27 +974,27 @@ CodeBlock::~CodeBlock()
 #if ENABLE(JIT) 
     unlinkCallers();
 
-    if (ctiCode)
-        WTF::fastFreeExecutable(ctiCode);
+    if (m_jitCode)
+        WTF::fastFreeExecutable(m_jitCode);
 #endif
 }
 
 #if ENABLE(JIT) 
 void CodeBlock::unlinkCallers()
 {
-    size_t size = linkedCallerList.size();
+    size_t size = m_linkedCallerList.size();
     for (size_t i = 0; i < size; ++i) {
-        CallLinkInfo* currentCaller = linkedCallerList[i];
+        CallLinkInfo* currentCaller = m_linkedCallerList[i];
         JIT::unlinkCall(currentCaller);
         currentCaller->setUnlinked();
     }
-    linkedCallerList.clear();
+    m_linkedCallerList.clear();
 }
 #endif
 
 void CodeBlock::derefStructures(Instruction* vPC) const
 {
-    Interpreter* interpreter = globalData->interpreter;
+    Interpreter* interpreter = m_globalData->interpreter;
 
     if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) {
         vPC[4].u.structure->deref();
@@ -1040,7 +1039,7 @@ void CodeBlock::derefStructures(Instruction* vPC) const
 
 void CodeBlock::refStructures(Instruction* vPC) const
 {
-    Interpreter* interpreter = globalData->interpreter;
+    Interpreter* interpreter = m_globalData->interpreter;
 
     if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) {
         vPC[4].u.structure->ref();
@@ -1073,34 +1072,34 @@ void CodeBlock::refStructures(Instruction* vPC) const
 
 void CodeBlock::mark()
 {
-    for (size_t i = 0; i < constantRegisters.size(); ++i)
-        if (!constantRegisters[i].marked())
-            constantRegisters[i].mark();
+    for (size_t i = 0; i < m_constantRegisters.size(); ++i)
+        if (!m_constantRegisters[i].marked())
+            m_constantRegisters[i].mark();
 
-    for (size_t i = 0; i < unexpectedConstants.size(); ++i)
-        if (!unexpectedConstants[i]->marked())
-            unexpectedConstants[i]->mark();
+    for (size_t i = 0; i < m_unexpectedConstants.size(); ++i)
+        if (!m_unexpectedConstants[i]->marked())
+            m_unexpectedConstants[i]->mark();
 
-    for (size_t i = 0; i < functions.size(); ++i)
-        functions[i]->body()->mark();
+    for (size_t i = 0; i < m_functions.size(); ++i)
+        m_functions[i]->body()->mark();
 
-    for (size_t i = 0; i < functionExpressions.size(); ++i)
-        functionExpressions[i]->body()->mark();
+    for (size_t i = 0; i < m_functionExpressions.size(); ++i)
+        m_functionExpressions[i]->body()->mark();
 }
 
 bool CodeBlock::getHandlerForVPC(const Instruction* vPC, Instruction*& target, int& scopeDepth)
 {
-    Vector<HandlerInfo>::iterator ptr = exceptionHandlers.begin(); 
-    Vector<HandlerInfo>::iterator end = exceptionHandlers.end();
-    unsigned addressOffset = vPC - instructions.begin();
-    ASSERT(addressOffset < instructions.size());
+    Vector<HandlerInfo>::iterator ptr = m_exceptionHandlers.begin(); 
+    Vector<HandlerInfo>::iterator end = m_exceptionHandlers.end();
+    unsigned addressOffset = vPC - m_instructions.begin();
+    ASSERT(addressOffset < m_instructions.size());
     
     for (; ptr != end; ++ptr) {
         // Handlers are ordered innermost first, so the first handler we encounter
         // that contains the source address is the correct handler to use.
         if (ptr->start <= addressOffset && ptr->end >= addressOffset) {
             scopeDepth = ptr->scopeDepth;
-            target = instructions.begin() + ptr->target;
+            target = m_instructions.begin() + ptr->target;
             return true;
         }
     }
@@ -1109,11 +1108,11 @@ bool CodeBlock::getHandlerForVPC(const Instruction* vPC, Instruction*& target, i
 
 void* CodeBlock::nativeExceptionCodeForHandlerVPC(const Instruction* handlerVPC)
 {
-    Vector<HandlerInfo>::iterator ptr = exceptionHandlers.begin(); 
-    Vector<HandlerInfo>::iterator end = exceptionHandlers.end();
+    Vector<HandlerInfo>::iterator ptr = m_exceptionHandlers.begin(); 
+    Vector<HandlerInfo>::iterator end = m_exceptionHandlers.end();
     
     for (; ptr != end; ++ptr) {
-        Instruction*target = instructions.begin() + ptr->target;
+        Instruction*target = m_instructions.begin() + ptr->target;
         if (handlerVPC == target)
             return ptr->nativeCode;
     }
@@ -1123,33 +1122,33 @@ void* CodeBlock::nativeExceptionCodeForHandlerVPC(const Instruction* handlerVPC)
 
 int CodeBlock::lineNumberForVPC(const Instruction* vPC)
 {
-    unsigned instructionOffset = vPC - instructions.begin();
-    ASSERT(instructionOffset < instructions.size());
+    unsigned instructionOffset = vPC - m_instructions.begin();
+    ASSERT(instructionOffset < m_instructions.size());
 
-    if (!lineInfo.size())
-        return ownerNode->source().firstLine(); // Empty function
+    if (!m_lineInfo.size())
+        return m_ownerNode->source().firstLine(); // Empty function
 
     int low = 0;
-    int high = lineInfo.size();
+    int high = m_lineInfo.size();
     while (low < high) {
         int mid = low + (high - low) / 2;
-        if (lineInfo[mid].instructionOffset <= instructionOffset)
+        if (m_lineInfo[mid].instructionOffset <= instructionOffset)
             low = mid + 1;
         else
             high = mid;
     }
     
     if (!low)
-        return ownerNode->source().firstLine();
-    return lineInfo[low - 1].lineNumber;
+        return m_ownerNode->source().firstLine();
+    return m_lineInfo[low - 1].lineNumber;
 }
 
 int CodeBlock::expressionRangeForVPC(const Instruction* vPC, int& divot, int& startOffset, int& endOffset)
 {
-    unsigned instructionOffset = vPC - instructions.begin();
-    ASSERT(instructionOffset < instructions.size());
+    unsigned instructionOffset = vPC - m_instructions.begin();
+    ASSERT(instructionOffset < m_instructions.size());
 
-    if (!expressionInfo.size()) {
+    if (!m_expressionInfo.size()) {
         // We didn't think anything could throw.  Apparently we were wrong.
         startOffset = 0;
         endOffset = 0;
@@ -1158,10 +1157,10 @@ int CodeBlock::expressionRangeForVPC(const Instruction* vPC, int& divot, int& st
     }
 
     int low = 0;
-    int high = expressionInfo.size();
+    int high = m_expressionInfo.size();
     while (low < high) {
         int mid = low + (high - low) / 2;
-        if (expressionInfo[mid].instructionOffset <= instructionOffset)
+        if (m_expressionInfo[mid].instructionOffset <= instructionOffset)
             low = mid + 1;
         else
             high = mid;
@@ -1175,28 +1174,32 @@ int CodeBlock::expressionRangeForVPC(const Instruction* vPC, int& divot, int& st
         return lineNumberForVPC(vPC);
     }
 
-    startOffset = expressionInfo[low - 1].startOffset;
-    endOffset = expressionInfo[low - 1].endOffset;
-    divot = expressionInfo[low - 1].divotPoint + sourceOffset;
+    startOffset = m_expressionInfo[low - 1].startOffset;
+    endOffset = m_expressionInfo[low - 1].endOffset;
+    divot = m_expressionInfo[low - 1].divotPoint + m_sourceOffset;
     return lineNumberForVPC(vPC);
 }
 
 void CodeBlock::shrinkToFit()
 {
-    instructions.shrinkToFit();
-    globalResolveInstructions.shrinkToFit();
-    propertyAccessInstructions.shrinkToFit();
-    callLinkInfos.shrinkToFit();
-    linkedCallerList.shrinkToFit();
-    identifiers.shrinkToFit();
-    functions.shrinkToFit();
-    functionExpressions.shrinkToFit();
-    constantRegisters.shrinkToFit();
-    unexpectedConstants.shrinkToFit();
-    regexps.shrinkToFit();
-    exceptionHandlers.shrinkToFit();
-    expressionInfo.shrinkToFit();
-    lineInfo.shrinkToFit();
+    m_instructions.shrinkToFit();
+
+    m_globalResolveInstructions.shrinkToFit();
+    m_propertyAccessInstructions.shrinkToFit();
+    m_callLinkInfos.shrinkToFit();
+    m_linkedCallerList.shrinkToFit();
+
+    m_exceptionHandlers.shrinkToFit();
+    m_expressionInfo.shrinkToFit();
+    m_lineInfo.shrinkToFit();
+
+    m_identifiers.shrinkToFit();
+    m_functions.shrinkToFit();
+    m_functionExpressions.shrinkToFit();
+    m_constantRegisters.shrinkToFit();
+    m_unexpectedConstants.shrinkToFit();
+    m_regexps.shrinkToFit();
+
     m_immediateSwitchJumpTables.shrinkToFit();
     m_characterSwitchJumpTables.shrinkToFit();
     m_stringSwitchJumpTables.shrinkToFit();
index d33ce83..8e6071c 100644 (file)
@@ -215,24 +215,26 @@ namespace JSC {
 #endif
     };
 
-    struct CodeBlock {
+    class CodeBlock {
+        friend class JIT;
+    public:
         CodeBlock(ScopeNode* ownerNode, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset)
-            : ownerNode(ownerNode)
-            , globalData(0)
+            : m_numCalleeRegisters(0)
+            , m_numConstants(0)
+            , m_numVars(0)
+            , m_numParameters(0)
+            , m_ownerNode(ownerNode)
+            , m_globalData(0)
 #if ENABLE(JIT)
-            , ctiCode(0)
+            , m_jitCode(0)
 #endif
-            , numCalleeRegisters(0)
-            , numConstants(0)
-            , numVars(0)
-            , numParameters(0)
-            , needsFullScopeChain(ownerNode->needsActivation())
-            , usesEval(ownerNode->usesEval())
-            , codeType(codeType)
-            , source(sourceProvider)
-            , sourceOffset(sourceOffset)
+            , m_needsFullScopeChain(ownerNode->needsActivation())
+            , m_usesEval(ownerNode->usesEval())
+            , m_codeType(codeType)
+            , m_source(sourceProvider)
+            , m_sourceOffset(sourceOffset)
         {
-            ASSERT(source);
+            ASSERT(m_source);
         }
 
         ~CodeBlock();
@@ -244,25 +246,25 @@ namespace JSC {
         void addCaller(CallLinkInfo* caller)
         {
             caller->callee = this;
-            caller->position = linkedCallerList.size();
-            linkedCallerList.append(caller);
+            caller->position = m_linkedCallerList.size();
+            m_linkedCallerList.append(caller);
         }
 
         void removeCaller(CallLinkInfo* caller)
         {
             unsigned pos = caller->position;
-            unsigned lastPos = linkedCallerList.size() - 1;
+            unsigned lastPos = m_linkedCallerList.size() - 1;
 
             if (pos != lastPos) {
-                linkedCallerList[pos] = linkedCallerList[lastPos];
-                linkedCallerList[pos]->position = pos;
+                m_linkedCallerList[pos] = m_linkedCallerList[lastPos];
+                m_linkedCallerList[pos]->position = pos;
             }
-            linkedCallerList.shrink(lastPos);
+            m_linkedCallerList.shrink(lastPos);
         }
 
         inline bool isKnownNotImmediate(int index)
         {
-            if (index == thisRegister)
+            if (index == m_thisRegister)
                 return true;
 
             if (isConstantRegisterIndex(index))
@@ -273,17 +275,17 @@ namespace JSC {
 
         ALWAYS_INLINE bool isConstantRegisterIndex(int index)
         {
-            return index >= numVars && index < numVars + numConstants;
+            return index >= m_numVars && index < m_numVars + m_numConstants;
         }
 
         ALWAYS_INLINE JSValue* getConstant(int index)
         {
-            return constantRegisters[index - numVars].getJSValue();
+            return m_constantRegisters[index - m_numVars].getJSValue();
         }
 
         ALWAYS_INLINE bool isTemporaryRegisterIndex(int index)
         {
-            return index >= numVars + numConstants;
+            return index >= m_numVars + m_numConstants;
         }
 
 #if !defined(NDEBUG) || ENABLE_OPCODE_SAMPLING
@@ -302,15 +304,92 @@ namespace JSC {
 
         StructureStubInfo& getStubInfo(void* returnAddress)
         {
-            return *(binaryChop<StructureStubInfo, void*, getStructureStubInfoReturnLocation>(propertyAccessInstructions.begin(), propertyAccessInstructions.size(), returnAddress));
+            return *(binaryChop<StructureStubInfo, void*, getStructureStubInfoReturnLocation>(m_propertyAccessInstructions.begin(), m_propertyAccessInstructions.size(), returnAddress));
         }
 
         CallLinkInfo& getCallLinkInfo(void* returnAddress)
         {
-            return *(binaryChop<CallLinkInfo, void*, getCallLinkInfoReturnLocation>(callLinkInfos.begin(), callLinkInfos.size(), returnAddress));
+            return *(binaryChop<CallLinkInfo, void*, getCallLinkInfoReturnLocation>(m_callLinkInfos.begin(), m_callLinkInfos.size(), returnAddress));
         }
 
-        void shrinkToFit();
+
+        Vector<Instruction>& instructions() { return m_instructions; }
+#if ENABLE(JIT)
+        void setJITCode(void* jitCode) { m_jitCode = jitCode; }
+        void* jitCode() { return m_jitCode; }
+#endif
+
+        ScopeNode* ownerNode() const { return m_ownerNode; }
+
+        void setGlobalData(JSGlobalData* globalData) { m_globalData = globalData; }
+
+        void setThisRegister(int thisRegister) { m_thisRegister = thisRegister; }
+        int thisRegister() const { return m_thisRegister; }
+
+        void setNeedsFullScopeChain(bool needsFullScopeChain) { m_needsFullScopeChain = needsFullScopeChain; }
+        bool needsFullScopeChain() const { return m_needsFullScopeChain; }
+        void setUsesEval(bool usesEval) { m_usesEval = usesEval; }
+        bool usesEval() const { return m_usesEval; }
+        void setUsesArguments(bool usesArguments) { m_usesArguments = usesArguments; }
+        bool usesArguments() const { return m_usesArguments; }
+
+        CodeType codeType() const { return m_codeType; }
+
+        SourceProvider* source() const { return m_source.get(); }
+        unsigned sourceOffset() const { return m_sourceOffset; }
+
+        void addGlobalResolveInstruction(unsigned globalResolveInstructions) { m_globalResolveInstructions.append(globalResolveInstructions); }
+
+        size_t numberOfPropertyAccessInstructions() const { return m_propertyAccessInstructions.size(); }
+        void addPropertyAccessInstruction(unsigned propertyAccessInstructions) { m_propertyAccessInstructions.append(StructureStubInfo(propertyAccessInstructions)); }
+        StructureStubInfo& propertyAccessInstruction(int index) { return m_propertyAccessInstructions[index]; }
+
+        size_t numberOfCallLinkInfos() const { return m_callLinkInfos.size(); }
+        void addCallLinkInfo() { m_callLinkInfos.append(CallLinkInfo()); }
+        CallLinkInfo& callLinkInfo(int index) { return m_callLinkInfos[index]; }
+
+        size_t numberOfJumpTargets() const { return m_jumpTargets.size(); }
+        void addJumpTarget(unsigned jumpTarget) { m_jumpTargets.append(jumpTarget); }
+        unsigned jumpTarget(int index) const { return m_jumpTargets[index]; }
+        unsigned lastJumpTarget() const { return m_jumpTargets.last(); }
+
+        size_t numberOfExceptionHandlers() const { return m_exceptionHandlers.size(); }
+        void addExceptionHandler(const HandlerInfo& hanler) { return m_exceptionHandlers.append(hanler); }
+        HandlerInfo& exceptionHandler(int index) { return m_exceptionHandlers[index]; }
+
+        void addExpressionInfo(const ExpressionRangeInfo& expressionInfo) { return m_expressionInfo.append(expressionInfo); }
+
+        size_t numberOfLineInfos() const { return m_lineInfo.size(); }
+        void addLineInfo(const LineInfo& lineInfo) { return m_lineInfo.append(lineInfo); }
+        LineInfo& lastLineInfo() { return m_lineInfo.last(); }
+
+#if ENABLE(JIT)
+        HashMap<void*, unsigned>& jitReturnAddressVPCMap() { return m_jitReturnAddressVPCMap; }
+#endif
+
+        // Constant Pool
+
+        size_t numberOfIdentifiers() const { return m_identifiers.size(); }
+        void addIdentifier(const Identifier& i) { return m_identifiers.append(i); }
+        Identifier& identifier(int index) { return m_identifiers[index]; }
+
+        size_t numberOfConstantRegisters() const { return m_constantRegisters.size(); }
+        void addConstantRegister(const Register& r) { return m_constantRegisters.append(r); }
+        Register& constantRegister(int index) { return m_constantRegisters[index]; }
+
+        unsigned addFunction(FuncDeclNode* n) { unsigned size = m_functions.size(); m_functions.append(n); return size; }
+        FuncDeclNode* function(int index) const { return m_functions[index].get(); }
+
+        unsigned addFunctionExpression(FuncExprNode* n) { unsigned size = m_functionExpressions.size(); m_functionExpressions.append(n); return size; }
+        FuncExprNode* functionExpression(int index) const { return m_functionExpressions[index].get(); }
+
+        unsigned addUnexpectedConstant(JSValue* v) { unsigned size = m_unexpectedConstants.size(); m_unexpectedConstants.append(v); return size; }
+        JSValue* unexpectedConstant(int index) const { return m_unexpectedConstants[index]; }
+
+        unsigned addRegExp(RegExp* r) { unsigned size = m_regexps.size(); m_regexps.append(r); return size; }
+        RegExp* regexp(int index) const { return m_regexps[index].get(); }
+
+        // Jump Tables
 
         size_t numberOfImmediateSwitchJumpTables() const { return m_immediateSwitchJumpTables.size(); }
         SimpleJumpTable& addImmediateSwitchJumpTable() { m_immediateSwitchJumpTables.append(SimpleJumpTable()); return m_immediateSwitchJumpTables.last(); }
@@ -324,86 +403,106 @@ namespace JSC {
         StringJumpTable& addStringSwitchJumpTable() { m_stringSwitchJumpTables.append(StringJumpTable()); return m_stringSwitchJumpTables.last(); }
         StringJumpTable& stringSwitchJumpTable(int tableIndex) { return m_stringSwitchJumpTables[tableIndex]; }
 
-        ScopeNode* ownerNode;
-        JSGlobalData* globalData;
-#if ENABLE(JIT)
-        void* ctiCode;
-#endif
 
-        int numCalleeRegisters;
+        SymbolTable& symbolTable() { return m_symbolTable; }
+        EvalCodeCache& evalCodeCache() { return m_evalCodeCache; }
 
+        void shrinkToFit();
+
+        // FIXME: Make these remaining members private.
+
+        int m_numCalleeRegisters;
         // NOTE: numConstants holds the number of constant registers allocated
         // by the code generator, not the number of constant registers used.
         // (Duplicate constants are uniqued during code generation, and spare
         // constant registers may be allocated.)
-        int numConstants;
-        int numVars;
-        int numParameters;
-        int thisRegister;
-        bool needsFullScopeChain;
-        bool usesEval;
-        bool usesArguments;
-        CodeType codeType;
-        RefPtr<SourceProvider> source;
-        unsigned sourceOffset;
-
-        Vector<Instruction> instructions;
-        Vector<unsigned> globalResolveInstructions;
-        Vector<StructureStubInfo> propertyAccessInstructions;
-        Vector<CallLinkInfo> callLinkInfos;
-        Vector<CallLinkInfo*> linkedCallerList;
-
-        // Constant pool
-        Vector<Identifier> identifiers;
-        Vector<RefPtr<FuncDeclNode> > functions;
-        Vector<RefPtr<FuncExprNode> > functionExpressions;
-        Vector<Register> constantRegisters;
-        Vector<JSValue*> unexpectedConstants;
-        Vector<RefPtr<RegExp> > regexps;
-        Vector<HandlerInfo> exceptionHandlers;
-        Vector<ExpressionRangeInfo> expressionInfo;
-        Vector<LineInfo> lineInfo;
+        int m_numConstants;
+        int m_numVars;
+        int m_numParameters;
 
+    private:
+#if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING)
+        void dump(ExecState*, const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator&) const;
+#endif
+
+        ScopeNode* m_ownerNode;
+        JSGlobalData* m_globalData;
+
+        Vector<Instruction> m_instructions;
 #if ENABLE(JIT)
-        HashMap<void*, unsigned> ctiReturnAddressVPCMap;
+        void* m_jitCode;
 #endif
 
-        Vector<unsigned> jumpTargets;
+        int m_thisRegister;
 
-        EvalCodeCache evalCodeCache;
+        bool m_needsFullScopeChain;
+        bool m_usesEval;
+        bool m_usesArguments;
 
-        SymbolTable symbolTable;
-    private:
-#if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING)
-        void dump(ExecState*, const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator&) const;
+        CodeType m_codeType;
+
+        RefPtr<SourceProvider> m_source;
+        unsigned m_sourceOffset;
+
+        Vector<unsigned> m_globalResolveInstructions;
+        Vector<StructureStubInfo> m_propertyAccessInstructions;
+        Vector<CallLinkInfo> m_callLinkInfos;
+        Vector<CallLinkInfo*> m_linkedCallerList;
+
+        Vector<unsigned> m_jumpTargets;
+
+        Vector<HandlerInfo> m_exceptionHandlers;
+        Vector<ExpressionRangeInfo> m_expressionInfo;
+        Vector<LineInfo> m_lineInfo;
+
+#if ENABLE(JIT)
+        HashMap<void*, unsigned> m_jitReturnAddressVPCMap;
 #endif
 
+        // Constant Pool
+        Vector<Identifier> m_identifiers;
+        Vector<Register> m_constantRegisters;
+        Vector<RefPtr<FuncDeclNode> > m_functions;
+        Vector<RefPtr<FuncExprNode> > m_functionExpressions;
+        Vector<JSValue*> m_unexpectedConstants;
+        Vector<RefPtr<RegExp> > m_regexps;
+
+        // Jump Tables
         Vector<SimpleJumpTable> m_immediateSwitchJumpTables;
         Vector<SimpleJumpTable> m_characterSwitchJumpTables;
         Vector<StringJumpTable> m_stringSwitchJumpTables;
+
+        SymbolTable m_symbolTable;
+
+        EvalCodeCache m_evalCodeCache;
     };
 
     // Program code is not marked by any function, so we make the global object
     // responsible for marking it.
 
-    struct ProgramCodeBlock : public CodeBlock {
+    class ProgramCodeBlock : public CodeBlock {
+    public:
         ProgramCodeBlock(ScopeNode* ownerNode, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider)
             : CodeBlock(ownerNode, codeType, sourceProvider, 0)
-            , globalObject(globalObject)
+            , m_globalObject(globalObject)
         {
-            globalObject->codeBlocks().add(this);
+            m_globalObject->codeBlocks().add(this);
         }
 
         ~ProgramCodeBlock()
         {
-            if (globalObject)
-                globalObject->codeBlocks().remove(this);
+            if (m_globalObject)
+                m_globalObject->codeBlocks().remove(this);
         }
 
-        JSGlobalObject* globalObject; // For program and eval nodes, the global object that marks the constant pool.
+        void clearGlobalObject() { m_globalObject = 0; }
+
+    private:
+        JSGlobalObject* m_globalObject; // For program and eval nodes, the global object that marks the constant pool.
     };
 
-    struct EvalCodeBlock : public ProgramCodeBlock {
+    class EvalCodeBlock : public ProgramCodeBlock {
+    public:
         EvalCodeBlock(ScopeNode* ownerNode, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider)
             : ProgramCodeBlock(ownerNode, EvalCode, globalObject, sourceProvider)
         {
index b73aa9a..e09c611 100644 (file)
@@ -42,14 +42,14 @@ namespace JSC {
 void ScopeSampleRecord::sample(CodeBlock* codeBlock, Instruction* vPC)
 {
     if (!m_samples) {
-        m_size = codeBlock->instructions.size();
+        m_size = codeBlock->instructions().size();
         m_samples = static_cast<int*>(calloc(m_size, sizeof(int)));
         m_codeBlock = codeBlock;
     }
 
     ++m_sampleCount;
 
-    unsigned offest = vPC - codeBlock->instructions.begin();
+    unsigned offest = vPC - codeBlock->instructions().begin();
     // Since we don't read and write codeBlock and vPC atomically, this check
     // can fail if we sample mid op_call / op_ret.
     if (offest < m_size) {
@@ -248,7 +248,7 @@ void SamplingTool::dump(ExecState* exec)
         double blockPercent = (record->m_sampleCount * 100.0) / m_sampleCount;
 
         if (blockPercent >= 1) {
-            Instruction* code = codeBlock->instructions.begin();
+            Instruction* code = codeBlock->instructions().begin();
             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);
             if (i < 10) {
                 HashMap<unsigned,unsigned> lineCounts;
index 9fd719d..cdeaeac 100644 (file)
@@ -129,7 +129,7 @@ void BytecodeGenerator::setDumpsGeneratedCode(bool dumpsGeneratedCode)
 
 void BytecodeGenerator::generate()
 {
-    m_codeBlock->thisRegister = m_thisRegister.index();
+    m_codeBlock->setThisRegister(m_thisRegister.index());
 
     m_scopeNode->emitBytecode(*this);
 
@@ -154,7 +154,7 @@ bool BytecodeGenerator::addVar(const Identifier& ident, bool isConstant, Registe
         return false;
     }
 
-    ++m_codeBlock->numVars;
+    ++m_codeBlock->m_numVars;
     r0 = newRegister();
     return true;
 }
@@ -178,7 +178,7 @@ bool BytecodeGenerator::addGlobalVar(const Identifier& ident, bool isConstant, R
 
 void BytecodeGenerator::allocateConstants(size_t count)
 {
-    m_codeBlock->numConstants = count;
+    m_codeBlock->m_numConstants = count;
     if (!count)
         return;
     
@@ -206,21 +206,21 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d
     , m_emitNodeDepth(0)
 {
     if (m_shouldEmitDebugHooks)
-        m_codeBlock->needsFullScopeChain = true;
+        m_codeBlock->setNeedsFullScopeChain(true);
 
     emitOpcode(op_enter);
-    codeBlock->globalData = m_globalData;
+    codeBlock->setGlobalData(m_globalData);
 
     // FIXME: Move code that modifies the global object to Interpreter::execute.
     
-    m_codeBlock->numParameters = 1; // Allocate space for "this"
+    m_codeBlock->m_numParameters = 1; // Allocate space for "this"
 
     JSGlobalObject* globalObject = scopeChain.globalObject();
     ExecState* exec = globalObject->globalExec();
     RegisterFile* registerFile = &exec->globalData().interpreter->registerFile();
     
     // Shift register indexes in generated code to elide registers allocated by intermediate stack frames.
-    m_globalVarStorageOffset = -RegisterFile::CallFrameHeaderSize - m_codeBlock->numParameters - registerFile->size();
+    m_globalVarStorageOffset = -RegisterFile::CallFrameHeaderSize - m_codeBlock->m_numParameters - registerFile->size();
 
     // Add previously defined symbols to bookkeeping.
     m_globals.grow(symbolTable->size());
@@ -285,19 +285,19 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug
     , m_emitNodeDepth(0)
 {
     if (m_shouldEmitDebugHooks)
-        m_codeBlock->needsFullScopeChain = true;
+        m_codeBlock->setNeedsFullScopeChain(true);
 
-    codeBlock->globalData = m_globalData;
+    codeBlock->setGlobalData(m_globalData);
 
     bool usesArguments = functionBody->usesArguments();
-    codeBlock->usesArguments = usesArguments;
+    codeBlock->setUsesArguments(usesArguments);
     if (usesArguments) {
         m_argumentsRegister.setIndex(RegisterFile::OptionalCalleeArguments);
         addVar(propertyNames().arguments, false);
     }
 
-    if (m_codeBlock->needsFullScopeChain) {
-        ++m_codeBlock->numVars;
+    if (m_codeBlock->needsFullScopeChain()) {
+        ++m_codeBlock->m_numVars;
         m_activationRegisterIndex = newRegister()->index();
         emitOpcode(op_enter_with_activation);
         instructions().append(m_activationRegisterIndex);
@@ -327,7 +327,7 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug
     // Add "this" as a parameter
     m_thisRegister.setIndex(m_nextParameterIndex);
     ++m_nextParameterIndex;
-    ++m_codeBlock->numParameters;
+    ++m_codeBlock->m_numParameters;
 
     if (functionBody->usesThis()) {
         emitOpcode(op_convert_this);
@@ -356,11 +356,11 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const Debugger* debugge
     , m_emitNodeDepth(0)
 {
     if (m_shouldEmitDebugHooks)
-        m_codeBlock->needsFullScopeChain = true;
+        m_codeBlock->setNeedsFullScopeChain(true);
 
     emitOpcode(op_enter);
-    codeBlock->globalData = m_globalData;
-    m_codeBlock->numParameters = 1; // Allocate space for "this"
+    codeBlock->setGlobalData(m_globalData);
+    m_codeBlock->m_numParameters = 1; // Allocate space for "this"
 
     allocateConstants(evalNode->neededConstants());
 }
@@ -380,7 +380,7 @@ RegisterID* BytecodeGenerator::addParameter(const Identifier& ident)
     // To maintain the calling convention, we have to allocate unique space for
     // each parameter, even if the parameter doesn't make it into the symbol table.
     ++m_nextParameterIndex;
-    ++m_codeBlock->numParameters;
+    ++m_codeBlock->m_numParameters;
     return result;
 }
 
@@ -426,7 +426,7 @@ bool BytecodeGenerator::isLocalConstant(const Identifier& ident)
 RegisterID* BytecodeGenerator::newRegister()
 {
     m_calleeRegisters.append(m_calleeRegisters.size());
-    m_codeBlock->numCalleeRegisters = max<int>(m_codeBlock->numCalleeRegisters, m_calleeRegisters.size());
+    m_codeBlock->m_numCalleeRegisters = max<int>(m_codeBlock->m_numCalleeRegisters, m_calleeRegisters.size());
     return &m_calleeRegisters.last();
 }
 
@@ -443,7 +443,7 @@ RegisterID* BytecodeGenerator::newTemporary()
 
 RegisterID* BytecodeGenerator::highestUsedRegister()
 {
-    size_t count = m_codeBlock->numCalleeRegisters;
+    size_t count = m_codeBlock->m_numCalleeRegisters;
     while (m_calleeRegisters.size() < count)
         newRegister();
     return &m_calleeRegisters.last();
@@ -477,16 +477,16 @@ PassRefPtr<Label> BytecodeGenerator::emitLabel(Label* l0)
     unsigned newLabelIndex = instructions().size();
     l0->setLocation(newLabelIndex);
 
-    if (m_codeBlock->jumpTargets.size() != 0) {
-        unsigned lastLabelIndex = m_codeBlock->jumpTargets.last();
+    if (m_codeBlock->numberOfJumpTargets()) {
+        unsigned lastLabelIndex = m_codeBlock->lastJumpTarget();
         ASSERT(lastLabelIndex <= newLabelIndex);
         if (newLabelIndex == lastLabelIndex) {
             // Peephole optimizations have already been disabled by emitting the last label
-            return l0;            
+            return l0;
         }
     }
 
-    m_codeBlock->jumpTargets.append(newLabelIndex);
+    m_codeBlock->addJumpTarget(newLabelIndex);
 
     // This disables peephole optimizations when an instruction is a jump target
     m_lastOpcodeID = op_end;
@@ -670,25 +670,21 @@ PassRefPtr<Label> BytecodeGenerator::emitJumpIfFalse(RegisterID* cond, Label* ta
 unsigned BytecodeGenerator::addConstant(FuncDeclNode* n)
 {
     // No need to explicitly unique function body nodes -- they're unique already.
-    int index = m_codeBlock->functions.size();
-    m_codeBlock->functions.append(n);
-    return index;
+    return m_codeBlock->addFunction(n);
 }
 
 unsigned BytecodeGenerator::addConstant(FuncExprNode* n)
 {
     // No need to explicitly unique function expression nodes -- they're unique already.
-    int index = m_codeBlock->functionExpressions.size();
-    m_codeBlock->functionExpressions.append(n);
-    return index;
+    return m_codeBlock->addFunctionExpression(n);
 }
 
 unsigned BytecodeGenerator::addConstant(const Identifier& ident)
 {
     UString::Rep* rep = ident.ustring().rep();
-    pair<IdentifierMap::iterator, bool> result = m_identifierMap.add(rep, m_codeBlock->identifiers.size());
+    pair<IdentifierMap::iterator, bool> result = m_identifierMap.add(rep, m_codeBlock->numberOfIdentifiers());
     if (result.second) // new entry
-        m_codeBlock->identifiers.append(Identifier(m_globalData, rep));
+        m_codeBlock->addIdentifier(Identifier(m_globalData, rep));
 
     return result.first->second;
 }
@@ -701,7 +697,7 @@ RegisterID* BytecodeGenerator::addConstant(JSValue* v)
         
         ++m_nextConstantIndex;
 
-        m_codeBlock->constantRegisters.append(v);
+        m_codeBlock->addConstantRegister(v);
         return &constant;
     }
 
@@ -710,16 +706,12 @@ RegisterID* BytecodeGenerator::addConstant(JSValue* v)
 
 unsigned BytecodeGenerator::addUnexpectedConstant(JSValue* v)
 {
-    int index = m_codeBlock->unexpectedConstants.size();
-    m_codeBlock->unexpectedConstants.append(v);
-    return index;
+    return m_codeBlock->addUnexpectedConstant(v);
 }
 
 unsigned BytecodeGenerator::addRegExp(RegExp* r)
 {
-    int index = m_codeBlock->regexps.size();
-    m_codeBlock->regexps.append(r);
-    return index;
+    return m_codeBlock->addRegExp(r);
 }
 
 RegisterID* BytecodeGenerator::emitMove(RegisterID* dst, RegisterID* src)
@@ -794,8 +786,8 @@ RegisterID* BytecodeGenerator::emitEqualityOp(OpcodeID opcodeID, RegisterID* dst
         if (src1->index() == dstIndex
             && src1->isTemporary()
             && m_codeBlock->isConstantRegisterIndex(src2->index())
-            && m_codeBlock->constantRegisters[src2->index() - m_codeBlock->numVars].jsValue(m_scopeChain->globalObject()->globalExec())->isString()) {
-            const UString& value = asString(m_codeBlock->constantRegisters[src2->index() - m_codeBlock->numVars].jsValue(m_scopeChain->globalObject()->globalExec()))->value();
+            && m_codeBlock->constantRegister(src2->index() - m_codeBlock->m_numVars).jsValue(m_scopeChain->globalObject()->globalExec())->isString()) {
+            const UString& value = asString(m_codeBlock->constantRegister(src2->index() - m_codeBlock->m_numVars).jsValue(m_scopeChain->globalObject()->globalExec()))->value();
             if (value == "undefined") {
                 rewindUnaryOp();
                 emitOpcode(op_is_undefined);
@@ -986,7 +978,7 @@ RegisterID* BytecodeGenerator::emitResolve(RegisterID* dst, const Identifier& pr
     }
 
     if (globalObject) {
-        m_codeBlock->globalResolveInstructions.append(instructions().size());
+        m_codeBlock->addGlobalResolveInstruction(instructions().size());
         emitOpcode(op_resolve_global);
         instructions().append(dst->index());
         instructions().append(globalObject);
@@ -1066,7 +1058,7 @@ RegisterID* BytecodeGenerator::emitResolveFunction(RegisterID* baseDst, Register
 
 RegisterID* BytecodeGenerator::emitGetById(RegisterID* dst, RegisterID* base, const Identifier& property)
 {
-    m_codeBlock->propertyAccessInstructions.append(instructions().size());
+    m_codeBlock->addPropertyAccessInstruction(instructions().size());
 
     emitOpcode(op_get_by_id);
     instructions().append(dst->index());
@@ -1081,7 +1073,7 @@ RegisterID* BytecodeGenerator::emitGetById(RegisterID* dst, RegisterID* base, co
 
 RegisterID* BytecodeGenerator::emitPutById(RegisterID* base, const Identifier& property, RegisterID* value)
 {
-    m_codeBlock->propertyAccessInstructions.append(instructions().size());
+    m_codeBlock->addPropertyAccessInstruction(instructions().size());
 
     emitOpcode(op_put_by_id);
     instructions().append(base->index());
@@ -1253,7 +1245,7 @@ RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, Regi
     }
 
     emitExpressionInfo(divot, startOffset, endOffset);
-    m_codeBlock->callLinkInfos.append(CallLinkInfo());
+    m_codeBlock->addCallLinkInfo();
 
     // Emit call.
     emitOpcode(opcodeID);
@@ -1277,10 +1269,10 @@ RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, Regi
 
 RegisterID* BytecodeGenerator::emitReturn(RegisterID* src)
 {
-    if (m_codeBlock->needsFullScopeChain) {
+    if (m_codeBlock->needsFullScopeChain()) {
         emitOpcode(op_tear_off_activation);
         instructions().append(m_activationRegisterIndex);
-    } else if (m_codeBlock->usesArguments && m_codeBlock->numParameters > 1)
+    } else if (m_codeBlock->usesArguments() && m_codeBlock->m_numParameters > 1)
         emitOpcode(op_tear_off_arguments);
 
     return emitUnaryNoDstOp(op_ret, src);
@@ -1332,7 +1324,7 @@ RegisterID* BytecodeGenerator::emitConstruct(RegisterID* dst, RegisterID* func,
         callFrame.append(newTemporary());
 
     emitExpressionInfo(divot, startOffset, endOffset);
-    m_codeBlock->callLinkInfos.append(CallLinkInfo());
+    m_codeBlock->addCallLinkInfo();
 
     emitOpcode(op_construct);
     instructions().append(dst->index()); // dst
@@ -1551,7 +1543,7 @@ RegisterID* BytecodeGenerator::emitNextPropertyName(RegisterID* dst, RegisterID*
 RegisterID* BytecodeGenerator::emitCatch(RegisterID* targetRegister, Label* start, Label* end)
 {
     HandlerInfo info = { start->offsetFrom(0), end->offsetFrom(0), instructions().size(), m_dynamicScopeDepth, 0 };
-    exceptionHandlers().append(info);
+    m_codeBlock->addExceptionHandler(info);
     emitOpcode(op_catch);
     instructions().append(targetRegister->index());
     return targetRegister;
index fb79a7c..6d7ad65 100644 (file)
@@ -140,7 +140,7 @@ namespace JSC {
 
         RegisterID* destinationForAssignResult(RegisterID* dst)
         {
-            if (dst && dst != ignoredResult() && m_codeBlock->needsFullScopeChain)
+            if (dst && dst != ignoredResult() && m_codeBlock->needsFullScopeChain())
                 return dst->isTemporary() ? dst : newTemporary();
             return 0;
         }
@@ -163,9 +163,9 @@ namespace JSC {
         {
             // Node::emitCode assumes that dst, if provided, is either a local or a referenced temporary.
             ASSERT(!dst || dst == ignoredResult() || !dst->isTemporary() || dst->refCount());
-            if (!m_codeBlock->lineInfo.size() || m_codeBlock->lineInfo.last().lineNumber != n->lineNo()) {
+            if (!m_codeBlock->numberOfLineInfos() || m_codeBlock->lastLineInfo().lineNumber != n->lineNo()) {
                 LineInfo info = { instructions().size(), n->lineNo() };
-                m_codeBlock->lineInfo.append(info);
+                m_codeBlock->addLineInfo(info);
             }
             if (m_emitNodeDepth >= s_maxEmitNodeDepth)
                 return emitThrowExpressionTooDeepException();
@@ -182,7 +182,7 @@ namespace JSC {
 
         void emitExpressionInfo(unsigned divot, unsigned startOffset, unsigned endOffset)
         { 
-            divot -= m_codeBlock->sourceOffset;
+            divot -= m_codeBlock->sourceOffset();
             if (divot > ExpressionRangeInfo::MaxDivot) {
                 // Overflow has occurred, we can only give line number info for errors for this region
                 divot = 0;
@@ -206,12 +206,12 @@ namespace JSC {
             info.divotPoint = divot;
             info.startOffset = startOffset;
             info.endOffset = endOffset;
-            m_codeBlock->expressionInfo.append(info);
+            m_codeBlock->addExpressionInfo(info);
         }
         
         ALWAYS_INLINE bool leftHandSideNeedsCopy(bool rightHasAssignments, bool rightIsPure)
         {
-            return (m_codeType != FunctionCode || m_codeBlock->needsFullScopeChain || rightHasAssignments) && !rightIsPure;
+            return (m_codeType != FunctionCode || m_codeBlock->needsFullScopeChain() || rightHasAssignments) && !rightIsPure;
         }
 
         ALWAYS_INLINE PassRefPtr<RegisterID> emitNodeForLeftHandSide(ExpressionNode* n, bool rightHasAssignments, bool rightIsPure)
@@ -398,12 +398,11 @@ namespace JSC {
         unsigned addUnexpectedConstant(JSValue*);
         unsigned addRegExp(RegExp*);
 
-        Vector<Instruction>& instructions() { return m_codeBlock->instructions; }
+        Vector<Instruction>& instructions() { return m_codeBlock->instructions(); }
         SymbolTable& symbolTable() { return *m_symbolTable; }
-        Vector<HandlerInfo>& exceptionHandlers() { return m_codeBlock->exceptionHandlers; }
 
         bool shouldOptimizeLocals() { return (m_codeType != EvalCode) && !m_dynamicScopeDepth; }
-        bool canOptimizeNonLocals() { return (m_codeType == FunctionCode) && !m_dynamicScopeDepth && !m_codeBlock->usesEval; }
+        bool canOptimizeNonLocals() { return (m_codeType == FunctionCode) && !m_dynamicScopeDepth && !m_codeBlock->usesEval(); }
 
         RegisterID* emitThrowExpressionTooDeepException();
 
index da79ed3..0b3d038 100644 (file)
@@ -53,7 +53,7 @@ namespace JSC {
             unsigned size = m_unresolvedJumps.size();
             for (unsigned i = 0; i < size; ++i) {
                 unsigned j = m_unresolvedJumps[i];
-                m_codeBlock->instructions[j].u.operand = m_location - j;
+                m_codeBlock->instructions()[j].u.operand = m_location - j;
             }
         }
 
index 00e5d7e..16283ab 100644 (file)
@@ -32,7 +32,7 @@ namespace JSC {
 
 JSValue* CallFrame::thisValue()
 {
-    return this[codeBlock()->thisRegister].jsValue(this);
+    return this[codeBlock()->thisRegister()].jsValue(this);
 }
 
 }
index d12618e..8de9086 100644 (file)
@@ -92,12 +92,12 @@ static const int preferredScriptCheckTimeInterval = 1000;
 
 static ALWAYS_INLINE Instruction* vPCForPC(CodeBlock* codeBlock, void* pc)
 {
-    if (pc >= codeBlock->instructions.begin() && pc < codeBlock->instructions.end())
+    if (pc >= codeBlock->instructions().begin() && pc < codeBlock->instructions().end())
         return static_cast<Instruction*>(pc);
 
-    ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(pc));
-    unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(pc);
-    return codeBlock->instructions.begin() + vPCIndex;
+    ASSERT(codeBlock->jitReturnAddressVPCMap().contains(pc));
+    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(pc);
+    return codeBlock->instructions().begin() + vPCIndex;
 }
 
 #else // ENABLE(JIT)
@@ -112,7 +112,7 @@ static ALWAYS_INLINE Instruction* vPCForPC(CodeBlock*, void* pc)
 // Returns the depth of the scope chain within a given call frame.
 static int depth(CodeBlock* codeBlock, ScopeChain& sc)
 {
-    if (!codeBlock->needsFullScopeChain)
+    if (!codeBlock->needsFullScopeChain())
         return 0;
     int scopeDepth = 0;
     ScopeChainIterator iter = sc.begin();
@@ -333,7 +333,7 @@ NEVER_INLINE bool Interpreter::resolve(CallFrame* callFrame, Instruction* vPC, J
     ASSERT(iter != end);
 
     CodeBlock* codeBlock = callFrame->codeBlock();
-    Identifier& ident = codeBlock->identifiers[property];
+    Identifier& ident = codeBlock->identifier(property);
     do {
         JSObject* o = *iter;
         PropertySlot slot(o);
@@ -356,7 +356,7 @@ NEVER_INLINE bool Interpreter::resolveSkip(CallFrame* callFrame, Instruction* vP
 
     int dst = (vPC + 1)->u.operand;
     int property = (vPC + 2)->u.operand;
-    int skip = (vPC + 3)->u.operand + codeBlock->needsFullScopeChain;
+    int skip = (vPC + 3)->u.operand + codeBlock->needsFullScopeChain();
 
     ScopeChainNode* scopeChain = callFrame->scopeChain();
     ScopeChainIterator iter = scopeChain->begin();
@@ -366,7 +366,7 @@ NEVER_INLINE bool Interpreter::resolveSkip(CallFrame* callFrame, Instruction* vP
         ++iter;
         ASSERT(iter != end);
     }
-    Identifier& ident = codeBlock->identifiers[property];
+    Identifier& ident = codeBlock->identifier(property);
     do {
         JSObject* o = *iter;
         PropertySlot slot(o);
@@ -398,7 +398,7 @@ NEVER_INLINE bool Interpreter::resolveGlobal(CallFrame* callFrame, Instruction*
     }
 
     CodeBlock* codeBlock = callFrame->codeBlock();
-    Identifier& ident = codeBlock->identifiers[property];
+    Identifier& ident = codeBlock->identifier(property);
     PropertySlot slot(globalObject);
     if (globalObject->getPropertySlot(callFrame, ident, slot)) {
         JSValue* result = slot.getValue(callFrame, ident);
@@ -450,7 +450,7 @@ NEVER_INLINE void Interpreter::resolveBase(CallFrame* callFrame, Instruction* vP
 {
     int dst = (vPC + 1)->u.operand;
     int property = (vPC + 2)->u.operand;
-    callFrame[dst] = inlineResolveBase(callFrame, callFrame->codeBlock()->identifiers[property], callFrame->scopeChain());
+    callFrame[dst] = inlineResolveBase(callFrame, callFrame->codeBlock()->identifier(property), callFrame->scopeChain());
 }
 
 NEVER_INLINE bool Interpreter::resolveBaseAndProperty(CallFrame* callFrame, Instruction* vPC, JSValue*& exceptionValue)
@@ -468,7 +468,7 @@ NEVER_INLINE bool Interpreter::resolveBaseAndProperty(CallFrame* callFrame, Inst
     ASSERT(iter != end);
 
     CodeBlock* codeBlock = callFrame->codeBlock();
-    Identifier& ident = codeBlock->identifiers[property];
+    Identifier& ident = codeBlock->identifier(property);
     JSObject* base;
     do {
         base = *iter;
@@ -504,7 +504,7 @@ NEVER_INLINE bool Interpreter::resolveBaseAndFunc(CallFrame* callFrame, Instruct
     ASSERT(iter != end);
 
     CodeBlock* codeBlock = callFrame->codeBlock();
-    Identifier& ident = codeBlock->identifiers[property];
+    Identifier& ident = codeBlock->identifier(property);
     JSObject* base;
     do {
         base = *iter;
@@ -537,14 +537,14 @@ NEVER_INLINE bool Interpreter::resolveBaseAndFunc(CallFrame* callFrame, Instruct
 ALWAYS_INLINE CallFrame* Interpreter::slideRegisterWindowForCall(CodeBlock* newCodeBlock, RegisterFile* registerFile, CallFrame* callFrame, size_t registerOffset, int argc)
 {
     Register* r = callFrame->registers();
-    Register* newEnd = r + registerOffset + newCodeBlock->numCalleeRegisters;
+    Register* newEnd = r + registerOffset + newCodeBlock->m_numCalleeRegisters;
 
-    if (LIKELY(argc == newCodeBlock->numParameters)) { // correct number of arguments
+    if (LIKELY(argc == newCodeBlock->m_numParameters)) { // correct number of arguments
         if (UNLIKELY(!registerFile->grow(newEnd)))
             return 0;
         r += registerOffset;
-    } else if (argc < newCodeBlock->numParameters) { // too few arguments -- fill in the blanks
-        size_t omittedArgCount = newCodeBlock->numParameters - argc;
+    } else if (argc < newCodeBlock->m_numParameters) { // too few arguments -- fill in the blanks
+        size_t omittedArgCount = newCodeBlock->m_numParameters - argc;
         registerOffset += omittedArgCount;
         newEnd += omittedArgCount;
         if (!registerFile->grow(newEnd))
@@ -555,7 +555,7 @@ ALWAYS_INLINE CallFrame* Interpreter::slideRegisterWindowForCall(CodeBlock* newC
         for (size_t i = 0; i < omittedArgCount; ++i)
             argv[i] = jsUndefined();
     } else { // too many arguments -- copy expected arguments, leaving the extra arguments behind
-        size_t numParameters = newCodeBlock->numParameters;
+        size_t numParameters = newCodeBlock->m_numParameters;
         registerOffset += numParameters;
         newEnd += numParameters;
 
@@ -593,7 +593,7 @@ NEVER_INLINE JSValue* Interpreter::callEval(CallFrame* callFrame, RegisterFile*
 
     ScopeChainNode* scopeChain = callFrame->scopeChain();
     CodeBlock* codeBlock = callFrame->codeBlock();
-    RefPtr<EvalNode> evalNode = codeBlock->evalCodeCache.get(callFrame, programSource, scopeChain, exceptionValue);
+    RefPtr<EvalNode> evalNode = codeBlock->evalCodeCache().get(callFrame, programSource, scopeChain, exceptionValue);
 
     JSValue* result = jsUndefined();
     if (evalNode)
@@ -675,7 +675,7 @@ void Interpreter::dumpRegisters(CallFrame* callFrame)
     const Register* it;
     const Register* end;
 
-    if (codeBlock->codeType == GlobalCode) {
+    if (codeBlock->codeType() == GlobalCode) {
         it = registerFile->lastGlobal();
         end = it + registerFile->numGlobals();
         while (it != end) {
@@ -685,9 +685,9 @@ void Interpreter::dumpRegisters(CallFrame* callFrame)
         printf("----------------------------------------------------\n");
     }
     
-    it = callFrame->registers() - RegisterFile::CallFrameHeaderSize - codeBlock->numParameters;
+    it = callFrame->registers() - RegisterFile::CallFrameHeaderSize - codeBlock->m_numParameters;
     printf("[this]                     | %10p | %10p \n", it, (*it).v()); ++it;
-    end = it + max(codeBlock->numParameters - 1, 0); // - 1 to skip "this"
+    end = it + max(codeBlock->m_numParameters - 1, 0); // - 1 to skip "this"
     if (it != end) {
         do {
             printf("[param]                    | %10p | %10p \n", it, (*it).v());
@@ -708,7 +708,7 @@ void Interpreter::dumpRegisters(CallFrame* callFrame)
 
     int registerCount = 0;
 
-    end = it + codeBlock->numVars;
+    end = it + codeBlock->m_numVars;
     if (it != end) {
         do {
             printf("[r%2d]                      | %10p | %10p \n", registerCount, it, (*it).v());
@@ -718,7 +718,7 @@ void Interpreter::dumpRegisters(CallFrame* callFrame)
     }
     printf("----------------------------------------------------\n");
 
-    end = it + codeBlock->numConstants;
+    end = it + codeBlock->m_numConstants;
     if (it != end) {
         do {
             printf("[r%2d]                      | %10p | %10p \n", registerCount, it, (*it).v());
@@ -728,7 +728,7 @@ void Interpreter::dumpRegisters(CallFrame* callFrame)
     }
     printf("----------------------------------------------------\n");
 
-    end = it + codeBlock->numCalleeRegisters - codeBlock->numConstants - codeBlock->numVars;
+    end = it + codeBlock->m_numCalleeRegisters - codeBlock->m_numConstants - codeBlock->m_numVars;
     if (it != end) {
         do {
             printf("[r%2d]                      | %10p | %10p \n", registerCount, it, (*it).v());
@@ -760,20 +760,20 @@ NEVER_INLINE bool Interpreter::unwindCallFrame(CallFrame*& callFrame, JSValue* e
     if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) {
         DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue);
         if (callFrame->callee())
-            debugger->returnEvent(debuggerCallFrame, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->lastLine());
+            debugger->returnEvent(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->lastLine());
         else
-            debugger->didExecuteProgram(debuggerCallFrame, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->lastLine());
+            debugger->didExecuteProgram(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->lastLine());
     }
 
     if (Profiler* profiler = *Profiler::enabledProfilerReference()) {
         if (callFrame->callee())
             profiler->didExecute(callFrame, callFrame->callee());
         else
-            profiler->didExecute(callFrame, codeBlock->ownerNode->sourceURL(), codeBlock->ownerNode->lineNo());
+            profiler->didExecute(callFrame, codeBlock->ownerNode()->sourceURL(), codeBlock->ownerNode()->lineNo());
     }
 
     // If this call frame created an activation or an 'arguments' object, tear it off.
-    if (oldCodeBlock->codeType == FunctionCode && oldCodeBlock->needsFullScopeChain) {
+    if (oldCodeBlock->codeType() == FunctionCode && oldCodeBlock->needsFullScopeChain()) {
         while (!scopeChain->object->isObject(&JSActivation::info))
             scopeChain = scopeChain->pop();
         static_cast<JSActivation*>(scopeChain->object)->copyRegisters(callFrame->optionalCalleeArguments());
@@ -782,7 +782,7 @@ NEVER_INLINE bool Interpreter::unwindCallFrame(CallFrame*& callFrame, JSValue* e
             arguments->copyRegisters();
     }
 
-    if (oldCodeBlock->needsFullScopeChain)
+    if (oldCodeBlock->needsFullScopeChain())
         scopeChain->deref();
 
     void* returnPC = callFrame->returnPC();
@@ -825,8 +825,8 @@ NEVER_INLINE Instruction* Interpreter::throwException(CallFrame*& callFrame, JSV
                     exception->putWithAttributes(callFrame, Identifier(callFrame, expressionEndOffsetPropertyName), jsNumber(callFrame, divotPoint + endOffset), ReadOnly | DontDelete);
                 } else
                     exception->putWithAttributes(callFrame, Identifier(callFrame, "line"), jsNumber(callFrame, codeBlock->lineNumberForVPC(vPC)), ReadOnly | DontDelete);
-                exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceId"), jsNumber(callFrame, codeBlock->ownerNode->sourceID()), ReadOnly | DontDelete);
-                exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceURL"), jsOwnedString(callFrame, codeBlock->ownerNode->sourceURL()), ReadOnly | DontDelete);
+                exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceId"), jsNumber(callFrame, codeBlock->ownerNode()->sourceID()), ReadOnly | DontDelete);
+                exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceURL"), jsOwnedString(callFrame, codeBlock->ownerNode()->sourceURL()), ReadOnly | DontDelete);
             }
             
             if (exception->isWatchdogException()) {
@@ -840,7 +840,7 @@ NEVER_INLINE Instruction* Interpreter::throwException(CallFrame*& callFrame, JSV
 
     if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) {
         DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue);
-        debugger->exception(debuggerCallFrame, codeBlock->ownerNode->sourceID(), codeBlock->lineNumberForVPC(vPC));
+        debugger->exception(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->lineNumberForVPC(vPC));
     }
 
     // If we throw in the middle of a call instruction, we need to notify
@@ -906,7 +906,7 @@ JSValue* Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, Sc
     CodeBlock* codeBlock = &programNode->bytecode(scopeChain);
 
     Register* oldEnd = m_registerFile.end();
-    Register* newEnd = oldEnd + codeBlock->numParameters + RegisterFile::CallFrameHeaderSize + codeBlock->numCalleeRegisters;
+    Register* newEnd = oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters;
     if (!m_registerFile.grow(newEnd)) {
         *exception = createStackOverflowError(callFrame);
         return jsNull();
@@ -918,11 +918,11 @@ JSValue* Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, Sc
     JSGlobalObject* globalObject = callFrame->dynamicGlobalObject();
     globalObject->copyGlobalsTo(m_registerFile);
 
-    CallFrame* newCallFrame = CallFrame::create(oldEnd + codeBlock->numParameters + RegisterFile::CallFrameHeaderSize);
-    newCallFrame[codeBlock->thisRegister] = thisObj;
+    CallFrame* newCallFrame = CallFrame::create(oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize);
+    newCallFrame[codeBlock->thisRegister()] = thisObj;
     newCallFrame->init(codeBlock, 0, scopeChain, CallFrame::noCaller(), 0, 0, 0);
 
-    if (codeBlock->needsFullScopeChain)
+    if (codeBlock->needsFullScopeChain())
         scopeChain->ref();
 
     Profiler** profiler = Profiler::enabledProfilerReference();
@@ -935,9 +935,9 @@ JSValue* Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, Sc
 
         m_reentryDepth++;
 #if ENABLE(JIT)
-        if (!codeBlock->ctiCode)
+        if (!codeBlock->jitCode())
             JIT::compile(scopeChain->globalData, codeBlock);
-        result = JIT::execute(codeBlock->ctiCode, &m_registerFile, newCallFrame, scopeChain->globalData, exception);
+        result = JIT::execute(codeBlock->jitCode(), &m_registerFile, newCallFrame, scopeChain->globalData, exception);
 #else
         result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
 #endif
@@ -1001,9 +1001,9 @@ JSValue* Interpreter::execute(FunctionBodyNode* functionBodyNode, CallFrame* cal
 
         m_reentryDepth++;
 #if ENABLE(JIT)
-        if (!codeBlock->ctiCode)
+        if (!codeBlock->jitCode())
             JIT::compile(scopeChain->globalData, codeBlock);
-        result = JIT::execute(codeBlock->ctiCode, &m_registerFile, newCallFrame, scopeChain->globalData, exception);
+        result = JIT::execute(codeBlock->jitCode(), &m_registerFile, newCallFrame, scopeChain->globalData, exception);
 #else
         result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
 #endif
@@ -1019,7 +1019,7 @@ JSValue* Interpreter::execute(FunctionBodyNode* functionBodyNode, CallFrame* cal
 
 JSValue* Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue** exception)
 {
-    return execute(evalNode, callFrame, thisObj, m_registerFile.size() + evalNode->bytecode(scopeChain).numParameters + RegisterFile::CallFrameHeaderSize, scopeChain, exception);
+    return execute(evalNode, callFrame, thisObj, m_registerFile.size() + evalNode->bytecode(scopeChain).m_numParameters + RegisterFile::CallFrameHeaderSize, scopeChain, exception);
 }
 
 JSValue* Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* thisObj, int globalRegisterOffset, ScopeChainNode* scopeChain, JSValue** exception)
@@ -1048,7 +1048,7 @@ JSValue* Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject
 
         BatchedTransitionOptimizer optimizer(variableObject);
 
-        const DeclarationStacks::VarStack& varStack = codeBlock->ownerNode->varStack();
+        const DeclarationStacks::VarStack& varStack = codeBlock->ownerNode()->varStack();
         DeclarationStacks::VarStack::const_iterator varStackEnd = varStack.end();
         for (DeclarationStacks::VarStack::const_iterator it = varStack.begin(); it != varStackEnd; ++it) {
             const Identifier& ident = (*it).first;
@@ -1058,7 +1058,7 @@ JSValue* Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject
             }
         }
 
-        const DeclarationStacks::FunctionStack& functionStack = codeBlock->ownerNode->functionStack();
+        const DeclarationStacks::FunctionStack& functionStack = codeBlock->ownerNode()->functionStack();
         DeclarationStacks::FunctionStack::const_iterator functionStackEnd = functionStack.end();
         for (DeclarationStacks::FunctionStack::const_iterator it = functionStack.begin(); it != functionStackEnd; ++it) {
             PutPropertySlot slot;
@@ -1068,7 +1068,7 @@ JSValue* Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject
     }
 
     Register* oldEnd = m_registerFile.end();
-    Register* newEnd = m_registerFile.start() + globalRegisterOffset + codeBlock->numCalleeRegisters;
+    Register* newEnd = m_registerFile.start() + globalRegisterOffset + codeBlock->m_numCalleeRegisters;
     if (!m_registerFile.grow(newEnd)) {
         *exception = createStackOverflowError(callFrame);
         return jsNull();
@@ -1077,10 +1077,10 @@ JSValue* Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject
     CallFrame* newCallFrame = CallFrame::create(m_registerFile.start() + globalRegisterOffset);
 
     // a 0 codeBlock indicates a built-in caller
-    newCallFrame[codeBlock->thisRegister] = thisObj;
+    newCallFrame[codeBlock->thisRegister()] = thisObj;
     newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), 0, 0, 0);
 
-    if (codeBlock->needsFullScopeChain)
+    if (codeBlock->needsFullScopeChain())
         scopeChain->ref();
 
     Profiler** profiler = Profiler::enabledProfilerReference();
@@ -1093,9 +1093,9 @@ JSValue* Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject
 
         m_reentryDepth++;
 #if ENABLE(JIT)
-        if (!codeBlock->ctiCode)
+        if (!codeBlock->jitCode())
             JIT::compile(scopeChain->globalData, codeBlock);
-        result = JIT::execute(codeBlock->ctiCode, &m_registerFile, newCallFrame, scopeChain->globalData, exception);
+        result = JIT::execute(codeBlock->jitCode(), &m_registerFile, newCallFrame, scopeChain->globalData, exception);
 #else
         result = privateExecute(Normal, &m_registerFile, newCallFrame, exception);
 #endif
@@ -1117,22 +1117,22 @@ NEVER_INLINE void Interpreter::debug(CallFrame* callFrame, DebugHookID debugHook
 
     switch (debugHookID) {
         case DidEnterCallFrame:
-            debugger->callEvent(callFrame, callFrame->codeBlock()->ownerNode->sourceID(), firstLine);
+            debugger->callEvent(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine);
             return;
         case WillLeaveCallFrame:
-            debugger->returnEvent(callFrame, callFrame->codeBlock()->ownerNode->sourceID(), lastLine);
+            debugger->returnEvent(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine);
             return;
         case WillExecuteStatement:
-            debugger->atStatement(callFrame, callFrame->codeBlock()->ownerNode->sourceID(), firstLine);
+            debugger->atStatement(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine);
             return;
         case WillExecuteProgram:
-            debugger->willExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode->sourceID(), firstLine);
+            debugger->willExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine);
             return;
         case DidExecuteProgram:
-            debugger->didExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode->sourceID(), lastLine);
+            debugger->didExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine);
             return;
         case DidReachBreakpoint:
-            debugger->didReachBreakpoint(callFrame, callFrame->codeBlock()->ownerNode->sourceID(), lastLine);
+            debugger->didReachBreakpoint(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine);
             return;
     }
 }
@@ -1226,7 +1226,7 @@ NEVER_INLINE ScopeChainNode* Interpreter::createExceptionScope(CallFrame* callFr
 {
     int dst = (++vPC)->u.operand;
     CodeBlock* codeBlock = callFrame->codeBlock();
-    Identifier& property = codeBlock->identifiers[(++vPC)->u.operand];
+    Identifier& property = codeBlock->identifier((++vPC)->u.operand);
     JSValue* value = callFrame[(++vPC)->u.operand].jsValue(callFrame);
     JSObject* scope = new (callFrame) JSStaticScopeObject(callFrame, property, value, DontDelete);
     callFrame[dst] = scope;
@@ -1485,7 +1485,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
     JSValue* exceptionValue = noValue();
     Instruction* handlerVPC = 0;
 
-    Instruction* vPC = callFrame->codeBlock()->instructions.begin();
+    Instruction* vPC = callFrame->codeBlock()->instructions().begin();
     Profiler** enabledProfilerReference = Profiler::enabledProfilerReference();
     unsigned tickCount = m_ticksUntilNextTimeoutCheck + 1;
 
@@ -1574,7 +1574,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
         */
         int dst = (++vPC)->u.operand;
         int regExp = (++vPC)->u.operand;
-        callFrame[dst] = new (globalData) RegExpObject(callFrame->scopeChain()->globalObject()->regExpStructure(), callFrame->codeBlock()->regexps[regExp]);
+        callFrame[dst] = new (globalData) RegExpObject(callFrame->scopeChain()->globalObject()->regExpStructure(), callFrame->codeBlock()->regexp(regExp));
 
         ++vPC;
         NEXT_INSTRUCTION();
@@ -2412,7 +2412,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
          */
         int dst = (++vPC)->u.operand;
         int index = (++vPC)->u.operand;
-        int skip = (++vPC)->u.operand + callFrame->codeBlock()->needsFullScopeChain;
+        int skip = (++vPC)->u.operand + callFrame->codeBlock()->needsFullScopeChain();
 
         ScopeChainNode* scopeChain = callFrame->scopeChain();
         ScopeChainIterator iter = scopeChain->begin();
@@ -2434,7 +2434,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
 
          */
         int index = (++vPC)->u.operand;
-        int skip = (++vPC)->u.operand + callFrame->codeBlock()->needsFullScopeChain;
+        int skip = (++vPC)->u.operand + callFrame->codeBlock()->needsFullScopeChain();
         int value = (++vPC)->u.operand;
 
         ScopeChainNode* scopeChain = callFrame->scopeChain();
@@ -2515,7 +2515,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
         int property = vPC[3].u.operand;
 
         CodeBlock* codeBlock = callFrame->codeBlock();
-        Identifier& ident = codeBlock->identifiers[property];
+        Identifier& ident = codeBlock->identifier(property);
         JSValue* baseValue = callFrame[base].jsValue(callFrame);
         PropertySlot slot(baseValue);
         JSValue* result = baseValue->get(callFrame, ident, slot);
@@ -2547,7 +2547,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
                 int dst = vPC[1].u.operand;
                 int offset = vPC[5].u.operand;
 
-                ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifiers[vPC[3].u.operand]) == baseObject->getDirectOffset(offset));
+                ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
                 callFrame[dst] = baseObject->getDirectOffset(offset);
 
                 vPC += 8;
@@ -2581,7 +2581,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
                     int dst = vPC[1].u.operand;
                     int offset = vPC[6].u.operand;
 
-                    ASSERT(protoObject->get(callFrame, callFrame->codeBlock()->identifiers[vPC[3].u.operand]) == protoObject->getDirectOffset(offset));
+                    ASSERT(protoObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == protoObject->getDirectOffset(offset));
                     callFrame[dst] = protoObject->getDirectOffset(offset);
 
                     vPC += 8;
@@ -2636,7 +2636,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
                         int dst = vPC[1].u.operand;
                         int offset = vPC[7].u.operand;
 
-                        ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifiers[vPC[3].u.operand]) == baseObject->getDirectOffset(offset));
+                        ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset));
                         callFrame[dst] = baseObject->getDirectOffset(offset);
 
                         vPC += 8;
@@ -2659,7 +2659,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
         int base = vPC[2].u.operand;
         int property = vPC[3].u.operand;
 
-        Identifier& ident = callFrame->codeBlock()->identifiers[property];
+        Identifier& ident = callFrame->codeBlock()->identifier(property);
         JSValue* baseValue = callFrame[base].jsValue(callFrame);
         PropertySlot slot(baseValue);
         JSValue* result = baseValue->get(callFrame, ident, slot);
@@ -2725,7 +2725,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
 
         CodeBlock* codeBlock = callFrame->codeBlock();
         JSValue* baseValue = callFrame[base].jsValue(callFrame);
-        Identifier& ident = codeBlock->identifiers[property];
+        Identifier& ident = codeBlock->identifier(property);
         PutPropertySlot slot;
         baseValue->put(callFrame, ident, callFrame[value].jsValue(callFrame), slot);
         CHECK_FOR_EXCEPTION();
@@ -2774,7 +2774,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
 
                 int value = vPC[3].u.operand;
                 unsigned offset = vPC[7].u.operand;
-                ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifiers[vPC[2].u.operand])) == offset);
+                ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifier(vPC[2].u.operand))) == offset);
                 baseObject->putDirectOffset(offset, callFrame[value].jsValue(callFrame));
 
                 vPC += 8;
@@ -2809,7 +2809,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
                 int value = vPC[3].u.operand;
                 unsigned offset = vPC[5].u.operand;
                 
-                ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifiers[vPC[2].u.operand])) == offset);
+                ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifier(vPC[2].u.operand))) == offset);
                 baseObject->putDirectOffset(offset, callFrame[value].jsValue(callFrame));
 
                 vPC += 8;
@@ -2834,7 +2834,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
         int value = vPC[3].u.operand;
 
         JSValue* baseValue = callFrame[base].jsValue(callFrame);
-        Identifier& ident = callFrame->codeBlock()->identifiers[property];
+        Identifier& ident = callFrame->codeBlock()->identifier(property);
         PutPropertySlot slot;
         baseValue->put(callFrame, ident, callFrame[value].jsValue(callFrame), slot);
         CHECK_FOR_EXCEPTION();
@@ -2855,7 +2855,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
         int property = (++vPC)->u.operand;
 
         JSObject* baseObj = callFrame[base].jsValue(callFrame)->toObject(callFrame);
-        Identifier& ident = callFrame->codeBlock()->identifiers[property];
+        Identifier& ident = callFrame->codeBlock()->identifier(property);
         JSValue* result = jsBoolean(baseObj->deleteProperty(callFrame, ident));
         CHECK_FOR_EXCEPTION();
         callFrame[dst] = result;
@@ -3264,7 +3264,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
         int dst = (++vPC)->u.operand;
         int func = (++vPC)->u.operand;
 
-        callFrame[dst] = callFrame->codeBlock()->functions[func]->makeFunction(callFrame, callFrame->scopeChain());
+        callFrame[dst] = callFrame->codeBlock()->function(func)->makeFunction(callFrame, callFrame->scopeChain());
 
         ++vPC;
         NEXT_INSTRUCTION();
@@ -3280,7 +3280,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
         int dst = (++vPC)->u.operand;
         int func = (++vPC)->u.operand;
 
-        callFrame[dst] = callFrame->codeBlock()->functionExpressions[func]->makeFunction(callFrame, callFrame->scopeChain());
+        callFrame[dst] = callFrame->codeBlock()->functionExpression(func)->makeFunction(callFrame, callFrame->scopeChain());
 
         ++vPC;
         NEXT_INSTRUCTION();
@@ -3359,7 +3359,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
             }
 
             callFrame->init(newCodeBlock, vPC + 5, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v));
-            vPC = newCodeBlock->instructions.begin();
+            vPC = newCodeBlock->instructions().begin();
 
 #if ENABLE(OPCODE_STATS)
             OpcodeStats::resetLastInstruction();
@@ -3413,7 +3413,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
         */
 
         int src = (++vPC)->u.operand;
-        ASSERT(callFrame->codeBlock()->needsFullScopeChain);
+        ASSERT(callFrame->codeBlock()->needsFullScopeChain());
 
         asActivation(callFrame[src].getJSValue())->copyRegisters(callFrame->optionalCalleeArguments());
 
@@ -3433,7 +3433,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
            This opcode should only be used immediately before op_ret.
         */
 
-        ASSERT(callFrame->codeBlock()->usesArguments && !callFrame->codeBlock()->needsFullScopeChain);
+        ASSERT(callFrame->codeBlock()->usesArguments() && !callFrame->codeBlock()->needsFullScopeChain());
 
         callFrame->optionalCalleeArguments()->copyRegisters();
 
@@ -3452,7 +3452,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
 
         int result = (++vPC)->u.operand;
 
-        if (callFrame->codeBlock()->needsFullScopeChain)
+        if (callFrame->codeBlock()->needsFullScopeChain())
             callFrame->scopeChain()->deref();
 
         JSValue* returnValue = callFrame[result].jsValue(callFrame);
@@ -3482,11 +3482,11 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
         size_t i = 0;
         CodeBlock* codeBlock = callFrame->codeBlock();
         
-        for (size_t count = codeBlock->numVars; i < count; ++i)
+        for (size_t count = codeBlock->m_numVars; i < count; ++i)
             callFrame[i] = jsUndefined();
 
-        for (size_t count = codeBlock->constantRegisters.size(), j = 0; j < count; ++i, ++j)
-            callFrame[i] = codeBlock->constantRegisters[j];
+        for (size_t count = codeBlock->numberOfConstantRegisters(), j = 0; j < count; ++i, ++j)
+            callFrame[i] = codeBlock->constantRegister(j);
 
         ++vPC;
         NEXT_INSTRUCTION();
@@ -3507,14 +3507,14 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
         size_t i = 0;
         CodeBlock* codeBlock = callFrame->codeBlock();
 
-        for (size_t count = codeBlock->numVars; i < count; ++i)
+        for (size_t count = codeBlock->m_numVars; i < count; ++i)
             callFrame[i] = jsUndefined();
 
-        for (size_t count = codeBlock->constantRegisters.size(), j = 0; j < count; ++i, ++j)
-            callFrame[i] = codeBlock->constantRegisters[j];
+        for (size_t count = codeBlock->numberOfConstantRegisters(), j = 0; j < count; ++i, ++j)
+            callFrame[i] = codeBlock->constantRegister(j);
 
         int dst = (++vPC)->u.operand;
-        JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionBodyNode*>(codeBlock->ownerNode));
+        JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionBodyNode*>(codeBlock->ownerNode()));
         callFrame[dst] = activation;
         callFrame->setScopeChain(callFrame->scopeChain()->copy()->push(activation));
 
@@ -3611,7 +3611,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
             }
 
             callFrame->init(newCodeBlock, vPC + 7, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v));
-            vPC = newCodeBlock->instructions.begin();
+            vPC = newCodeBlock->instructions().begin();
 
 #if ENABLE(OPCODE_STATS)
             OpcodeStats::resetLastInstruction();
@@ -3812,7 +3812,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
         */
         int dst = (++vPC)->u.operand;
         int src = (++vPC)->u.operand;
-        callFrame[dst] = callFrame->codeBlock()->unexpectedConstants[src];
+        callFrame[dst] = callFrame->codeBlock()->unexpectedConstant(src);
 
         ++vPC;
         NEXT_INSTRUCTION();
@@ -3830,7 +3830,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
         int message = (++vPC)->u.operand;
 
         CodeBlock* codeBlock = callFrame->codeBlock();
-        callFrame[dst] = Error::create(callFrame, (ErrorType)type, codeBlock->unexpectedConstants[message]->toString(callFrame), codeBlock->lineNumberForVPC(vPC), codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->sourceURL());
+        callFrame[dst] = Error::create(callFrame, (ErrorType)type, codeBlock->unexpectedConstant(message)->toString(callFrame), codeBlock->lineNumberForVPC(vPC), codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
 
         ++vPC;
         NEXT_INSTRUCTION();
@@ -3842,7 +3842,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
            program. Return control to the calling native code.
         */
 
-        if (callFrame->codeBlock()->needsFullScopeChain) {
+        if (callFrame->codeBlock()->needsFullScopeChain()) {
             ScopeChainNode* scopeChain = callFrame->scopeChain();
             ASSERT(scopeChain->refCount > 1);
             scopeChain->deref();
@@ -3867,7 +3867,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
 
         ASSERT(callFrame[base].jsValue(callFrame)->isObject());
         JSObject* baseObj = asObject(callFrame[base].jsValue(callFrame));
-        Identifier& ident = callFrame->codeBlock()->identifiers[property];
+        Identifier& ident = callFrame->codeBlock()->identifier(property);
         ASSERT(callFrame[function].jsValue(callFrame)->isObject());
         baseObj->defineGetter(callFrame, ident, asObject(callFrame[function].jsValue(callFrame)));
 
@@ -3891,7 +3891,7 @@ JSValue* Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerF
 
         ASSERT(callFrame[base].jsValue(callFrame)->isObject());
         JSObject* baseObj = asObject(callFrame[base].jsValue(callFrame));
-        Identifier& ident = callFrame->codeBlock()->identifiers[property];
+        Identifier& ident = callFrame->codeBlock()->identifier(property);
         ASSERT(callFrame[function].jsValue(callFrame)->isObject());
         baseObj->defineSetter(callFrame, ident, asObject(callFrame[function].jsValue(callFrame)));
 
@@ -3997,9 +3997,9 @@ JSValue* Interpreter::retrieveArguments(CallFrame* callFrame, JSFunction* functi
         return jsNull();
 
     CodeBlock* codeBlock = functionCallFrame->codeBlock();
-    if (codeBlock->usesArguments) {
-        ASSERT(codeBlock->codeType == FunctionCode);
-        SymbolTable& symbolTable = codeBlock->symbolTable;
+    if (codeBlock->usesArguments()) {
+        ASSERT(codeBlock->codeType() == FunctionCode);
+        SymbolTable& symbolTable = codeBlock->symbolTable();
         int argumentsIndex = symbolTable.get(functionCallFrame->propertyNames().arguments.ustring().rep()).getIndex();
         return functionCallFrame[argumentsIndex].jsValue(callFrame);
     }
@@ -4047,8 +4047,8 @@ void Interpreter::retrieveLastCaller(CallFrame* callFrame, int& lineNumber, intp
 
     Instruction* vPC = vPCForPC(callerCodeBlock, callFrame->returnPC());
     lineNumber = callerCodeBlock->lineNumberForVPC(vPC - 1);
-    sourceID = callerCodeBlock->ownerNode->sourceID();
-    sourceURL = callerCodeBlock->ownerNode->sourceURL();
+    sourceID = callerCodeBlock->ownerNode()->sourceID();
+    sourceURL = callerCodeBlock->ownerNode()->sourceURL();
     function = callerFrame->callee();
 }
 
@@ -4087,8 +4087,8 @@ NEVER_INLINE void Interpreter::tryCTICachePutByID(CallFrame* callFrame, CodeBloc
     // In the interpreter the last structure is trapped here; in CTI we use the
     // *_second method to achieve a similar (but not quite the same) effect.
 
-    unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(returnAddress);
-    Instruction* vPC = codeBlock->instructions.begin() + vPCIndex;
+    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(returnAddress);
+    Instruction* vPC = codeBlock->instructions().begin() + vPCIndex;
 
     // Cache hit: Specialize instruction and ref Structures.
 
@@ -4175,8 +4175,8 @@ NEVER_INLINE void Interpreter::tryCTICacheGetByID(CallFrame* callFrame, CodeBloc
     // In the interpreter the last structure is trapped here; in CTI we use the
     // *_second method to achieve a similar (but not quite the same) effect.
 
-    unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(returnAddress);
-    Instruction* vPC = codeBlock->instructions.begin() + vPCIndex;
+    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(returnAddress);
+    Instruction* vPC = codeBlock->instructions().begin() + vPCIndex;
 
     // Cache hit: Specialize instruction and ref Structures.
 
@@ -4424,7 +4424,7 @@ void Interpreter::cti_register_file_check(CTI_ARGS)
 {
     CTI_STACK_HACK();
 
-    if (LIKELY(ARG_registerFile->grow(ARG_callFrame + ARG_callFrame->codeBlock()->numCalleeRegisters)))
+    if (LIKELY(ARG_registerFile->grow(ARG_callFrame + ARG_callFrame->codeBlock()->m_numCalleeRegisters)))
         return;
 
     // Rewind to the previous call frame because op_call already optimistically
@@ -4582,8 +4582,8 @@ JSValue* Interpreter::cti_op_get_by_id_self_fail(CTI_ARGS)
         && slot.slotBase() == baseValue) {
 
         CodeBlock* codeBlock = callFrame->codeBlock();
-        unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
-        Instruction* vPC = codeBlock->instructions.begin() + vPCIndex;
+        unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
+        Instruction* vPC = codeBlock->instructions().begin() + vPCIndex;
 
         ASSERT(slot.slotBase()->isObject());
 
@@ -4666,7 +4666,7 @@ JSValue* Interpreter::cti_op_get_by_id_proto_list(CTI_ARGS)
 
     Structure* structure = asCell(baseValue)->structure();
     CodeBlock* codeBlock = callFrame->codeBlock();
-    Instruction* vPC = codeBlock->instructions.begin() + codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
+    Instruction* vPC = codeBlock->instructions().begin() + codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
 
     ASSERT(slot.slotBase()->isObject());
     JSObject* slotBaseObject = asObject(slot.slotBase());
@@ -4775,9 +4775,9 @@ JSValue* Interpreter::cti_op_instanceof(CTI_ARGS)
     if (!baseVal->isObject()) {
         CallFrame* callFrame = ARG_callFrame;
         CodeBlock* codeBlock = callFrame->codeBlock();
-        ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
-        unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
-        ARG_globalData->exception = createInvalidParamError(callFrame, "instanceof", baseVal, codeBlock->instructions.begin() + vPCIndex, codeBlock);
+        ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
+        unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
+        ARG_globalData->exception = createInvalidParamError(callFrame, "instanceof", baseVal, codeBlock->instructions().begin() + vPCIndex, codeBlock);
         VM_THROW_EXCEPTION();
     }
 
@@ -4848,7 +4848,7 @@ void* Interpreter::cti_op_call_JSFunction(CTI_ARGS)
     ScopeChainNode* callDataScopeChain = asFunction(ARG_src1)->m_scopeChain.node();
     CodeBlock* newCodeBlock = &asFunction(ARG_src1)->body()->bytecode(callDataScopeChain);
 
-    if (!newCodeBlock->ctiCode)
+    if (!newCodeBlock->jitCode())
         JIT::compile(ARG_globalData, newCodeBlock);
 
     return newCodeBlock;
@@ -4862,12 +4862,12 @@ VoidPtrPair Interpreter::cti_op_call_arityCheck(CTI_ARGS)
     CodeBlock* newCodeBlock = ARG_codeBlock4;
     int argCount = ARG_int3;
 
-    ASSERT(argCount != newCodeBlock->numParameters);
+    ASSERT(argCount != newCodeBlock->m_numParameters);
 
     CallFrame* oldCallFrame = callFrame->callerFrame();
 
-    if (argCount > newCodeBlock->numParameters) {
-        size_t numParameters = newCodeBlock->numParameters;
+    if (argCount > newCodeBlock->m_numParameters) {
+        size_t numParameters = newCodeBlock->m_numParameters;
         Register* r = callFrame->registers() + numParameters;
 
         Register* argv = r - RegisterFile::CallFrameHeaderSize - numParameters - argCount;
@@ -4877,9 +4877,9 @@ VoidPtrPair Interpreter::cti_op_call_arityCheck(CTI_ARGS)
         callFrame = CallFrame::create(r);
         callFrame->setCallerFrame(oldCallFrame);
     } else {
-        size_t omittedArgCount = newCodeBlock->numParameters - argCount;
+        size_t omittedArgCount = newCodeBlock->m_numParameters - argCount;
         Register* r = callFrame->registers() + omittedArgCount;
-        Register* newEnd = r + newCodeBlock->numCalleeRegisters;
+        Register* newEnd = r + newCodeBlock->m_numCalleeRegisters;
         if (!ARG_registerFile->grow(newEnd)) {
             // Rewind to the previous call frame because op_call already optimistically
             // moved the call frame forward.
@@ -4907,12 +4907,12 @@ void* Interpreter::cti_vm_dontLazyLinkCall(CTI_ARGS)
 
     JSFunction* callee = asFunction(ARG_src1);
     CodeBlock* codeBlock = &callee->body()->bytecode(callee->m_scopeChain.node());
-    if (!codeBlock->ctiCode)
+    if (!codeBlock->jitCode())
         JIT::compile(ARG_globalData, codeBlock);
 
     ctiRepatchCallByReturnAddress(ARG_returnAddress2, ARG_globalData->interpreter->m_ctiVirtualCallLink);
 
-    return codeBlock->ctiCode;
+    return codeBlock->jitCode();
 }
 
 void* Interpreter::cti_vm_lazyLinkCall(CTI_ARGS)
@@ -4921,20 +4921,20 @@ void* Interpreter::cti_vm_lazyLinkCall(CTI_ARGS)
 
     JSFunction* callee = asFunction(ARG_src1);
     CodeBlock* codeBlock = &callee->body()->bytecode(callee->m_scopeChain.node());
-    if (!codeBlock->ctiCode)
+    if (!codeBlock->jitCode())
         JIT::compile(ARG_globalData, codeBlock);
 
     CallLinkInfo* callLinkInfo = &ARG_callFrame->callerFrame()->codeBlock()->getCallLinkInfo(ARG_returnAddress2);
-    JIT::linkCall(callee, codeBlock, codeBlock->ctiCode, callLinkInfo, ARG_int3);
+    JIT::linkCall(callee, codeBlock, codeBlock->jitCode(), callLinkInfo, ARG_int3);
 
-    return codeBlock->ctiCode;
+    return codeBlock->jitCode();
 }
 
 JSObject* Interpreter::cti_op_push_activation(CTI_ARGS)
 {
     CTI_STACK_HACK();
 
-    JSActivation* activation = new (ARG_globalData) JSActivation(ARG_callFrame, static_cast<FunctionBodyNode*>(ARG_callFrame->codeBlock()->ownerNode));
+    JSActivation* activation = new (ARG_globalData) JSActivation(ARG_callFrame, static_cast<FunctionBodyNode*>(ARG_callFrame->codeBlock()->ownerNode()));
     ARG_callFrame->setScopeChain(ARG_callFrame->scopeChain()->copy()->push(activation));
     return activation;
 }
@@ -5007,7 +5007,7 @@ void Interpreter::cti_op_tear_off_activation(CTI_ARGS)
 {
     CTI_STACK_HACK();
 
-    ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain);
+    ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain());
     asActivation(ARG_src1)->copyRegisters(ARG_callFrame->optionalCalleeArguments());
 }
 
@@ -5015,7 +5015,7 @@ void Interpreter::cti_op_tear_off_arguments(CTI_ARGS)
 {
     CTI_STACK_HACK();
 
-    ASSERT(ARG_callFrame->codeBlock()->usesArguments && !ARG_callFrame->codeBlock()->needsFullScopeChain);
+    ASSERT(ARG_callFrame->codeBlock()->usesArguments() && !ARG_callFrame->codeBlock()->needsFullScopeChain());
     ARG_callFrame->optionalCalleeArguments()->copyRegisters();
 }
 
@@ -5039,7 +5039,7 @@ void Interpreter::cti_op_ret_scopeChain(CTI_ARGS)
 {
     CTI_STACK_HACK();
 
-    ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain);
+    ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain());
     ARG_callFrame->scopeChain()->deref();
 }
 
@@ -5074,9 +5074,9 @@ JSValue* Interpreter::cti_op_resolve(CTI_ARGS)
     } while (++iter != end);
 
     CodeBlock* codeBlock = callFrame->codeBlock();
-    ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
-    unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
-    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions.begin() + vPCIndex, codeBlock);
+    ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
+    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
+    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock);
     VM_THROW_EXCEPTION();
 }
 
@@ -5201,9 +5201,9 @@ VoidPtrPair Interpreter::cti_op_resolve_func(CTI_ARGS)
     } while (iter != end);
 
     CodeBlock* codeBlock = callFrame->codeBlock();
-    ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
-    unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
-    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions.begin() + vPCIndex, codeBlock);
+    ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
+    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
+    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock);
     VM_THROW_EXCEPTION_2();
 }
 
@@ -5359,9 +5359,9 @@ JSValue* Interpreter::cti_op_resolve_skip(CTI_ARGS)
     } while (++iter != end);
 
     CodeBlock* codeBlock = callFrame->codeBlock();
-    ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
-    unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
-    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions.begin() + vPCIndex, codeBlock);
+    ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
+    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
+    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock);
     VM_THROW_EXCEPTION();
 }
 
@@ -5598,9 +5598,9 @@ VoidPtrPair Interpreter::cti_op_resolve_with_base(CTI_ARGS)
     } while (iter != end);
 
     CodeBlock* codeBlock = callFrame->codeBlock();
-    ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
-    unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
-    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions.begin() + vPCIndex, codeBlock);
+    ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
+    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
+    ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock);
     VM_THROW_EXCEPTION_2();
 }
 
@@ -5756,13 +5756,13 @@ JSValue* Interpreter::cti_op_throw(CTI_ARGS)
     CallFrame* callFrame = ARG_callFrame;
     CodeBlock* codeBlock = callFrame->codeBlock();
 
-    ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
-    unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
+    ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
+    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
 
     JSValue* exceptionValue = ARG_src1;
     ASSERT(exceptionValue);
 
-    Instruction* handlerVPC = ARG_globalData->interpreter->throwException(callFrame, exceptionValue, codeBlock->instructions.begin() + vPCIndex, true);
+    Instruction* handlerVPC = ARG_globalData->interpreter->throwException(callFrame, exceptionValue, codeBlock->instructions().begin() + vPCIndex, true);
 
     if (!handlerVPC) {
         *ARG_exception = exceptionValue;
@@ -5910,9 +5910,9 @@ JSValue* Interpreter::cti_op_in(CTI_ARGS)
     if (!baseVal->isObject()) {
         CallFrame* callFrame = ARG_callFrame;
         CodeBlock* codeBlock = callFrame->codeBlock();
-        ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));
-        unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);
-        ARG_globalData->exception = createInvalidParamError(callFrame, "in", baseVal, codeBlock->instructions.begin() + vPCIndex, codeBlock);
+        ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS));
+        unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS);
+        ARG_globalData->exception = createInvalidParamError(callFrame, "in", baseVal, codeBlock->instructions().begin() + vPCIndex, codeBlock);
         VM_THROW_EXCEPTION();
     }
 
@@ -6077,7 +6077,7 @@ JSObject* Interpreter::cti_op_new_error(CTI_ARGS)
     JSValue* message = ARG_src2;
     unsigned lineNumber = ARG_int3;
 
-    return Error::create(callFrame, static_cast<ErrorType>(type), message->toString(callFrame), lineNumber, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->sourceURL());
+    return Error::create(callFrame, static_cast<ErrorType>(type), message->toString(callFrame), lineNumber, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
 }
 
 void Interpreter::cti_op_debug(CTI_ARGS)
@@ -6101,14 +6101,14 @@ JSValue* Interpreter::cti_vm_throw(CTI_ARGS)
     CodeBlock* codeBlock = callFrame->codeBlock();
     JSGlobalData* globalData = ARG_globalData;
 
-    ASSERT(codeBlock->ctiReturnAddressVPCMap.contains(globalData->exceptionLocation));
-    unsigned vPCIndex = codeBlock->ctiReturnAddressVPCMap.get(globalData->exceptionLocation);
+    ASSERT(codeBlock->jitReturnAddressVPCMap().contains(globalData->exceptionLocation));
+    unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(globalData->exceptionLocation);
 
     JSValue* exceptionValue = globalData->exception;
     ASSERT(exceptionValue);
     globalData->exception = noValue();
 
-    Instruction* handlerVPC = globalData->interpreter->throwException(callFrame, exceptionValue, codeBlock->instructions.begin() + vPCIndex, false);
+    Instruction* handlerVPC = globalData->interpreter->throwException(callFrame, exceptionValue, codeBlock->instructions().begin() + vPCIndex, false);
 
     if (!handlerVPC) {
         *ARG_exception = exceptionValue;
index 50f5416..ea1245b 100644 (file)
@@ -184,9 +184,9 @@ JIT::JIT(JSGlobalData* globalData, CodeBlock* codeBlock)
     : m_interpreter(globalData->interpreter)
     , m_globalData(globalData)
     , m_codeBlock(codeBlock)
-    , m_labels(codeBlock ? codeBlock->instructions.size() : 0)
-    , m_propertyAccessCompilationInfo(codeBlock ? codeBlock->propertyAccessInstructions.size() : 0)
-    , m_callStructureStubCompilationInfo(codeBlock ? codeBlock->callLinkInfos.size() : 0)
+    , m_labels(codeBlock ? codeBlock->instructions().size() : 0)
+    , m_propertyAccessCompilationInfo(codeBlock ? codeBlock->numberOfPropertyAccessInstructions() : 0)
+    , m_callStructureStubCompilationInfo(codeBlock ? codeBlock->numberOfCallLinkInfos() : 0)
     , m_lastResultBytecodeRegister(std::numeric_limits<int>::max())
     , m_jumpTargetsPosition(0)
 {
@@ -265,8 +265,8 @@ void JIT::emitSlowScriptCheck(unsigned bytecodeIndex)
 
 void JIT::privateCompileMainPass()
 {
-    Instruction* instruction = m_codeBlock->instructions.begin();
-    unsigned instructionCount = m_codeBlock->instructions.size();
+    Instruction* instruction = m_codeBlock->instructions().begin();
+    unsigned instructionCount = m_codeBlock->instructions().size();
 
     unsigned propertyAccessInstructionIndex = 0;
     unsigned callLinkInfoIndex = 0;
@@ -319,7 +319,7 @@ void JIT::privateCompileMainPass()
             break;
         }
         case op_end: {
-            if (m_codeBlock->needsFullScopeChain)
+            if (m_codeBlock->needsFullScopeChain())
                 emitCTICall(i, Interpreter::cti_op_end);
             emitGetVirtualRegister(instruction[i + 1].u.operand, X86::eax, i);
             __ pushl_m(RegisterFile::ReturnPC * static_cast<int>(sizeof(Register)), X86::edi);
@@ -393,12 +393,12 @@ void JIT::privateCompileMainPass()
             break;
         }
         case op_put_by_id: {
-            compilePutByIdHotPath(instruction[i + 1].u.operand, &(m_codeBlock->identifiers[instruction[i + 2].u.operand]), instruction[i + 3].u.operand, i, propertyAccessInstructionIndex++);
+            compilePutByIdHotPath(instruction[i + 1].u.operand, &(m_codeBlock->identifier(instruction[i + 2].u.operand)), instruction[i + 3].u.operand, i, propertyAccessInstructionIndex++);
             i += 8;
             break;
         }
         case op_get_by_id: {
-            compileGetByIdHotPath(instruction[i + 1].u.operand, instruction[i + 2].u.operand, &(m_codeBlock->identifiers[instruction[i + 3].u.operand]), i, propertyAccessInstructionIndex++);
+            compileGetByIdHotPath(instruction[i + 1].u.operand, instruction[i + 2].u.operand, &(m_codeBlock->identifier(instruction[i + 3].u.operand)), i, propertyAccessInstructionIndex++);
             i += 8;
             break;
         }
@@ -463,7 +463,7 @@ void JIT::privateCompileMainPass()
         }
         case op_del_by_id: {
             emitPutCTIArgFromVirtualRegister(instruction[i + 2].u.operand, 0, X86::ecx);
-            Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 3].u.operand]);
+            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 3].u.operand));
             emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 4);
             emitCTICall(i, Interpreter::cti_op_del_by_id);
             emitPutVirtualRegister(instruction[i + 1].u.operand);
@@ -500,7 +500,7 @@ void JIT::privateCompileMainPass()
             break;
         }
         case op_new_func: {
-            FuncDeclNode* func = (m_codeBlock->functions[instruction[i + 2].u.operand]).get();
+            FuncDeclNode* func = m_codeBlock->function(instruction[i + 2].u.operand);
             emitPutCTIArgConstant(reinterpret_cast<unsigned>(func), 0);
             emitCTICall(i, Interpreter::cti_op_new_func);
             emitPutVirtualRegister(instruction[i + 1].u.operand);
@@ -531,7 +531,7 @@ void JIT::privateCompileMainPass()
             break;
         }
         case op_get_scoped_var: {
-            int skip = instruction[i + 3].u.operand + m_codeBlock->needsFullScopeChain;
+            int skip = instruction[i + 3].u.operand + m_codeBlock->needsFullScopeChain();
 
             emitGetFromCallFrameHeader(RegisterFile::ScopeChain, X86::eax);
             while (skip--)
@@ -544,7 +544,7 @@ void JIT::privateCompileMainPass()
             break;
         }
         case op_put_scoped_var: {
-            int skip = instruction[i + 2].u.operand + m_codeBlock->needsFullScopeChain;
+            int skip = instruction[i + 2].u.operand + m_codeBlock->needsFullScopeChain();
 
             emitGetFromCallFrameHeader(RegisterFile::ScopeChain, X86::edx);
             emitGetVirtualRegister(instruction[i + 3].u.operand, X86::eax, i);
@@ -569,7 +569,7 @@ void JIT::privateCompileMainPass()
         }
         case op_ret: {
             // We could JIT generate the deref, only calling out to C when the refcount hits zero.
-            if (m_codeBlock->needsFullScopeChain)
+            if (m_codeBlock->needsFullScopeChain())
                 emitCTICall(i, Interpreter::cti_op_ret_scopeChain);
 
             // Return the result in %eax.
@@ -598,7 +598,7 @@ void JIT::privateCompileMainPass()
             break;
         }
         case op_resolve: {
-            Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 2].u.operand]);
+            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand));
             emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0);
             emitCTICall(i, Interpreter::cti_op_resolve);
             emitPutVirtualRegister(instruction[i + 1].u.operand);
@@ -641,7 +641,7 @@ void JIT::privateCompileMainPass()
             break;
         }
         case op_resolve_func: {
-            Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 3].u.operand]);
+            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 3].u.operand));
             emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0);
             emitCTICall(i, Interpreter::cti_op_resolve_func);
             emitPutVirtualRegister(instruction[i + 2].u.operand, X86::edx);
@@ -704,7 +704,7 @@ void JIT::privateCompileMainPass()
             break;
         };
         case op_resolve_base: {
-            Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 2].u.operand]);
+            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand));
             emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0);
             emitCTICall(i, Interpreter::cti_op_resolve_base);
             emitPutVirtualRegister(instruction[i + 1].u.operand);
@@ -719,9 +719,9 @@ void JIT::privateCompileMainPass()
             break;
         }
         case op_resolve_skip: {
-            Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 2].u.operand]);
+            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand));
             emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0);
-            emitPutCTIArgConstant(instruction[i + 3].u.operand + m_codeBlock->needsFullScopeChain, 4);
+            emitPutCTIArgConstant(instruction[i + 3].u.operand + m_codeBlock->needsFullScopeChain(), 4);
             emitCTICall(i, Interpreter::cti_op_resolve_skip);
             emitPutVirtualRegister(instruction[i + 1].u.operand);
             i += 4;
@@ -730,7 +730,7 @@ void JIT::privateCompileMainPass()
         case op_resolve_global: {
             // Fast case
             unsigned globalObject = asInteger(instruction[i + 2].u.jsCell);
-            Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 3].u.operand]);
+            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 3].u.operand));
             void* structureAddress = reinterpret_cast<void*>(instruction + i + 4);
             void* offsetAddr = reinterpret_cast<void*>(instruction + i + 5);
 
@@ -886,7 +886,7 @@ void JIT::privateCompileMainPass()
             break;
         }
         case op_unexpected_load: {
-            JSValue* v = m_codeBlock->unexpectedConstants[instruction[i + 2].u.operand];
+            JSValue* v = m_codeBlock->unexpectedConstant(instruction[i + 2].u.operand);
             __ movl_i32r(asInteger(v), X86::eax);
             emitPutVirtualRegister(instruction[i + 1].u.operand);
             i += 3;
@@ -983,7 +983,7 @@ void JIT::privateCompileMainPass()
             break;
         }
         case op_resolve_with_base: {
-            Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 3].u.operand]);
+            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 3].u.operand));
             emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0);
             emitCTICall(i, Interpreter::cti_op_resolve_with_base);
             emitPutVirtualRegister(instruction[i + 2].u.operand, X86::edx);
@@ -992,7 +992,7 @@ void JIT::privateCompileMainPass()
             break;
         }
         case op_new_func_exp: {
-            FuncExprNode* func = (m_codeBlock->functionExpressions[instruction[i + 2].u.operand]).get();
+            FuncExprNode* func = m_codeBlock->functionExpression(instruction[i + 2].u.operand);
             emitPutCTIArgConstant(reinterpret_cast<unsigned>(func), 0);
             emitCTICall(i, Interpreter::cti_op_new_func_exp);
             emitPutVirtualRegister(instruction[i + 1].u.operand);
@@ -1069,7 +1069,7 @@ void JIT::privateCompileMainPass()
             break;
         }
         case op_new_regexp: {
-            RegExp* regExp = m_codeBlock->regexps[instruction[i + 2].u.operand].get();
+            RegExp* regExp = m_codeBlock->regexp(instruction[i + 2].u.operand);
             emitPutCTIArgConstant(reinterpret_cast<unsigned>(regExp), 0);
             emitCTICall(i, Interpreter::cti_op_new_regexp);
             emitPutVirtualRegister(instruction[i + 1].u.operand);
@@ -1171,7 +1171,7 @@ void JIT::privateCompileMainPass()
             break;
         }
         case op_push_new_scope: {
-            Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 2].u.operand]);
+            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand));
             emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0);
             emitPutCTIArgFromVirtualRegister(instruction[i + 3].u.operand, 4, X86::ecx);
             emitCTICall(i, Interpreter::cti_op_push_new_scope);
@@ -1262,7 +1262,7 @@ void JIT::privateCompileMainPass()
         }
         case op_put_getter: {
             emitPutCTIArgFromVirtualRegister(instruction[i + 1].u.operand, 0, X86::ecx);
-            Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 2].u.operand]);
+            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand));
             emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 4);
             emitPutCTIArgFromVirtualRegister(instruction[i + 3].u.operand, 8, X86::ecx);
             emitCTICall(i, Interpreter::cti_op_put_getter);
@@ -1271,7 +1271,7 @@ void JIT::privateCompileMainPass()
         }
         case op_put_setter: {
             emitPutCTIArgFromVirtualRegister(instruction[i + 1].u.operand, 0, X86::ecx);
-            Identifier* ident = &(m_codeBlock->identifiers[instruction[i + 2].u.operand]);
+            Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand));
             emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 4);
             emitPutCTIArgFromVirtualRegister(instruction[i + 3].u.operand, 8, X86::ecx);
             emitCTICall(i, Interpreter::cti_op_put_setter);
@@ -1279,7 +1279,7 @@ void JIT::privateCompileMainPass()
             break;
         }
         case op_new_error: {
-            JSValue* message = m_codeBlock->unexpectedConstants[instruction[i + 3].u.operand];
+            JSValue* message = m_codeBlock->unexpectedConstant(instruction[i + 3].u.operand);
             emitPutCTIArgConstant(instruction[i + 2].u.operand, 0);
             emitPutCTIArgConstant(asInteger(message), 4);
             emitPutCTIArgConstant(m_codeBlock->lineNumberForVPC(&instruction[i]), 8);
@@ -1358,7 +1358,7 @@ void JIT::privateCompileMainPass()
             // Even though CTI doesn't use them, we initialize our constant
             // registers to zap stale pointers, to avoid unnecessarily prolonging
             // object lifetime and increasing GC pressure.
-            size_t count = m_codeBlock->numVars + m_codeBlock->constantRegisters.size();
+            size_t count = m_codeBlock->m_numVars + m_codeBlock->numberOfConstantRegisters();
             for (size_t j = 0; j < count; ++j)
                 emitInitRegister(j);
 
@@ -1369,7 +1369,7 @@ void JIT::privateCompileMainPass()
             // Even though CTI doesn't use them, we initialize our constant
             // registers to zap stale pointers, to avoid unnecessarily prolonging
             // object lifetime and increasing GC pressure.
-            size_t count = m_codeBlock->numVars + m_codeBlock->constantRegisters.size();
+            size_t count = m_codeBlock->m_numVars + m_codeBlock->numberOfConstantRegisters();
             for (size_t j = 0; j < count; ++j)
                 emitInitRegister(j);
 
@@ -1380,7 +1380,7 @@ void JIT::privateCompileMainPass()
             break;
         }
         case op_create_arguments: {
-            emitCTICall(i, (m_codeBlock->numParameters == 1) ? Interpreter::cti_op_create_arguments_no_params : Interpreter::cti_op_create_arguments);
+            emitCTICall(i, (m_codeBlock->m_numParameters == 1) ? Interpreter::cti_op_create_arguments_no_params : Interpreter::cti_op_create_arguments);
             i += 1;
             break;
         }
@@ -1432,8 +1432,8 @@ void JIT::privateCompileMainPass()
         }
     }
 
-    ASSERT(propertyAccessInstructionIndex == m_codeBlock->propertyAccessInstructions.size());
-    ASSERT(callLinkInfoIndex == m_codeBlock->callLinkInfos.size());
+    ASSERT(propertyAccessInstructionIndex == m_codeBlock->numberOfPropertyAccessInstructions());
+    ASSERT(callLinkInfoIndex == m_codeBlock->numberOfCallLinkInfos());
 }
 
 
@@ -1461,7 +1461,7 @@ void JIT::privateCompileSlowCases()
     unsigned propertyAccessInstructionIndex = 0;
     unsigned callLinkInfoIndex = 0;
 
-    Instruction* instruction = m_codeBlock->instructions.begin();
+    Instruction* instruction = m_codeBlock->instructions().begin();
     for (Vector<SlowCaseEntry>::iterator iter = m_slowCases.begin(); iter != m_slowCases.end(); ++iter) {
         // FIXME: enable peephole optimizations for slow cases when applicable
         killLastResultRegister();
@@ -1604,12 +1604,12 @@ void JIT::privateCompileSlowCases()
             break;
         }
         case op_put_by_id: {
-            compilePutByIdSlowCase(instruction[i + 1].u.operand, &(m_codeBlock->identifiers[instruction[i + 2].u.operand]), instruction[i + 3].u.operand, i, iter, propertyAccessInstructionIndex++);
+            compilePutByIdSlowCase(instruction[i + 1].u.operand, &(m_codeBlock->identifier(instruction[i + 2].u.operand)), instruction[i + 3].u.operand, i, iter, propertyAccessInstructionIndex++);
             i += 8;
             break;
         }
         case op_get_by_id: {
-            compileGetByIdSlowCase(instruction[i + 1].u.operand, instruction[i + 2].u.operand, &(m_codeBlock->identifiers[instruction[i + 3].u.operand]), i, iter, propertyAccessInstructionIndex++);
+            compileGetByIdSlowCase(instruction[i + 1].u.operand, instruction[i + 2].u.operand, &(m_codeBlock->identifier(instruction[i + 3].u.operand)), i, iter, propertyAccessInstructionIndex++);
             i += 8;
             break;
         }
@@ -1947,8 +1947,8 @@ void JIT::privateCompileSlowCases()
         __ link(__ jmp(), m_labels[i]);
     }
 
-    ASSERT(propertyAccessInstructionIndex == m_codeBlock->propertyAccessInstructions.size());
-    ASSERT(callLinkInfoIndex == m_codeBlock->callLinkInfos.size());
+    ASSERT(propertyAccessInstructionIndex == m_codeBlock->numberOfPropertyAccessInstructions());
+    ASSERT(callLinkInfoIndex == m_codeBlock->numberOfCallLinkInfos());
 }
 
 void JIT::privateCompile()
@@ -1957,7 +1957,7 @@ void JIT::privateCompile()
         __ movl_i32m(reinterpret_cast<unsigned>(m_codeBlock), m_interpreter->sampler()->codeBlockSlot());
 #endif
 #if ENABLE(OPCODE_SAMPLING)
-        __ movl_i32m(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin()), m_interpreter->sampler()->sampleSlot());
+        __ movl_i32m(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin()), m_interpreter->sampler()->sampleSlot());
 #endif
 
     // Could use a popl_m, but would need to offset the following instruction if so.
@@ -1966,12 +1966,12 @@ void JIT::privateCompile()
 
     JmpSrc slowRegisterFileCheck;
     JmpDst afterRegisterFileCheck;
-    if (m_codeBlock->codeType == FunctionCode) {
+    if (m_codeBlock->codeType() == FunctionCode) {
         // In the case of a fast linked call, we do not set this up in the caller.
         emitPutImmediateToCallFrameHeader(m_codeBlock, RegisterFile::CodeBlock);
 
         emitGetCTIParam(CTI_ARGS_registerFile, X86::eax);
-        __ leal_mr(m_codeBlock->numCalleeRegisters * sizeof(Register), X86::edi, X86::edx);
+        __ leal_mr(m_codeBlock->m_numCalleeRegisters * sizeof(Register), X86::edi, X86::edx);
         __ cmpl_mr(FIELD_OFFSET(RegisterFile, m_end), X86::eax, X86::edx);
         slowRegisterFileCheck = __ jg();
         afterRegisterFileCheck = __ label();
@@ -1981,7 +1981,7 @@ void JIT::privateCompile()
     privateCompileLinkPass();
     privateCompileSlowCases();
 
-    if (m_codeBlock->codeType == FunctionCode) {
+    if (m_codeBlock->codeType() == FunctionCode) {
         __ link(slowRegisterFileCheck, __ label());
         emitCTICall(0, Interpreter::cti_register_file_check);
         JmpSrc backToBody = __ jmp();
@@ -2020,33 +2020,35 @@ void JIT::privateCompile()
         }
     }
 
-    for (Vector<HandlerInfo>::iterator iter = m_codeBlock->exceptionHandlers.begin(); iter != m_codeBlock->exceptionHandlers.end(); ++iter)
-         iter->nativeCode = __ getRelocatedAddress(code, m_labels[iter->target]);
+    for (size_t i = 0; i < m_codeBlock->numberOfExceptionHandlers(); ++i) {
+        HandlerInfo& handler = m_codeBlock->exceptionHandler(i);
+        handler.nativeCode = __ getRelocatedAddress(code, m_labels[handler.target]);
+    }
 
     for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) {
         if (iter->to)
             X86Assembler::link(code, iter->from, iter->to);
-        m_codeBlock->ctiReturnAddressVPCMap.add(__ getRelocatedAddress(code, iter->from), iter->bytecodeIndex);
+        m_codeBlock->jitReturnAddressVPCMap().add(__ getRelocatedAddress(code, iter->from), iter->bytecodeIndex);
     }
 
     // Link absolute addresses for jsr
     for (Vector<JSRInfo>::iterator iter = m_jsrSites.begin(); iter != m_jsrSites.end(); ++iter)
         X86Assembler::linkAbsoluteAddress(code, iter->addrPosition, iter->target);
 
-    for (unsigned i = 0; i < m_codeBlock->propertyAccessInstructions.size(); ++i) {
-        StructureStubInfo& info = m_codeBlock->propertyAccessInstructions[i];
+    for (unsigned i = 0; i < m_codeBlock->numberOfPropertyAccessInstructions(); ++i) {
+        StructureStubInfo& info = m_codeBlock->propertyAccessInstruction(i);
         info.callReturnLocation = X86Assembler::getRelocatedAddress(code, m_propertyAccessCompilationInfo[i].callReturnLocation);
         info.hotPathBegin = X86Assembler::getRelocatedAddress(code, m_propertyAccessCompilationInfo[i].hotPathBegin);
     }
-    for (unsigned i = 0; i < m_codeBlock->callLinkInfos.size(); ++i) {
-        CallLinkInfo& info = m_codeBlock->callLinkInfos[i];
+    for (unsigned i = 0; i < m_codeBlock->numberOfCallLinkInfos(); ++i) {
+        CallLinkInfo& info = m_codeBlock->callLinkInfo(i);
         info.callReturnLocation = X86Assembler::getRelocatedAddress(code, m_callStructureStubCompilationInfo[i].callReturnLocation);
         info.hotPathBegin = X86Assembler::getRelocatedAddress(code, m_callStructureStubCompilationInfo[i].hotPathBegin);
         info.hotPathOther = X86Assembler::getRelocatedAddress(code, m_callStructureStubCompilationInfo[i].hotPathOther);
         info.coldPathOther = X86Assembler::getRelocatedAddress(code, m_callStructureStubCompilationInfo[i].coldPathOther);
     }
 
-    m_codeBlock->ctiCode = code;
+    m_codeBlock->setJITCode(code);
 }
 
 void JIT::privateCompileCTIMachineTrampolines()
@@ -2110,7 +2112,7 @@ void JIT::privateCompileCTIMachineTrampolines()
     __ link(hasCodeBlock1, __ label());
 
     // Check argCount matches callee arity.
-    __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, numParameters), X86::eax);
+    __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, m_numParameters), X86::eax);
     JmpSrc arityCheckOkay1 = __ je();
     __ popl_r(X86::ebx);
     emitPutCTIArg(X86::ebx, 4);
@@ -2152,7 +2154,7 @@ void JIT::privateCompileCTIMachineTrampolines()
     __ link(hasCodeBlock2, __ label());
 
     // Check argCount matches callee arity.
-    __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, numParameters), X86::eax);
+    __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, m_numParameters), X86::eax);
     JmpSrc arityCheckOkay2 = __ je();
     __ popl_r(X86::ebx);
     emitPutCTIArg(X86::ebx, 4);
@@ -2194,7 +2196,7 @@ void JIT::privateCompileCTIMachineTrampolines()
     __ link(hasCodeBlock3, __ label());
 
     // Check argCount matches callee arity.
-    __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, numParameters), X86::eax);
+    __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, m_numParameters), X86::eax);
     JmpSrc arityCheckOkay3 = __ je();
     __ popl_r(X86::ebx);
     emitPutCTIArg(X86::ebx, 4);
@@ -2211,7 +2213,7 @@ void JIT::privateCompileCTIMachineTrampolines()
     compileOpCallInitializeCallFrame();
 
     // load ctiCode from the new codeBlock.
-    __ movl_mr(FIELD_OFFSET(CodeBlock, ctiCode), X86::eax, X86::eax);
+    __ movl_mr(FIELD_OFFSET(CodeBlock, m_jitCode), X86::eax, X86::eax);
 
     __ jmp_r(X86::eax);
 
index 49055fb..ce8bd5d 100644 (file)
@@ -55,7 +55,7 @@ void JIT::unlinkCall(CallLinkInfo* callLinkInfo)
 void JIT::linkCall(JSFunction* callee, CodeBlock* calleeCodeBlock, void* ctiCode, CallLinkInfo* callLinkInfo, int callerArgCount)
 {
     // Currently we only link calls with the exact number of arguments.
-    if (callerArgCount == calleeCodeBlock->numParameters) {
+    if (callerArgCount == calleeCodeBlock->m_numParameters) {
         ASSERT(!callLinkInfo->isLinked());
     
         calleeCodeBlock->addCaller(callLinkInfo);
index 464169f..0616cc6 100644 (file)
@@ -68,8 +68,8 @@ ALWAYS_INLINE void JIT::emitGetVirtualRegister(int src, RegisterID dst, unsigned
 
     if (src == m_lastResultBytecodeRegister && m_codeBlock->isTemporaryRegisterIndex(src)) {
         bool atJumpTarget = false;
-        while (m_jumpTargetsPosition < m_codeBlock->jumpTargets.size() && m_codeBlock->jumpTargets[m_jumpTargetsPosition] <= currentInstructionIndex) {
-            if (m_codeBlock->jumpTargets[m_jumpTargetsPosition] == currentInstructionIndex)
+        while (m_jumpTargetsPosition < m_codeBlock->numberOfJumpTargets() && m_codeBlock->jumpTarget(m_jumpTargetsPosition) <= currentInstructionIndex) {
+            if (m_codeBlock->jumpTarget(m_jumpTargetsPosition) == currentInstructionIndex)
                 atJumpTarget = true;
             ++m_jumpTargetsPosition;
         }
@@ -224,14 +224,14 @@ ALWAYS_INLINE void JIT::restoreArgumentReferenceForTrampoline()
 ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_j helper)
 {
 #if ENABLE(OPCODE_SAMPLING)
-    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
+    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
 #endif
     restoreArgumentReference();
     emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
     JmpSrc ctiCall = call();
     m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
 #if ENABLE(OPCODE_SAMPLING)
-    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
+    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
 #endif
     killLastResultRegister();
 
@@ -241,14 +241,14 @@ ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_j helper
 ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_o helper)
 {
 #if ENABLE(OPCODE_SAMPLING)
-    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
+    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
 #endif
     restoreArgumentReference();
     emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
     JmpSrc ctiCall = call();
     m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
 #if ENABLE(OPCODE_SAMPLING)
-    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
+    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
 #endif
     killLastResultRegister();
 
@@ -258,14 +258,14 @@ ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_o helper
 ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_p helper)
 {
 #if ENABLE(OPCODE_SAMPLING)
-    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
+    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
 #endif
     restoreArgumentReference();
     emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
     JmpSrc ctiCall = call();
     m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
 #if ENABLE(OPCODE_SAMPLING)
-    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
+    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
 #endif
     killLastResultRegister();
 
@@ -275,14 +275,14 @@ ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_p helper
 ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_b helper)
 {
 #if ENABLE(OPCODE_SAMPLING)
-    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
+    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
 #endif
     restoreArgumentReference();
     emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
     JmpSrc ctiCall = call();
     m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
 #if ENABLE(OPCODE_SAMPLING)
-    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
+    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
 #endif
     killLastResultRegister();
 
@@ -292,14 +292,14 @@ ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_b helper
 ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_v helper)
 {
 #if ENABLE(OPCODE_SAMPLING)
-    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
+    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
 #endif
     restoreArgumentReference();
     emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
     JmpSrc ctiCall = call();
     m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
 #if ENABLE(OPCODE_SAMPLING)
-    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
+    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
 #endif
     killLastResultRegister();
 
@@ -309,14 +309,14 @@ ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_v helper
 ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_s helper)
 {
 #if ENABLE(OPCODE_SAMPLING)
-    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
+    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
 #endif
     restoreArgumentReference();
     emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
     JmpSrc ctiCall = call();
     m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
 #if ENABLE(OPCODE_SAMPLING)
-    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
+    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
 #endif
     killLastResultRegister();
 
@@ -326,14 +326,14 @@ ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_s helper
 ALWAYS_INLINE JmpSrc JIT::emitCTICall(unsigned bytecodeIndex, CTIHelper_2 helper)
 {
 #if ENABLE(OPCODE_SAMPLING)
-    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
+    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());
 #endif
     restoreArgumentReference();
     emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame);
     JmpSrc ctiCall = call();
     m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex));
 #if ENABLE(OPCODE_SAMPLING)
-    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions.begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
+    store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());
 #endif
     killLastResultRegister();
 
index a4cba0f..816c15e 100644 (file)
@@ -114,7 +114,7 @@ void JIT::compileGetByIdHotPath(int resultVReg, int baseVReg, Identifier*, unsig
 
     emitGetVirtualRegister(baseVReg, X86::eax, i);
 
-    ASSERT(m_codeBlock->propertyAccessInstructions[propertyAccessInstructionIndex].bytecodeIndex == i);
+    ASSERT(m_codeBlock->propertyAccessInstruction(propertyAccessInstructionIndex).bytecodeIndex == i);
 
     emitJumpSlowCaseIfNotJSCell(X86::eax, i, baseVReg);
 
@@ -155,7 +155,7 @@ void JIT::compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident
     emitPutVirtualRegister(resultVReg);
 
     // Track the location of the call; this will be used to recover repatch information.
-    ASSERT(m_codeBlock->propertyAccessInstructions[propertyAccessInstructionIndex].bytecodeIndex == i);
+    ASSERT(m_codeBlock->propertyAccessInstruction(propertyAccessInstructionIndex).bytecodeIndex == i);
     m_propertyAccessCompilationInfo[propertyAccessInstructionIndex].callReturnLocation = call;
 }
 
@@ -167,7 +167,7 @@ void JIT::compilePutByIdHotPath(int baseVReg, Identifier*, int valueVReg, unsign
 
     emitGetVirtualRegisters(baseVReg, X86::eax, valueVReg, X86::edx, i);
 
-    ASSERT(m_codeBlock->propertyAccessInstructions[propertyAccessInstructionIndex].bytecodeIndex == i);
+    ASSERT(m_codeBlock->propertyAccessInstruction(propertyAccessInstructionIndex).bytecodeIndex == i);
 
     // Jump to a slow case if either the base object is an immediate, or if the Structure does not match.
     emitJumpSlowCaseIfNotJSCell(X86::eax, i, baseVReg);
@@ -198,7 +198,7 @@ void JIT::compilePutByIdSlowCase(int baseVReg, Identifier* ident, int, unsigned
     JmpSrc call = emitCTICall(i, Interpreter::cti_op_put_by_id);
 
     // Track the location of the call; this will be used to recover repatch information.
-    ASSERT(m_codeBlock->propertyAccessInstructions[propertyAccessInstructionIndex].bytecodeIndex == i);
+    ASSERT(m_codeBlock->propertyAccessInstruction(propertyAccessInstructionIndex).bytecodeIndex == i);
     m_propertyAccessCompilationInfo[propertyAccessInstructionIndex].callReturnLocation = call;
 }
 
index 323627e..8055365 100644 (file)
@@ -2465,7 +2465,7 @@ void EvalNode::generateBytecode(ScopeChainNode* scopeChainNode)
 
     m_code.set(new EvalCodeBlock(this, globalObject, source().provider()));
 
-    BytecodeGenerator generator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable, m_code.get());
+    BytecodeGenerator generator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable(), m_code.get());
     generator.generate();
 
     // Eval code needs to hang on to its declaration stacks to keep declaration info alive until Interpreter::execute time,
@@ -2549,7 +2549,7 @@ void FunctionBodyNode::generateBytecode(ScopeChainNode* scopeChainNode)
 
     m_code.set(new CodeBlock(this, FunctionCode, source().provider(), source().startOffset()));
 
-    BytecodeGenerator generator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable, m_code.get());
+    BytecodeGenerator generator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable(), m_code.get());
     generator.generate();
 
     destroyData();
index a4f6a56..fe7aaba 100644 (file)
@@ -107,7 +107,7 @@ namespace JSC {
         function = callFrame->callee();
     
         CodeBlock* codeBlock = &function->body()->generatedBytecode();
-        int numParameters = codeBlock->numParameters;
+        int numParameters = codeBlock->m_numParameters;
         argc = callFrame->argumentCount();
 
         if (argc <= numParameters)
@@ -206,8 +206,8 @@ namespace JSC {
     {
         ASSERT(!d()->registerArray);
 
-        size_t numParametersMinusThis = d()->functionBody->generatedBytecode().numParameters - 1;
-        size_t numVars = d()->functionBody->generatedBytecode().numVars;
+        size_t numParametersMinusThis = d()->functionBody->generatedBytecode().m_numParameters - 1;
+        size_t numVars = d()->functionBody->generatedBytecode().m_numVars;
         size_t numLocals = numVars + numParametersMinusThis;
 
         if (!numLocals)
index f833086..10eb667 100644 (file)
@@ -95,7 +95,7 @@ JSValue* createUndefinedVariableError(ExecState* exec, const Identifier& ident,
     int line = codeBlock->expressionRangeForVPC(vPC, divotPoint, startOffset, endOffset);
     UString message = "Can't find variable: ";
     message.append(ident.ustring());
-    JSObject* exception = Error::create(exec, ReferenceError, message, line, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->sourceURL());
+    JSObject* exception = Error::create(exec, ReferenceError, message, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
     exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
     exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
     exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
@@ -106,7 +106,7 @@ bool isStrWhiteSpace(UChar c);
 
 static UString createErrorMessage(ExecState* exec, CodeBlock* codeBlock, int, int expressionStart, int expressionStop, JSValue* value, UString error)
 {
-    if (!expressionStop || expressionStart > codeBlock->source->length()) {
+    if (!expressionStop || expressionStart > codeBlock->source()->length()) {
         UString errorText = value->toString(exec);
         errorText.append(" is ");
         errorText.append(error);
@@ -117,14 +117,14 @@ static UString createErrorMessage(ExecState* exec, CodeBlock* codeBlock, int, in
     
     if (expressionStart < expressionStop) {
         errorText.append('\'');
-        errorText.append(codeBlock->source->getRange(expressionStart, expressionStop));
+        errorText.append(codeBlock->source()->getRange(expressionStart, expressionStop));
         errorText.append("' [");
         errorText.append(value->toString(exec));
         errorText.append("] is ");
     } else {
         // No range information, so give a few characters of context
-        const UChar* data = codeBlock->source->data();
-        int dataLength = codeBlock->source->length();
+        const UChar* data = codeBlock->source()->data();
+        int dataLength = codeBlock->source()->length();
         int start = expressionStart;
         int stop = expressionStart;
         // Get up to 20 characters of context to the left and right of the divot, clamping to the line.
@@ -138,7 +138,7 @@ static UString createErrorMessage(ExecState* exec, CodeBlock* codeBlock, int, in
         while (stop > expressionStart && isStrWhiteSpace(data[stop]))
             stop--;
         errorText.append("near '...");
-        errorText.append(codeBlock->source->getRange(start, stop));
+        errorText.append(codeBlock->source()->getRange(start, stop));
         errorText.append("...' [");
         errorText.append(value->toString(exec));
         errorText.append("] is ");
@@ -159,7 +159,7 @@ JSObject* createInvalidParamError(ExecState* exec, const char* op, JSValue* valu
     int divotPoint = 0;
     int line = codeBlock->expressionRangeForVPC(vPC, divotPoint, startOffset, endOffset);
     UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint, divotPoint + endOffset, value, message);
-    JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->sourceURL());
+    JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
     exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
     exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
     exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
@@ -175,12 +175,12 @@ JSObject* createNotAConstructorError(ExecState* exec, JSValue* value, const Inst
 
     // We're in a "new" expression, so we need to skip over the "new.." part
     int startPoint = divotPoint - (startOffset ? startOffset - 4 : 0); // -4 for "new "
-    const UChar* data = codeBlock->source->data();
+    const UChar* data = codeBlock->source()->data();
     while (startPoint < divotPoint && isStrWhiteSpace(data[startPoint]))
         startPoint++;
     
     UString errorMessage = createErrorMessage(exec, codeBlock, line, startPoint, divotPoint, value, "not a constructor");
-    JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->sourceURL());
+    JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
     exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
     exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
     exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
@@ -194,7 +194,7 @@ JSValue* createNotAFunctionError(ExecState* exec, JSValue* value, const Instruct
     int divotPoint = 0;
     int line = codeBlock->expressionRangeForVPC(vPC, divotPoint, startOffset, endOffset);
     UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, value, "not a function");
-    JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->sourceURL());    
+    JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());    
     exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
     exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
     exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
@@ -218,7 +218,7 @@ JSObject* createNotAnObjectError(ExecState* exec, JSNotAnObjectErrorStub* error,
     int divotPoint = 0;
     int line = codeBlock->expressionRangeForVPC(vPC, divotPoint, startOffset, endOffset);
     UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, error->isNull() ? jsNull() : jsUndefined(), "not an object");
-    JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->sourceURL());
+    JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL());
     exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete);
     exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete);
     exception->putWithAttributes(exec, Identifier(exec, expressionEndOffsetPropertyName), jsNumber(exec, divotPoint + endOffset), ReadOnly | DontDelete);
index 46445b0..5ddcb16 100644 (file)
@@ -57,7 +57,7 @@ void JSActivation::mark()
     if (!registerArray)
         return;
 
-    size_t numParametersMinusThis = d()->functionBody->generatedBytecode().numParameters - 1;
+    size_t numParametersMinusThis = d()->functionBody->generatedBytecode().m_numParameters - 1;
 
     size_t i = 0;
     size_t count = numParametersMinusThis; 
@@ -67,7 +67,7 @@ void JSActivation::mark()
             r.mark();
     }
 
-    size_t numVars = d()->functionBody->generatedBytecode().numVars;
+    size_t numVars = d()->functionBody->generatedBytecode().m_numVars;
 
     // Skip the call frame, which sits between the parameters and vars.
     i += RegisterFile::CallFrameHeaderSize;
index 866d4b2..9cd29d9 100644 (file)
@@ -69,7 +69,7 @@ namespace JSC {
     private:
         struct JSActivationData : public JSVariableObjectData {
             JSActivationData(PassRefPtr<FunctionBodyNode> functionBody, Register* registers)
-                : JSVariableObjectData(&functionBody->generatedBytecode().symbolTable, registers)
+                : JSVariableObjectData(&functionBody->generatedBytecode().symbolTable(), registers)
                 , functionBody(functionBody)
             {
             }
index 9dcbc08..f6fee58 100644 (file)
@@ -112,7 +112,7 @@ JSGlobalObject::~JSGlobalObject()
 
     HashSet<ProgramCodeBlock*>::const_iterator end = codeBlocks().end();
     for (HashSet<ProgramCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it)
-        (*it)->globalObject = 0;
+        (*it)->clearGlobalObject();
         
     RegisterFile& registerFile = globalData()->interpreter->registerFile();
     if (registerFile.globalObject() == this) {