Changeset 28468 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp


Ignore:
Timestamp:
Dec 5, 2007, 6:31:41 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

Reviewed by Darin Adler.

Third step in refactoring JSGlobalObject: Moved data members and
functions accessing data members from Interpreter to JSGlobalObject.
Changed Interpreter member functions to static functions.


This resolves a bug in global object bootstrapping, where the global
ExecState could be used when uninitialized.


This is a big change, but it's mostly code motion and renaming.


Layout and JS tests, and testjsglue and testapi, pass. SunSpider reports
a .7% regression, but Shark sees no difference related to this patch,
and SunSpider reported a .7% speedup from an earlier step in this
refactoring, so I think it's fair to call that a wash.

JavaScriptGlue:

Reviewed by Darin Adler.

Third step in refactoring JSGlobalObject: Moved data members and data
member access from Interpreter to JSGlobalObject. Replaced JSInterpreter
subclass with JSGlobalObject subclass.


  • JSRun.cpp: (JSRun::JSRun): (JSRun::Evaluate): (JSRun::CheckSyntax):
  • JSRun.h: (JSGlueGlobalObject::JSGlueGlobalObject):
  • JSUtils.cpp: (KJSValueToCFTypeInternal):
  • JSValueWrapper.cpp: (getThreadGlobalExecState):

WebCore:

Reviewed by Darin Adler.

Third step in refactoring JSGlobalObject: Moved data members and data
member access from Interpreter to JSGlobalObject. Changed Interpreter
member functions to static functions. Same for the subclass,
ScriptInterpreter.


This is a big change, but it's mostly code motion and renaming.

WebKit/mac:

Reviewed by Darin Adler.

Third step in refactoring JSGlobalObject: Moved data members and data
member access from Interpreter to JSGlobalObject.


  • WebView/WebFrame.mm: (-[WebFrame _attachScriptDebugger]):

WebKit/win:

Reviewed by Darin Adler.

