JavaScriptCore:
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Dec 2007 05:47:41 +0000 (05:47 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Dec 2007 05:47:41 +0000 (05:47 +0000)
        Reviewed by Sam Weinig.

        Split this:

                            FunctionBodyNode
                                    ^
                                    |
                                ProgramNode

        into this:

                                ScopeNode
                ^                   ^                   ^
                |                   |                   |
        FunctionBodyNode        ProgramNode         EvalNode

        in preparation for specializing each class more while optimizing global
        variable access.

        Also removed some cruft from the FunctionBodyNode interface to simplify
        things.

        SunSpider says this patch is a .8% speedup, which seems reasonable,
        since it eliminates a few branches and adds KJS_FAST_CALL in a few
        places.

        Layout tests and JS tests pass. Also, this baby builds on Windows! (Qt
        mileage may vary...)

WebCore:

        Reviewed by Sam Weinig.

        Updated for rename in JavaScriptCore.

        * bridge/mac/WebCoreScriptDebugger.mm:
        (-[WebCoreScriptCallFrame scopeChain]):
        (-[WebCoreScriptCallFrame functionName]):
        (-[WebCoreScriptCallFrame evaluateWebScript:]):

WebKit/win:

        Reviewed by Sam Weinig.

        Updated for rename in JavaScriptCore.

        * WebScriptCallFrame.cpp:
        (WebScriptCallFrame::functionName):
        (WebScriptCallFrame::valueByEvaluatingJavaScriptFromString):

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

13 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.exp
JavaScriptCore/kjs/ExecState.cpp
JavaScriptCore/kjs/ExecState.h
JavaScriptCore/kjs/JSVariableObject.h
JavaScriptCore/kjs/function.cpp
JavaScriptCore/kjs/function_object.cpp
JavaScriptCore/kjs/nodes.cpp
JavaScriptCore/kjs/nodes.h
WebCore/ChangeLog
WebCore/bridge/mac/WebCoreScriptDebugger.mm
WebKit/win/ChangeLog
WebKit/win/WebScriptCallFrame.cpp

index 8836af82dd97d4cd436b8be5f488578eaf4e4574..a4540f247ce4a5642a367263048e479ea86f1f83 100644 (file)
@@ -1,3 +1,34 @@
+2007-12-10  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Split this:
+        
+                            FunctionBodyNode
+                                    ^
+                                    |
+                                ProgramNode
+            
+        into this:
+            
+                                ScopeNode
+                ^                   ^                   ^
+                |                   |                   |
+        FunctionBodyNode        ProgramNode         EvalNode
+
+        in preparation for specializing each class more while optimizing global
+        variable access.
+        
+        Also removed some cruft from the FunctionBodyNode interface to simplify
+        things.
+        
+        SunSpider says this patch is a .8% speedup, which seems reasonable,
+        since it eliminates a few branches and adds KJS_FAST_CALL in a few
+        places.
+        
+        Layout tests and JS tests pass. Also, this baby builds on Windows! (Qt
+        mileage may vary...)
+
 2007-12-10  Geoffrey Garen  <ggaren@apple.com>
 
         RS by Mark Rowe.
index c134594f08fd594c80cbc8ae516014dee23b5b9c..b95cd999a8f573428c5001149487924781340399 100644 (file)
@@ -201,6 +201,7 @@ __ZN3KJS8Debugger6attachEPNS_14JSGlobalObjectE
 __ZN3KJS8Debugger9exceptionEPNS_9ExecStateEiiPNS_7JSValueE
 __ZN3KJS8DebuggerC2Ev
 __ZN3KJS8DebuggerD2Ev
+__ZN3KJS8EvalNodeC1EPN3WTF6VectorINS1_6RefPtrINS_13StatementNodeEEELm0EEE
 __ZN3KJS8JSObject11hasInstanceEPNS_9ExecStateEPNS_7JSValueE
 __ZN3KJS8JSObject12removeDirectERKNS_10IdentifierE
 __ZN3KJS8JSObject14callAsFunctionEPNS_9ExecStateEPS0_RKNS_4ListE
@@ -229,7 +230,7 @@ __ZN3KJS9Collector4sizeEv
 __ZN3KJS9Collector7collectEv
 __ZN3KJS9Collector7protectEPNS_7JSValueE
 __ZN3KJS9Collector9unprotectEPNS_7JSValueE
-__ZN3KJS9ExecStateC1EPNS_14JSGlobalObjectEPNS_8JSObjectEPNS_16FunctionBodyNodeENS_8CodeTypeEPS0_S8_PNS_11FunctionImpEPKNS_4ListE
+__ZN3KJS9ExecStateC1EPNS_14JSGlobalObjectEPNS_8JSObjectEPNS_9ScopeNodeENS_8CodeTypeEPS0_S8_PNS_11FunctionImpEPKNS_4ListE
 __ZN3KJS9ExecStateD1Ev
 __ZN3KJSeqERKNS_7UStringEPKc
 __ZN3WTF10fastCallocEmm
index b682f276e0ca4d1ed51ae805daa24cb35ecc3936..f6d80d27917d156cc271efcc9009d9b6e9022595 100644 (file)
@@ -33,14 +33,14 @@ namespace KJS {
 
 // ECMA 10.2
 ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisV, 
-                     FunctionBodyNode* currentBody, CodeType type, ExecState* callingExec, ExecState* currentExec,
+                     ScopeNode* scopeNode, CodeType type, ExecState* callingExec, ExecState* currentExec,
                      FunctionImp* func, const List* args)
     : m_globalObject(globalObject)
     , m_exception(0)
     , m_propertyNames(CommonIdentifiers::shared())
     , m_callingExec(callingExec)
     , m_savedExec(currentExec)
-    , m_currentBody(currentBody)
+    , m_scopeNode(scopeNode)
     , m_function(func)
     , m_arguments(args)
     , m_iterationDepth(0)
@@ -77,7 +77,7 @@ ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisV,
         break;
     }
 
