WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 127486
jsc-cli should allow scripts to access argv
https://bugs.webkit.org/show_bug.cgi?id=127486
Summary
jsc-cli should allow scripts to access argv
Mark Hahnenberg
Reported
2014-01-23 08:43:24 PST
One of the fundamental things command line scripts want to do is access their command line arguments. One way to do this would be to expose a global ARGV array containing each argument passed the script.
Attachments
Patch
(35.62 KB, patch)
2014-02-14 09:37 PST
,
Mark Hahnenberg
oliver
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Mark Hahnenberg
Comment 1
2014-02-14 09:37:44 PST
Created
attachment 224227
[details]
Patch
Oliver Hunt
Comment 2
2014-02-14 10:04:45 PST
Comment on
attachment 224227
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=224227&action=review
> Tools/jsc-cli/jsc-cli.xcodeproj/project.pbxproj:8 > - classes = { > - }; > - objectVersion = 46; > - objects = { > + archiveVersion = 1; > + classes = { > + }; > + objectVersion = 46; > + objects = { >
Goddammit Xcode :)
Mark Hahnenberg
Comment 3
2014-02-14 10:08:54 PST
(In reply to
comment #2
)
> (From update of
attachment 224227
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=224227&action=review
> > > Tools/jsc-cli/jsc-cli.xcodeproj/project.pbxproj:8 > > - classes = { > > - }; > > - objectVersion = 46; > > - objects = { > > + archiveVersion = 1; > > + classes = { > > + }; > > + objectVersion = 46; > > + objects = { > > > > Goddammit Xcode :)
Yeah, I dunno what's going on there lol.
Mark Hahnenberg
Comment 4
2014-02-14 14:12:50 PST
Comment on
attachment 224227
[details]
Patch Commit queue looks like it's having a bad time, so I'll land manually.
Mark Hahnenberg
Comment 5
2014-02-14 14:23:30 PST
Committed
r164134
: <
http://trac.webkit.org/changeset/164134
>
Joseph Pecoraro
Comment 6
2014-02-14 14:32:20 PST
Comment on
attachment 224227
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=224227&action=review
> Tools/jsc-cli/jsc-cli/CLIInstance.m:75 > + [_context[@"ARGV"] setValue:(_baseFile ? _baseFile : @"") atIndex:0];
Nit: You could pull _context[@"ARGV"] out into a local instead of potentially calling it a bunch of times in a loop. I don't think ObjC has any support for optimizing away repeated calls like this. Of course performance right here is not important, but this is a good idiom to get used to for ObjC.
Mark Hahnenberg
Comment 7
2014-02-14 14:33:55 PST
(In reply to
comment #6
)
> (From update of
attachment 224227
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=224227&action=review
> > > Tools/jsc-cli/jsc-cli/CLIInstance.m:75 > > + [_context[@"ARGV"] setValue:(_baseFile ? _baseFile : @"") atIndex:0]; > > Nit: You could pull _context[@"ARGV"] out into a local instead of potentially calling it a bunch of times in a loop. I don't think ObjC has any support for optimizing away repeated calls like this. Of course performance right here is not important, but this is a good idiom to get used to for ObjC.
Yeah, that's definitely a good idea. Not only does Obj-C not do a good job optimizing this, but these lookups aren't exactly cheap in the JSC API.
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