Third step in refactoring JSGlobalObject: Moved data members and data
member access from Interpreter to JSGlobalObject.


  • WebFrame.cpp: (WebFrame::globalContext): (WebFrame::attachScriptDebugger): (WebFrame::windowObjectCleared):
  • WebScriptDebugger.cpp: (WebScriptDebugger::WebScriptDebugger):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/nodes.cpp

    r28458 r28468  
    360360        }
    361361    }
    362     Debugger* dbg = exec->dynamicInterpreter()->debugger();
     362    Debugger* dbg = exec->dynamicGlobalObject()->debugger();
    363363    if (dbg && !dbg->hasHandledException(exec, exceptionValue)) {
    364364        bool cont = dbg->exception(exec, currentSourceId(exec), m_line, exceptionValue);
     
    393393bool StatementNode::hitStatement(ExecState* exec)
    394394{
    395   Debugger *dbg = exec->dynamicInterpreter()->debugger();
     395  Debugger *dbg = exec->dynamicGlobalObject()->debugger();
    396396  if (dbg)
    397397    return dbg->atStatement(exec, currentSourceId(exec), firstLine(), lastLine());
     
    491491JSValue* RegExpNode::evaluate(ExecState* exec)
    492492{
    493     return exec->lexicalInterpreter()->builtinRegExp()->createRegExpImp(exec, m_regExp);
     493    return exec->lexicalGlobalObject()->regExpConstructor()->createRegExpImp(exec, m_regExp);
    494494}
    495495
     
    615615JSValue *ElementNode::evaluate(ExecState *exec)
    616616{
    617   JSObject *array = exec->lexicalInterpreter()->builtinArray()->construct(exec, List::empty());
     617  JSObject *array = exec->lexicalGlobalObject()->arrayConstructor()->construct(exec, List::empty());
    618618  int length = 0;
    619619  for (ElementNode *n = this; n; n = n->next.get()) {
     
    646646    length = opt ? array->get(exec, exec->propertyNames().length)->toInt32(exec) : 0;
    647647  } else {
    648     JSValue *newArr = exec->lexicalInterpreter()->builtinArray()->construct(exec,List::empty());
     648    JSValue *newArr = exec->lexicalGlobalObject()->arrayConstructor()->construct(exec,List::empty());
    649649    array = static_cast<JSObject*>(newArr);
    650650    length = 0;
     
    671671    return list->evaluate(exec);
    672672
    673   return exec->lexicalInterpreter()->builtinObject()->construct(exec,List::empty());
     673  return exec->lexicalGlobalObject()->objectConstructor()->construct(exec,List::empty());
    674674}
    675675
     
    686686JSValue *PropertyListNode::evaluate(ExecState *exec)
    687687{
    688   JSObject *obj = exec->lexicalInterpreter()->builtinObject()->construct(exec, List::empty());
     688  JSObject *obj = exec->lexicalGlobalObject()->objectConstructor()->construct(exec, List::empty());
    689689 
    690690  for (PropertyListNode *p = this; p; p = p->next.get()) {
     
    946946  KJS_CHECKEXCEPTIONVALUE
    947947
    948   JSObject *thisObj =  exec->dynamicInterpreter()->globalObject();
     948  JSObject *thisObj =  exec->dynamicGlobalObject();
    949949
    950950  return func->call(exec, thisObj, argList);
     
    10011001      // that in host objects you always get a valid object for this.
    10021002      if (thisObj->isActivation())
    1003         thisObj = exec->dynamicInterpreter()->globalObject();
     1003        thisObj = exec->dynamicGlobalObject();
    10041004
    10051005      return func->call(exec, thisObj, argList);
     
    10621062    KJS_CHECKEXCEPTIONVALUE
    10631063
    1064     return func->call(exec, exec->dynamicInterpreter()->globalObject(), argList);
     1064    return func->call(exec, exec->dynamicGlobalObject(), argList);
    10651065}
    10661066
     
    37843784        exec->popIteration();
    37853785
    3786         if (exec->dynamicInterpreter()->timedOut())
     3786        if (exec->dynamicGlobalObject()->timedOut())
    37873787            return Completion(Interrupted);
    37883788
     
    38373837        exec->popIteration();
    38383838
    3839         if (exec->dynamicInterpreter()->timedOut())
     3839        if (exec->dynamicGlobalObject()->timedOut())
    38403840            return Completion(Interrupted);
    38413841   
     
    39033903        }
    39043904
    3905         if (exec->dynamicInterpreter()->timedOut())
     3905        if (exec->dynamicGlobalObject()->timedOut())
    39063906            return Completion(Interrupted);
    39073907
     
    45814581    processDeclarations(exec);
    45824582
    4583     if (Debugger* dbg = exec->dynamicInterpreter()->debugger()) {
     4583    if (Debugger* dbg = exec->dynamicGlobalObject()->debugger()) {
    45844584        if (!dbg->callEvent(exec, sourceId(), lineNo(), exec->function(), *exec->arguments())) {
    45854585            dbg->imp()->abort();
     
    45904590    Completion completion = BlockNode::execute(exec);
    45914591   
    4592     if (Debugger* dbg = exec->dynamicInterpreter()->debugger()) {
     4592    if (Debugger* dbg = exec->dynamicGlobalObject()->debugger()) {
    45934593        if (completion.complType() == Throw)
    45944594            exec->setException(completion.value());
     
    46214621  FunctionImp *func = new FunctionImp(exec, ident, body.get(), exec->scopeChain());
    46224622
    4623   JSObject *proto = exec->lexicalInterpreter()->builtinObject()->construct(exec, List::empty());
     4623  JSObject *proto = exec->lexicalGlobalObject()->objectConstructor()->construct(exec, List::empty());
    46244624  proto->put(exec, exec->propertyNames().constructor, func, ReadOnly | DontDelete | DontEnum);
    46254625  func->put(exec, exec->propertyNames().prototype, proto, Internal|DontDelete);
     
    46574657
    46584658  FunctionImp* func = new FunctionImp(exec, ident, body.get(), exec->scopeChain());
    4659   JSObject* proto = exec->lexicalInterpreter()->builtinObject()->construct(exec, List::empty());
     4659  JSObject* proto = exec->lexicalGlobalObject()->objectConstructor()->construct(exec, List::empty());
    46604660  proto->put(exec, exec->propertyNames().constructor, func, ReadOnly | DontDelete | DontEnum);
    46614661  func->put(exec, exec->propertyNames().prototype, proto, Internal | DontDelete);
Note: See TracChangeset for help on using the changeset viewer.