-    if (currentBody)
+    if (scopeNode)
         m_globalObject->setCurrentExec(this);
 }
 
index 9b22b372a10d20bb831723df0ffc432c8975fc29..322170da591b41823dc42f84bad0760413de3f71 100644 (file)
@@ -39,13 +39,13 @@ namespace KJS  {
     };
     
     class ActivationImp;
-    class FunctionBodyNode;
     class FunctionImp;
     class GlobalFuncImp;
     class Interpreter;
     class JSGlobalObject;
     class JSVariableObject;
     class ScopeChain;
+    class ScopeNode;
     struct LocalStorageEntry;
     
     /**
@@ -84,7 +84,7 @@ namespace KJS  {
         
         ActivationImp* activationObject() { return m_activation; }
         CodeType codeType() { return m_codeType; }
-        FunctionBodyNode* currentBody() { return m_currentBody; }
+        ScopeNode* scopeNode() { return m_scopeNode; }
         FunctionImp* function() const { return m_function; }
         const List* arguments() const { return m_arguments; }
         
@@ -111,7 +111,7 @@ namespace KJS  {
     
     public:
         ExecState(JSGlobalObject* glob, JSObject* thisV,
-                  FunctionBodyNode* currentBody, CodeType type = GlobalCode,
+                  ScopeNode* scopeNode, CodeType type = GlobalCode,
                   ExecState* callingExecState = 0, ExecState* currentExec = 0, 
                   FunctionImp* function = 0, const List* args = 0);
         ~ExecState();
@@ -126,7 +126,7 @@ namespace KJS  {
 
         ExecState* m_callingExec;
         ExecState* m_savedExec;
-        FunctionBodyNode* m_currentBody;
+        ScopeNode* m_scopeNode;
         
         FunctionImp* m_function;
         const List* m_arguments;
index 11c92b972448e3e6c32b432ba8de8eaf3a77faf3..1b7b12fcb0150ca7202839440131035e2891b1ad 100644 (file)
@@ -55,8 +55,9 @@ namespace KJS {
             {
             }
 
-            LocalStorage localStorage;
-            SymbolTable* symbolTable;
+            LocalStorage localStorage; // Storage for variables in the symbol table.
+            SymbolTable* symbolTable; // Maps name -> index in localStorage.
+
         };
 
         JSVariableObject(JSVariableObjectData* data)
index fd2f3363becfbd80c9eb962427e68ea7e09a8a30..0846c2a5e6e061913e0442520d6911c09ec42ff9 100644 (file)
@@ -130,7 +130,7 @@ JSValue* FunctionImp::callerGetter(ExecState* exec, JSObject*, const Identifier&
 JSValue* FunctionImp::lengthGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot& slot)
 {
     FunctionImp* thisObj = static_cast<FunctionImp*>(slot.slotBase());
-    return jsNumber(thisObj->body->numParams());
+    return jsNumber(thisObj->body->parameters().size());
 }
 
 bool FunctionImp::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
@@ -180,7 +180,7 @@ Identifier FunctionImp::getParameterName(int index)
 {
     Vector<Identifier>& parameters = body->parameters();
 
-    if (static_cast<size_t>(index) >= body->numParams())
+    if (static_cast<size_t>(index) >= body->parameters().size())
         return CommonIdentifiers::shared()->nullIdentifier;
   
     Identifier name = parameters[index];
@@ -699,7 +699,7 @@ JSValue* GlobalFuncImp::callAsFunction(ExecState* exec, JSObject* thisObj, const
         int sourceId;
         int errLine;
         UString errMsg;
-        RefPtr<ProgramNode> progNode(parser().parse<ProgramNode>(UString(), 0, s.data(), s.size(), &sourceId, &errLine, &errMsg));
+        RefPtr<EvalNode> progNode(parser().parse<EvalNode>(UString(), 0, s.data(), s.size(), &sourceId, &errLine, &errMsg));
 
         Debugger* dbg = exec->dynamicGlobalObject()->debugger();
         if (dbg) {
index 275ce7c8c4c881810becf781febf6d1939ead583..0b81c702efca985107abbd2370ab13aeb3db4845 100644 (file)
@@ -231,11 +231,11 @@ JSObject* FunctionObjectImp::construct(ExecState* exec, const List& args, const
           while (i < len && *c == ' ')
               c++, i++;
           if (i == len) {
-              functionBody->addParam(Identifier(param));
+              functionBody->parameters().append(Identifier(param));
               params++;
               break;
           } else if (*c == ',') {
-              functionBody->addParam(Identifier(param));
+              functionBody->parameters().append(Identifier(param));
               params++;
               c++, i++;
               continue;
index 6e8e1614e66ce06dc27e084aa645d1697adbac6b..c37e4115adbad1f67f50b4f4c2778d6bfda65369 100644 (file)
@@ -265,13 +265,13 @@ static void substitute(UString &string, const UString &substring)
 static inline int currentSourceId(ExecState* exec) KJS_FAST_CALL;
 static inline int currentSourceId(ExecState* exec)
 {
-    return exec->currentBody()->sourceId();
+    return exec->scopeNode()->sourceId();
 }
 
 static inline const UString& currentSourceURL(ExecState* exec) KJS_FAST_CALL;
 static inline const UString& currentSourceURL(ExecState* exec)
 {
-    return exec->currentBody()->sourceURL();
+    return exec->scopeNode()->sourceURL();
 }
 
 Completion Node::createErrorCompletion(ExecState* exec, ErrorType e, const char *msg)
@@ -4400,17 +4400,30 @@ Completion TryNode::execute(ExecState *exec)
 
 // ------------------------------ FunctionBodyNode -----------------------------
 
-FunctionBodyNode::FunctionBodyNode(SourceElements* children)
+ScopeNode::ScopeNode(SourceElements* children)
     : BlockNode(children)
     , m_sourceURL(parser().sourceURL())
     , m_sourceId(parser().sourceId())
-    , m_initializedDeclarationStacks(false)
-    , m_initializedSymbolTable(false)
-    , m_optimizedResolveNodes(false)
 {
 }
 
-void FunctionBodyNode::initializeDeclarationStacks(ExecState* exec)
+ProgramNode::ProgramNode(SourceElements* children)
+    : ScopeNode(children)
+{
+}
+
+EvalNode::EvalNode(SourceElements* children)
+    : ScopeNode(children)
+{
+}
+
+FunctionBodyNode::FunctionBodyNode(SourceElements* children)
+    : ScopeNode(children)
+    , m_initialized(false)
+{
+}
+
+void ScopeNode::initializeDeclarationStacks(ExecState* exec)
 {
     DeclarationStacks::NodeStack nodeStack;
     DeclarationStacks stacks(exec, nodeStack, m_varStack, m_functionStack);
@@ -4429,8 +4442,6 @@ void FunctionBodyNode::initializeDeclarationStacks(ExecState* exec)
         node = nodeStack[size];
         nodeStack.shrink(size);
     }
-
-    m_initializedDeclarationStacks = true;
 }
 
 void FunctionBodyNode::initializeSymbolTable()
@@ -4447,8 +4458,6 @@ void FunctionBodyNode::initializeSymbolTable()
 
     for (i = 0, size = m_functionStack.size(); i < size; ++i)
         m_symbolTable.set(m_functionStack[i]->ident.ustring().rep(), count++);
-
-    m_initializedSymbolTable = true;
 }
 
 void FunctionBodyNode::optimizeVariableAccess()
@@ -4468,28 +4477,17 @@ void FunctionBodyNode::optimizeVariableAccess()
         node = nodeStack[size];
         nodeStack.shrink(size);
     }
-
-    m_optimizedResolveNodes = true;
 }
 
 void FunctionBodyNode::processDeclarations(ExecState* exec)
 {
-    if (!m_initializedDeclarationStacks)
+    if (!m_initialized) {
         initializeDeclarationStacks(exec);
-
-    if (exec->codeType() == FunctionCode)
-        processDeclarationsForFunctionCode(exec);
-    else
-        processDeclarationsForProgramCode(exec);
-}
-
-void FunctionBodyNode::processDeclarationsForFunctionCode(ExecState* exec)
-{
-    if (!m_initializedSymbolTable)
         initializeSymbolTable();
-
-    if (!m_optimizedResolveNodes)
         optimizeVariableAccess();
+        
+        m_initialized = true;
+    }
 
     LocalStorage& localStorage = exec->variableObject()->localStorage();
     localStorage.reserveCapacity(m_varStack.size() + m_parameters.size() + m_functionStack.size());
@@ -4520,13 +4518,15 @@ void FunctionBodyNode::processDeclarationsForFunctionCode(ExecState* exec)
     exec->updateLocalStorage();
 }
 
-void FunctionBodyNode::processDeclarationsForProgramCode(ExecState* exec)
+void ProgramNode::processDeclarations(ExecState* exec)
 {
+    initializeDeclarationStacks(exec);
+
     size_t i, size;
 
-    JSObject* variableObject = exec->variableObject();
+    JSVariableObject* variableObject = exec->variableObject();
     
-    int minAttributes = Internal | (exec->codeType() != EvalCode ? DontDelete : 0);
+    int minAttributes = Internal | DontDelete;
 
     for (i = 0, size = m_varStack.size(); i < size; ++i) {
         VarDeclNode* node = m_varStack[i];
@@ -4538,32 +4538,63 @@ void FunctionBodyNode::processDeclarationsForProgramCode(ExecState* exec)
         variableObject->put(exec, node->ident, jsUndefined(), attributes);
     }
 
-    ASSERT(!m_parameters.size());
-
     for (i = 0, size = m_functionStack.size(); i < size; ++i) {
         FuncDeclNode* node = m_functionStack[i];
         variableObject->put(exec, node->ident, node->makeFunction(exec), minAttributes);
     }
 }
 
-void FunctionBodyNode::addParam(const Identifier& ident)
+void EvalNode::processDeclarations(ExecState* exec)
 {
-  m_parameters.append(ident);
+    initializeDeclarationStacks(exec);
+
+    size_t i, size;
+
+    JSVariableObject* variableObject = exec->variableObject();
+    
+    int minAttributes = Internal;
+
+    for (i = 0, size = m_varStack.size(); i < size; ++i) {
+        VarDeclNode* node = m_varStack[i];
+        if (variableObject->hasProperty(exec, node->ident))
+            continue;
+        int attributes = minAttributes;
+        if (node->varType == VarDeclNode::Constant)
+            attributes |= ReadOnly;
+        variableObject->put(exec, node->ident, jsUndefined(), attributes);
+    }
+
+    for (i = 0, size = m_functionStack.size(); i < size; ++i) {
+        FuncDeclNode* node = m_functionStack[i];
+        variableObject->put(exec, node->ident, node->makeFunction(exec), minAttributes);
+    }
 }
 
 UString FunctionBodyNode::paramString() const
 {
   UString s("");
-  size_t count = numParams();
+  size_t count = m_parameters.size();
   for (size_t pos = 0; pos < count; ++pos) {
     if (!s.isEmpty())
         s += ", ";
-    s += paramName(pos).ustring();
+    s += m_parameters[pos].ustring();
   }
 
   return s;
 }
 
+Completion ProgramNode::execute(ExecState* exec)
+{
+    processDeclarations(exec);
+    return ScopeNode::execute(exec);
+}
+
+Completion EvalNode::execute(ExecState* exec)
+{
+    processDeclarations(exec);
+    return ScopeNode::execute(exec);
+}
+
 Completion FunctionBodyNode::execute(ExecState* exec)
 {
     processDeclarations(exec);
@@ -4575,7 +4606,7 @@ Completion FunctionBodyNode::execute(ExecState* exec)
         }
     }    
     
-    Completion completion = BlockNode::execute(exec);
+    Completion completion = ScopeNode::execute(exec);
     
     if (Debugger* dbg = exec->dynamicGlobalObject()->debugger()) {
         if (completion.complType() == Throw)
@@ -4596,7 +4627,7 @@ Completion FunctionBodyNode::execute(ExecState* exec)
 void FuncDeclNode::addParams() 
 {
   for (ParameterNode *p = param.get(); p != 0L; p = p->nextParam())
-    body->addParam(p->ident());
+    body->parameters().append(p->ident());
 }
 
 void FuncDeclNode::getDeclarations(DeclarationStacks& stacks) 
@@ -4612,7 +4643,7 @@ FunctionImp* FuncDeclNode::makeFunction(ExecState* exec)
   proto->put(exec, exec->propertyNames().constructor, func, ReadOnly | DontDelete | DontEnum);
   func->put(exec, exec->propertyNames().prototype, proto, Internal|DontDelete);
 
-  func->put(exec, exec->propertyNames().length, jsNumber(body->numParams()), ReadOnly|DontDelete|DontEnum);
+  func->put(exec, exec->propertyNames().length, jsNumber(body->parameters().size()), ReadOnly|DontDelete|DontEnum);
   return func;
 }
 
@@ -4627,7 +4658,7 @@ Completion FuncDeclNode::execute(ExecState *)
 void FuncExprNode::addParams()
 {
   for (ParameterNode *p = param.get(); p != 0L; p = p->nextParam())
-    body->addParam(p->ident());
+    body->parameters().append(p->ident());
 }
 
 JSValue *FuncExprNode::evaluate(ExecState *exec)
@@ -4656,9 +4687,4 @@ JSValue *FuncExprNode::evaluate(ExecState *exec)
   return func;
 }
 
-ProgramNode::ProgramNode(SourceElements* children)
-    : FunctionBodyNode(children)
-{
-}
-
-}
+} // namespace KJS
index a7776ab41618b49b76c8329dc472bc2386c06f46..68f02746a92597416e473f84e87243ba275c22b7 100644 (file)
@@ -1949,48 +1949,64 @@ namespace KJS {
     ListRefPtr<ParameterNode> next;
   };
 
-  // inherited by ProgramNode
-  class FunctionBodyNode : public BlockNode {
+  class ScopeNode : public BlockNode {
   public:
-    FunctionBodyNode(SourceElements* children) KJS_FAST_CALL;
+    ScopeNode(SourceElements*) KJS_FAST_CALL;
+
     int sourceId() KJS_FAST_CALL { return m_sourceId; }
     const UString& sourceURL() KJS_FAST_CALL { return m_sourceURL; }
 
-    virtual Completion execute(ExecState*) KJS_FAST_CALL;
-    
-    SymbolTable& symbolTable() { return m_symbolTable; }
+  protected:
+    void initializeDeclarationStacks(ExecState*) KJS_FAST_CALL;
+
+    DeclarationStacks::VarStack m_varStack;
+    DeclarationStacks::FunctionStack m_functionStack;
 
-    void addParam(const Identifier& ident) KJS_FAST_CALL;
-    size_t numParams() const KJS_FAST_CALL { return m_parameters.size(); }
-    Identifier paramName(size_t pos) const KJS_FAST_CALL { return m_parameters[pos]; }
-    UString paramString() const KJS_FAST_CALL;
-    Vector<Identifier>& parameters() KJS_FAST_CALL { return m_parameters; }
-    ALWAYS_INLINE void processDeclarations(ExecState*);
-    ALWAYS_INLINE void processDeclarationsForFunctionCode(ExecState*);
-    ALWAYS_INLINE void processDeclarationsForProgramCode(ExecState*);
   private:
     UString m_sourceURL;
     int m_sourceId;
+  };
 
-    void initializeDeclarationStacks(ExecState*);
-    bool m_initializedDeclarationStacks;
-
-    void initializeSymbolTable();
-    bool m_initializedSymbolTable;
+  class ProgramNode : public ScopeNode {
+  public:
+    ProgramNode(SourceElements*) KJS_FAST_CALL;
+    virtual Completion execute(ExecState*) KJS_FAST_CALL;
     
-    void optimizeVariableAccess();
-    bool m_optimizedResolveNodes;
+  private:
+    ALWAYS_INLINE void processDeclarations(ExecState*) KJS_FAST_CALL;
+  };
+
+  class EvalNode : public ScopeNode {
+  public:
+    EvalNode(SourceElements*) KJS_FAST_CALL;
+    virtual Completion execute(ExecState*) KJS_FAST_CALL;
     
-    // Properties that will go into the ActivationImp's local storage. (Used for initializing the ActivationImp.)
-    DeclarationStacks::VarStack m_varStack;
-    DeclarationStacks::FunctionStack m_functionStack;
-    Vector<Identifier> m_parameters;
+  private:
+    ALWAYS_INLINE void processDeclarations(ExecState*) KJS_FAST_CALL;
+  };
+
+  class FunctionBodyNode : public ScopeNode {
+  public:
+    FunctionBodyNode(SourceElements*) KJS_FAST_CALL;
+
+    virtual Completion execute(ExecState*) KJS_FAST_CALL;
+
+    SymbolTable& symbolTable() KJS_FAST_CALL { return m_symbolTable; }
 
-    // Mapping from property name -> local storage index. (Used once to transform the AST, and subsequently for residual slow case lookups.)
+    Vector<Identifier>& parameters() KJS_FAST_CALL { return m_parameters; }
+    UString paramString() const KJS_FAST_CALL;
+
+  private:
+    void initializeSymbolTable() KJS_FAST_CALL;
+    void optimizeVariableAccess() KJS_FAST_CALL;
+    ALWAYS_INLINE void processDeclarations(ExecState*) KJS_FAST_CALL;
+
+    bool m_initialized;
+    Vector<Identifier> m_parameters;
     SymbolTable m_symbolTable;
   };
 
-    class FuncExprNode : public ExpressionNode {
+  class FuncExprNode : public ExpressionNode {
   public:
     FuncExprNode(const Identifier& i, FunctionBodyNode* b, ParameterNode* p = 0) KJS_FAST_CALL 
       : ident(i), param(p), body(b) { addParams(); }
@@ -2085,11 +2101,6 @@ namespace KJS {
       RefPtr<CaseBlockNode> block;
   };
   
-  class ProgramNode : public FunctionBodyNode {
-  public:
-    ProgramNode(SourceElements* children) KJS_FAST_CALL;
-  };
-
   struct ElementList {
       ElementNode* head;
       ElementNode* tail;
index 38ec0508be8b066c01a1e1d54fd079f8c434f21c..c737b2e0d60d34d7ada8fba580e1c870f92143f8 100644 (file)
@@ -1,3 +1,14 @@
+2007-12-10  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Updated for rename in JavaScriptCore.
+
+        * bridge/mac/WebCoreScriptDebugger.mm:
+        (-[WebCoreScriptCallFrame scopeChain]):
+        (-[WebCoreScriptCallFrame functionName]):
+        (-[WebCoreScriptCallFrame evaluateWebScript:]):
+
 2007-12-10  Rodney Dawes  <dobey@wayofthemonkey.com>
 
         Bug 16383: Ambiguous Window Usage in kjs_dom.cpp
index ad9277557a02dd821779e847aa57eeaff0805567..2f88e810ae4fd48d9e777d4489acae2b981977d5 100644 (file)
@@ -284,7 +284,7 @@ class WebCoreScriptDebuggerImp : public KJS::Debugger {
 
 - (NSArray *)scopeChain
 {
-    if (!_state->currentBody()) {  // global frame
+    if (!_state->scopeNode()) {  // global frame
         return [NSArray arrayWithObject:_globalObj];
     }
 
@@ -307,7 +307,7 @@ class WebCoreScriptDebuggerImp : public KJS::Debugger {
 
 - (NSString *)functionName
 {
-    if (_state->currentBody()) {
+    if (_state->scopeNode()) {
         FunctionImp *func = _state->function();
         if (func) {
             Identifier fn = func->functionName();
@@ -347,7 +347,7 @@ class WebCoreScriptDebuggerImp : public KJS::Debugger {
 
     // find "eval"
     JSObject *eval = NULL;
-    if (state->currentBody()) {  // "eval" won't work without context (i.e. at global scope)
+    if (state->scopeNode()) {  // "eval" won't work without context (i.e. at global scope)
         JSValue *v = globalObject->get(state, "eval");
         if (v->isObject() && static_cast<JSObject *>(v)->implementsCall())
             eval = static_cast<JSObject *>(v);
index f76966ef78af158022945ca0f9d7c425f2f64ea3..af07d2c75ad635b32643ff3f0b903bff8cffc738 100644 (file)
@@ -1,3 +1,13 @@
+2007-12-10  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Updated for rename in JavaScriptCore.
+
+        * WebScriptCallFrame.cpp:
+        (WebScriptCallFrame::functionName):
+        (WebScriptCallFrame::valueByEvaluatingJavaScriptFromString):
+
 2007-12-07  Steve Falkenburg  <sfalken@apple.com>
 
         Fix version parsing.
index 7369ec228404594be13dfcbd7375f67a1e1739b6..48c79c1ab560bfa476c4b7fe7929a68e76ca8972 100644 (file)
@@ -146,7 +146,7 @@ HRESULT STDMETHODCALLTYPE WebScriptCallFrame::functionName(
 
     *funcName = 0;
 
-    if (!m_state->currentBody())
+    if (!m_state->scopeNode())
         return S_OK;
 
     FunctionImp* func = m_state->function();
@@ -227,7 +227,7 @@ JSValue* WebScriptCallFrame::valueByEvaluatingJavaScriptFromString(BSTR script)
 
     // find "eval"
     JSObject* eval = 0;
-    if (state->currentBody()) {  // "eval" won't work without context (i.e. at global scope)
+    if (state->scopeNode()) {  // "eval" won't work without context (i.e. at global scope)
         JSValue* v = globObj->get(state, "eval");
         if (v->isObject() && static_cast<JSObject*>(v)->implementsCall())
             eval = static_cast<JSObject*>(v);