4173 Commits

Author SHA1 Message Date
igor%mir2.org
15cacee8fd From my email:
I think recent Christopher suggestions about tail call elimination is worth
to consider, as it would allow to cut invocation cost of script functions
quite nicely in many cases. Plus I am thinking of not creating Object[] array
to pass arguments to callee if it is another interpreted function as it can
directly access the caller stack. But first I decided to make some
preparation work to simplify an implementation of these features later. The
attached patch includes:

1. Moving all code to setup scope from
InterpretedFunction.call/InterpretedFunction.call to Interpreter.interpret so
the call method simply calls Interpreter.interpret. It would make tail call
elimination code much simple. I also hope this simplifies changes Christopher
needs for the continuations support (but I have strong reservation about
possibility to implement it corectly).

2. Moving all declaration of temporary variables used only during processing
of the single ICODE to the case blocks.

3. Interpreter loop termination only in RETURN icodes, not when pc exceeds
icode size, so there is no need to check for this condition on each icode.
(Scripts are handled via the special END_ICODE token).


git-svn-id: svn://10.0.0.236/trunk@116986 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-20 20:00:32 +00:00
pschwartau%netscape.com
c58ce60f59 Fixing a blunder in Section 4, and changing from brackets to braces for ECMA attribute.
git-svn-id: svn://10.0.0.236/trunk@116982 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-20 19:24:08 +00:00
pschwartau%netscape.com
112ed24fd3 Deleted an extraneous line; improved readablity.
git-svn-id: svn://10.0.0.236/trunk@116981 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-20 19:13:36 +00:00
khanson%netscape.com
79891be530 Patch 74900 for bug #131817 (OOM in AllocSrcNote causes crash in js_NewSrcNote). The patch was contributed by Steven Cole (scole@planetweb.com), sr=brendan, r=khanson, a=scc
git-svn-id: svn://10.0.0.236/trunk@116956 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-20 05:45:12 +00:00
brendan%mozilla.org
ff87dae2bd Defend against early OOM when finishing JSDHashTables (131815, r=scole, sr=jband, a=asa).
git-svn-id: svn://10.0.0.236/trunk@116941 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-20 02:22:50 +00:00
pschwartau%netscape.com
e1c6553285 Initial add. Regression test for bug 131964.
git-svn-id: svn://10.0.0.236/trunk@116922 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-20 00:23:22 +00:00
brendan%mozilla.org
686853c41c Fix ChangeScopeTable gross dimensioning bug (131904, r=scole&khanson, sr=jband, a=asa).
git-svn-id: svn://10.0.0.236/trunk@116915 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-19 23:25:17 +00:00
brendan%mozilla.org
2e938ed0a9 Fix 'var arguments;' in a function by specializing to JSOP_ARGUMENTS properly (131510, r=khanson, sr=jband, a=asa).
git-svn-id: svn://10.0.0.236/trunk@116910 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-19 22:51:48 +00:00
timeless%mac.com
69ae314807 Bug 106386 rid source of misspellings
r=db48x sr=blake a=asa


git-svn-id: svn://10.0.0.236/trunk@116832 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-19 04:30:17 +00:00
igor%mir2.org
6c4d9c6001 IdScriptable.maxInstanceId/IdScriptable.activateIdMap is replaced by getMaxId/setMaxId to have more flexible and simple id map initialization.
git-svn-id: svn://10.0.0.236/trunk@116769 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-18 01:26:01 +00:00
igor%mir2.org
d18abf02e1 Code to setup/restore security domain is moved to single place in Interpreter.interpret to make checking for correctness easy.
git-svn-id: svn://10.0.0.236/trunk@116753 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-17 20:10:31 +00:00
igor%mir2.org
3bb105309c cosmetics: change layout of Interpreter.interpret main switch from
switch (...)
    case LABEL:
        code
to
switch (...)
case LABEL:
    code

to has less problems with fitting to 80-character lines


