Bug 147475

Summary: jsc-tailcall: Add enums for type-safety
Product: WebKit Reporter: Basile Clement <basile_clement>
Component: JavaScriptCoreAssignee: Basile Clement <basile_clement>
Status: RESOLVED FIXED    
Severity: Normal CC: msaboff
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 146477    
Attachments:
Description Flags
Patch
msaboff: review-
Patch
none
Patch
none
Patch msaboff: review+

Description Basile Clement 2015-07-30 16:57:34 PDT
We should have:

 - An enum to specify whether we want to keep or trash the caller frame instead of using reinterpret_cast<void*>(0) and reinterpret_cast<void*>(1)

 - An enum to indicate whether we are performing a regular call, a tail call, or a constructor call.
Comment 1 Basile Clement 2015-07-30 17:03:44 PDT
Created attachment 257881 [details]
Patch
Comment 2 Basile Clement 2015-07-30 17:04:53 PDT
Building to run the tests but this should solve the build failures from the merge from trunk.
Comment 3 Basile Clement 2015-07-30 17:08:31 PDT
Created attachment 257882 [details]
Patch

Now it builds
Comment 4 Michael Saboff 2015-07-30 17:28:21 PDT
Comment on attachment 257881 [details]
Patch

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

r-
You need to add CallMode.{cpp,h} & DeferredSourceDump.{cpp,h} to Windows and cmake builds.

> Source/JavaScriptCore/bytecode/CallMode.h:31
> +enum class CallMode { Tail = 0, Regular, Construct };

Minor nit - Wouldn't it make more logical sense to order these Regular, TailCail, Construct, is there special meaning to TailCall being 0?

> Source/JavaScriptCore/bytecode/CallMode.h:33
> +enum FrameAction { KeepTheFrame = 0, TrashTheFrame };

Doesn't ReuseTheFrame sound better?
Comment 5 Basile Clement 2015-07-30 17:30:47 PDT
(In reply to comment #4)
> Comment on attachment 257881 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=257881&action=review
> 
> r-
> You need to add CallMode.{cpp,h} & DeferredSourceDump.{cpp,h} to Windows and
> cmake builds.

Oh oops, I knew there was a reason I kept this locally instead of submitting a patch earlier...
(Note that there is nothing to do w/ DeferredSourceDump, it was just reordered when I did "Sort by name" in XCode).

> 
> > Source/JavaScriptCore/bytecode/CallMode.h:31
> > +enum class CallMode { Tail = 0, Regular, Construct };
> 
> Minor nit - Wouldn't it make more logical sense to order these Regular,
> TailCail, Construct, is there special meaning to TailCall being 0?

It would make sense. Tail is 0 because CallMode and FrameAction were a single enum initially, changing this.

> 
> > Source/JavaScriptCore/bytecode/CallMode.h:33
> > +enum FrameAction { KeepTheFrame = 0, TrashTheFrame };
> 
> Doesn't ReuseTheFrame sound better?

ReuseTheFrame is much nicer, changing this.
Comment 6 Basile Clement 2015-07-30 17:34:59 PDT
Created attachment 257885 [details]
Patch
Comment 7 Basile Clement 2015-07-30 17:38:24 PDT
Created attachment 257887 [details]
Patch
Comment 8 Michael Saboff 2015-07-30 17:40:30 PDT
Comment on attachment 257887 [details]
Patch

r=me
Comment 9 Basile Clement 2015-07-30 17:44:01 PDT
Landed in r187629 <http://trac.webkit.org/changeset/187629>