Changeset 34457 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jun 8, 2008, 5:57:28 PM (17 years ago)
Author:
[email protected]
Message:

2008-06-08 Cameron Zwarich <[email protected]>

Reviewed by Darin.

Bug 19346: REGRESSION: Mootools 1.2 Class inheritance broken in post-SquirrelFish merge
<https://bugs.webkit.org/show_bug.cgi?id=19346>

A check for whether a function's caller is eval code accidentally included
the case where the caller's caller is native code. Add a CodeType field to
CodeBlock and use this for the eval caller test instead.

JavaScriptCore:

  • VM/CodeBlock.h: (KJS::CodeBlock::CodeBlock): (KJS::ProgramCodeBlock::ProgramCodeBlock): (KJS::EvalCodeBlock::EvalCodeBlock):
  • VM/Machine.cpp: (KJS::getCallerFunctionOffset):
  • kjs/nodes.cpp: (KJS::FunctionBodyNode::generateCode): (KJS::ProgramNode::generateCode):

LayoutTests:

  • fast/js/function-dot-arguments-and-caller-expected.txt:
  • fast/js/function-dot-arguments-and-caller.html:
Location:
trunk/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r34437 r34457  
     12008-06-08  Cameron Zwarich  <[email protected]>
     2
     3        Reviewed by Darin.
     4
     5        Bug 19346: REGRESSION: Mootools 1.2 Class inheritance broken in post-SquirrelFish merge
     6        <https://bugs.webkit.org/show_bug.cgi?id=19346>
     7
     8        A check for whether a function's caller is eval code accidentally included
     9        the case where the caller's caller is native code. Add a CodeType field to
     10        CodeBlock and use this for the eval caller test instead.
     11
     12        * VM/CodeBlock.h:
     13        (KJS::CodeBlock::CodeBlock):
     14        (KJS::ProgramCodeBlock::ProgramCodeBlock):
     15        (KJS::EvalCodeBlock::EvalCodeBlock):
     16        * VM/Machine.cpp:
     17        (KJS::getCallerFunctionOffset):
     18        * kjs/nodes.cpp:
     19        (KJS::FunctionBodyNode::generateCode):
     20        (KJS::ProgramNode::generateCode):
     21
    1222008-06-07  Cameron Zwarich  <[email protected]>
    223
  • trunk/JavaScriptCore/VM/CodeBlock.h

    r34372 r34457  
    5757
    5858    struct CodeBlock {
    59         CodeBlock(ScopeNode* ownerNode_)
     59        CodeBlock(ScopeNode* ownerNode_, CodeType codeType_)
    6060            : ownerNode(ownerNode_)
    6161            , numTemporaries(0)
     
    6565            , needsFullScopeChain(ownerNode_->usesEval() || ownerNode_->needsClosure())
    6666            , usesEval(ownerNode_->usesEval())
     67            , codeType(codeType_)
    6768        {
    6869        }
     
    8283        bool needsFullScopeChain;
    8384        bool usesEval;
     85        CodeType codeType;
    8486
    8587        Vector<Instruction> instructions;
     
    102104
    103105    struct ProgramCodeBlock : public CodeBlock {
    104         ProgramCodeBlock(ScopeNode* ownerNode, JSGlobalObject* globalObject_)
    105             : CodeBlock(ownerNode)
     106        ProgramCodeBlock(ScopeNode* ownerNode_, CodeType codeType_, JSGlobalObject* globalObject_)
     107            : CodeBlock(ownerNode_, codeType_)
    106108            , globalObject(globalObject_)
    107109        {
     
    119121
    120122    struct EvalCodeBlock : public ProgramCodeBlock {
    121         EvalCodeBlock(ScopeNode* ownerNode, JSGlobalObject* globalObject_)
    122             : ProgramCodeBlock(ownerNode, globalObject_)
     123        EvalCodeBlock(ScopeNode* ownerNode_, JSGlobalObject* globalObject_)
     124            : ProgramCodeBlock(ownerNode_, EvalCode, globalObject_)
    123125        {
    124126        }
  • trunk/JavaScriptCore/VM/Machine.cpp

    r34412 r34457  
    6565    if (!callerCodeBlock) // test for top frame of re-entrant function call
    6666        return false;
    67 
     67   
     68    if (callerCodeBlock->codeType == EvalCode)
     69        return false;
     70   
    6871    callerOffset = callFrame[Machine::CallerRegisterOffset].u.i - callerCodeBlock->numLocals - Machine::CallFrameHeaderSize;
    6972    if (callerOffset < 0) // test for global frame
    70         return false;
    71 
    72     Register* callerCallFrame = (*registerBase) + callerOffset;
    73     if (!callerCallFrame[Machine::CallerCodeBlock].u.codeBlock) // test for eval frame
    7473        return false;
    7574
  • trunk/JavaScriptCore/kjs/nodes.cpp

    r34412 r34457  
    18181818    JSGlobalObject* globalObject = scopeChain.globalObject();
    18191819
    1820     m_code.set(new CodeBlock(this));
     1820    m_code.set(new CodeBlock(this, FunctionCode));
    18211821
    18221822    CodeGenerator generator(this, globalObject->debugger(), scopeChain, &m_symbolTable, m_code.get());
     
    18541854    JSGlobalObject* globalObject = scopeChain.globalObject();
    18551855   
    1856     m_code.set(new ProgramCodeBlock(this, globalObject));
     1856    m_code.set(new ProgramCodeBlock(this, GlobalCode, globalObject));
    18571857   
    18581858    CodeGenerator generator(this, globalObject->debugger(), scopeChain, &globalObject->symbolTable(), m_code.get(), m_varStack, m_functionStack, canCreateGlobals);
Note: See TracChangeset for help on using the changeset viewer.