Commit Graph

3738 Commits

Author SHA1 Message Date
brendan%mozilla.org
06c740491e Don't report uncaught exceptions unless returning to native code (97646, r=jband, sr=shaver). 2001-09-27 05:04:45 +00:00
nboyd%atg.com
212d1b132a Add support for serialization and deserialization. 2001-09-27 02:33:51 +00:00
dbradley%netscape.com
0b484536e8 Bug 94859 silence compiler warning about unused variable r=rginda, sr=jband 2001-09-26 04:11:54 +00:00
pschwartau%netscape.com
9c2e261f72 Adding comments from contributor. 2001-09-26 01:15:14 +00:00
pschwartau%netscape.com
9fb2c068a7 Correcting some typos. 2001-09-26 00:58:35 +00:00
pschwartau%netscape.com
576808aca7 Initial add. Regression test for bug 101488. 2001-09-26 00:32:11 +00:00
nboyd%atg.com
7c030bfefb Patch from Igor:
Currently omj/TokenStream and omj/optimizer/Optimizer.java both contain
code to convert number value to a wrapper object of smallest size. The
attached patch moves this wrapping to Node constructor to avoid code
duplication and eliminate special treatment of exact integers in
Optimizer.java.


The constant folding code in omj/optimizer/Optimizer.java currently always
replaces x * 1, x - 0 by simply x which does not force the toNumber convertion,
which is visible, for example, via typeof. For example, when running at
optimization level 2, the following

function f() {
    return "0" * 1;
}

print(typeof(f()));

prints "string" instead of expected "number".

The const_fold.patch fixes this via replacing x*1 by (+x) to force number convertion.

It assumes that the patch with number wrapping changes is in place.
2001-09-25 14:09:22 +00:00
nboyd%atg.com
7ccac99fc4 Currently omj/TokenStream and omj/optimizer/Optimizer.java both contain code to
convert number value to a wrapper object of smallest size. The attached patch
moves this wrapping to Node constructor to avoid code duplication and eliminate
special treatment of exact integers in Optimizer.java.
2001-09-25 14:08:08 +00:00
brendan%mozilla.org
3558787cfd Report uncaught exceptions from all JS_Compile* APIs (97646, sr=jband&shaver). 2001-09-25 06:43:33 +00:00
dbradley%netscape.com
a47dae7c99 patch from bug 99838 - Changes to remove xpconnects dependency on DOM r=jband, sr=jst 2001-09-24 22:57:47 +00:00
dbradley%netscape.com
03a4f2723c added files: mozilla/js/src/xpconnect/idl/nsIXPCScriptNotify.idl 2001-09-24 22:53:00 +00:00
dbradley%netscape.com
1f85e703a9 patch from bug 99838 - Changes to remove xpconnects dependency on DOM r=jband, sr=jst 2001-09-24 22:48:35 +00:00
nboyd%atg.com
6a75823f31 Remove obsolete class. 2001-09-23 20:01:43 +00:00
nboyd%atg.com
113dae7eb7 Fix bug:
Hello Norris

The script should return 0, Rhino returns NaN

Steven

<script>
var trial = parseInt("0)");
alert(trial);
</script>
2001-09-23 20:01:31 +00:00
nboyd%atg.com
8bb4a031bf Patch from Igor:
Currently omj/optimizer/Codegen.java uses special classes ConstantList
and ConstantDude to store the list of static constants in the generated
class. It seems that using a simple double[] array with a constant
counter and checking via "(int)number == number" for constant types not
only eliminates these 2 classes but makes the whole code simple, see
the attached patch.

The patch also modifies nodeIsConvertToObjectOfNumber to return not a
Number, but the number node itself that is used to extract double
value directly via Node.getDouble() call. I changed it to allow  to
store values of number literals in nodes without using wrapper object.
2001-09-23 20:00:26 +00:00
nboyd%atg.com
5ad714f337 Patch from Igor:
Replacing usage of ShallowNodeIterator to loop throw node children by
explicit calls to Node.getFirstChild()/ Node.getNextSibling()) with
comments when the node children list is modified while iterating
through it.

It avoids creation of ShallowNodeIterator objects and eliminates the
need to have ShallowNodeIterator class.
2001-09-23 19:58:38 +00:00
cls%seawood.org
69b6808ca6 Use default EXPORTS rules instead of installing headers by hand.
Bug #98371 sr=alecf
2001-09-23 03:34:32 +00:00
jband%netscape.com
801cc884a1 I'm tired of this warning: '*/' found outside of comment. This was much discussed. But no one ever bothered to actually check in the trivial fix. r=rginda rs=jband. 2001-09-22 17:42:36 +00:00
rginda%netscape.com
c07e99883d - venkman only -
bug 100943, changes needed to build jsd on os/2
patch by Dainis Jonitis, r=mkaply,rginda
2001-09-22 01:39:24 +00:00
pschwartau%netscape.com
b38eac9fd6 Make formatArray() work in Rhino. Improve getState() by checking for more whitespace characters. 2001-09-21 22:44:46 +00:00
timeless%mac.com
d2a5676d57 Bug 100873 JS Hard Codes JS_HAVE_LONG_LONG to the detriment of FreeBSD
r=cls sr=shaver
2001-09-21 14:09:54 +00:00
jband%netscape.com
afa3e0b204 fix bug 100222. Fix crash by only releasing other objects in xpcwrappedjs dtor if xpconnect has not yet shutdown. r=dbradley sr=jst. 2001-09-20 00:51:38 +00:00
gerv%gerv.net
1856815ff1 Oops. 2001-09-20 00:02:59 +00:00
scc%mozilla.org
bc444f528a bug #98089: ripped new license 2001-09-19 22:39:41 +00:00
nboyd%atg.com
dfdc492a06 Patch from Igor:
Currently Rhino source has quite a few places with code like (String)node.getDatum()
 or ((Number)node.getDatum()).doubleValue(). The patch changes this usage to call
node.getString() or node.getDouble().

It also adds new constructors to Node to accept int or double values in addition to
Object datum to replace new Node(token, new Integer(x)) by Node(token, x) etc. It
may allow in future not to create a wrapper object for int or double datum to speed
up parsing.
2001-09-19 17:01:46 +00:00
jband%netscape.com
229409f54e fix bug 100260. xpconnect should not hold a weak reference to a classinfo object after the xpcwrappednativeproto that was holding a strong ref is destroyed. sr=jst, r=dbradley,markh. 2001-09-19 06:22:17 +00:00
rogerl%netscape.com
30680afe44 Fix bug #98306, ParseAtom crash for "/[/]/" r=jst, r/sr=be. 2001-09-18 22:36:14 +00:00
jaggernaut%netscape.com
d1a7bfa843 One module per line for REQUIRES. r=/sr=alecf 2001-09-18 22:01:13 +00:00
jaggernaut%netscape.com
dc40187223 Bug 73353: splitting the modules on the REQUIRES lines in Makefile.in across multiple lines to more clearly show the changes made. sr=alecf 2001-09-18 13:41:47 +00:00
nboyd%atg.com
8496f933ce Patch from Igor:
Currently in the interpreter mode all number literals are stored in
InterpreterData.itsICode as an index to InterpreterData.itsNumberTable
which holds the actual value.

For integers that fit 2 or 4 bytes this is an overkill and the attached
patch stores integers in InterpreterData.itsICode inline after special
TokenStream.INTNUMBER or TokenStream.SHORTNUMBERS tokens.

The changes made benchmarks to run 1.5% faster. It also saves memory
because InterpreterData.itsNumberTable is allocated only for non-integers
that present only in a small number of scripts.

In principle, it may be possible to store all numbers inline as well, but
unfortunately re-assembling of 8 bytes from InterpreterData.itsICode array
into double is rather slow operation and is not worth the hassles.

Regards, Igor
2001-09-18 12:27:23 +00:00
nboyd%atg.com
eb3cf99fce Patch from Igor:
Hi, Norris!

Currently ScriptableObject.put does not check lastAccess cache during its search for
slots. When I added this check (see the attached patch) it speeded up the benchmark
suite by about 1.5% and in particular for setProp_bench.js the win was about 8%.

I think that even on multiprocessor machines it would not introduces any additional
issues  like accessing the old value in the processor cache because the put method
accesses existing properties via unsynchronized getSlot, and the check for lastAccess
is on pair with that.

Trgards, Igor
2001-09-18 12:26:10 +00:00
nboyd%atg.com
c352f1aa9b Fix for problem from Felix Meschberger:
When handling an Exception the Context tries to get the current script
and line number from the Java Stacktrace. To get the indication of which
entry in the trace might be an ECMA script, the file extension ".js" is
assumed.

For our integration we use the standard extension ".ecma" which collides
with the above assumption. But we don't force this extension, we just
have a convention. We name these files ".ecma" as they are not plain
ECMA but JSP-like ECMA. That is instead of using Java as the programming
language we use ECMA. In this respect they would be ".esp".
2001-09-18 12:24:56 +00:00
brendan%mozilla.org
c18c814935 Use the maximum of fp->argc and fp->fun->nargs to bound fp->argv (97921, sr=jband&shaver). 2001-09-18 01:47:41 +00:00
pschwartau%netscape.com
ca95abb70c Forgot to remove these comment-marks. 2001-09-17 23:55:06 +00:00
pschwartau%netscape.com
12c45dcfdc Skip regression test for bug 100199 until the bug is fixed. 2001-09-17 23:53:12 +00:00
pschwartau%netscape.com
67ac10ea31 Initial add. Regression test for bug 100199. 2001-09-17 23:49:25 +00:00
alecf%netscape.com
62424ee7b2 Final REQUIRES changes for bug 98371, adding support for MOZ_TRACK_MODULE_DEPS to win32. r=cls (and tested by cls!) 2001-09-17 19:06:35 +00:00
pschwartau%netscape.com
625129bd11 Improve visual presentation in the case where test string contains '\n'. 2001-09-14 20:10:49 +00:00
nboyd%atg.com
b5141d614d Patch from Igor:
Patch fixes issue of not ignoring UNICODE format characters in match
and peek methods, adds explicit assertions checks for code assumptions
and makes handling of ASCII '\r', '\n' and UNICODE U+2028, U+2029 line
ends uniform.

