WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
159549
Move CallFrame header info from JSStack.h to CallFrame.h
https://bugs.webkit.org/show_bug.cgi?id=159549
Summary
Move CallFrame header info from JSStack.h to CallFrame.h
Mark Lam
Reported
2016-07-08 00:26:30 PDT
... because CallFrame.h is the more appropriate place for the CallFrameHeader info.
Attachments
proposed patch.
(132.75 KB, patch)
2016-07-08 01:08 PDT
,
Mark Lam
mark.lam
: review-
Details
Formatted Diff
Diff
proposed patch.
(136.75 KB, patch)
2016-07-08 10:03 PDT
,
Mark Lam
ggaren
: review+
Details
Formatted Diff
Diff
revised patch with Geoff's feedback.
(136.75 KB, patch)
2016-07-08 14:57 PDT
,
Mark Lam
no flags
Details
Formatted Diff
Diff
Patch for landing.
(136.79 KB, patch)
2016-07-08 15:50 PDT
,
Mark Lam
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Mark Lam
Comment 1
2016-07-08 01:08:46 PDT
Created
attachment 283119
[details]
proposed patch.
WebKit Commit Bot
Comment 2
2016-07-08 01:09:59 PDT
Attachment 283119
[details]
did not pass style-queue: ERROR: Source/JavaScriptCore/jit/CallFrameShuffler.cpp:43: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 58 files If any of these errors are false positives, please file a bug against check-webkit-style.
Mark Lam
Comment 3
2016-07-08 07:23:06 PDT
Comment on
attachment 283119
[details]
proposed patch. Let me fix the build error on the debug build first.
Mark Lam
Comment 4
2016-07-08 10:03:21 PDT
Created
attachment 283180
[details]
proposed patch.
WebKit Commit Bot
Comment 5
2016-07-08 10:05:07 PDT
Attachment 283180
[details]
did not pass style-queue: ERROR: Source/JavaScriptCore/jit/CallFrameShuffler.cpp:43: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 59 files If any of these errors are false positives, please file a bug against check-webkit-style.
Geoffrey Garen
Comment 6
2016-07-08 10:41:29 PDT
Comment on
attachment 283180
[details]
proposed patch. View in context:
https://bugs.webkit.org/attachment.cgi?id=283180&action=review
> Source/JavaScriptCore/interpreter/CallFrame.h:74 > + struct CallFrameHeader { > + enum Entry {
This is odd C++ style. The idiomatic way to namespace an enum is "enum class". The idiomatic equivalent for what you've done is "enum class CallFrameHeaderEntry". I think that's probably better. "CallFrameHeaderEntry" a bit long, so maybe just "CallFrameSlot" instead. I'm not sure any clients care that these values form a header, and in fact they're not quite a header since more data (function arguments) lies beyond them.
Mark Lam
Comment 7
2016-07-08 10:50:02 PDT
(In reply to
comment #6
)
> Comment on
attachment 283180
[details]
> proposed patch. > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=283180&action=review
> > > Source/JavaScriptCore/interpreter/CallFrame.h:74 > > + struct CallFrameHeader { > > + enum Entry { > > This is odd C++ style. > > The idiomatic way to namespace an enum is "enum class". > > The idiomatic equivalent for what you've done is "enum class > CallFrameHeaderEntry". I think that's probably better. > > "CallFrameHeaderEntry" a bit long, so maybe just "CallFrameSlot" instead. > I'm not sure any clients care that these values form a header, and in fact > they're not quite a header since more data (function arguments) lies beyond > them.
I wanted to use an enum class at first, but that resulted in the enum values not being accepted as int values every where they are used. For example, indexing with [CallFrameHeader::Callee] will yield an error saying that the indexing value, CallFrameHeader::Callee, is not an int. I have already tried all of these: enum class CallFrameEntry { ... enum class CallFrameEntry : int { ... enum class CallFrameEntry : int { CallerFrameAndPCSize = ... CodeBlock = CallerFrameAndPCSize, Callee = CodeBlock + 1, ... All of them did not resolve the error. Hence, I fell back on how the pattern which we used previously i.e. an enum inside a class so that the class provides scoping for the enum while the enum values still int type. As for the name of the class/struct, I'm not that comfortable with CallFrameHeader either given that it is more so a container for CallFrameConstants. I kept CallFrameHeader to retain the legacy reference to what this values are for, but am open to changing it. In light of enum class being not a viable solution, what do you propose I do?
Geoffrey Garen
Comment 8
2016-07-08 11:52:16 PDT
> I wanted to use an enum class at first, but that resulted in the enum values > not being accepted as int values every where they are used.
That's right. enum class is type-safe, so you need to cast or invoke the int constructor to turn it into an int. Will casting work? I think it will. It looks like our APIs that currently accept JSStack::CallFrameHeaderEntry are reasonably encapsulated, so they can do the casting for us.
Mark Lam
Comment 9
2016-07-08 14:57:46 PDT
Created
attachment 283200
[details]
revised patch with Geoff's feedback. After talking with Geoff offline, we decided to go with static const int fields. This has been applied to the revised patch.
WebKit Commit Bot
Comment 10
2016-07-08 14:59:22 PDT
Attachment 283200
[details]
did not pass style-queue: ERROR: Source/JavaScriptCore/jit/CallFrameShuffler.cpp:43: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 59 files If any of these errors are false positives, please file a bug against check-webkit-style.
Mark Lam
Comment 11
2016-07-08 15:50:41 PDT
Created
attachment 283208
[details]
Patch for landing.
WebKit Commit Bot
Comment 12
2016-07-08 15:53:15 PDT
Attachment 283208
[details]
did not pass style-queue: ERROR: Source/JavaScriptCore/jit/CallFrameShuffler.cpp:43: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 59 files If any of these errors are false positives, please file a bug against check-webkit-style.
Mark Lam
Comment 13
2016-07-08 15:59:33 PDT
Landed in
r203006
: <
http://trac.webkit.org/r203006
>.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug