Changeset 61553 in webkit for trunk/JavaScriptCore/interpreter


Ignore:
Timestamp:
Jun 21, 2010, 10:43:03 AM (15 years ago)
Author:
[email protected]
Message:

2010-06-19 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

Need to ensure that we grow the RegisterFile when creating a callframe for host code
https://bugs.webkit.org/show_bug.cgi?id=40858
<rdar://problem/8108986>

In the past the use of the callframe in hostcode was much more
limited. Now that we expect the callframe to always be valid
we need to grow the RegisterFile so that this is actually the
case. In this particular case the problem was failing to grow
the registerfile could lead to a callframe that extended beyond
RegisterFiler::end(), so vm re-entry would clobber the callframe
other scenarios could also lead to badness.

I was unable to construct a simple testcase to trigger badness,
and any such testcase would be so dependent on exact vm stack
layout that it would be unlikely to work as a testcase following
any callframe or register allocation changes anyway.

Thankfully the new assertion I added should help to catch these
failures in future, and triggers on a couple of tests currently.

  • interpreter/CallFrame.cpp: (JSC::CallFrame::registerFile):
  • interpreter/CallFrame.h: (JSC::ExecState::init):
  • interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute):
  • jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION):
Location:
trunk/JavaScriptCore/interpreter
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/interpreter/CallFrame.cpp

    r60392 r61553  
    4343    printf("Callpoint => %s:%d\n", urlString.ascii(), signedLineNumber);
    4444}
     45
     46RegisterFile* CallFrame::registerFile()
     47{
     48    return &interpreter()->registerFile();
     49}
     50
    4551#endif
    4652
  • trunk/JavaScriptCore/interpreter/CallFrame.h

    r60762 r61553  
    118118        {
    119119            ASSERT(callerFrame); // Use noCaller() rather than 0 for the outer host call frame caller.
     120            ASSERT(callerFrame == noCaller() || callerFrame->removeHostCallFrameFlag()->registerFile()->end() >= this);
    120121
    121122            setCodeBlock(codeBlock);
     
    156157    private:
    157158        static const intptr_t HostCallFrameFlag = 1;
    158 
     159#ifndef NDEBUG
     160        RegisterFile* registerFile();
     161#endif
    159162        ExecState();
    160163        ~ExecState();
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r60762 r61553  
    36463646            ScopeChainNode* scopeChain = callFrame->scopeChain();
    36473647            CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
     3648            if (!registerFile->grow(newCallFrame->registers())) {
     3649                exceptionValue = createStackOverflowError(callFrame);
     3650                goto vm_throw;
     3651            }
     3652
    36483653            newCallFrame->init(0, vPC + OPCODE_LENGTH(op_call), scopeChain, callFrame, argCount, asObject(v));
    36493654
     
    37933798            ScopeChainNode* scopeChain = callFrame->scopeChain();
    37943799            CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
     3800            if (!registerFile->grow(newCallFrame->registers())) {
     3801                exceptionValue = createStackOverflowError(callFrame);
     3802                goto vm_throw;
     3803            }
    37953804            newCallFrame->init(0, vPC + OPCODE_LENGTH(op_call_varargs), scopeChain, callFrame, argCount, asObject(v));
    37963805           
     
    41114120            ScopeChainNode* scopeChain = callFrame->scopeChain();
    41124121            CallFrame* newCallFrame = CallFrame::create(callFrame->registers() + registerOffset);
     4122            if (!registerFile->grow(newCallFrame->registers())) {
     4123                exceptionValue = createStackOverflowError(callFrame);
     4124                goto vm_throw;
     4125            }
    41134126            newCallFrame->init(0, vPC + OPCODE_LENGTH(op_construct), scopeChain, callFrame, argCount, asObject(v));
    41144127
Note: See TracChangeset for help on using the changeset viewer.