Caching xmlarray length leads to bigger code

RESOLVED INVALID

Status

()

Core
JavaScript Engine
--
enhancement
RESOLVED INVALID
12 years ago
6 years ago

People

(Reporter: Igor Bukanov, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

12 years ago
In many places jsxml.c contains loop like:

for (i = 0, n = xml_array->length; i < n; i++) {
    complex_loop_body;
}

where n is not accessed outside the loop. But such optimization is harmful for code size as the compiler would be forced to generate code to save/restore the value of n before calling functions in complex_loop_body where the compiler can  not see their body.

Thus I suggest to replace the loops just by

for (i = 0; i < n = xml_array->length; i++) {
    complex_loop_body;
}

since due to the complexity of the body any speedup from reloading xml_array->length should not be observable.
I think we should get this fixed for js1.7 final.  Anyone disagree?

/be
Blocks: 355044
(Reporter)

Comment 2

11 years ago
I am not working on the bug right now.
Assignee: igor → general
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.