Exemple #1
0
CompilationResult Plan::finalizeWithoutNotifyingCallback()
{
    if (!isStillValid())
        return CompilationInvalidated;
    
    bool result;
    if (codeBlock->codeType() == FunctionCode)
        result = finalizer->finalizeFunction();
    else
        result = finalizer->finalize();
    
    if (!result)
        return CompilationFailed;
    
    reallyAdd(codeBlock->jitCode()->dfgCommon());
    
    return CompilationSuccessful;
}
Exemple #2
0
CompilationResult Plan::finalize(RefPtr<JSC::JITCode>& jitCode, MacroAssemblerCodePtr* jitCodeWithArityCheck)
{
    if (!isStillValid())
        return CompilationInvalidated;
    
    bool result;
    if (compileMode == CompileFunction)
        result = finalizer->finalizeFunction(jitCode, *jitCodeWithArityCheck);
    else
        result = finalizer->finalize(jitCode);
    
    if (!result)
        return CompilationFailed;
    
    reallyAdd();
    
    return CompilationSuccessful;
}
Exemple #3
0
CompilationResult Plan::finalizeWithoutNotifyingCallback()
{
    // We will establish new references from the code block to things. So, we need a barrier.
    vm->heap.writeBarrier(codeBlock);
    
    if (!isStillValid()) {
        CODEBLOCK_LOG_EVENT(codeBlock, "dfgFinalize", ("invalidated"));
        return CompilationInvalidated;
    }

    bool result;
    if (codeBlock->codeType() == FunctionCode)
        result = finalizer->finalizeFunction();
    else
        result = finalizer->finalize();
    
    if (!result) {
        CODEBLOCK_LOG_EVENT(codeBlock, "dfgFinalize", ("failed"));
        return CompilationFailed;
    }
    
    reallyAdd(codeBlock->jitCode()->dfgCommon());
    
    if (validationEnabled()) {
        TrackedReferences trackedReferences;
        
        for (WriteBarrier<JSCell>& reference : codeBlock->jitCode()->dfgCommon()->weakReferences)
            trackedReferences.add(reference.get());
        for (WriteBarrier<Structure>& reference : codeBlock->jitCode()->dfgCommon()->weakStructureReferences)
            trackedReferences.add(reference.get());
        for (WriteBarrier<Unknown>& constant : codeBlock->constants())
            trackedReferences.add(constant.get());
        
        // Check that any other references that we have anywhere in the JITCode are also
        // tracked either strongly or weakly.
        codeBlock->jitCode()->validateReferences(trackedReferences);
    }
    
    CODEBLOCK_LOG_EVENT(codeBlock, "dfgFinalize", ("succeeded"));
    return CompilationSuccessful;
}