Changeset 183790 in webkit


Ignore:
Timestamp:
May 4, 2015 8:35:13 PM (9 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r183789.
https://bugs.webkit.org/show_bug.cgi?id=144620

Causing flakiness on exceptionFuzz tests locally on 32-bit
build (Requested by saamyjoon on #webkit).

Reverted changeset:

"Global functions should be initialized as JSFunctions in byte
code"
https://bugs.webkit.org/show_bug.cgi?id=144178
http://trac.webkit.org/changeset/183789

Location:
trunk/Source/JavaScriptCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r183789 r183790  
     12015-05-04  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, rolling out r183789.
     4        https://bugs.webkit.org/show_bug.cgi?id=144620
     5
     6        Causing flakiness on exceptionFuzz tests locally on 32-bit
     7        build (Requested by saamyjoon on #webkit).
     8
     9        Reverted changeset:
     10
     11        "Global functions should be initialized as JSFunctions in byte
     12        code"
     13        https://bugs.webkit.org/show_bug.cgi?id=144178
     14        http://trac.webkit.org/changeset/183789
     15
    1162015-05-04  Saam Barati  <saambarati1@gmail.com>
    217
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp

    r183789 r183790  
    472472    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    473473    Base::visitChildren(thisObject, visitor);
     474    for (size_t i = 0, end = thisObject->m_functionDeclarations.size(); i != end; i++)
     475        visitor.append(&thisObject->m_functionDeclarations[i].second);
    474476}
    475477
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h

    r183789 r183790  
    655655    static void destroy(JSCell*);
    656656
     657    void addFunctionDeclaration(VM& vm, const Identifier& name, UnlinkedFunctionExecutable* functionExecutable)
     658    {
     659        m_functionDeclarations.append(std::make_pair(name, WriteBarrier<UnlinkedFunctionExecutable>(vm, this, functionExecutable)));
     660    }
     661
    657662    void addVariableDeclaration(const Identifier& name, bool isConstant)
    658663    {
     
    661666
    662667    typedef Vector<std::pair<Identifier, bool>> VariableDeclations;
     668    typedef Vector<std::pair<Identifier, WriteBarrier<UnlinkedFunctionExecutable>> > FunctionDeclations;
    663669
    664670    const VariableDeclations& variableDeclarations() const { return m_varDeclarations; }
     671    const FunctionDeclations& functionDeclarations() const { return m_functionDeclarations; }
    665672
    666673    static void visitChildren(JSCell*, SlotVisitor&);
     
    673680
    674681    VariableDeclations m_varDeclarations;
     682    FunctionDeclations m_functionDeclarations;
    675683
    676684public:
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r183789 r183790  
    7878    {
    7979        RefPtr<RegisterID> temp = newTemporary();
    80         RefPtr<RegisterID> globalScope = scopeRegister(); // FIXME: With lexical scoping, this won't always be the global object: https://bugs.webkit.org/show_bug.cgi?id=142944
    81         for (auto functionPair : m_functionsToInitialize) {
    82             FunctionBodyNode* functionBody = functionPair.first;
    83             FunctionVariableType functionType = functionPair.second;
     80        for (FunctionBodyNode* functionBody : m_functionsToInitialize) {
    8481            emitNewFunction(temp.get(), functionBody);
    85             if (functionType == NormalFunctionVariable)
    86                 initializeVariable(variable(functionBody->ident()) , temp.get());
    87             else if (functionType == GlobalFunctionVariable)
    88                 emitPutToScope(globalScope.get(), Variable(functionBody->ident()), temp.get(), ThrowIfNotFound);
    89             else
    90                 RELEASE_ASSERT_NOT_REACHED();
     82            initializeVariable(variable(functionBody->ident()), temp.get());
    9183        }
    9284    }
     
    172164    for (size_t i = 0; i < functionStack.size(); ++i) {
    173165        FunctionBodyNode* function = functionStack[i];
    174         m_functionsToInitialize.append(std::make_pair(function, GlobalFunctionVariable));
     166        UnlinkedFunctionExecutable* unlinkedFunction = makeFunction(function);
     167        codeBlock->addFunctionDeclaration(*m_vm, function->ident(), unlinkedFunction);
    175168    }
    176169
     
    392385        const Identifier& ident = function->ident();
    393386        createVariable(ident, varKind(ident.impl()), IsVariable);
    394         m_functionsToInitialize.append(std::make_pair(function, NormalFunctionVariable));
     387        m_functionsToInitialize.append(function);
    395388    }
    396389    for (auto& entry : functionNode->varStack()) {
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r183789 r183790  
    745745        Vector<TryContext> m_tryContextStack;
    746746        Vector<std::pair<RefPtr<RegisterID>, const DeconstructionPatternNode*>> m_deconstructedParameters;
    747         enum FunctionVariableType : uint8_t { NormalFunctionVariable, GlobalFunctionVariable };
    748         Vector<std::pair<FunctionBodyNode*, FunctionVariableType>> m_functionsToInitialize;
     747        Vector<FunctionBodyNode*> m_functionsToInitialize;
    749748        bool m_needToInitializeArguments { false };
    750749       
  • trunk/Source/JavaScriptCore/runtime/Executable.cpp

    r183789 r183790  
    511511
    512512    const UnlinkedProgramCodeBlock::VariableDeclations& variableDeclarations = unlinkedCodeBlock->variableDeclarations();
    513 
    514     for (size_t i = 0, numberOfFunctions = unlinkedCodeBlock->numberOfFunctionDecls(); i < numberOfFunctions; ++i) {
    515         UnlinkedFunctionExecutable* unlinkedFunctionExecutable = unlinkedCodeBlock->functionDecl(i);
    516         ASSERT(!unlinkedFunctionExecutable->name().isEmpty());
    517         globalObject->addFunction(callFrame, unlinkedFunctionExecutable->name());
     513    const UnlinkedProgramCodeBlock::FunctionDeclations& functionDeclarations = unlinkedCodeBlock->functionDeclarations();
     514
     515    for (size_t i = 0; i < functionDeclarations.size(); ++i) {
     516        UnlinkedFunctionExecutable* unlinkedFunctionExecutable = functionDeclarations[i].second.get();
     517        JSValue value = JSFunction::create(vm, unlinkedFunctionExecutable->link(vm, m_source), scope);
     518        globalObject->addFunction(callFrame, functionDeclarations[i].first, value);
    518519        if (vm.typeProfiler() || vm.controlFlowProfiler()) {
    519520            vm.functionHasExecutedCache()->insertUnexecutedRange(sourceID(),
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r183789 r183790  
    503503}
    504504
    505 void JSGlobalObject::addGlobalVar(const Identifier& ident, ConstantMode constantMode)
     505JSGlobalObject::NewGlobalVar JSGlobalObject::addGlobalVar(const Identifier& ident, ConstantMode constantMode)
    506506{
    507507    ConcurrentJITLocker locker(symbolTable()->m_lock);
    508508    SymbolTableEntry entry = symbolTable()->get(locker, ident.impl());
    509     if (!entry.isNull())
    510         return;
     509    if (!entry.isNull()) {
     510        NewGlobalVar result;
     511        result.offset = entry.scopeOffset();
     512        result.set = entry.watchpointSet();
     513        return result;
     514    }
    511515   
    512516    ScopeOffset offset = symbolTable()->takeNextScopeOffset(locker);
     
    520524    ScopeOffset offsetForAssert = addVariables(1);
    521525    RELEASE_ASSERT(offsetForAssert == offset);
    522 }
    523 
    524 void JSGlobalObject::addFunction(ExecState* exec, const Identifier& propertyName)
     526
     527    NewGlobalVar var;
     528    var.offset = offset;
     529    var.set = newEntry.watchpointSet();
     530    return var;
     531}
     532
     533void JSGlobalObject::addFunction(ExecState* exec, const Identifier& propertyName, JSValue value)
    525534{
    526535    VM& vm = exec->vm();
    527536    removeDirect(vm, propertyName); // Newly declared functions overwrite existing properties.
    528     addGlobalVar(propertyName, IsVariable);
     537    NewGlobalVar var = addGlobalVar(propertyName, IsVariable);
     538    variableAt(var.offset).set(exec->vm(), this, value);
     539    if (var.set)
     540        var.set->touch(VariableWriteFireDetail(this, propertyName));
    529541}
    530542
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r183789 r183790  
    339339    }
    340340
    341     void addGlobalVar(const Identifier&, ConstantMode);
     341    struct NewGlobalVar {
     342        ScopeOffset offset;
     343        WatchpointSet* set;
     344    };
     345    NewGlobalVar addGlobalVar(const Identifier&, ConstantMode);
    342346
    343347public:
     
    371375            addGlobalVar(propertyName, IsConstant);
    372376    }
    373     void addFunction(ExecState*, const Identifier&);
     377    void addFunction(ExecState*, const Identifier&, JSValue);
    374378
    375379    // The following accessors return pristine values, even if a script
Note: See TracChangeset for help on using the changeset viewer.