Changeset 29059 in webkit
- Timestamp:
- Jan 1, 2008, 12:43:59 AM (18 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r29047 r29059 1 2008-01-01 Darin Adler <[email protected]> 2 3 Reviewed by Oliver. 4 5 - http://bugs.webkit.org/show_bug.cgi?id=16684 6 eliminate debugger overhead from function body execution 7 8 Speeds SunSpider up 1.003x. That's a small amount, but measurable. 9 10 * JavaScriptCore.exp: Updated. 11 * kjs/Parser.h: 12 (KJS::Parser::parse): Create the node with a static member function named create() instead 13 of using new explicitly. 14 15 * kjs/grammar.y: Changed calls to new FunctionBodyNode to use FunctionBodyNode::create(). 16 17 * kjs/nodes.cpp: 18 (KJS::ProgramNode::create): Added. Calls new. 19 (KJS::EvalNode::create): Ditto. 20 (KJS::FunctionBodyNode::create): Ditto, but creates FunctionBodyNodeWithDebuggerHooks 21 when a debugger is present. 22 (KJS::FunctionBodyNode::execute): Removed debugger hooks. 23 (KJS::FunctionBodyNodeWithDebuggerHooks::FunctionBodyNodeWithDebuggerHooks): Added. 24 (KJS::FunctionBodyNodeWithDebuggerHooks::execute): Calls the debugger, then the code, 25 then the debugger again. 26 27 * kjs/nodes.h: Added create functions, made the constructors private and protected. 28 1 29 2007-12-30 Eric Seidel <[email protected]> 2 30 -
trunk/JavaScriptCore/JavaScriptCore.exp
r28973 r29059 121 121 __ZN3KJS11JSImmediate8toObjectEPKNS_7JSValueEPNS_9ExecStateE 122 122 __ZN3KJS11JSImmediate8toStringEPKNS_7JSValueE 123 __ZN3KJS11ProgramNode C1EPNS_14SourceElementsEPN3WTF6VectorISt4pairINS_10IdentifierEjELm16EEEPNS4_IPNS_12FuncDeclNodeELm16EEE123 __ZN3KJS11ProgramNode6createEPNS_14SourceElementsEPN3WTF6VectorISt4pairINS_10IdentifierEjELm16EEEPNS4_IPNS_12FuncDeclNodeELm16EEE 124 124 __ZN3KJS11PropertyMap11getLocationERKNS_10IdentifierE 125 125 __ZN3KJS11PropertyMap5clearEv -
trunk/JavaScriptCore/kjs/Parser.h
r28937 r29059 85 85 return 0; 86 86 } 87 RefPtr<ParsedNode> node = new ParsedNode(m_sourceElements.release().get(),88 m_varDeclarations ? &m_varDeclarations->data : 0,89 m_funcDeclarations ? &m_funcDeclarations->data : 0);87 RefPtr<ParsedNode> node = ParsedNode::create(m_sourceElements.release().get(), 88 m_varDeclarations ? &m_varDeclarations->data : 0, 89 m_funcDeclarations ? &m_funcDeclarations->data : 0); 90 90 m_varDeclarations = 0; 91 91 m_funcDeclarations = 0; -
trunk/JavaScriptCore/kjs/grammar.y
r28975 r29059 1002 1002 1003 1003 FunctionBody: 1004 /* not in spec */ { $$ = new FunctionBodyNode(0, 0, 0); }1005 | SourceElements { $$ = new FunctionBodyNode($1.m_node, $1.m_varDeclarations ? &$1.m_varDeclarations->data : 0,1006 $1.m_funcDeclarations ? &$1.m_funcDeclarations->data : 0);1004 /* not in spec */ { $$ = FunctionBodyNode::create(0, 0, 0); } 1005 | SourceElements { $$ = FunctionBodyNode::create($1.m_node, $1.m_varDeclarations ? &$1.m_varDeclarations->data : 0, 1006 $1.m_funcDeclarations ? &$1.m_funcDeclarations->data : 0); 1007 1007 // As in mergeDeclarationLists() we have to ref/deref to safely get rid of 1008 1008 // the declaration lists. -
trunk/JavaScriptCore/kjs/nodes.cpp
r29022 r29059 44 44 45 45 namespace KJS { 46 47 class FunctionBodyNodeWithDebuggerHooks : public FunctionBodyNode { 48 public: 49 FunctionBodyNodeWithDebuggerHooks(SourceElements*, DeclarationStacks::VarStack*, DeclarationStacks::FunctionStack*) KJS_FAST_CALL; 50 virtual JSValue* execute(ExecState*) KJS_FAST_CALL; 51 }; 46 52 47 53 #define KJS_CHECKEXCEPTION \ … … 4226 4232 } 4227 4233 4234 ProgramNode* ProgramNode::create(SourceElements* children, DeclarationStacks::VarStack* varStack, DeclarationStacks::FunctionStack* funcStack) 4235 { 4236 return new ProgramNode(children, varStack, funcStack); 4237 } 4238 4228 4239 EvalNode::EvalNode(SourceElements* children, DeclarationStacks::VarStack* varStack, DeclarationStacks::FunctionStack* funcStack) 4229 4240 : ScopeNode(children, varStack, funcStack) 4230 4241 { 4242 } 4243 4244 EvalNode* EvalNode::create(SourceElements* children, DeclarationStacks::VarStack* varStack, DeclarationStacks::FunctionStack* funcStack) 4245 { 4246 return new EvalNode(children, varStack, funcStack); 4231 4247 } 4232 4248 … … 4235 4251 , m_initialized(false) 4236 4252 { 4253 } 4254 4255 FunctionBodyNode* FunctionBodyNode::create(SourceElements* children, DeclarationStacks::VarStack* varStack, DeclarationStacks::FunctionStack* funcStack) 4256 { 4257 if (Debugger::debuggersPresent) 4258 return new FunctionBodyNodeWithDebuggerHooks(children, varStack, funcStack); 4259 return new FunctionBodyNode(children, varStack, funcStack); 4237 4260 } 4238 4261 … … 4475 4498 { 4476 4499 processDeclarations(exec); 4477 4500 return ScopeNode::execute(exec); 4501 } 4502 4503 // ------------------------------ FunctionBodyNodeWithDebuggerHooks --------------------------------- 4504 4505 FunctionBodyNodeWithDebuggerHooks::FunctionBodyNodeWithDebuggerHooks(SourceElements* children, 4506 DeclarationStacks::VarStack* varStack, DeclarationStacks::FunctionStack* funcStack) 4507 : FunctionBodyNode(children, varStack, funcStack) 4508 { 4509 } 4510 4511 JSValue* FunctionBodyNodeWithDebuggerHooks::execute(ExecState* exec) 4512 { 4478 4513 if (Debugger* dbg = exec->dynamicGlobalObject()->debugger()) { 4479 4514 if (!dbg->callEvent(exec, sourceId(), lineNo(), exec->function(), *exec->arguments())) { … … 4481 4516 return exec->setInterruptedCompletion(); 4482 4517 } 4483 } 4484 4485 JSValue* result = ScopeNode::execute(exec);4486 4518 } 4519 4520 JSValue* result = FunctionBodyNode::execute(exec); 4521 4487 4522 if (Debugger* dbg = exec->dynamicGlobalObject()->debugger()) { 4488 4523 if (exec->completionType() == Throw) … … 4494 4529 } 4495 4530 4496 4497 4531 return result; 4498 4532 } -
trunk/JavaScriptCore/kjs/nodes.h
r29022 r29059 1969 1969 class ProgramNode : public ScopeNode { 1970 1970 public: 1971 ProgramNode(SourceElements*, DeclarationStacks::VarStack*, DeclarationStacks::FunctionStack*) KJS_FAST_CALL;1971 static ProgramNode* create(SourceElements*, DeclarationStacks::VarStack*, DeclarationStacks::FunctionStack*) KJS_FAST_CALL; 1972 1972 virtual JSValue* execute(ExecState*) KJS_FAST_CALL; 1973 1973 1974 1974 private: 1975 ProgramNode(SourceElements*, DeclarationStacks::VarStack*, DeclarationStacks::FunctionStack*) KJS_FAST_CALL; 1975 1976 void initializeSymbolTable(ExecState*) KJS_FAST_CALL; 1976 1977 ALWAYS_INLINE void processDeclarations(ExecState*) KJS_FAST_CALL; … … 1982 1983 class EvalNode : public ScopeNode { 1983 1984 public: 1984 EvalNode(SourceElements*, DeclarationStacks::VarStack*, DeclarationStacks::FunctionStack*) KJS_FAST_CALL;1985 static EvalNode* create(SourceElements*, DeclarationStacks::VarStack*, DeclarationStacks::FunctionStack*) KJS_FAST_CALL; 1985 1986 virtual JSValue* execute(ExecState*) KJS_FAST_CALL; 1986 1987 1987 1988 private: 1989 EvalNode(SourceElements*, DeclarationStacks::VarStack*, DeclarationStacks::FunctionStack*) KJS_FAST_CALL; 1988 1990 ALWAYS_INLINE void processDeclarations(ExecState*) KJS_FAST_CALL; 1989 1991 }; … … 1991 1993 class FunctionBodyNode : public ScopeNode { 1992 1994 public: 1993 FunctionBodyNode(SourceElements*, DeclarationStacks::VarStack*, DeclarationStacks::FunctionStack*) KJS_FAST_CALL;1995 static FunctionBodyNode* create(SourceElements*, DeclarationStacks::VarStack*, DeclarationStacks::FunctionStack*) KJS_FAST_CALL; 1994 1996 1995 1997 virtual JSValue* execute(ExecState*) KJS_FAST_CALL; … … 1999 2001 Vector<Identifier>& parameters() KJS_FAST_CALL { return m_parameters; } 2000 2002 UString paramString() const KJS_FAST_CALL; 2003 2004 protected: 2005 FunctionBodyNode(SourceElements*, DeclarationStacks::VarStack*, DeclarationStacks::FunctionStack*) KJS_FAST_CALL; 2001 2006 2002 2007 private:
Note:
See TracChangeset
for help on using the changeset viewer.