Ignore:
Timestamp:
Jun 6, 2008, 11:03:24 PM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Darin.

Combine per-thread objects into one, to make it easier to support legacy clients (for
which they shouldn't be really per-thread).

No change on SunSpider total.

  • kjs/JSGlobalData.cpp: Added. (KJS::JSGlobalData::JSGlobalData): (KJS::JSGlobalData::~JSGlobalData): (KJS::JSGlobalData::threadInstance):
  • kjs/JSGlobalData.h: Added. This class encapsulates all data that should be per-thread (or shared between legacy clients). It will also keep a Heap pointer, but right now, Heap (Collector) methods are all static.
  • kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor explicitly taking JSGlobalData to access IdentifierTable. Actually, all of them should, but this will be a separate patch.
  • kjs/identifier.cpp: (KJS::IdentifierTable::literalTable): (KJS::createIdentifierTable): (KJS::deleteIdentifierTable): (KJS::Identifier::add): (KJS::Identifier::addSlowCase): Combined IdentifierTable and LiteralIdentifierTable into a single class for simplicity.
  • kjs/grammar.y: kjsyyparse now takes JSGlobalData, not just a Lexer.
  • kjs/nodes.cpp: (KJS::Node::Node): (KJS::EvalFunctionCallNode::emitCode): (KJS::ScopeNode::ScopeNode): Changed to access Lexer and Parser via JSGlobalData::threadInstance(). This is also a temporary measure, they will need to use JSGlobalData explicitly.
  • VM/CodeGenerator.cpp: (KJS::CodeGenerator::CodeGenerator):
  • VM/CodeGenerator.h:
  • VM/Machine.cpp: (KJS::callEval):
  • kjs/CommonIdentifiers.cpp: (KJS::CommonIdentifiers::CommonIdentifiers):
  • kjs/CommonIdentifiers.h:
  • kjs/DebuggerCallFrame.cpp: (KJS::DebuggerCallFrame::evaluate):
  • kjs/ExecState.cpp: (KJS::ExecState::ExecState):
  • kjs/ExecState.h: (KJS::ExecState::globalData): (KJS::ExecState::identifierTable): (KJS::ExecState::propertyNames): (KJS::ExecState::emptyList): (KJS::ExecState::lexer): (KJS::ExecState::parser): (KJS::ExecState::arrayTable): (KJS::ExecState::dateTable): (KJS::ExecState::mathTable): (KJS::ExecState::numberTable): (KJS::ExecState::RegExpImpTable): (KJS::ExecState::RegExpObjectImpTable): (KJS::ExecState::stringTable):
  • kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce):
  • kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init):
  • kjs/JSGlobalObject.h: (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): (KJS::JSGlobalObject::head): (KJS::JSGlobalObject::globalData):
  • kjs/Parser.cpp: (KJS::Parser::parse):
  • kjs/Parser.h:
  • kjs/function.cpp: (KJS::FunctionImp::getParameterName): (KJS::IndexToNameMap::unMap): (KJS::globalFuncEval):
  • kjs/function_object.cpp: (KJS::FunctionObjectImp::construct):
  • kjs/interpreter.cpp: (KJS::Interpreter::checkSyntax): (KJS::Interpreter::evaluate):
  • kjs/lexer.cpp: (kjsyylex):
  • kjs/lexer.h:
  • kjs/testkjs.cpp: (prettyPrintScript): Updated for the above changes. Most of threadInstance uses here will need to be replaced with explicitly passed pointers to support legacy JSC clients.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/ExecState.h

    r34355 r34412  
    2525#define ExecState_h
    2626
     27#include "JSGlobalData.h"
    2728#include "LabelStack.h"
    2829#include "LocalStorageEntry.h"
     
    3334namespace KJS  {
    3435
    35     class CommonIdentifiers;
    3636    class EvalNode;
    3737    class FunctionBodyNode;
    3838    class FunctionImp;
    3939    class GlobalFuncImp;
    40     struct HashTable;
    4140    class Interpreter;
    4241    class JSGlobalObject;
     
    4948    struct Instruction;
    5049   
    51     struct PerThreadData {
    52         const HashTable* arrayTable;
    53         const HashTable* dateTable;
    54         const HashTable* mathTable;
    55         const HashTable* numberTable;
    56         const HashTable* RegExpImpTable;
    57         const HashTable* RegExpObjectImpTable;
    58         const HashTable* stringTable;
    59 
    60         CommonIdentifiers* propertyNames;
    61         List emptyList;
    62     };
    63 
    6450    // Represents the current state of script execution.
    6551    // Passed as the first argument to most functions.
     
    9278        bool hadException() const { return !!m_exception; }
    9379
    94         // These pointers are used to avoid accessing global variables for these,
    95         // to avoid taking PIC branches in Mach-O binaries.
    96         const CommonIdentifiers& propertyNames() const { return *m_perThreadData->propertyNames; }
    97         const List& emptyList() const { return m_perThreadData->emptyList; }
    98         static const HashTable* arrayTable(ExecState* exec) { return exec->m_perThreadData->arrayTable; }
    99         static const HashTable* dateTable(ExecState* exec) { return exec->m_perThreadData->dateTable; }
    100         static const HashTable* mathTable(ExecState* exec) { return exec->m_perThreadData->mathTable; }
    101         static const HashTable* numberTable(ExecState* exec) { return exec->m_perThreadData->numberTable; }
    102         static const HashTable* RegExpImpTable(ExecState* exec) { return exec->m_perThreadData->RegExpImpTable; }
    103         static const HashTable* RegExpObjectImpTable(ExecState* exec) { return exec->m_perThreadData->RegExpObjectImpTable; }
    104         static const HashTable* stringTable(ExecState* exec) { return exec->m_perThreadData->stringTable; }
     80        JSGlobalData& globalData() { return *m_globalData; }
     81
     82        IdentifierTable* identifierTable() { return m_globalData->identifierTable; }
     83        const CommonIdentifiers& propertyNames() const { return *m_globalData->propertyNames; }
     84        const List& emptyList() const { return m_globalData->emptyList; }
     85        Lexer* lexer() { return m_globalData->lexer; }
     86        Parser* parser() { return m_globalData->parser; }
     87        static const HashTable* arrayTable(ExecState* exec) { return exec->m_globalData->arrayTable; }
     88        static const HashTable* dateTable(ExecState* exec) { return exec->m_globalData->dateTable; }
     89        static const HashTable* mathTable(ExecState* exec) { return exec->m_globalData->mathTable; }
     90        static const HashTable* numberTable(ExecState* exec) { return exec->m_globalData->numberTable; }
     91        static const HashTable* RegExpImpTable(ExecState* exec) { return exec->m_globalData->RegExpImpTable; }
     92        static const HashTable* RegExpObjectImpTable(ExecState* exec) { return exec->m_globalData->RegExpObjectImpTable; }
     93        static const HashTable* stringTable(ExecState* exec) { return exec->m_globalData->stringTable; }
    10594
    10695    private:
     
    117106        JSValue* m_exception;
    118107
    119         const PerThreadData* m_perThreadData;
     108        JSGlobalData* m_globalData;
    120109
    121110        // These values are controlled by the machine.
Note: See TracChangeset for help on using the changeset viewer.