WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
109902
[JSC] MAYBE_MISSING_PARAMETER(..., DefaultIsNullString) macro is redundant
https://bugs.webkit.org/show_bug.cgi?id=109902
Summary
[JSC] MAYBE_MISSING_PARAMETER(..., DefaultIsNullString) macro is redundant
Kentaro Hara
Reported
2013-02-14 23:43:37 PST
c.f. corresponding V8 bug:
https://bugs.webkit.org/show_bug.cgi?id=109899
Currently: - MAYBE_MISSING_PARAMETER(exec, index, DefaultIsUndefined) returns exec->argument(index). - MAYBE_MISSING_PARAMETER(exec, index, DefaultIsNullString) returns JSValue() if exec->argument(index) is missing (i.e. the length of the argument is less than index). It returns exec->argument(index) otherwise. No one other than CodeGeneratorJS.pm uses MAYBE_MISSING_PARAMETER(exec, index, DefaultIsUndefined). Instead, we simply use exec->argument(index). We should remove the redundant usage in CodeGeneratorJS.pm too. The long-name macro has been making generated code less readable. In addition, we can rename MAYBE_MISSING_PARAMETER() to MissingIsNullString().
Attachments
Patch
(60.77 KB, patch)
2013-02-14 23:45 PST
,
Kentaro Hara
no flags
Details
Formatted Diff
Diff
patch for landing
(61.10 KB, patch)
2013-02-18 23:27 PST
,
Kentaro Hara
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Kentaro Hara
Comment 1
2013-02-14 23:45:12 PST
Created
attachment 188494
[details]
Patch
Adam Barth
Comment 2
2013-02-15 09:11:23 PST
Comment on
attachment 188494
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=188494&action=review
> Source/WebCore/bindings/js/JSDOMBinding.h:62 > +#define MissingIsNullString(exec, index) (((index) >= (exec)->argumentCount()) ? (JSValue()) : ((exec)->argument(index)))
Same comment. This should probably be an inline function. If it can't be an inline function, we should keep the ALL_CAPS name.
Darin Adler
Comment 3
2013-02-15 09:34:55 PST
Comment on
attachment 188494
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=188494&action=review
>> Source/WebCore/bindings/js/JSDOMBinding.h:62 >> +#define MissingIsNullString(exec, index) (((index) >= (exec)->argumentCount()) ? (JSValue()) : ((exec)->argument(index))) > > Same comment. This should probably be an inline function. If it can't be an inline function, we should keep the ALL_CAPS name.
Further, both the names MAYBE_MISSING_PARAMETER and MissingIsNullString are examples of the kind of confusing names we try to avoid. A function should be named after its return value. And even though it’s used to implement DefaultIsNullString, this does not return a string, so it’s really confusing to mention string in its name. ARGUMENT_OR_NULL (or ArgumentOrNull if it can be an inline function) would be one possible name. Not great, but better than the two we used in the past.
Kentaro Hara
Comment 4
2013-02-18 23:27:22 PST
Created
attachment 189002
[details]
patch for landing
Kentaro Hara
Comment 5
2013-02-18 23:28:07 PST
(In reply to
comment #3
)
> (From update of
attachment 188494
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=188494&action=review
> > >> Source/WebCore/bindings/js/JSDOMBinding.h:62 > >> +#define MissingIsNullString(exec, index) (((index) >= (exec)->argumentCount()) ? (JSValue()) : ((exec)->argument(index))) > > > > Same comment. This should probably be an inline function. If it can't be an inline function, we should keep the ALL_CAPS name. > > Further, both the names MAYBE_MISSING_PARAMETER and MissingIsNullString are examples of the kind of confusing names we try to avoid. A function should be named after its return value. And even though it’s used to implement DefaultIsNullString, this does not return a string, so it’s really confusing to mention string in its name. > > ARGUMENT_OR_NULL (or ArgumentOrNull if it can be an inline function) would be one possible name. Not great, but better than the two we used in the past.
Thanks, changed it to an inline function and renamed it to argumentOrNull().
WebKit Review Bot
Comment 6
2013-02-19 00:13:55 PST
Comment on
attachment 189002
[details]
patch for landing Clearing flags on attachment: 189002 Committed
r143304
: <
http://trac.webkit.org/changeset/143304
>
WebKit Review Bot
Comment 7
2013-02-19 00:13:59 PST
All reviewed patches have been landed. Closing bug.
Julien Brianceau
Comment 8
2013-02-19 00:20:56 PST
This patch breaks our SH4 build slave:
http://build.webkit.org/builders/Qt%20Linux%20SH4%20Release/builds/20416
Kentaro Hara
Comment 9
2013-02-19 00:21:33 PST
(In reply to
comment #8
)
> This patch breaks our SH4 build slave:
http://build.webkit.org/builders/Qt%20Linux%20SH4%20Release/builds/20416
Sorry, looking.
Kentaro Hara
Comment 10
2013-02-19 00:25:50 PST
Fixed the build error in
r143306
.
Julien Brianceau
Comment 11
2013-02-19 01:03:02 PST
(In reply to
comment #10
)
> Fixed the build error in
r143306
.
Thanks a lot !
Ryosuke Niwa
Comment 12
2013-02-19 01:24:32 PST
Landed another build fix in
r143309
.
Csaba Osztrogonác
Comment 13
2013-02-19 02:07:06 PST
Comment on
attachment 189002
[details]
patch for landing View in context:
https://bugs.webkit.org/attachment.cgi?id=189002&action=review
> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:2758 > + push(@$outputArray, " " . GetNativeTypeFromSignature($parameter) . " $name(" . JSValueToNative($parameter, $optional eq "DefaultIsNullString" ? "argumentOrNull(exec, $argsIndex)" : "exec->argument($argsIndex)") . ");\n");
It caused the following warning: Use of uninitialized value $optional in string eq at /home/oszi/WebKit/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm line 2758. Could you check and fix it, please?
Csaba Osztrogonác
Comment 14
2013-02-19 02:09:30 PST
(In reply to
comment #13
)
> (From update of
attachment 189002
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=189002&action=review
> > > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:2758 > > + push(@$outputArray, " " . GetNativeTypeFromSignature($parameter) . " $name(" . JSValueToNative($parameter, $optional eq "DefaultIsNullString" ? "argumentOrNull(exec, $argsIndex)" : "exec->argument($argsIndex)") . ");\n"); > > It caused the following warning: > Use of uninitialized value $optional in string eq at /home/oszi/WebKit/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm line 2758. > > Could you check and fix it, please?
See the Qt bot for details:
http://build.webkit.org/builders/Qt%20Linux%20Release/builds/57635/steps/compile-webkit/logs/stdio
Csaba Osztrogonác
Comment 15
2013-02-19 03:20:01 PST
(In reply to
comment #14
)
> (In reply to
comment #13
) > > (From update of
attachment 189002
[details]
[details]) > > View in context:
https://bugs.webkit.org/attachment.cgi?id=189002&action=review
> > > > > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:2758 > > > + push(@$outputArray, " " . GetNativeTypeFromSignature($parameter) . " $name(" . JSValueToNative($parameter, $optional eq "DefaultIsNullString" ? "argumentOrNull(exec, $argsIndex)" : "exec->argument($argsIndex)") . ");\n"); > > > > It caused the following warning: > > Use of uninitialized value $optional in string eq at /home/oszi/WebKit/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm line 2758. > > > > Could you check and fix it, please? > > See the Qt bot for details: >
http://build.webkit.org/builders/Qt%20Linux%20Release/builds/57635/steps/compile-webkit/logs/stdio
Fixed by
https://trac.webkit.org/changeset/143308
Csaba Osztrogonác
Comment 16
2013-02-19 03:20:24 PST
Additionally it broke the bindings tests on all bot. Could you fix it?
Csaba Osztrogonác
Comment 17
2013-02-19 13:07:58 PST
(In reply to
comment #16
)
> Additionally it broke the bindings tests on all bot. Could you fix it?
ping for fix?
Kentaro Hara
Comment 18
2013-02-19 13:09:41 PST
(In reply to
comment #17
)
> (In reply to
comment #16
) > > Additionally it broke the bindings tests on all bot. Could you fix it? > > ping for fix?
Fixed in
r143374
. Sorry for late.
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