Bug 150878

Summary: B3 should be able to compile a Check
Product: WebKit Reporter: Filip Pizlo <fpizlo>
Component: JavaScriptCoreAssignee: Filip Pizlo <fpizlo>
Status: RESOLVED FIXED    
Severity: Normal CC: barraclough, benjamin, commit-queue, ggaren, mark.lam, mhahnenb, msaboff, nrotem, oliver, sam, sbarati
Priority: P2    
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 150279    
Attachments:
Description Flags
the patch sbarati: review+

Description Filip Pizlo 2015-11-03 20:55:34 PST
Patch forthcoming.
Comment 1 Filip Pizlo 2015-11-03 20:59:16 PST
Created attachment 264765 [details]
the patch
Comment 2 WebKit Commit Bot 2015-11-03 21:02:22 PST
Attachment 264765 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/b3/testb3.cpp:1778:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:1779:  Consider using CHECK_EQ instead of CHECK(a == b)  [readability/check] [2]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:1781:  Consider using CHECK_EQ instead of CHECK(a == b)  [readability/check] [2]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:1794:  Consider using CHECK_EQ instead of CHECK(a == b)  [readability/check] [2]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:1794:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
ERROR: Source/JavaScriptCore/b3/testb3.cpp:1795:  Consider using CHECK_EQ instead of CHECK(a == b)  [readability/check] [2]
Total errors found: 6 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Saam Barati 2015-11-04 08:55:48 PST
Comment on attachment 264765 [details]
the patch

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

r=me

> Source/JavaScriptCore/b3/B3LowerToAir.cpp:486
> +            case ValueRep::SomeRegister:

What's the difference between "Register" and "SomeRegister"?

> Source/JavaScriptCore/b3/testb3.cpp:1781
> +            CHECK(params.reps[0].value() == 1);

I'm a bit confused here, why is this "1"?
Comment 4 Saam Barati 2015-11-04 08:56:02 PST
Comment on attachment 264765 [details]
the patch

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

r=me

> Source/JavaScriptCore/b3/B3LowerToAir.cpp:486
> +            case ValueRep::SomeRegister:

What's the difference between "Register" and "SomeRegister"?

> Source/JavaScriptCore/b3/testb3.cpp:1781
> +            CHECK(params.reps[0].value() == 1);

I'm a bit confused here, why is this "1"?
Comment 5 Filip Pizlo 2015-11-04 14:14:29 PST
(In reply to comment #4)
> Comment on attachment 264765 [details]
> the patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=264765&action=review
> 
> r=me
> 
> > Source/JavaScriptCore/b3/B3LowerToAir.cpp:486
> > +            case ValueRep::SomeRegister:
> 
> What's the difference between "Register" and "SomeRegister"?

SomeRegister is a constraint requesting that the value ends up in a register.  It means that it can end up with any register that matches the value's type (GPR for int, FPR for double).

> 
> > Source/JavaScriptCore/b3/testb3.cpp:1781
> > +            CHECK(params.reps[0].value() == 1);
> 
> I'm a bit confused here, why is this "1"?

A Check is a stackmap, so it must provide a ValueRep for each operand. The ValueRep only needs to be valid on the path where the Check "failed", i.e. its predicate was true. By convention, if you do:

Check(x, y)

Then we claim that x's value was 1.  Note that y is optional.  For y, we will provide an actual value recovery.

The reason why we don't provide an honest recovery of x is that it's not actually useful for most users of Check, and it just so happens to 1 is kind of correct.
Comment 6 Filip Pizlo 2015-11-04 14:16:12 PST
Landed in http://trac.webkit.org/changeset/192035