It was rather tricky to fix format character issue and I spend some
time figuring out what TokenStream assumes about LineBuffer that
breaks my initial thoughts on the patch in cases like very long
sequences of format characters that do not fit in the buffer. I
fixed that but it made the code rather unclear so I put explicit
checks for assumptions/preconditions to help with debugging.

I added Context.check flag to turn on/off these checks and
Context.codeBug to throw an exception in case of check violations,
and also modified UintMap to use them instead of the private
flags there.

It would be nice to add some tests about format characters to the test
suite with checks similar to "eval('1 =\u200C= 1') == true" and
"eval('.\u200C1') == 0.1".
2001-09-14 17:26:12 +00:00
nboyd%atg.com
7c041252b1 Patch from Igor:
Hi, Norris!

I have found few problems with NativeArraj.java.

1. jsSet_length requires that the new length value should be an instance of Number. But according to Ecma 15.4.5.1, item 12-13, an error should be thrown only if ToUint32(length_value) != ToNumber(length_value). Here is a simple test that demonstrates it:

Array(5).length = new Number(1)

It currenly throws an exception.

2. jsSet_length when executing the code marked with "// assume that the representation is sparse" effectively removes all properties with values less then the current length when String is used to represent its value. Note that simply changing lines "if (d == d && d < length) delete(id);" to "if (d == d && d >= longVal) delete(id);" is not good because it would remove properties like "4.5" or "007", the full array index check has to be used instead.

Here is a test case that catches the problem:

var BIG_INDEX = 4294967290;
var a = Array(BIG_INDEX);
a[BIG_INDEX - 1] = 'a';
a[BIG_INDEX - 10000] = 'b';
a[BIG_INDEX - 0.5] = 'c';

a.length = BIG_INDEX - 5000;
var s = '';
for (var i in a) s += a[i];

print('s="'+s+'"');

this should print s='cb' (or 'bc': EcmaScript does not fix the order), but currently it gives s=''.

3. There are race conditions in jsSet_length and getIds.
The first contains:
                    if (hasElem(this, i))
                        ScriptRuntime.delete(this, new Long(i));
which would lead to call to delete in the Array prototype if 2 threads would invoke this code. Simply calling ScriptableObject.delete without any checks for existence is enough here.

getIds assumes that the count of present elements in the dense array does not change, which is not true when another thread deletes elements from dense.

The attached patch fixes these issues.

Regards, Igor
2001-09-14 13:50:09 +00:00
brendan%mozilla.org
cf80f7240c Fix unsafe JS_DHashTableRawRemove usage; unoverload cx->resolving into a counter and a JSDHashTable pointer (94422, r/sr=jband,waterson with dbaron sanity checks). 2001-09-14 03:37:15 +00:00
pschwartau%netscape.com
6333005ace Making testcase compatible with updated testRegExp() function in utility file shell.js 2001-09-14 00:29:21 +00:00
pschwartau%netscape.com
a6700335b7 Improving the error-reporting functions for RegExp tests. Now more complete and more consistent. 2001-09-14 00:15:59 +00:00
nboyd%atg.com
db1d39756e Fix broken link 2001-09-13 13:49:23 +00:00
brendan%mozilla.org
3efd0e519f 1. Fix jsdhash/pldhash.[ch] so that add/remove cycles for a given k do not
create a long chain of removed sentinels.  Also, when adding k to a table
    where k is not mapped, but where k hashes to a chain that includes removed
    sentinels, recycle the first removed sentinel in the chain for k's entry.
2.  Cache cx->resolving till js_DestroyContext, to avoid high JSDHashTable
    new/destroy overhead in js_LookupProperty.
3.  Add NS_TraceStack to nsTraceMalloc.[ch] and clean the .c file up a bit.
2001-09-12 06:39:31 +00:00
cls%seawood.org
1db0a058f3 Make generated header use common install rules.
Bug #59454 r=bryner sr=alecf
2001-09-12 06:35:50 +00:00
blizzard%redhat.com
3b2127bd59 Checking in for Ulrich Drepper. Bug #99246. r=beard, sr=brendan 2001-09-12 03:19:08 +00:00
pschwartau%netscape.com
cb7ef4c5f2 Trivial whitespace cleanup. 2001-09-10 23:16:43 +00:00
pschwartau%netscape.com
9394dbd3ec Initial add. Regression test for bug 97921. 2001-09-10 23:05:12 +00:00
alecf%netscape.com
8bf5905937 add REQUIRES support to jpeg, sun-java, db, etc.. b=98371 r=cls 2001-09-10 20:48:38 +00:00