Changeset 32758 in webkit
- Timestamp:
- May 1, 2008 4:26:02 AM (16 years ago)
- Location:
- branches/squirrelfish/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/squirrelfish/JavaScriptCore/ChangeLog
r32757 r32758 1 2008-05-01 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Maciej. 4 5 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile 6 <https://bugs.webkit.org/show_bug.cgi?id=18827> 7 8 This patch makes getters and setters work. It does this by 9 tracking whether the RegisterFile is "safe", that is whether 10 the interpreter is in a state that in which it can handle 11 the RegisterFile being reallocated. 12 13 * VM/Machine.cpp: 14 (KJS::resolve): 15 (KJS::Machine::privateExecute): 16 * VM/RegisterFile.h: 17 * kjs/function.cpp: 18 (KJS::FunctionImp::callAsFunction): 19 1 20 2008-04-30 Geoffrey Garen <ggaren@apple.com> 2 21 -
branches/squirrelfish/JavaScriptCore/VM/Machine.cpp
r32756 r32758 266 266 if (o->getPropertySlot(exec, ident, slot)) { 267 267 r[dst].u.jsValue = slot.getValue(exec, o, ident); 268 return true; 268 exceptionValue = exec->exception(); 269 return !exceptionValue; 269 270 } 270 271 } while (++iter != end); … … 713 714 JSValue** k = codeBlock->jsValues.data(); 714 715 716 registerFile->setUnsafeForReentry(true); 715 717 #define VM_CHECK_EXCEPTION() \ 716 718 do { \ … … 1419 1421 JSObject* thisObject = r[thisRegister].u.jsObject; 1420 1422 1423 registerFile->setUnsafeForReentry(false); 1421 1424 JSValue* result = eval(exec, thisObject, scopeChain, registerFile, r, argv, argc, exceptionValue); 1425 registerFile->setUnsafeForReentry(true); 1422 1426 r = (*registerBase) + registerOffset; 1423 1427 … … 1490 1494 List args(&r[argv + 1].u.jsValue, argc - 1); 1491 1495 1496 registerFile->setUnsafeForReentry(false); 1492 1497 JSValue* returnValue = static_cast<JSObject*>(v)->callAsFunction(exec, thisObj, args); 1498 registerFile->setUnsafeForReentry(true); 1493 1499 1494 1500 r = (*registerBase) + registerOffset; … … 1592 1598 1593 1599 List args(&r[argv + 1].u.jsValue, argc - 1); 1600 registerFile->setUnsafeForReentry(false); 1594 1601 JSValue* returnValue = constructor->construct(exec, args); 1602 registerFile->setUnsafeForReentry(true); 1595 1603 1596 1604 r = (*registerBase) + registerOffset; … … 1737 1745 } 1738 1746 vm_throw: { 1747 exec->clearException(); 1739 1748 handlerVPC = throwException(exec, exceptionValue, registerBase, vPC, codeBlock, k, scopeChain, r); 1740 1749 if (!handlerVPC) { -
branches/squirrelfish/JavaScriptCore/VM/RegisterFile.h
r32718 r32758 89 89 enum { DefaultRegisterFileSize = 2 * 1024 * 1024 }; 90 90 RegisterFile(RegisterFileStack* stack, size_t maxSize) 91 : m_isForImplicitCall(false) 91 : m_unsafeForReentry(false) 92 , m_isForImplicitCall(false) 92 93 , m_size(0) 93 94 , m_capacity(0) … … 150 151 Collector::markStackObjectsConservatively(m_buffer, m_base + m_size); 151 152 } 152 153 bool unsafeForReentry() { return m_unsafeForReentry; } 154 void setUnsafeForReentry(bool unsafeForReentry) { m_unsafeForReentry = unsafeForReentry; } 153 155 void setIsForImplicitCall(bool isForImplicitCall) { m_isForImplicitCall = isForImplicitCall; } 154 156 bool isForImplicitCall() { return m_isForImplicitCall; } … … 165 167 166 168 void setBase(Register*); 167 169 bool m_unsafeForReentry; 168 170 bool m_isForImplicitCall; 169 171 size_t m_size; -
branches/squirrelfish/JavaScriptCore/kjs/function.cpp
r32749 r32758 84 84 { 85 85 JSValue* exception = 0; 86 JSValue* result = machine().execute(body.get(), exec, this, thisObj, args, &exec->dynamicGlobalObject()->registerFileStack(), _scope.node(), &exception); 87 exec->setException(exception); 88 return result; 86 RegisterFileStack* stack = &exec->dynamicGlobalObject()->registerFileStack(); 87 RegisterFile* current = stack->current(); 88 if (current->unsafeForReentry()) { 89 stack->pushFunctionRegisterFile(); 90 JSValue* result = machine().execute(body.get(), exec, this, thisObj, args, stack, _scope.node(), &exception); 91 stack->popFunctionRegisterFile(); 92 exec->setException(exception); 93 return result; 94 } else { 95 JSValue* result = machine().execute(body.get(), exec, this, thisObj, args, stack, _scope.node(), &exception); 96 current->setUnsafeForReentry(false); 97 exec->setException(exception); 98 return result; 99 } 89 100 } 90 101
Note: See TracChangeset
for help on using the changeset viewer.