Closed Bug 348545 Opened 18 years ago Closed 13 years ago
Consolidating JSString builders
Currently a few places in SpiderMonkey contains code to assemble a jschar buffer to build JSString* instance later. See for example, various toSource implementations. It would be nice to consolidate such code behind a simple API.
This is a proof of concept that adds new JSStringBaker API to jsstr.c and changes errorInstance.stack builder to use it. The API allows to perform error checking only one per a sequnce of string appends decreasing "if (failed)" noise in the code. The most ugly part of the patch is SBIncreaseCapacity function is jsstr.c. Since the API has options to specify a capacity hint and a hard limit on the string length, SBIncreaseCapacity has to deal with quite a few cases leading to messy code. Perhaps it can simplified. If the main idea behind API is OK and naming is tolerable, I will extend the patch to switch toSource implementations.
Assignee: general → igor.bukanov
Status: NEW → ASSIGNED
StringBaker, heh. Some might prefer more prosaic StringBuilder, but I like it. This bug should be prioritized against more pressing mozilla1.9 perf work of course, but I didn't mean to forget to reply in favor. /be
I am not working on the bug right now.
Assignee: igor → general
Status: ASSIGNED → NEW
Ups noticed that bug too late.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.