Closed
Bug 622557
Opened 15 years ago
Closed 14 years ago
Removal of indexbase/resetbase
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
WORKSFORME
| Tracking | Status | |
|---|---|---|
| blocking2.0 | --- | .x+ |
People
(Reporter: igor, Assigned: igor)
Details
(Whiteboard: softblocker)
Attachments
(1 file, 1 obsolete file)
|
131.44 KB,
patch
|
Details | Diff | Splinter Review |
We should consider to remove INDEXBASE and RESETBASE prefix/suffix bytecodes and use 3-byte literal indexes in the bytecode to support over 64K of literals per script. With method and trace jits a potential performance loss in the interpreter should not be visisble while simpler bytecode handling would remove a source of critical bytes.
| Assignee | ||
Comment 1•15 years ago
|
||
About 2.0 nomination: although this bug is just an enhancement, implementing this would make bytecode handling simpler and remove poteny6ially rather bad bugs.
blocking1.9.1: ? → ---
blocking1.9.2: ? → ---
blocking2.0: betaN+ → ?
status1.9.1:
? → ---
status1.9.2:
? → ---
| Assignee | ||
Comment 2•15 years ago
|
||
The patch passes tests but I need to do some performance tests before asking for a review.
What about using 32-bit indexes?
| Assignee | ||
Comment 4•15 years ago
|
||
(In reply to comment #3)
> What about using 32-bit indexes?
I would like first try 3-byte indexes to clearly factor that out behind few inlines. Currently the assumption about 2-byte indexes is hardcoded in rather a few places.
After that we may consider alternatives like embedding atoms directly into the bytecode etc.
Updated•15 years ago
|
blocking2.0: ? → beta9+
Comment 5•15 years ago
|
||
There's no point in four-byte indexes, due to
/*
* Offset fields follow certain notes and are frequency-encoded: an offset in
* [0,0x7f] consumes one byte, an offset in [0x80,0x7fffff] takes three, and
* the high bit of the first byte is set.
*/
#define SN_3BYTE_OFFSET_FLAG 0x80
#define SN_3BYTE_OFFSET_MASK 0x7f
combined with
index = js_NewSrcNote2(cx, cg, noteType, (ptrdiff_t) ALE_INDEX(label));
return js_NewSrcNote2(cx, cg, SRC_FUNCDEF, (ptrdiff_t)index) >= 0 &&
at least. 23 bits is all you get.
We might even prefer frequency-encoding the atom index: if the high bit in the first byte is set, it's a three byte index, else a one-byte index. This makes for a branch in the interpreter that won't predict too well in general, but might be ok for lots of interpreter evaluations of a given script (where the immediate is always one byte or always three bytes).
/be
Updated•15 years ago
|
Whiteboard: softblocker
| Assignee | ||
Comment 6•15 years ago
|
||
The patch passes try server and shell tests.
With the patch I do not see differences with V8 and SS scores when run in the interpreter mode or with -m/-j flags. For better expose of index size increase and an extra shift/add per literal index that the interpreter now uses I created the following test:
var obj = { a:1, b:2, c: 3, d:4, f: function(N) {
var s = 0;
for (; N != 0; --N) {
s += this.a + this.b + this.c + this.d;
}
return s;
}};
obj.f(1e4);
var t = Date.now();
obj.f(1e7);
print(Date.now() - t);
In the test the density of literal index bytecodes in the loop is about 50%. With or without patch its gives the same timing with pure interpreter mode - about 1.51 seconds +- noise.
Attachment #500810 -
Attachment is obsolete: true
Attachment #501085 -
Flags: review?(brendan)
As per today's meeting, beta 9 will be a time-based release. Marking these all betaN+. Please move it back to beta9+ if you believe it MUST be in the next beta (ie: trunk is in an unshippable state without this)
blocking2.0: beta9+ → betaN+
Fixing fields my automated script accidentally blanked. Apologies for the bugspam
Comment 9•15 years ago
|
||
Comment on attachment 501085 [details] [diff] [review]
v2
I'm not convinced we need this for Firefox 4 / Mozilla 2. I could be wrong. If we don't need it, though, I'd like to see more experiments run on variable-length immediate coding, word-coding, other ideas, for lots of immediates.
/be
Comment 10•15 years ago
|
||
(In reply to comment #9)
>
> I'm not convinced we need this for Firefox 4 / Mozilla 2.
I agree -- this shouldn't be a softblocker. It's even marked as an "enhancement".
Updated•15 years ago
|
blocking2.0: betaN+ → .x
Comment 11•14 years ago
|
||
Comment on attachment 501085 [details] [diff] [review]
v2
Aren't we going a different direction, to cut down on bytecode population: some variable-length coding of indexes (and jump offsets)?
/be
Attachment #501085 -
Flags: review?(brendan)
| Assignee | ||
Updated•14 years ago
|
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•