Last Comment Bug 717501 - vm/Unicode.h:index{1,2} could be slimmed down
: vm/Unicode.h:index{1,2} could be slimmed down
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
-- normal (vote)
: ---
Assigned To: Nathan Froyd [:froydnj]
: Jason Orendorff [:jorendorff]
Depends on:
  Show dependency treegraph
Reported: 2012-01-11 19:19 PST by Nathan Froyd [:froydnj]
Modified: 2012-01-14 01:19 PST (History)
3 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch (2.38 KB, patch)
2012-01-11 19:24 PST, Nathan Froyd [:froydnj]
no flags Details | Diff | Splinter Review
patch (2.38 KB, patch)
2012-01-11 19:28 PST, Nathan Froyd [:froydnj]
evilpies: review+
Details | Diff | Splinter Review

Description User image Nathan Froyd [:froydnj] 2012-01-11 19:19:00 PST
Both js::unicode::index{1,2} are declared as arrays of uint16_t, but no entries in either array are larger than 255.  They should be declared as arrays of uint8_t; doing so saves about 12K of space.
Comment 1 User image Nathan Froyd [:froydnj] 2012-01-11 19:24:17 PST
Created attachment 587922 [details] [diff] [review]

Patch.  The change to size_t is to make it obvious that we're not depending on the size of the array's element type.  The assert change in makes the code more obvious, I think.
Comment 2 User image Nathan Froyd [:froydnj] 2012-01-11 19:28:36 PST
Created attachment 587924 [details] [diff] [review]

Now with a correct assert!
Comment 3 User image Tom Schuster [:evilpie] 2012-01-12 13:59:25 PST
Comment on attachment 587924 [details] [diff] [review]

Review of attachment 587924 [details] [diff] [review]:

Thanks, good find! I guess after 3+ iterations of this patch, I somehow didn't catch this anymore. From my memory there was something at the first try that prevent me from making them uint8.
Comment 5 User image Marco Bonardo [::mak] 2012-01-14 01:19:59 PST

Note You need to log in before you can comment on or make changes to this bug.