Ignore:
Timestamp:
Aug 11, 2016, 5:22:20 PM (9 years ago)
Author:
[email protected]
Message:

[JSC] Revert most of r203808
https://bugs.webkit.org/show_bug.cgi?id=160784

Patch by Benjamin Poulain <[email protected]> on 2016-08-11
Reviewed by Geoffrey Garen.

Switching to fastMalloc() caused regressions on Jetstream and Octane
on MacBook Air. I was able to get back some of it in the following
patches but the tests that never go to FTL are still regressed.

This patch revert r203808 except of the node index.
Nodes are allocated with the custom allocator like before but they are
now also kept in a table, addressed by the node index.

  • CMakeLists.txt:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • b3/B3SparseCollection.h:

(JSC::B3::SparseCollection::packIndices): Deleted.

  • dfg/DFGAllocator.h: Added.

(JSC::DFG::Allocator::Region::size):
(JSC::DFG::Allocator::Region::headerSize):
(JSC::DFG::Allocator::Region::numberOfThingsPerRegion):
(JSC::DFG::Allocator::Region::data):
(JSC::DFG::Allocator::Region::isInThisRegion):
(JSC::DFG::Allocator::Region::regionFor):
(JSC::DFG::Allocator<T>::Allocator):
(JSC::DFG::Allocator<T>::~Allocator):
(JSC::DFG::Allocator<T>::allocate):
(JSC::DFG::Allocator<T>::free):
(JSC::DFG::Allocator<T>::freeAll):
(JSC::DFG::Allocator<T>::reset):
(JSC::DFG::Allocator<T>::indexOf):
(JSC::DFG::Allocator<T>::allocatorOf):
(JSC::DFG::Allocator<T>::bumpAllocate):
(JSC::DFG::Allocator<T>::freeListAllocate):
(JSC::DFG::Allocator<T>::allocateSlow):
(JSC::DFG::Allocator<T>::freeRegionsStartingAt):
(JSC::DFG::Allocator<T>::startBumpingIn):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compileImpl):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::Graph):
(JSC::DFG::Graph::~Graph):
(JSC::DFG::Graph::addNodeToMapByIndex):
(JSC::DFG::Graph::deleteNode):
(JSC::DFG::Graph::packNodeIndices):

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::addNode):
(JSC::DFG::Graph::maxNodeCount):
(JSC::DFG::Graph::nodeAt):

  • dfg/DFGLongLivedState.cpp: Added.

(JSC::DFG::LongLivedState::LongLivedState):
(JSC::DFG::LongLivedState::~LongLivedState):
(JSC::DFG::LongLivedState::shrinkToFit):

  • dfg/DFGLongLivedState.h: Added.
  • dfg/DFGNode.h:
  • dfg/DFGNodeAllocator.h: Added.

(operator new ):

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::compileInThread):
(JSC::DFG::Plan::compileInThreadImpl):

  • dfg/DFGPlan.h:
  • dfg/DFGWorklist.cpp:

(JSC::DFG::Worklist::runThread):

  • runtime/VM.cpp:

(JSC::VM::VM):

  • runtime/VM.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/dfg/DFGGraph.h

    r204355 r204393  
    3030
    3131#include "AssemblyHelpers.h"
    32 #include "B3SparseCollection.h"
    3332#include "BytecodeLivenessAnalysisInlines.h"
    3433#include "CodeBlock.h"
     
    3635#include "DFGBasicBlock.h"
    3736#include "DFGFrozenValue.h"
     37#include "DFGLongLivedState.h"
    3838#include "DFGNode.h"
     39#include "DFGNodeAllocator.h"
    3940#include "DFGPlan.h"
    4041#include "DFGPropertyTypeKey.h"
     
    124125class Graph : public virtual Scannable {
    125126public:
    126     Graph(VM&, Plan&);
     127    Graph(VM&, Plan&, LongLivedState&);
    127128    ~Graph();
    128129   
     
    184185    Node* addNode(Params... params)
    185186    {
    186         Node* node = new Node(params...);
    187         m_nodes.add(std::unique_ptr<Node>(node));
     187        Node* node = new (m_allocator) Node(params...);
     188        addNodeToMapByIndex(node);
    188189        return node;
    189190    }
     
    191192    Node* addNode(SpeculatedType type, Params... params)
    192193    {
    193         Node* node = addNode(params...);
     194        Node* node = new (m_allocator) Node(params...);
    194195        node->predict(type);
     196        addNodeToMapByIndex(node);
    195197        return node;
    196198    }
     199
    197200    void deleteNode(Node*);
    198     unsigned maxNodeCount() const { return m_nodes.size(); }
    199     Node* nodeAt(unsigned index) const { return m_nodes[index]; }
     201    unsigned maxNodeCount() const { return m_nodesByIndex.size(); }
     202    Node* nodeAt(unsigned index) const { return m_nodesByIndex[index]; }
    200203    void packNodeIndices();
    201204
     
    835838    CodeBlock* m_codeBlock;
    836839    CodeBlock* m_profiledBlock;
     840   
     841    NodeAllocator& m_allocator;
    837842
    838843    Vector< RefPtr<BasicBlock> , 8> m_blocks;
     
    923928    bool m_hasExceptionHandlers { false };
    924929private:
    925     void adoptNodeOutOfLine(Node&);
     930    void addNodeToMapByIndex(Node*);
    926931
    927932    bool isStringPrototypeMethodSane(JSGlobalObject*, UniquedStringImpl*);
     
    957962    }
    958963
    959     B3::SparseCollection<Node> m_nodes;
     964    Vector<Node*, 0, UnsafeVectorOverflow> m_nodesByIndex;
     965    Vector<unsigned, 0, UnsafeVectorOverflow> m_nodeIndexFreeList;
    960966    Vector<AbstractValue, 0, UnsafeVectorOverflow> m_abstractValuesCache;
    961967};
Note: See TracChangeset for help on using the changeset viewer.