Bug 115684

Summary: ftp branch: Fix broken 32-bit build + clean up JITStubs.cpp a bit.
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: fpizlo, ggaren, mhahnenberg, msaboff, oliver
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
the patch. ggaren: review+

Description Mark Lam 2013-05-06 17:06:06 PDT
Remedy minor bit rotting in DFGSpeculativeJIT32_64.cpp.  JITStubs.cpp has a case for CPU(X86_64) && USE(JSVALUE32_64) which doesn't make sense.  Will delete this block of unnecessary code.  Also will add some line breaks and update some comments to more clearly delineate between the sections of code in JITStubs.cpp.
Comment 1 Mark Lam 2013-05-06 17:10:11 PDT
Created attachment 200857 [details]
the patch.
Comment 2 Geoffrey Garen 2013-05-06 17:14:45 PDT
Comment on attachment 200857 [details]
the patch.

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

> Source/JavaScriptCore/jit/JITStubs.cpp:312
> -#else // USE(JSVALUE32_64)
> +#else // !USE(JSVALUE32_64)
>  
>  #if COMPILER(GCC) && CPU(X86_64)
>  

I believe the style in other WebKit code is to annotate a dependent preprocessor macro with the heading for the macro's start. So, in this case, "USE(JSVALUE32_64)" is correct.
Comment 3 Mark Lam 2013-05-06 17:42:18 PDT
(In reply to comment #2)
> (From update of attachment 200857 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=200857&action=review
> 
> > Source/JavaScriptCore/jit/JITStubs.cpp:312
> > -#else // USE(JSVALUE32_64)
> > +#else // !USE(JSVALUE32_64)
> >  
> >  #if COMPILER(GCC) && CPU(X86_64)
> >  
> 
> I believe the style in other WebKit code is to annotate a dependent preprocessor macro with the heading for the macro's start. So, in this case, "USE(JSVALUE32_64)" is correct.

I'll revert this !USE(JSVALUE32_64) change for this commit, but for future reference, what is the right thing to do then when we have a case like the following?

#if CPU(x86)
...
#elif CPU(X86_64)
...
#else // what comment is appropriate here?
#endif // whacomment is appropriate here?
Comment 4 Mark Lam 2013-05-06 17:47:01 PDT
Thanks for the review.  Landed in r149655: <http://trac.webkit.org/changeset/149655>.
Comment 5 Geoffrey Garen 2013-05-06 22:06:32 PDT
> what is the right thing to do then when we have a case like the following?
> 
> #if CPU(x86)
> ...
> #elif CPU(X86_64)
> ...
> #else // what comment is appropriate here?
> #endif // whacomment is appropriate here?

I don't think we have a clear guideline on this. Thinking about it now, I might choose not to use #elif, and instead:

#if CPU(X86)
#endif // CPU(X86)

#if CPU(X86_64)
#endif // CPU(X86_64)

#if !CPU(X86) && !CPU(X86_64)
#endif // !CPU(X86) && !CPU(X86_64)

The phrase "else" is hard to decipher when it flows hundred of lines after an "if", possibly with intervening "#elif".