git-svn-id: svn://10.0.0.236/trunk@116752 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-17 18:40:11 +00:00
brendan%mozilla.org
c6ea6491a9 Forgot to check this in yesterday: fix all engine-defined getters and setters to have no slot [to be JSPROP_SHARED] (130970, r/sr=shaver&jband, a=asa).
git-svn-id: svn://10.0.0.236/trunk@116746 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-17 11:01:34 +00:00
pschwartau%netscape.com
70cccd65f4 Initial add. Regression test for bug 131510.
git-svn-id: svn://10.0.0.236/trunk@116734 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-17 05:24:01 +00:00
igor%mir2.org
1a044d7dfe Activate support for getting token names if debugging interpreter icode, not only when debugging parsing trees. Not to depend in TokenStream on Interpreter, printICode debug flag is moved to Context, as with printTrees definition.
Fixing debug printing of icode which are not defined in TokenStream


git-svn-id: svn://10.0.0.236/trunk@116731 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-17 03:34:43 +00:00
igor%mir2.org
c04519684b Fixing serialization problem reported by Todd Trimmer (babyduck@usa.com):
...

>I did some tinkering and found there are pure java.lang.Object
>instantiations deep inside all the "standard objects" added to the
>ImporterTopLevel with Context.initStandardObject(). This is what is keeping
>it from serializing.

This is due to presence of Scriptable.NOT_FOUND and IdScriptable.NULL_VALUE tags in the data to serialize.

I replaced the type for the tags from Object to UniqueTag which is serializable ad knows how to make restored tags the same objects as Scriptable.NOT_FOUND and IdScriptable.NULL_VALUE.

Similarly Undefined was made serializable and to restore to Undefined.instance upon reading.


git-svn-id: svn://10.0.0.236/trunk@116729 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-16 23:31:04 +00:00
brendan%mozilla.org
917f8658bb Null test to handle recovery from OOM under js_NewContext reported by scole@planetweb.com (r/sr=jband, a=me).
git-svn-id: svn://10.0.0.236/trunk@116728 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-16 23:19:35 +00:00
nboyd%atg.com
614e29e599 Patch from Christopher Olivier:
While looking into optimizing the modifications I've
made, I noticed that one of the bottlenecks seemed to be calls to the Java
instanceof operator, particularly if the class argument to instanceof isn't
final. Based on this observation I tweaked ScriptRuntime.java to attempt to avoid
some of the many "instanceof Scriptable" calls in it (which I've attached). In
particular I optimized the comparison operators for the case where the arguments
are Number's. This seems to provide some significant performance improvement in
many cases particularly in compiled mode.  See below (note the tests were
performed with today's rhinoLatest.zip code patched with the attached
ScriptRuntime.java and didn't include any of my other modifications).


git-svn-id: svn://10.0.0.236/trunk@116725 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-16 19:33:46 +00:00
brendan%mozilla.org
b9d4528238 Restore non-bogus assertion removed in last rev, and fix the case that tripped it in js_ChangeScopeProperty, by not removing [and maybe freeing sprop->slot] before re-adding sprop; also fix all engine-defined getters and setters to have no slot [to be JSPROP_SHARED] (130970, r/sr=shaver&jband, a=asa).
git-svn-id: svn://10.0.0.236/trunk@116696 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-16 04:51:29 +00:00
rginda%netscape.com
987eb43a38 bug 129519, "JS_GetPropertyDesc gives up too easily", r=jband, sr=shaver, a=bren
dan
Reflect new JSPD_* defines, make jsd_GetValueProperty degrade gracefully instead of fail outright when we run into a problem fetching the property value.


git-svn-id: svn://10.0.0.236/trunk@116676 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-16 01:58:36 +00:00
rginda%netscape.com
fe7a5ec2b5 bug 129519, "JS_GetPropertyDesc gives up too easily", r=jband, sr=shaver, a=bren
dan
Make JS_GetPropertyDesc degrade gracefully instead of fail outright when we run
into a problem fetching the property value.


git-svn-id: svn://10.0.0.236/trunk@116675 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-16 01:56:19 +00:00
igor%mir2.org
6a7c0622bb 1. Implementing Externalizable interface in ObjToIntMap and UintMap to allow for efficient storage of internal hash table data. For ObjToIntMap it allows to restore correctly cached values of object's hash codes and do not store internal DELETED mark.
2. ObjToIntMap.clear and UintMap.clear now do not discard internal buffers, but clears references to external objects to match behavior of Java Vector.clear and Hashtable.clear.


git-svn-id: svn://10.0.0.236/trunk@116633 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-15 07:13:33 +00:00
khanson%netscape.com
4ff6898f69 bug #130991 (Out-of-Memory in jsshell causes assertion failure in jsobj.c)
patch by Brendan, sr=jband, r=khanson, a=asa


git-svn-id: svn://10.0.0.236/trunk@116632 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-15 06:22:00 +00:00
pschwartau%netscape.com
750daa3f98 Added two new cases where the result is all zeros.
git-svn-id: svn://10.0.0.236/trunk@116625 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-15 05:15:57 +00:00
jband%netscape.com
0a33474113 fix bug 130139. We are iterating an array of pointers not an array of objects. r=dbradley sr=brendan a=asa.
git-svn-id: svn://10.0.0.236/trunk@116621 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-15 04:10:25 +00:00
khanson%netscape.com
2a691ad4e6 bug #130711, r=khanson, sr=brendan, a=asa, memory leak in JS_dtoa
git-svn-id: svn://10.0.0.236/trunk@116601 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-15 00:11:44 +00:00
brendan%mozilla.org
97643dca16 Remove bogus assertion, tripped by js_ChangeScopePropertyAttrs calling js_AddScopeProperty (130970, r=shaver, sr=jband, a=shaver).
git-svn-id: svn://10.0.0.236/trunk@116580 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-14 21:59:16 +00:00
brendan%mozilla.org
45a2cddc1c Fix JS/PL_DHashTableEnumerate to compress or shrink the table after enumeration using the same logic as ADD and REMOVE use (120953, r=dbaron, sr=shaver, a=asa).
git-svn-id: svn://10.0.0.236/trunk@116579 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-14 21:55:08 +00:00
timeless%mac.com
95ef008f42 Bug 61314 Makefile rules for "jsmath.o" and "jsmathtemp.o" cause stale object files, obscure bugs
patch by mang@subcarrier.org r=rogerl sr=brendan a=asa


git-svn-id: svn://10.0.0.236/trunk@116577 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-14 21:41:09 +00:00
igor%mir2.org
d1f9023a1d ObjToIntMap was added to map Objects to int in a memory wise way and VariableTable was modified to use ObjToIntMap for itsVariableNames
git-svn-id: svn://10.0.0.236/trunk@116571 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-14 20:37:15 +00:00
brendan%mozilla.org
66979b2420 No strict warnings without the strict option, and other js1.5/mozilla1.0 tidying (129972, r=shaver, sr=jband, a=asa).
git-svn-id: svn://10.0.0.236/trunk@116505 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-14 00:14:48 +00:00
brendan%mozilla.org
6c6f3b2ee3 Fix Array.prototype.sort to follow ECMA and win perf by not (re-)defining length on the 'this' object (130451, r=shaver, sr=jband, a=asa).
git-svn-id: svn://10.0.0.236/trunk@116504 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-14 00:10:31 +00:00
nboyd%atg.com
c4cd199282 Turn on debug info in class files by default.
git-svn-id: svn://10.0.0.236/trunk@116482 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-13 19:34:23 +00:00
nboyd%atg.com
2309ae693d Fix problem reported in newsgroup:
If I have a Java class with a normal method that throws an exception, Rhino
(1.5pre4) will let JavaScript catch the exception. If the Java class has a
getter method, Rhino will NOT let JavaScript catch the exception. Very
disturbing.

Here's a console dump to show you what I'm talking about:

D:\jsSandbox>cat GIJoe.java
public class GIJoe
{
        // Getter
        public static int getYoJoe()
                throws Exception
        {
                throw new Exception("Please catch me!");
        }

        // Normal
        public static int rebel()
                throws Exception
        {
                throw new Exception("Please catch me too!");
        }
}
D:\jsSandbox>javac GIJoe.java

D:\jsSandbox>cat gi.js
var gi = new Packages.GIJoe();

try
{
        var i = gi.rebel();
        java.lang.System.err.println("rebel(): uncaught");
}
catch(e1)
{
        java.lang.System.err.println("rebel(): caught");
}


try
{
        var i = gi.yoJoe;
        java.lang.System.err.println("yoJoe: uncaught");
}
catch(e2)
{
        java.lang.System.err.println("yoJoe: caught");
}


D:\jsSandbox>java -cp .;e:\javas\rhino1_5R4pre\js.jar
org.mozilla.javascript.too
ls.shell.Main
js> load("gi.js");
rebel(): caught
java.lang.Exception: Please catch me!
org.mozilla.javascript.WrappedException: WrappedException of Please catch
me!
        at org.mozilla.javascript.JavaMembers.get(JavaMembers.java:105)
        at
org.mozilla.javascript.NativeJavaObject.get(NativeJavaObject.java:93)

        at
org.mozilla.javascript.ScriptRuntime.getProp(ScriptRuntime.java:691)
        at
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1591)
        at
org.mozilla.javascript.InterpretedScript.call(InterpretedScript.java:
63)
        at
org.mozilla.javascript.InterpretedScript.exec(InterpretedScript.java:
54)
        at org.mozilla.javascript.Context.evaluateReader(Context.java:741)
        at
org.mozilla.javascript.tools.shell.Main.evaluateReader(Main.java:347)

        at
org.mozilla.javascript.tools.shell.Main.processSource(Main.java:336)
        at org.mozilla.javascript.tools.shell.Global.load(Global.java:169)
        at java.lang.reflect.Method.invoke(Native Method)
        at
org.mozilla.javascript.FunctionObject.callVarargs(FunctionObject.java
:586)
        at
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:460)
        at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1216)
        at
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1679)
        at
org.mozilla.javascript.InterpretedScript.call(InterpretedScript.java:
63)
        at
org.mozilla.javascript.InterpretedScript.exec(InterpretedScript.java:
54)
        at org.mozilla.javascript.Context.evaluateReader(Context.java:741)
        at
org.mozilla.javascript.tools.shell.Main.evaluateReader(Main.java:347)

        at
org.mozilla.javascript.tools.shell.Main.processSource(Main.java:284)
        at org.mozilla.javascript.tools.shell.Main.exec(Main.java:146)
        at org.mozilla.javascript.tools.shell.Main.main(Main.java:74)
js>



Due to a lack of an "uncaught" statement in the output, we see that the
exception from GIJoe::getYoJoe() was indeed thrown, but not caught by the
JavaScript.

Do any nightly builds past 1.5pre4 address this issue?


Todd Trimmer


git-svn-id: svn://10.0.0.236/trunk@116477 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-13 13:33:40 +00:00
brendan%mozilla.org
c4c296cdeb khanson@netscape.com's patch to switch from QuickSort to heap-sort, plus a crucial ECMA-purity/property-tree-perf fix to InitArrayObject (to SET rather than DEFINE; bug 99120, r=waldemar, sr=shaver&brendan, a=asa).
git-svn-id: svn://10.0.0.236/trunk@116457 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-13 01:50:13 +00:00
igor%mir2.org
dfc19c66e1 Rename catchStack to tryStack and allocate it only when required
git-svn-id: svn://10.0.0.236/trunk@116429 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-12 22:02:55 +00:00
igor%mir2.org
36790db5a9 Move definitions of interpreter bytecode specific tokens like BREAKPOINT or INTNUMBER to Interpreter.java.
Use switch instead of string array to return token names not to depend on token oder.


git-svn-id: svn://10.0.0.236/trunk@116428 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-12 22:00:56 +00:00
brendan%mozilla.org
580199465b Missing JSFunction API (129545, r=shaver, sr=jband, a=asa).
git-svn-id: svn://10.0.0.236/trunk@116427 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-12 21:58:27 +00:00
brendan%mozilla.org
86689bb73e Don't forget to lock obj in js_AddNativeProperty and js_ChangeNativePropertyAttrs (130137, r=jband, sr=shaver, a=roc+moz).
git-svn-id: svn://10.0.0.236/trunk@116378 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-12 07:17:30 +00:00
gerv%gerv.net
43afcdc139 Replacing original licensing text from C version of this file.
git-svn-id: svn://10.0.0.236/trunk@116351 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-11 23:11:55 +00:00
jband%netscape.com
56b0628feb fix bug 129697. Don't leave a dangling (to crash later) JS root if JS_NewObject fails while creating a wrapped native. r=beard sr=jst a=asa (for trunk and 0.9.9 branch).
git-svn-id: svn://10.0.0.236/trunk@116255 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-09 03:02:10 +00:00
brendan%mozilla.org
8ca8b078fd Avoid MSVC bogo-warning.
git-svn-id: svn://10.0.0.236/trunk@116242 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-09 00:56:29 +00:00
brendan%mozilla.org
58df9f1560 Fix longstanding bug where watchpoints didn't work with JSPROP_SETTER (127243, r=rginda, sr=shaver, a=dbaron).
git-svn-id: svn://10.0.0.236/trunk@116216 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-08 22:46:58 +00:00
beard%netscape.com
3be28a0bec Fix for bug #123920, prevents reentering the JS engine during Java object JS wrapper finalization, by deferring calls into Java at the end of the garbage collection cycle and storing the wrappers in a linked list, which gets processed by a GC callback.
r=jband, sr=brendan, a=asa


git-svn-id: svn://10.0.0.236/trunk@116212 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-08 22:41:49 +00:00
seawood%netscape.com
bf34327dff This patch replaces the bogus USE_AUTOCONF ifdef + platform ifdef tests with a
simple HAVE_LOCALTIME_R test.  -DHAVE_LOCALTIME_R has been added to the
js/src/config/<platform>.mks as necessary.
bug #128556 r=brendan sr=shaver a=asa


git-svn-id: svn://10.0.0.236/trunk@116119 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-08 01:42:32 +00:00
rginda%netscape.com
344465fc39 bug 128057, r=brendan, sr=shaver, a=asa
check for JS_GetPropertyDesc failure in JS_GetPropertyDescArray


git-svn-id: svn://10.0.0.236/trunk@115980 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-06 22:15:39 +00:00
darin%netscape.com
04849998e1 fixes bug 124042 "support internationalized URIs" r=dougt, sr=alecf, a=asa
git-svn-id: svn://10.0.0.236/trunk@115936 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-06 07:48:55 +00:00
pschwartau%netscape.com
d6d2d2537e Skip new test that uses the clone() function in SpiderMonkey's js.c file
git-svn-id: svn://10.0.0.236/trunk@115935 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-06 05:34:22 +00:00
pschwartau%netscape.com
48079dabad Initial add. Regression test for bug 127557.
git-svn-id: svn://10.0.0.236/trunk@115934 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-06 05:14:58 +00:00
brendan%mozilla.org
884ceb2a0e Not part of build, for the js testsuite only: add clone shell function to clone a function object (for 127557 regression testing, a=shaver).
git-svn-id: svn://10.0.0.236/trunk@115931 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-06 04:45:32 +00:00