Skip to content
  • dslomov@google.com's avatar
    Source/WebCore: [V8][Chromium]Serialize dense arrays densly · 12ec3347
    dslomov@google.com authored
    https://bugs.webkit.org/show_bug.cgi?id=72198
    This patch ensures that:
    - Dense arrays are serialized densly, and not as name-value pairs
    - Sparse arrays are allocated as sparse on deserialization.
    The criteria to choose whether to serialize densly or sparsely is the size
    of a resulting serialized stream.
    
    Reviewed by David Levin.
    
    Test: fast/dom/Window/window-postmessage-arrays.html
    
    * bindings/v8/SerializedScriptValue.cpp:
    (WebCore::V8ObjectMap::Writer::writeDenseArray):
    (WebCore::V8ObjectMap::Writer::writeGenerateFreshSparseArray):
    (WebCore::V8ObjectMap::Writer::writeGenerateFreshDenseArray):
    (WebCore::V8ObjectMap::Serializer::writeDenseArray):
    (WebCore::V8ObjectMap::Serializer::AbstractObjectState::execDepth):
    (WebCore::V8ObjectMap::Serializer::AbstractObjectState::serializeProperties):
    (WebCore::V8ObjectMap::Serializer::ObjectState::advance):
    (WebCore::V8ObjectMap::Serializer::DenseArrayState::DenseArrayState):
    (WebCore::V8ObjectMap::Serializer::DenseArrayState::advance):
    (WebCore::V8ObjectMap::Serializer::DenseArrayState::objectDone):
    (WebCore::V8ObjectMap::Serializer::SparseArrayState::SparseArrayState):
    (WebCore::V8ObjectMap::Serializer::SparseArrayState::advance):
    (WebCore::V8ObjectMap::Serializer::serializeDensely):
    (WebCore::V8ObjectMap::Serializer::startArrayState):
    (WebCore::V8ObjectMap::Serializer::startObjectState):
    (WebCore::V8ObjectMap::Serializer::doSerialize):
    (WebCore::V8ObjectMap::Reader::read):
    (WebCore::V8ObjectMap::Deserializer::newSparseArray):
    (WebCore::V8ObjectMap::Deserializer::completeSparseArray):
    (WebCore::V8ObjectMap::Deserializer::completeDenseArray):
    
    LayoutTests: [V8][Chromium]Serialize dense arrays densly.
    https://bugs.webkit.org/show_bug.cgi?id=72198
    
    Reviewed by David Levin.
    
    * fast/dom/Window/script-tests/postmessage-clone.js:
    * fast/dom/Window/window-postmessage-arrays-expected.txt: Added.
    * fast/dom/Window/window-postmessage-arrays.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@100239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    12ec3347