Bug 149622 - Introduce Symbol type for property type inference
Summary: Introduce Symbol type for property type inference
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: Yusuke Suzuki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-29 03:35 PDT by Yusuke Suzuki
Modified: 2015-10-12 23:31 PDT (History)
7 users (show)

See Also:


Attachments
Patch (8.38 KB, patch)
2015-09-29 03:35 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff
Patch (17.54 KB, patch)
2015-10-10 21:51 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2015-09-29 03:35:17 PDT
Introduce Symbol type for property type inference
Comment 1 Yusuke Suzuki 2015-09-29 03:35:31 PDT
Created attachment 262059 [details]
Patch

WIP, not compiled yet
Comment 2 Yusuke Suzuki 2015-09-29 03:37:29 PDT
For example,

const Red = Symbol("Red");
const Blue = Symbol("Green");

class Apple {
    constructor(color)
    {
        this.color = color;
    }
}

let apple = new Apple(Red);
let greenApple = new Apple(Green);
Comment 3 Yusuke Suzuki 2015-10-10 21:51:33 PDT
Created attachment 262849 [details]
Patch
Comment 4 Geoffrey Garen 2015-10-12 12:07:42 PDT
Comment on attachment 262849 [details]
Patch

r=me
Comment 5 WebKit Commit Bot 2015-10-12 19:10:10 PDT
Comment on attachment 262849 [details]
Patch

Clearing flags on attachment: 262849

Committed r190916: <http://trac.webkit.org/changeset/190916>
Comment 6 WebKit Commit Bot 2015-10-12 19:10:14 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Alexey Proskuryakov 2015-10-12 22:10:34 PDT
There are many JSC tests failures after this patch: <https://build.webkit.org/builders/Apple%20El%20Capitan%20Debug%20JSC%20%28Tests%29/builds/175/steps/jscore-test/logs/stdio>

Could you please take a look?
Comment 8 Yusuke Suzuki 2015-10-12 22:33:15 PDT
(In reply to comment #7)
> There are many JSC tests failures after this patch:
> <https://build.webkit.org/builders/
> Apple%20El%20Capitan%20Debug%20JSC%20%28Tests%29/builds/175/steps/jscore-
> test/logs/stdio>
> 
> Could you please take a look?

Thanks. I'll check this.
Comment 9 Yusuke Suzuki 2015-10-12 23:25:26 PDT
The symbol structure is not registered even if it is used for InferredType.
Since Symbol / String InferredTypes claim that they don't have any structure, registerInferredType does not register these structures.

I've added register structure for Symbol structure in DFGStructureRegisterationPhase as the same to String structure.
Because,

1. InferredType::structure is only allowed for ObjectWithStructure / ObjectWithStructureOrOther. It seems clear to me that only ObjectWithStructure has structure.
2. Symbol is similar primitive value to String. So handling its structure in similar way to String is nice.

I'll land the patch just adding registerStrucutre(Symbol Structure) in DFGStructureRegisterationPhase.
Comment 10 Yusuke Suzuki 2015-10-12 23:30:41 PDT
Committed r190927: <http://trac.webkit.org/changeset/190927>
Comment 11 Yusuke Suzuki 2015-10-12 23:31:28 PDT
(In reply to comment #7)
> There are many JSC tests failures after this patch:
> <https://build.webkit.org/builders/
> Apple%20El%20Capitan%20Debug%20JSC%20%28Tests%29/builds/175/steps/jscore-
> test/logs/stdio>
> 
> Could you please take a look?

Fixed :)