On Wed, Apr 7, 2010 at 1:24 AM, Ryan Dahl <[email protected]> wrote: > On Tue, Apr 6, 2010 at 2:22 PM, Ryan Dahl <[email protected]> wrote: >>>> It would be nice to have V8 detect that a string is being written out >>>> multiple times and flatten it automatically. >>> >>> That might be more trickier than it seems, but if you've got an idea >>> in patch-form it'd be most appreciated :) >> >> I gave a try at hacking that in - and it seems to work for me. The >> patch uses an unused bit in the instance_type integer - that might be >> going too deep for such a hack. Actually, I'm not even sure if it's >> unused, but the tests pass at least. Well, please take a look at it - >> it's very likely I'm doing it totally wrong: >> http://codereview.chromium.org/1539013 > > Sorry, I gave the wrong URL. It is http://codereview.chromium.org/1594017
Using instance_type makes the flag shared by all strings with the same map. This is probably not what you want since e.g. all sequential ascii strings share a map. I think it's better to try the explicit approach with exposed flattening first. If you still want the VM to magically guess whether a string is accessed often or not you could try playing with the freshness heuristic in api.cc (see StringTracker class there). Thanks, Vitaly > -- > v8-dev mailing list > [email protected] > http://groups.google.com/group/v8-dev > > To unsubscribe, reply using "remove me" as the subject. > -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
