Closed
Bug 1015902
Opened 11 years ago
Closed 11 years ago
Latin1 strings: make equality operators work
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla32
People
(Reporter: jandem, Assigned: jandem)
References
Details
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
Useful for testing.
Attachment #8428629 -
Flags: review?(luke)
Assignee | ||
Comment 1•11 years ago
|
||
Forgot to qref.
Attachment #8428629 -
Attachment is obsolete: true
Attachment #8428629 -
Flags: review?(luke)
Attachment #8428632 -
Flags: review?(luke)
Assignee | ||
Comment 2•11 years ago
|
||
This patch uses AutoAssertNoGC, but I really want AutoCheckCannotGC (bug 1013531).
Terrence, could one of the GC people take bug 1013531 this week? I want to convert a lot of code the coming days/weeks, so it'd be great to have this work as expected.
Flags: needinfo?(terrence)
Comment 3•11 years ago
|
||
Comment on attachment 8428632 [details] [diff] [review]
Patch
Review of attachment 8428632 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/jit-test/tests/basic/latin1.js
@@ +10,5 @@
> + assertEq(s == "foo02", false);
> +
> + // Non-atomized to force char comparison.
> + var nonAtomized = "afoo01".substr(1);
> + assertEq(isLatin1(nonAtomized), false);
Later, substr() should return a latin1 string right? To prepare for that, perhaps you should make the first letter a unicode character?
::: js/src/jsstr.cpp
@@ +4201,5 @@
> +static bool
> +EqualCharsLatin1TwoByte(const char *s1, const jschar *s2, size_t len)
> +{
> + for (const char *s1end = s1 + len; s1 < s1end; s1++, s2++) {
> + if (jschar(*s1) != *s2)
I think there is an issue here in that it isn't defined whether 'char' is signed or unsigned which could make this cast to jschar to weird things. Can you explicitly cast to 'unsigned char' first and a testcase to latin1.js?
::: js/src/vm/String.h
@@ +749,5 @@
> +
> + MOZ_ALWAYS_INLINE
> + const char *inlineLatin1Chars(const JS::AutoAssertNoGC &nogc) const {
> + JS_ASSERT(hasLatin1Chars());
> + return d.inlineStorageLatin1;
Since these are members of JSInlineString, could the 'inline' prefix be dropped? In effect, these are just optimized versions of JSLinearString::chars, so it seems "safe".
Attachment #8428632 -
Flags: review?(luke) → review+
Comment 4•11 years ago
|
||
(In reply to Jan de Mooij [:jandem] from comment #2)
> This patch uses AutoAssertNoGC, but I really want AutoCheckCannotGC (bug
> 1013531).
>
> Terrence, could one of the GC people take bug 1013531 this week? I want to
> convert a lot of code the coming days/weeks, so it'd be great to have this
> work as expected.
On m-i. Should be good to go, unless it bounces.
Flags: needinfo?(terrence)
Comment 5•11 years ago
|
||
And it bounced. :-(
Assignee | ||
Comment 6•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/062236a88303
(In reply to Luke Wagner [:luke] from comment #3)
> I think there is an issue here in that it isn't defined whether 'char' is
> signed or unsigned which could make this cast to jschar to weird things.
> Can you explicitly cast to 'unsigned char' first and a testcase to latin1.js?
Ah, good catch. I modified the test to fail without this change. Bug 1018243 makes latin1 chars unsigned and removes the cast again.
> Since these are members of JSInlineString, could the 'inline' prefix be
> dropped? In effect, these are just optimized versions of
> JSLinearString::chars, so it seems "safe".
Done.
Comment 7•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in
before you can comment on or make changes to this bug.
Description
•