Bug 149622

Summary: Introduce Symbol type for property type inference
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: New BugsAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, fpizlo, ggaren, keith_miller, mark.lam, msaboff, sbarati
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

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 :)