Closed Bug 348545 Opened 18 years ago Closed 13 years ago

Consolidating JSString builders

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 700169

People

(Reporter: igor, Unassigned)

Details

Attachments

(1 file)

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.
Attached patch Proof-on-coceptSplinter Review
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
Attachment #233625 - Flags: review?(brendan)
Attachment #233625 - Flags: review?(brendan)
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.

Attachment

General

Creator:
Created:
Updated:
Size: