Bug 186692 - Properly zero unused property storage offsets
Summary: Properly zero unused property storage offsets
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Keith Miller
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-06-15 13:57 PDT by Keith Miller
Modified: 2018-07-05 14:12 PDT (History)
9 users (show)

See Also:


Attachments
Patch (26.16 KB, patch)
2018-06-15 14:04 PDT, Keith Miller
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews113 for mac-sierra (390.19 KB, application/zip)
2018-06-15 15:07 PDT, EWS Watchlist
no flags Details
Patch (32.14 KB, patch)
2018-06-15 15:55 PDT, Keith Miller
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews116 for mac-sierra (3.09 MB, application/zip)
2018-06-15 17:29 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews204 for win-future (12.74 MB, application/zip)
2018-06-15 18:29 PDT, EWS Watchlist
no flags Details
Patch (35.94 KB, patch)
2018-06-15 20:22 PDT, Keith Miller
no flags Details | Formatted Diff | Diff
Patch (34.65 KB, patch)
2018-06-15 20:24 PDT, Keith Miller
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews113 for mac-sierra (2.48 MB, application/zip)
2018-06-15 21:52 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews107 for mac-sierra-wk2 (3.02 MB, application/zip)
2018-06-15 22:29 PDT, EWS Watchlist
no flags Details
Patch (32.13 KB, patch)
2018-06-18 12:04 PDT, Keith Miller
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews114 for mac-sierra (3.29 MB, application/zip)
2018-06-18 13:24 PDT, EWS Watchlist
no flags Details
Patch (36.06 KB, patch)
2018-06-18 14:46 PDT, Keith Miller
no flags Details | Formatted Diff | Diff
Patch (36.06 KB, patch)
2018-06-18 15:37 PDT, Keith Miller
no flags Details | Formatted Diff | Diff
Patch (36.40 KB, patch)
2018-06-18 15:51 PDT, Keith Miller
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keith Miller 2018-06-15 13:57:23 PDT
Properly zero unused property storage offsets
Comment 1 Keith Miller 2018-06-15 14:04:31 PDT
Created attachment 342843 [details]
Patch
Comment 2 EWS Watchlist 2018-06-15 14:06:06 PDT
Attachment 342843 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/Butterfly.h:166:  The parameter name "vm" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/Butterfly.h:166:  The parameter name "indexingHeader" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/JSObject.cpp:1184:  Declaration has space between type name and * in propertyCapacity * sizeof  [whitespace/declaration] [3]
Total errors found: 3 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 EWS Watchlist 2018-06-15 15:07:39 PDT
Comment on attachment 342843 [details]
Patch

Attachment 342843 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/8202573

Number of test failures exceeded the failure limit.
Comment 4 EWS Watchlist 2018-06-15 15:07:41 PDT
Created attachment 342851 [details]
Archive of layout-test-results from ews113 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 5 Keith Miller 2018-06-15 15:55:56 PDT
Created attachment 342854 [details]
Patch
Comment 6 EWS Watchlist 2018-06-15 15:58:43 PDT
Attachment 342854 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/Butterfly.h:168:  The parameter name "vm" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/Butterfly.h:168:  The parameter name "indexingHeader" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/JSObject.cpp:1184:  Declaration has space between type name and * in propertyCapacity * sizeof  [whitespace/declaration] [3]
Total errors found: 3 in 10 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Geoffrey Garen 2018-06-15 16:17:55 PDT
Comment on attachment 342854 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=342854&action=review

Test case please.

r=me with test case and fix for test time regression if needed.

> Source/JavaScriptCore/ChangeLog:12
> +        or creating a RegExp matches array we never cleared the unused

array, we never clear

> Source/JavaScriptCore/runtime/ObjectInitializationScope.cpp:94
> +    for (int64_t i = 0; i < static_cast<int64_t>(structure->outOfLineCapacity()); i++) {
> +        // We rely on properties past the last offset be zero for concurrent GC.
> +        if (i + firstOutOfLineOffset > structure->lastOffset())
> +            ASSERT(!butterfly->propertyStorage()[-i - 1].get());
> +        else if (isScribbledValue(butterfly->propertyStorage()[-i - 1].get())) {
> +            dataLogLn("Found scribbled property at i = ", -i - 1);
> +            ASSERT_NOT_REACHED();
> +        }
> +    }

If this increases debug test time too much, you need to find a way to do this assertion conditionally.
Comment 8 EWS Watchlist 2018-06-15 17:29:26 PDT
Comment on attachment 342854 [details]
Patch

Attachment 342854 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/8204362

Number of test failures exceeded the failure limit.
Comment 9 EWS Watchlist 2018-06-15 17:29:27 PDT
Created attachment 342859 [details]
Archive of layout-test-results from ews116 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 10 EWS Watchlist 2018-06-15 18:28:59 PDT
Comment on attachment 342854 [details]
Patch

Attachment 342854 [details] did not pass win-ews (win):
Output: http://webkit-queues.webkit.org/results/8204839

New failing tests:
http/tests/preload/onload_event.html
Comment 11 EWS Watchlist 2018-06-15 18:29:09 PDT
Created attachment 342865 [details]
Archive of layout-test-results from ews204 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews204  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 12 Keith Miller 2018-06-15 18:29:20 PDT
rdar://problem/39489288
Comment 13 Saam Barati 2018-06-15 19:10:15 PDT
Comment on attachment 342854 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=342854&action=review

> Source/JavaScriptCore/runtime/RegExpMatchesArray.h:-52
> -    unsigned i = (createUninitialized ? initialLength : 0);

Why this change?
Comment 14 Keith Miller 2018-06-15 19:17:14 PDT
Comment on attachment 342854 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=342854&action=review

>> Source/JavaScriptCore/runtime/RegExpMatchesArray.h:-52
>> -    unsigned i = (createUninitialized ? initialLength : 0);
> 
> Why this change?

createUninitialized was always false. We only ever pass a custom structure.
Comment 15 Keith Miller 2018-06-15 20:22:58 PDT
Created attachment 342872 [details]
Patch
Comment 16 EWS Watchlist 2018-06-15 20:24:13 PDT
Attachment 342872 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/Butterfly.h:168:  The parameter name "vm" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/Butterfly.h:168:  The parameter name "indexingHeader" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/JSObject.cpp:1184:  Declaration has space between type name and * in propertyCapacity * sizeof  [whitespace/declaration] [3]
Total errors found: 3 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 17 Keith Miller 2018-06-15 20:24:30 PDT
Created attachment 342873 [details]
Patch
Comment 18 EWS Watchlist 2018-06-15 20:27:13 PDT
Attachment 342873 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/Butterfly.h:168:  The parameter name "vm" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/Butterfly.h:168:  The parameter name "indexingHeader" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/JSObject.cpp:1184:  Declaration has space between type name and * in propertyCapacity * sizeof  [whitespace/declaration] [3]
Total errors found: 3 in 13 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 19 EWS Watchlist 2018-06-15 21:52:23 PDT
Comment on attachment 342873 [details]
Patch

Attachment 342873 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/8207177

Number of test failures exceeded the failure limit.
Comment 20 EWS Watchlist 2018-06-15 21:52:24 PDT
Created attachment 342875 [details]
Archive of layout-test-results from ews113 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 21 EWS Watchlist 2018-06-15 22:28:59 PDT
Comment on attachment 342873 [details]
Patch

Attachment 342873 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/8207436

New failing tests:
css3/filters/backdrop/add-remove-add-backdrop-filter.html
Comment 22 EWS Watchlist 2018-06-15 22:29:01 PDT
Created attachment 342876 [details]
Archive of layout-test-results from ews107 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 23 Mark Lam 2018-06-16 11:11:40 PDT
Comment on attachment 342873 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=342873&action=review

> Source/JavaScriptCore/ChangeLog:13
> +        proprety storage. This patch fixes that issue and gets most users

typo: /proprety/property/

> Source/JavaScriptCore/runtime/Butterfly.h:166
> +    static Butterfly* tryCreateUninitialized(VM&, ObjectInitializationScope*, JSObject* intendedOwner, size_t preCapacity, size_t propertyCapacity, bool hasIndexingHeader, size_t indexingPayloadSizeInBytes, GCDeferralContext* = nullptr);
> +    static Butterfly* createUninitialized(VM&, ObjectInitializationScope*, JSObject* intendedOwner, size_t preCapacity, size_t propertyCapacity, bool hasIndexingHeader, size_t indexingPayloadSizeInBytes);

I see that operationAllocateSimplePropertyStorageWithInitialCapacity, operationAllocateSimplePropertyStorage, and tryCreateUninitializedRegExpMatchesArray are the only 2 clients that calls these without a ObjectInitializationScope.  I suggest that you:
1. Change all clients to instantiate and pass a ObjectInitializationScope anyway.
2. Pass a ObjectInitializationScope& instead of a ObjectInitializationScope*.
3. Remove the VM& argument.  You can get the VM& from the ObjectInitializationScope&.  ObjectInitializationScope was designed to work this way.

That will keep the interface simpler, and removes the question of whether ObjectInitializationScope is needed or not (preventing someone from making the wrong choice in the future when adding new code).

> Source/JavaScriptCore/runtime/ButterflyInlines.h:89
> +    if (initializationScope)
> +        initializationScope->notifyAllocated(intendedOwner, wasCreatedUnitializated);

Remove the initializationScope condition (after changing this function to take a ObjectInitializationScope& instead of ObjectInitializationScope*).

> Source/JavaScriptCore/runtime/ButterflyInlines.h:102
> +    if (initializationScope)
> +        initializationScope->notifyAllocated(intendedOwner, wasCreatedUnitializated);

Remove the initializationScope condition (after changing this function to take a ObjectInitializationScope& instead of ObjectInitializationScope*).

> Source/JavaScriptCore/runtime/JSObject.cpp:1185
> +        

Please remove whitespace.
Comment 24 Keith Miller 2018-06-16 12:26:03 PDT
Comment on attachment 342873 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=342873&action=review

>> Source/JavaScriptCore/ChangeLog:13
>> +        proprety storage. This patch fixes that issue and gets most users
> 
> typo: /proprety/property/

fixed.

>> Source/JavaScriptCore/runtime/Butterfly.h:166
>> +    static Butterfly* createUninitialized(VM&, ObjectInitializationScope*, JSObject* intendedOwner, size_t preCapacity, size_t propertyCapacity, bool hasIndexingHeader, size_t indexingPayloadSizeInBytes);
> 
> I see that operationAllocateSimplePropertyStorageWithInitialCapacity, operationAllocateSimplePropertyStorage, and tryCreateUninitializedRegExpMatchesArray are the only 2 clients that calls these without a ObjectInitializationScope.  I suggest that you:
> 1. Change all clients to instantiate and pass a ObjectInitializationScope anyway.
> 2. Pass a ObjectInitializationScope& instead of a ObjectInitializationScope*.
> 3. Remove the VM& argument.  You can get the VM& from the ObjectInitializationScope&.  ObjectInitializationScope was designed to work this way.
> 
> That will keep the interface simpler, and removes the question of whether ObjectInitializationScope is needed or not (preventing someone from making the wrong choice in the future when adding new code).

I don't see how that would work. The DFG/FTL operations don't actually initialize the object while the ObjectInitializationScope would be alive. Are you proposing that there should be a new method to drop the initialization scope?

>> Source/JavaScriptCore/runtime/JSObject.cpp:1185
>> +        
> 
> Please remove whitespace.

Fixed.
Comment 25 Filip Pizlo 2018-06-18 11:34:42 PDT
Comment on attachment 342873 [details]
Patch

I would rip out the part of this patch that adds more uses of ObjectInitializationScope.  In RegExpMatchesArray, we already use GCDeferralContext, which may not interact great with the DisallowGC that ObjectInitializationScope does.
Comment 26 Keith Miller 2018-06-18 12:04:07 PDT
Created attachment 342959 [details]
Patch
Comment 27 EWS Watchlist 2018-06-18 12:05:54 PDT
Attachment 342959 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/Butterfly.h:168:  The parameter name "vm" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/Butterfly.h:168:  The parameter name "indexingHeader" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/JSObject.cpp:1181:  Declaration has space between type name and * in propertyCapacity * sizeof  [whitespace/declaration] [3]
Total errors found: 3 in 13 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 28 EWS Watchlist 2018-06-18 13:24:26 PDT
Comment on attachment 342959 [details]
Patch

