Changeset 27339 in webkit
- Timestamp:
- Oct 31, 2007, 10:02:30 PM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r27336 r27339 1 2007-10-31 Maciej Stachowiak <mjs@apple.com> 2 3 Reviewed by Oliver. 4 5 - shave some cycles off of local storage access for a 1% SunSpider speedup 6 7 Keep the LocalStorage pointer in the ExecState, not 8 9 * kjs/ExecState.cpp: 10 (KJS::ExecState::updateLocalStorage): 11 * kjs/ExecState.h: 12 (KJS::ExecState::localStorage): 13 * kjs/nodes.cpp: 14 (KJS::LocalVarAccessNode::evaluate): 15 (KJS::LocalVarFunctionCallNode::evaluate): 16 (KJS::PostIncLocalVarNode::evaluate): 17 (KJS::PostDecLocalVarNode::evaluate): 18 (KJS::LocalVarTypeOfNode::evaluate): 19 (KJS::PreIncLocalVarNode::evaluate): 20 (KJS::PreDecLocalVarNode::evaluate): 21 (KJS::ReadModifyLocalVarNode::evaluate): 22 (KJS::AssignLocalVarNode::evaluate): 23 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode): 24 1 25 2007-10-31 Adam Roben <aroben@apple.com> 2 26 -
trunk/JavaScriptCore/kjs/ExecState.cpp
r27100 r27339 115 115 return dynamicInterpreter(); 116 116 } 117 117 118 void ExecState::updateLocalStorage() 119 { 120 m_localStorageBuffer = static_cast<ActivationImp*>(m_activation)->localStorage().data(); 121 } 118 122 119 123 } // namespace KJS -
trunk/JavaScriptCore/kjs/ExecState.h
r27101 r27339 45 45 class GlobalFuncImp; 46 46 class FunctionBodyNode; 47 class LocalStorageEntry; 47 48 48 49 /** … … 103 104 // important property lookup functions, to avoid taking PIC branches in Mach-O binaries 104 105 const CommonIdentifiers& propertyNames() const { return *m_propertyNames; } 105 106 107 LocalStorageEntry* localStorage() { return m_localStorageBuffer; } 108 void updateLocalStorage(); 109 106 110 private: 107 111 ExecState(Interpreter* interp, JSGlobalObject* glob, JSObject* thisV, … … 124 128 const List* m_arguments; 125 129 JSObject* m_activation; 126 130 LocalStorageEntry* m_localStorageBuffer; 131 127 132 ScopeChain scope; 128 133 JSObject* m_variable; -
trunk/JavaScriptCore/kjs/nodes.cpp
r27308 r27339 429 429 JSValue* LocalVarAccessNode::evaluate(ExecState* exec) 430 430 { 431 ActivationImp* variableObject = static_cast<ActivationImp*>(exec->variableObject()); 432 ASSERT(variableObject->isActivation()); 433 ASSERT(variableObject == exec->scopeChain().top()); 434 return variableObject->localStorage()[index].value; 431 ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation()); 432 ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top()); 433 return exec->localStorage()[index].value; 435 434 } 436 435 … … 766 765 JSValue* LocalVarFunctionCallNode::evaluate(ExecState* exec) 767 766 { 768 ActivationImp* variableObject = static_cast<ActivationImp*>(exec->variableObject()); 769 ASSERT(variableObject->isActivation()); 770 ASSERT(variableObject == exec->scopeChain().top()); 771 772 JSValue* v = variableObject->localStorage()[index].value; 767 ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation()); 768 ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top()); 769 770 JSValue* v = exec->localStorage()[index].value; 773 771 774 772 if (!v->isObject()) … … 933 931 JSValue* PostIncLocalVarNode::evaluate(ExecState* exec) 934 932 { 935 ActivationImp* variableObject = static_cast<ActivationImp*>(exec->variableObject()); 936 ASSERT(variableObject->isActivation()); 937 ASSERT(variableObject == exec->scopeChain().top()); 938 939 JSValue** slot = &variableObject->localStorage()[index].value; 933 ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation()); 934 ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top()); 935 936 JSValue** slot = &exec->localStorage()[index].value; 940 937 double n = (*slot)->toNumber(exec); 941 938 *slot = jsNumber(n + 1); … … 984 981 JSValue* PostDecLocalVarNode::evaluate(ExecState* exec) 985 982 { 986 ActivationImp* variableObject = static_cast<ActivationImp*>(exec->variableObject()); 987 ASSERT(variableObject->isActivation()); 988 ASSERT(variableObject == exec->scopeChain().top()); 989 990 JSValue** slot = &variableObject->localStorage()[index].value; 983 ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation()); 984 ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top()); 985 986 JSValue** slot = &exec->localStorage()[index].value; 991 987 double n = (*slot)->toNumber(exec); 992 988 *slot = jsNumber(n - 1); … … 1282 1278 JSValue* LocalVarTypeOfNode::evaluate(ExecState* exec) 1283 1279 { 1284 A ctivationImp* variableObject = static_cast<ActivationImp*>(exec->variableObject());1285 ASSERT( variableObject->isActivation());1286 ASSERT(variableObject == exec->scopeChain().top()); 1287 return typeStringForValue( variableObject->localStorage()[m_index].value);1280 ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation()); 1281 ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top()); 1282 1283 return typeStringForValue(exec->localStorage()[m_index].value); 1288 1284 } 1289 1285 … … 1335 1331 JSValue* PreIncLocalVarNode::evaluate(ExecState* exec) 1336 1332 { 1337 ActivationImp* variableObject = static_cast<ActivationImp*>(exec->variableObject()); 1338 ASSERT(variableObject->isActivation()); 1339 ASSERT(variableObject == exec->scopeChain().top()); 1340 JSValue* v = variableObject->localStorage()[m_index].value; 1341 1342 double n = v->toNumber(exec); 1333 ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation()); 1334 ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top()); 1335 JSValue** slot = &exec->localStorage()[m_index].value; 1336 1337 double n = (*slot)->toNumber(exec); 1343 1338 JSValue* n2 = jsNumber(n + 1); 1344 variableObject->localStorage()[m_index].value= n2;1339 *slot = n2; 1345 1340 return n2; 1346 1341 } … … 1384 1379 JSValue* PreDecLocalVarNode::evaluate(ExecState* exec) 1385 1380 { 1386 ActivationImp* variableObject = static_cast<ActivationImp*>(exec->variableObject()); 1387 ASSERT(variableObject->isActivation()); 1388 ASSERT(variableObject == exec->scopeChain().top()); 1389 JSValue* v = variableObject->localStorage()[m_index].value; 1390 1391 double n = v->toNumber(exec); 1381 ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation()); 1382 ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top()); 1383 JSValue** slot = &exec->localStorage()[m_index].value; 1384 1385 double n = (*slot)->toNumber(exec); 1392 1386 JSValue* n2 = jsNumber(n - 1); 1393 variableObject->localStorage()[m_index].value= n2;1387 *slot = n2; 1394 1388 return n2; 1395 1389 } … … 2201 2195 JSValue* ReadModifyLocalVarNode::evaluate(ExecState* exec) 2202 2196 { 2203 ActivationImp* variableObject = static_cast<ActivationImp*>(exec->variableObject()); 2204 ASSERT(variableObject->isActivation()); 2205 ASSERT(variableObject == exec->scopeChain().top()); 2206 JSValue* v; 2207 JSValue** slot = &variableObject->localStorage()[m_index].value; 2197 ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation()); 2198 ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top()); 2199 JSValue** slot = &exec->localStorage()[m_index].value; 2208 2200 2209 2201 ASSERT(m_oper != OpEqual); 2210 2202 JSValue* v2 = m_right->evaluate(exec); 2211 v = valueForReadModifyAssignment(exec, *slot, v2, m_oper);2203 JSValue* v = valueForReadModifyAssignment(exec, *slot, v2, m_oper); 2212 2204 2213 2205 KJS_CHECKEXCEPTIONVALUE … … 2219 2211 JSValue* AssignLocalVarNode::evaluate(ExecState* exec) 2220 2212 { 2221 ActivationImp* variableObject = static_cast<ActivationImp*>(exec->variableObject()); 2222 ASSERT(variableObject->isActivation()); 2223 ASSERT(variableObject == exec->scopeChain().top()); 2213 ASSERT(static_cast<ActivationImp*>(exec->variableObject())->isActivation()); 2214 ASSERT(static_cast<ActivationImp*>(exec->variableObject()) == exec->scopeChain().top()); 2224 2215 JSValue* v = m_right->evaluate(exec); 2225 2216 2226 2217 KJS_CHECKEXCEPTIONVALUE 2227 2218 2228 variableObject->localStorage()[m_index].value = v;2219 exec->localStorage()[m_index].value = v; 2229 2220 2230 2221 return v; … … 3569 3560 localStorage.append(LocalStorageEntry(node->makeFunction(exec), minAttributes)); 3570 3561 } 3562 3563 exec->updateLocalStorage(); 3571 3564 } 3572 3565
Note:
See TracChangeset
for help on using the changeset viewer.