Changeset 33319
- Timestamp:
- 05/12/08 23:03:08 (6 months ago)
- Location:
- branches/squirrelfish/JavaScriptCore
- Files:
-
- 4 modified
-
ChangeLog (modified) (1 diff)
-
VM/Machine.cpp (modified) (6 diffs)
-
VM/RegisterFile.h (modified) (3 diffs)
-
kjs/function.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/squirrelfish/JavaScriptCore/ChangeLog
r33318 r33319 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
r33317 r33319 270 270 if (o->getPropertySlot(exec, ident, slot)) { 271 271 r[dst].u.jsValue = slot.getValue(exec, o, ident); 272 return true; 272 exceptionValue = exec->exception(); 273 return !exceptionValue; 273 274 } 274 275 } while (++iter != end); … … 717 718 JSValue** k = codeBlock->jsValues.data(); 718 719 720 registerFile->setUnsafeForReentry(true); 719 721 #define VM_CHECK_EXCEPTION() \ 720 722 do { \ … … 1423 1425 JSObject* thisObject = r[thisRegister].u.jsObject; 1424 1426 1427 registerFile->setUnsafeForReentry(false); 1425 1428 JSValue* result = eval(exec, thisObject, scopeChain, registerFile, r, argv, argc, exceptionValue); 1429 registerFile->setUnsafeForReentry(true); 1426 1430 r = (*registerBase) + registerOffset; 1427 1431 … … 1494 1498 List args(&r[argv + 1].u.jsValue, argc - 1); 1495 1499 1500 registerFile->setUnsafeForReentry(false); 1496 1501 JSValue* returnValue = static_cast<JSObject*>(v)->callAsFunction(exec, thisObj, args); 1502 registerFile->setUnsafeForReentry(true); 1497 1503 1498 1504 r = (*registerBase) + registerOffset; … … 1596 1602 1597 1603 List args(&r[argv + 1].u.jsValue, argc - 1); 1604 registerFile->setUnsafeForReentry(false); 1598 1605 JSValue* returnValue = constructor->construct(exec, args); 1606 registerFile->setUnsafeForReentry(true); 1599 1607 1600 1608 r = (*registerBase) + registerOffset; … … 1741 1749 } 1742 1750 vm_throw: { 1751 exec->clearException(); 1743 1752 handlerVPC = throwException(exec, exceptionValue, registerBase, vPC, codeBlock, k, scopeChain, r); 1744 1753 if (!handlerVPC) { -
branches/squirrelfish/JavaScriptCore/VM/RegisterFile.h
r33305 r33319 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
r33314 r33319 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