Attachment 342959 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/8235221

Number of test failures exceeded the failure limit.
Comment 29 EWS Watchlist 2018-06-18 13:24:27 PDT
Created attachment 342967 [details]
Archive of layout-test-results from ews114 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews114  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 30 Keith Miller 2018-06-18 14:46:25 PDT
Created attachment 342972 [details]
Patch
Comment 31 EWS Watchlist 2018-06-18 14:49:16 PDT
Attachment 342972 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/Butterfly.h:168:  The parameter name "vm" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/Butterfly.h:168:  The parameter name "indexingHeader" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/JSObject.cpp:1181:  Declaration has space between type name and * in propertyCapacity * sizeof  [whitespace/declaration] [3]
Total errors found: 3 in 13 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 32 Keith Miller 2018-06-18 15:37:49 PDT
Created attachment 342981 [details]
Patch
Comment 33 EWS Watchlist 2018-06-18 15:40:30 PDT
Attachment 342981 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/Butterfly.h:168:  The parameter name "vm" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/Butterfly.h:168:  The parameter name "indexingHeader" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/JSObject.cpp:1181:  Declaration has space between type name and * in propertyCapacity * sizeof  [whitespace/declaration] [3]
Total errors found: 3 in 13 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 34 Keith Miller 2018-06-18 15:51:56 PDT
Created attachment 342983 [details]
Patch
Comment 35 EWS Watchlist 2018-06-18 15:53:50 PDT
Attachment 342983 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/runtime/Butterfly.h:167:  The parameter name "vm" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/Butterfly.h:167:  The parameter name "indexingHeader" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/JavaScriptCore/runtime/JSObject.cpp:1181:  Declaration has space between type name and * in propertyCapacity * sizeof  [whitespace/declaration] [3]
Total errors found: 3 in 13 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 36 WebKit Commit Bot 2018-06-18 16:53:34 PDT
Comment on attachment 342983 [details]
Patch

Clearing flags on attachment: 342983

Committed r232951: <https://trac.webkit.org/changeset/232951>
Comment 37 WebKit Commit Bot 2018-06-18 16:53:36 PDT
All reviewed patches have been landed.  Closing bug.
Comment 38 Saam Barati 2018-06-18 18:19:10 PDT
Comment on attachment 342983 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=342983&action=review

> Source/JavaScriptCore/runtime/JSArray.cpp:55
> +    ASSERT_UNUSED(globalObject, globalObject->isOriginalArrayStructure(structure) || structure == globalObject->regExpMatchesArrayStructure() || structure == globalObject->regExpMatchesArrayWithGroupsStructure());

This is crashing for me on a debug build
Comment 39 Saam Barati 2018-06-18 18:22:53 PDT
(In reply to Saam Barati from comment #38)
> Comment on attachment 342983 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=342983&action=review
> 
> > Source/JavaScriptCore/runtime/JSArray.cpp:55
> > +    ASSERT_UNUSED(globalObject, globalObject->isOriginalArrayStructure(structure) || structure == globalObject->regExpMatchesArrayStructure() || structure == globalObject->regExpMatchesArrayWithGroupsStructure());
> 
> This is crashing for me on a debug build

repro test case:

```
class A extends Array { }
new A;
```
Comment 40 Keith Miller 2018-06-18 18:25:01 PDT
Comment on attachment 342983 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=342983&action=review

>>> Source/JavaScriptCore/runtime/JSArray.cpp:55
>>> +    ASSERT_UNUSED(globalObject, globalObject->isOriginalArrayStructure(structure) || structure == globalObject->regExpMatchesArrayStructure() || structure == globalObject->regExpMatchesArrayWithGroupsStructure());
>> 
>> This is crashing for me on a debug build
> 
> repro test case:
> 
> ```
> class A extends Array { }
> new A;
> ```

Yeah, I can see how this would break for that... I should just get rid of that assert. It doesn't do very much.