Changeset 32758 in webkit


Ignore:
Timestamp:
May 1, 2008 4:26:02 AM (16 years ago)
Author:
oliver@apple.com
Message:

Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
<https://bugs.webkit.org/show_bug.cgi?id=18827>

Reviewed by Maciej

This patch makes getters and setters work. It does this by
tracking whether the RegisterFile is "safe", that is whether
the interpreter is in a state that in which it can handle
the RegisterFile being reallocated.

Location:
branches/squirrelfish/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/squirrelfish/JavaScriptCore/ChangeLog

    r32757 r32758  
     12008-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
    1202008-04-30  Geoffrey Garen  <ggaren@apple.com>
    221
  • branches/squirrelfish/JavaScriptCore/VM/Machine.cpp

    r32756 r32758  
    266266        if (o->getPropertySlot(exec, ident, slot)) {
    267267            r[dst].u.jsValue = slot.getValue(exec, o, ident);
    268             return true;
     268            exceptionValue = exec->exception();
     269            return !exceptionValue;
    269270        }
    270271    } while (++iter != end);
     
    713714    JSValue** k = codeBlock->jsValues.data();
    714715   
     716    registerFile->setUnsafeForReentry(true);
    715717#define VM_CHECK_EXCEPTION() \
    716718     do { \
     
    14191421            JSObject* thisObject = r[thisRegister].u.jsObject;
    14201422
     1423            registerFile->setUnsafeForReentry(false);
    14211424            JSValue* result = eval(exec, thisObject, scopeChain, registerFile, r, argv, argc, exceptionValue);
     1425            registerFile->setUnsafeForReentry(true);
    14221426            r = (*registerBase) + registerOffset;
    14231427
     
    14901494            List args(&r[argv + 1].u.jsValue, argc - 1);
    14911495
     1496            registerFile->setUnsafeForReentry(false);
    14921497            JSValue* returnValue = static_cast<JSObject*>(v)->callAsFunction(exec, thisObj, args);
     1498            registerFile->setUnsafeForReentry(true);
    14931499
    14941500            r = (*registerBase) + registerOffset;
     
    15921598
    15931599            List args(&r[argv + 1].u.jsValue, argc - 1);
     1600            registerFile->setUnsafeForReentry(false);
    15941601            JSValue* returnValue = constructor->construct(exec, args);
     1602            registerFile->setUnsafeForReentry(true);
    15951603       
    15961604            r = (*registerBase) + registerOffset;
     
    17371745    }
    17381746    vm_throw: {
     1747        exec->clearException();
    17391748        handlerVPC = throwException(exec, exceptionValue, registerBase, vPC, codeBlock, k, scopeChain, r);
    17401749        if (!handlerVPC) {
  • branches/squirrelfish/JavaScriptCore/VM/RegisterFile.h

    r32718 r32758  
    8989        enum { DefaultRegisterFileSize = 2 * 1024 * 1024 };
    9090        RegisterFile(RegisterFileStack* stack, size_t maxSize)
    91             : m_isForImplicitCall(false)
     91            : m_unsafeForReentry(false)
     92            , m_isForImplicitCall(false)
    9293            , m_size(0)
    9394            , m_capacity(0)
     
    150151            Collector::markStackObjectsConservatively(m_buffer, m_base + m_size);
    151152        }
    152        
     153        bool unsafeForReentry() { return m_unsafeForReentry; }
     154        void setUnsafeForReentry(bool unsafeForReentry) { m_unsafeForReentry = unsafeForReentry; }
    153155        void setIsForImplicitCall(bool isForImplicitCall) { m_isForImplicitCall = isForImplicitCall; }
    154156        bool isForImplicitCall() { return m_isForImplicitCall; }
     
    165167       
    166168        void setBase(Register*);
    167        
     169        bool m_unsafeForReentry;
    168170        bool m_isForImplicitCall;
    169171        size_t m_size;
  • branches/squirrelfish/JavaScriptCore/kjs/function.cpp

    r32749 r32758  
    8484{
    8585    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    }
    89100}
    90101
Note: See TracChangeset for help on using the changeset viewer.