Ignore:
Timestamp:
Nov 22, 2002, 1:04:55 AM (23 years ago)
Author:
darin
Message:

JavaScriptCore:

  • change ScopeChain to be a singly linked list shares tails, gives 11% gain on iBench
  • kjs/context.h: (ContextImp::pushScope): Make inline, use push instead of prepend, and pass imp pointer. (ContextImp::popScope): Make inline, use pop instead of removeFirst.
  • kjs/function.cpp: (DeclaredFunctionImp::DeclaredFunctionImp): No need to copy.
  • kjs/function_object.cpp: (FunctionObjectImp::construct): Use push instead of prepend, and pass imp pointer.
  • kjs/internal.cpp: (ContextImp::ContextImp): Use clear, push instead of prepend, and pass imp pointers.
  • kjs/nodes.cpp: (ResolveNode::evaluateReference): Use isEmpty, pop, and top instead of ScopeChainIterator.
  • kjs/object.h: Change _scope to be a NoRefScopeChain.
  • kjs/object.cpp: No need to initialize _scope any more, since it's not a NoRefScopeChain.
  • kjs/scope_chain.h: Rewrite, different implementation and interface.
  • kjs/scope_chain.cpp: More of the same.

WebCore:

  • khtml/ecma/kjs_dom.cpp: (DOMNode::pushEventHandlerScope): Change to push handlers on an existing scope chain rather than returning one. Name change too.
  • khtml/ecma/kjs_dom.h: More of the same.
  • khtml/ecma/kjs_html.cpp: (KJS::HTMLElement::pushEventHandlerScope): And here.
  • khtml/ecma/kjs_html.h: And here.
  • khtml/ecma/kjs_events.cpp: (JSEventListener::handleEvent): Use the pushEventHandlerScope function, and also don't worry about optimizing the "no change" case, because that already works pretty efficiently.
File:
1 edited

Legend:

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

    r2821 r2824  
    378378    case EvalCode:
    379379      if (_callingContext) {
    380         scope = _callingContext->scopeChain().copy();
     380        scope = _callingContext->scopeChain();
    381381        variable = _callingContext->variableObject();
    382382        thisVal = _callingContext->thisValue();
     
    384384      } // else same as GlobalCode
    385385    case GlobalCode:
    386       scope = ScopeChain();
    387       scope.prepend(glob);
     386      scope.clear();
     387      scope.push(glob.imp());
    388388      thisVal = Object(static_cast<ObjectImp*>(glob.imp()));
    389389      break;
     
    391391    case AnonymousCode:
    392392      if (type == FunctionCode) {
    393         scope = func->scope().copy();
    394         scope.prepend(activation);
     393        scope = func->scope();
     394        scope.push(activation.imp());
    395395      } else {
    396         scope = ScopeChain();
    397         scope.prepend(glob);
    398         scope.prepend(activation);
     396        scope.clear();
     397        scope.push(glob.imp());
     398        scope.push(activation.imp());
    399399      }
    400400      variable = activation; // TODO: DontDelete ? (ECMA 10.2.3)
     
    409409{
    410410  _interpreter->setContext(_callingContext);
    411 }
    412 
    413 void ContextImp::pushScope(const Object &s)
    414 {
    415   scope.prepend(s);
    416 }
    417 
    418 void ContextImp::popScope()
    419 {
    420   scope.removeFirst();
    421411}
    422412
Note: See TracChangeset for help on using the changeset viewer.