Changeset 33329
- Timestamp:
- 05/12/08 23:03:35 (6 months ago)
- Location:
- branches/squirrelfish/JavaScriptCore
- Files:
-
- 8 modified
-
ChangeLog (modified) (1 diff)
-
JavaScriptCore.exp (modified) (1 diff)
-
VM/Machine.cpp (modified) (11 diffs)
-
VM/Machine.h (modified) (1 diff)
-
kjs/ExecState.cpp (modified) (1 diff)
-
kjs/ExecState.h (modified) (3 diffs)
-
kjs/JSGlobalObject.cpp (modified) (1 diff)
-
kjs/JSGlobalObject.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/squirrelfish/JavaScriptCore/ChangeLog
r33328 r33329 1 2008-05-03 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Update ExecState::m_scopeChain when switching scope chains inside the 6 machine. 7 8 This fixes uses of lexicalGlobalObject, such as, in a subframe 9 10 alert(top.makeArray() instanceof Array ? "FAIL" : "PASS"); 11 12 and a bunch of the security failures listed in 13 https://bugs.webkit.org/show_bug.cgi?id=18870. (Those tests still fail, 14 seemingly because of regressions in exception messages). 15 16 SunSpider reports no change. 17 18 * VM/Machine.cpp: Factored out scope chain updating into a common 19 function that takes care to update ExecState::m_scopeChain, too. 20 21 * kjs/ExecState.h: I made Machine a friend of ExecState so that Machine 22 could update ExecState::m_scopeChain, even though that value is 23 read-only for everyone else. 24 25 * kjs/JSGlobalObject.h: 26 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Changed 27 this client to be a little friendlier to ExecState's internal 28 storage type for scope chain data. 29 1 30 2008-05-03 Geoffrey Garen <ggaren@apple.com> 2 31 -
branches/squirrelfish/JavaScriptCore/JavaScriptCore.exp
r33327 r33329 208 208 __ZN3KJS9Collector7protectEPNS_7JSValueE 209 209 __ZN3KJS9Collector9unprotectEPNS_7JSValueE 210 __ZN3KJS9ExecStateC1EPNS_14JSGlobalObjectEPNS_8JSObjectE RNS_10ScopeChainE210 __ZN3KJS9ExecStateC1EPNS_14JSGlobalObjectEPNS_8JSObjectEPNS_14ScopeChainNodeE 211 211 __ZN3KJSeqERKNS_7UStringEPKc 212 212 __ZN3WTF10fastCallocEmm -
branches/squirrelfish/JavaScriptCore/VM/Machine.cpp
r33328 r33329 503 503 while (scopeDelta--) 504 504 sc.pop(); 505 s copeChain = sc.node();505 setScopeChain(exec, scopeChain, sc.node()); 506 506 507 507 return handlerVPC; … … 567 567 if (codeBlock->needsFullScopeChain) 568 568 scopeChain = scopeChain->copy(); 569 570 ExecState newExec(exec, scopeChain); 569 571 570 572 m_reentryDepth++; 571 JSValue* result = privateExecute(Normal, exec, registerFile, r, scopeChain, codeBlock, exception);573 JSValue* result = privateExecute(Normal, &newExec, registerFile, r, scopeChain, codeBlock, exception); 572 574 m_reentryDepth--; 573 575 … … 620 622 scopeChain = scopeChainForCall(functionBodyNode, newCodeBlock, scopeChain, callFrame, registerBase, r); 621 623 624 ExecState newExec(exec, scopeChain); 625 622 626 m_reentryDepth++; 623 JSValue* result = privateExecute(Normal, exec, registerFile, r, scopeChain, newCodeBlock, exception);627 JSValue* result = privateExecute(Normal, &newExec, registerFile, r, scopeChain, newCodeBlock, exception); 624 628 m_reentryDepth--; 625 629 … … 671 675 scopeChain = scopeChain->copy(); 672 676 677 ExecState newExec(exec, scopeChain); 678 673 679 m_reentryDepth++; 674 JSValue* result = privateExecute(Normal, exec, registerFile, r, scopeChain, codeBlock, exception);680 JSValue* result = privateExecute(Normal, &newExec, registerFile, r, scopeChain, codeBlock, exception); 675 681 m_reentryDepth--; 676 682 … … 683 689 RegisterFile* registerFile = registerFileStack->current(); 684 690 return Machine::execute(evalNode, exec, thisObj, registerFile, registerFile->size(), scopeChain, exception); 691 } 692 693 ALWAYS_INLINE void Machine::setScopeChain(ExecState* exec, ScopeChainNode*& scopeChain, ScopeChainNode* newScopeChain) 694 { 695 scopeChain = newScopeChain; 696 exec->m_scopeChain = newScopeChain; 685 697 } 686 698 … … 1480 1492 codeBlock = newCodeBlock; 1481 1493 callFrame = (*registerBase) + callFrameOffset; // registerBase may have moved, recompute callFrame 1482 s copeChain = scopeChainForCall(functionBodyNode, codeBlock, callDataScopeChain, callFrame, registerBase, r);1494 setScopeChain(exec, scopeChain, scopeChainForCall(functionBodyNode, codeBlock, callDataScopeChain, callFrame, registerBase, r)); 1483 1495 k = codeBlock->jsValues.data(); 1484 1496 vPC = codeBlock->instructions.begin(); … … 1539 1551 k = codeBlock->jsValues.data(); 1540 1552 vPC = callFrame[ReturnVPC].u.vPC; 1541 s copeChain = callFrame[CallerScopeChain].u.scopeChain;1553 setScopeChain(exec, scopeChain, callFrame[CallerScopeChain].u.scopeChain); 1542 1554 r = (*registerBase) + callFrame[CallerRegisterOffset].u.i; 1543 1555 int r0 = callFrame[ReturnValueRegister].u.i; … … 1586 1598 codeBlock = newCodeBlock; 1587 1599 callFrame = (*registerBase) + callFrameOffset; // registerBase may have moved, recompute callFrame 1588 s copeChain = scopeChainForCall(functionBodyNode, codeBlock, callDataScopeChain, callFrame, registerBase, r);1600 setScopeChain(exec, scopeChain, scopeChainForCall(functionBodyNode, codeBlock, callDataScopeChain, callFrame, registerBase, r)); 1589 1601 k = codeBlock->jsValues.data(); 1590 1602 vPC = codeBlock->instructions.begin(); … … 1618 1630 VM_CHECK_EXCEPTION(); 1619 1631 1620 s copeChain = scopeChain->push(o);1632 setScopeChain(exec, scopeChain, scopeChain->push(o)); 1621 1633 1622 1634 ++vPC; … … 1624 1636 } 1625 1637 BEGIN_OPCODE(op_pop_scope) { 1626 s copeChain = scopeChain->pop();1638 setScopeChain(exec, scopeChain, scopeChain->pop()); 1627 1639 1628 1640 ++vPC; … … 1655 1667 int scopeDelta = (++vPC)->u.operand; 1656 1668 int offset = (++vPC)->u.operand; 1669 1670 ScopeChainNode* tmp = scopeChain; 1657 1671 while (scopeDelta--) 1658 scopeChain = scopeChain->pop(); 1672 tmp = tmp->pop(); 1673 setScopeChain(exec, scopeChain, tmp); 1674 1659 1675 vPC += offset; 1660 1676 NEXT_OPCODE; -
branches/squirrelfish/JavaScriptCore/VM/Machine.h
r33306 r33329 93 93 typedef enum { Normal, InitializeAndReturn } ExecutionFlag; 94 94 95 ALWAYS_INLINE void setScopeChain(ExecState* exec, ScopeChainNode*&, ScopeChainNode*); 96 95 97 NEVER_INLINE bool unwindCallFrame(Register**, const Instruction*&, CodeBlock*&, JSValue**&, ScopeChainNode*&, Register*&); 96 98 NEVER_INLINE Instruction* throwException(ExecState*, JSValue*, Register**, const Instruction*, CodeBlock*&, JSValue**&, ScopeChainNode*&, Register*&); -
branches/squirrelfish/JavaScriptCore/kjs/ExecState.cpp
r33318 r33329 32 32 namespace KJS { 33 33 34 ExecState::ExecState(JSGlobalObject* globalObject, JSObject* globalThisValue, ScopeChain& globalScopeChain) 35 : m_globalObject(globalObject) 34 ExecState::ExecState(JSGlobalObject* globalObject, JSObject* globalThisValue, ScopeChainNode* globalScopeChain) 35 : m_prev(0) 36 , m_globalObject(globalObject) 36 37 , m_globalThisValue(globalThisValue) 37 38 , m_exception(0) 38 39 , m_exceptionSource(0) 39 40 , m_perThreadData(globalObject->perThreadData()) 40 , m_scopeChain(globalScopeChain .node())41 , m_scopeChain(globalScopeChain) 41 42 { 43 } 44 45 ExecState::ExecState(ExecState* exec, ScopeChainNode* scopeChain) 46 : m_prev(exec) 47 , m_globalObject(exec->m_globalObject) 48 , m_globalThisValue(exec->m_globalThisValue) 49 , m_exception(0) 50 , m_exceptionSource(0) 51 , m_perThreadData(exec->m_globalObject->perThreadData()) 52 , m_scopeChain(scopeChain) 53 { 54 ASSERT(!exec->m_exception); 55 ASSERT(!exec->m_exceptionSource); 42 56 } 43 57 -
branches/squirrelfish/JavaScriptCore/kjs/ExecState.h
r33324 r33329 63 63 // Passed as the first argument to most functions. 64 64 class ExecState : Noncopyable { 65 friend class Machine; 66 65 67 public: 66 ExecState(JSGlobalObject*, JSObject* globalThisValue, ScopeChain &globalScopeChain);68 ExecState(JSGlobalObject*, JSObject* globalThisValue, ScopeChainNode* globalScopeChain); 67 69 68 70 // Global object in which execution began. … … 101 103 102 104 private: 105 ExecState(ExecState*, ScopeChainNode*); 106 103 107 bool isGlobalObject(JSObject*) const; 108 109 ExecState* m_prev; 104 110 105 111 JSGlobalObject* m_globalObject; … … 111 117 const PerThreadData* m_perThreadData; 112 118 113 constScopeChainNode* m_scopeChain;119 ScopeChainNode* m_scopeChain; 114 120 }; 115 121 -
branches/squirrelfish/JavaScriptCore/kjs/JSGlobalObject.cpp
r33306 r33329 208 208 d()->perThreadData.propertyNames = CommonIdentifiers::shared(); 209 209 210 d()->globalExec.set(new ExecState(this, thisValue, d()->globalScopeChain ));210 d()->globalExec.set(new ExecState(this, thisValue, d()->globalScopeChain.node())); 211 211 212 212 d()->pageGroupIdentifier = 0; -
branches/squirrelfish/JavaScriptCore/kjs/JSGlobalObject.h
r33327 r33329 83 83 : JSVariableObjectData(&symbolTable, registerFileStack.globalBasePointer(), 0) 84 84 , globalScopeChain(globalObject) 85 , globalExec(new ExecState(globalObject, thisValue, globalScopeChain ))85 , globalExec(new ExecState(globalObject, thisValue, globalScopeChain.node())) 86 86 { 87 87 }