Closed
Bug 1302283
Opened 8 years ago
Closed 8 years ago
Port jskwgen.cpp to Python.
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla51
Tracking | Status | |
---|---|---|
firefox51 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(1 file)
(deleted),
patch
|
Waldo
:
review+
|
Details | Diff | Splinter Review |
Separated from bug 1298779.
(In reply to Jeff Walden [:Waldo] (remove +bmo to email) from bug 1298779 comment #0)
> The approach to efficiently detect JavaScript keywords is basically to have
> jskwgen.cpp (that #includes "vm/Keywords.h") that compiles into
> host_jskwgen, which is run to create jsautokw.h. Somehow, jsautokw.h isn't
> being regenerated when vm/Keywords.h changes -- the dependency for the
> executable isn't propagated into a dependency for the generated header.
>
> At some point we should generate this header in Python, likely incidentally
> solving this problem.
let's solve it :)
Ported jskwgen.cpp to jsautokw.py.
jsautokw.py reads vm/Keywords.h and generates jsautokw.h, with almost same algorithm.
(a bit modified to make it more readable)
the generated code is almost same, except the order between adjacent cases for characters (if or case), because of the difference in sort and related algorithm, but it won't matter much.
Attachment #8790508 -
Flags: review?(jwalden+bmo)
Comment 1•8 years ago
|
||
Comment on attachment 8790508 [details] [diff] [review]
Port jskwgen to Python.
Review of attachment 8790508 [details] [diff] [review]:
-----------------------------------------------------------------
Mm. I think I understand this generally, I think it looks like the right transliteration/simplification in places, and in any event it seems likely bugs would manifest early and quickly, given this is used to handle keyword matching that we'd expect is well-exercised.
Too bad we don't have gperf as a build dependency -- creating this stuff is its bread and butter, and then we wouldn't have to implement and maintain it ourselves. :-(
::: js/src/jsautokw.py
@@ +7,3 @@
>
> +def read_keyword_list(filename):
> + macro_pat = re.compile(r"macro\(([^,]+), *[^,]+, *[^\)]+\)")
Add "^\s*" at the beginning and "\s*\\?$" at the end.
Attachment #8790508 -
Flags: review?(jwalden+bmo) → review+
Assignee | ||
Comment 2•8 years ago
|
||
Sorry, I set wrong bug number (bug 1298779)
https://hg.mozilla.org/integration/mozilla-inbound/rev/dfb5581340ad5c879c1174037ce5166e568395bb
https://hg.mozilla.org/mozilla-central/rev/dfb5581340ad
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in
before you can comment on or make changes to this bug.
Description
•