Changeset 243069 in webkit


Ignore:
Timestamp:
Mar 18, 2019 9:18:10 AM (5 years ago)
Author:
mark.lam@apple.com
Message:

Structure::flattenDictionary() should clear unused property slots.
https://bugs.webkit.org/show_bug.cgi?id=195871
<rdar://problem/48959497>

Reviewed by Michael Saboff.

JSTests:

  • stress/structure-flattenDictionary-should-clear-unused-property-slots.js: Added.

Source/JavaScriptCore:

It currently attempts to do this but fails because it's actually clearing up the
preCapacity region instead. The fix is simply to account for the preCapacity
when computing the start address of the property slots.

  • runtime/Structure.cpp:

(JSC::Structure::flattenDictionaryStructure):

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r243032 r243069  
     12019-03-18  Mark Lam  <mark.lam@apple.com>
     2
     3        Structure::flattenDictionary() should clear unused property slots.
     4        https://bugs.webkit.org/show_bug.cgi?id=195871
     5        <rdar://problem/48959497>
     6
     7        Reviewed by Michael Saboff.
     8
     9        * stress/structure-flattenDictionary-should-clear-unused-property-slots.js: Added.
     10
    1112019-03-15  Mark Lam  <mark.lam@apple.com>
    212
  • trunk/Source/JavaScriptCore/ChangeLog

    r243065 r243069  
     12019-03-18  Mark Lam  <mark.lam@apple.com>
     2
     3        Structure::flattenDictionary() should clear unused property slots.
     4        https://bugs.webkit.org/show_bug.cgi?id=195871
     5        <rdar://problem/48959497>
     6
     7        Reviewed by Michael Saboff.
     8
     9        It currently attempts to do this but fails because it's actually clearing up the
     10        preCapacity region instead.  The fix is simply to account for the preCapacity
     11        when computing the start address of the property slots.
     12
     13        * runtime/Structure.cpp:
     14        (JSC::Structure::flattenDictionaryStructure):
     15
    1162019-03-18  Robin Morisset  <rmorisset@apple.com>
    217
  • trunk/Source/JavaScriptCore/runtime/Structure.cpp

    r242123 r243069  
    11/*
    2  * Copyright (C) 2008, 2009, 2013-2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    779779
    780780        Butterfly* butterfly = object->butterfly();
    781         memset(
    782             butterfly->base(butterfly->indexingHeader()->preCapacity(this), beforeOutOfLineCapacity),
    783             0,
    784             (beforeOutOfLineCapacity - outOfLineSize()) * sizeof(EncodedJSValue));
     781        size_t preCapacity = butterfly->indexingHeader()->preCapacity(this);
     782        void* base = butterfly->base(preCapacity, beforeOutOfLineCapacity);
     783        void* startOfPropertyStorageSlots = reinterpret_cast<EncodedJSValue*>(base) + preCapacity;
     784        memset(startOfPropertyStorageSlots, 0, (beforeOutOfLineCapacity - outOfLineSize()) * sizeof(EncodedJSValue));
    785785        checkOffsetConsistency();
    786786    }
Note: See TracChangeset for help on using the changeset viewer.