Commit Graph

4011 Commits

Author SHA1 Message Date
nboyd%atg.com
1ce9a8feb9 Update for new failures. 2001-11-23 01:20:56 +00:00
nboyd%atg.com
4ef25a301c Hi,
I'm working on a project which uses rhino. I wanted to have finer
control over class generation and saving so I've done some patching
and clean up on the current rhino tip.

The biggest change I've made is the replacement of ClassOutput with
ClassRepository that has the single method:

    public boolean storeClass(String className, byte[] classBytes,
                           boolean isTopLevel) throws IOException;

This interface allows any arbitary storage method, such as a
Hashtable/Map. In addition it also allows you to specify whether a
class should be loaded, via returning true or false.  You can still use
ClassOutput as I've coded an internal wrapper.

With this interface it has also been possible to strip out the file
saving code from Codegen and OptClassNameHelper.  The file
saving code is now an inner class FileClassRepository in Context. As
a consequence of this  I've stripped out some methods from ClassNameHelper.
The resulting code is much more cleaner then before hand and everything
still works as per usual.

Other small additions are:
  o  Annonymous functions are now named class$1 instead of class1
  o  get/setClassName added to ClassNameHelper exposed in Context.

My final thoughts are, since all methods in ClassNameHelper except reset()
are now exposed whould n't it be much more "cleaner" to simply to some
how work around to eliminate reset() and provide getClassNameHelper()
via Context?  You could then remove the numerous ClassNameHelper shadow
methods from Context.

Likewise, FileClassRepository could be made a public class very easily
and combined with the above result in a dozen or so less public methods in
Context.

Anyway, the changes can be found on http://www.cins.co.uk/rhino.zip

Hope it is of use to some

Kemal Bayram
2001-11-22 15:48:21 +00:00
brendan%mozilla.org
106186f720 Thanks to scole@planetweb.com (Steven Cole) for fixing date_format to respect PRMJ_FormatTime's return value (102159, r=beard, sr=brendan). 2001-11-21 23:53:54 +00:00
brendan%mozilla.org
3350a394b5 Don't eagerly allocate fatlock freelist chunks; don't preallocate so much, and use a smaller global lock hashtable (109218, r=shaver/sr=jband). 2001-11-21 23:28:52 +00:00
pschwartau%netscape.com
e3560ba177 Removing two tests from the skip list because they have been removed from the repository. 2001-11-21 22:16:19 +00:00
pschwartau%netscape.com
63bbacdb75 Removing test from repository. It contains very large blocks.
But because of the fix to bug 80981, these are no longer large enough
to trigger the internal error and exit code 3 that the test looked for.
2001-11-21 21:59:31 +00:00
pschwartau%netscape.com
f3c83ec62e Skipping another test with a large switch() statement 2001-11-21 21:34:25 +00:00
pschwartau%netscape.com
a929ee24ec Initial add. Regression test for bug 80981. 2001-11-21 21:17:31 +00:00
nboyd%atg.com
46b8e5185c Hi,
I'm working on a project which uses rhino. I wanted to have finer
control over class generation and saving so I've done some patching
and clean up on the current rhino tip.

The biggest change I've made is the replacement of ClassOutput with
ClassRepository that has the single method:

    public boolean storeClass(String className, byte[] classBytes,
                           boolean isTopLevel) throws IOException;

This interface allows any arbitary storage method, such as a
Hashtable/Map. In addition it also allows you to specify whether a
class should be loaded, via returning true or false.  You can still use
ClassOutput as I've coded an internal wrapper.

With this interface it has also been possible to strip out the file
saving code from Codegen and OptClassNameHelper.  The file
saving code is now an inner class FileClassRepository in Context. As
a consequence of this  I've stripped out some methods from ClassNameHelper.
The resulting code is much more cleaner then before hand and everything
still works as per usual.

Other small additions are:
  o  Annonymous functions are now named class$1 instead of class1
  o  get/setClassName added to ClassNameHelper exposed in Context.

My final thoughts are, since all methods in ClassNameHelper except reset()
are now exposed whould n't it be much more "cleaner" to simply to some
how work around to eliminate reset() and provide getClassNameHelper()
via Context?  You could then remove the numerous ClassNameHelper shadow
methods from Context.

Likewise, FileClassRepository could be made a public class very easily
and combined with the above result in a dozen or so less public methods in
Context.

Anyway, the changes can be found on http://www.cins.co.uk/rhino.zip

Hope it is of use to some

Kemal Bayram <rhino@cins.co.uk>
2001-11-21 17:12:57 +00:00
seawood%netscape.com
7733357d51 Rename 'install' build phase to 'libs'.
Bug #56601 r=pavlov
2001-11-21 09:49:41 +00:00
brendan%mozilla.org
9b46da979c Thanks to scole@planetweb.com, no more un-ECMA error for /* in a /**/ comment (110286, r=khanson, sr=brendan). 2001-11-20 23:35:45 +00:00
brendan%mozilla.org
d2eb2bf046 Better fix than 0.9.6 minimal fix for NUL-termination assumption in replace (108832, r=shaver, sr=jband). 2001-11-20 21:26:33 +00:00
brendan%mozilla.org
5eaba7585d Don't warn or 'correct' = to == in a condition unless the right operand has greater precedence than == (106244, r=shaver, sr=jband). 2001-11-20 05:20:57 +00:00
rginda%netscape.com
43f2ce47ff bug 110903, patch=brendan, sr=shaver, r=me
Call new script hook for scripts created via xdr.
2001-11-20 02:47:41 +00:00
brendan%mozilla.org
024ffbebe7 Don't ass-u-me fp->argv => fp->fun (109635, sr=shaver/jband). 2001-11-20 02:37:01 +00:00
timeless%mac.com
060425ec59 Bugzilla Bug 110080 change !NS_SUCCEEDED(status) to NS_FAILED(status)
s/!NS_SUCCEEDED/NS_FAILED/g;s/!NS_FAILED/NS_SUCCEEDED/g;
r=dougt sr=hewitt
2001-11-19 06:45:00 +00:00
pschwartau%netscape.com
216a94f367 Initial add. Regression test for bug 110286. 2001-11-17 03:20:45 +00:00
brendan%mozilla.org
051d085765 Remove __call__ and add a callback used to check f.caller access for any function object f (109113, r=jst, sr=jband). 2001-11-16 02:56:49 +00:00
alecf%netscape.com
d49a4ba867 win32 REQUIRES cleanup 2001-11-15 03:49:13 +00:00
seawood%netscape.com
c7ca889121 Build libmozjs during the install phase.
Bug #104307 sr=jband
2001-11-14 04:52:55 +00:00
bzbarsky%mit.edu
f2ee8260a0 Use NS_LITERAL_STRING instead of NS_ConvertASCIItoUCS2 where possible
(i.e. where the string is a literal).  Bug 104159, r=jag, sr=alecf
2001-11-14 01:33:42 +00:00
pschwartau%netscape.com
0a61967ca6 Adding another case to test. 2001-11-13 19:46:27 +00:00
brendan%mozilla.org
8b9fb46499 Avoid ClaimScope (lock-free to -full transition) in JS_GetClass and js_FinalizeObject called from the GC (109183, r=shaver, sr=jband). 2001-11-11 21:25:13 +00:00
jband%netscape.com
cd8dc8ee2c not part of build. Now that null DOM strings are correctly supported we can fix the test case 2001-11-10 22:35:26 +00:00
pschwartau%netscape.com
7a9c2596f2 Fixing a typo. 2001-11-10 02:47:52 +00:00
pschwartau%netscape.com
267f1d9202 Adding another case to test. 2001-11-10 02:46:24 +00:00
brendan%mozilla.org
91397f1e55 For now (0.9.6), str_replace requires an independent replacement string (108832, r=shaver, sr=jband, a=asa). 2001-11-08 23:53:33 +00:00
pschwartau%netscape.com
b0756acf45 Initial add. Regression test for bug 108440. 2001-11-07 23:20:48 +00:00
nboyd%atg.com
e60c42afed Patch from Igor:
I suggest to move the code in ScriptableObject.get/put that deals with getter/setter
into separated methods so it would be easy to follow the code and the attached patch
does just that.
2001-11-07 14:15:48 +00:00
brendan%mozilla.org
63cb2c1077 Fix Function.call(this, 'alert(42)')() so the anonymous function finds its nearest scripted caller's principals (90546, sr=shaver&jband). 2001-11-07 06:34:04 +00:00
dbaron%fas.harvard.edu
8cd8d91750 Ensure that string literals are used as |const char*| rather than |char*|. r=jag sr=brendan b=107052 2001-11-07 06:24:10 +00:00
mkaply%us.ibm.com
5991fb004d #105476
r=os2team, sr=brendan@mozilla.org
Add ASM implementation of js_CompareAndSwap for OS/2 VACPP
2001-11-07 05:20:33 +00:00
dbaron%fas.harvard.edu
bfb2f49916 Add assertions that users of nsDependentC?String meet the requirements of nsAFlatC?String. Add nsDependentSingleFragmentC?Substring for users that don't. Additional cleanup after bug 100214. b=104651 r=jag sr=scc 2001-11-07 04:12:20 +00:00
brendan%mozilla.org
c220d0c707 Avoid recursive join/toString death (108440, r=shaver, sr=jband). 2001-11-07 00:15:44 +00:00
brendan%mozilla.org
be20b21443 Move the oversized arena back-pointer to a well-aligned header extension lying just behind a->base (108013, sr=waterson&jband). 2001-11-07 00:11:22 +00:00
jband%netscape.com
0c81cb1768 better error message when zero passed where object or null expected. bug 108284. r=dbradley sr=shaver. Also, fix uninitilized counter var in debug only code rs=jband 2001-11-06 00:40:54 +00:00
rginda%netscape.com
452f1525a4 removing dead code, see mozilla/js2 2001-11-05 21:46:17 +00:00
rginda%netscape.com
0065b1bb33 removing dead code, see mozilla/js2 2001-11-05 21:38:18 +00:00
seawood%netscape.com
be10c3b1a8 Backing out fix for remote mach-o builds as it left mach-o builds fragile.
Add TK_CFLAGS back to default CFLAGS/CXXFLAGS.
Bug #107696
2001-11-03 03:29:05 +00:00
rginda%netscape.com
2085b262f0 bug 108257, "source notes broken for functions compiled via JS_CompileUCFunctionForPrincipals", sr=brendan, r=shaver
no need to emit the function body after calling FunctionBody
2001-11-03 00:10:47 +00:00
peterv%netscape.com
3470de8c5b Add build option for the JS profiler on Mac. a=dbradley. Not part of the build. 2001-11-02 10:27:52 +00:00
pschwartau%netscape.com
c97d13ddcf Improving readability. 2001-11-02 02:17:57 +00:00
pschwartau%netscape.com
491a9eb409 Initial add. Regression test for bug 107771. 2001-11-02 02:06:54 +00:00
dbradley%netscape.com
5cb0f9371f Bug 83426 - Remove DOM exception hack. r=jst, r=dbradley, sr=jband 2001-11-01 15:52:53 +00:00
jband%netscape.com
3bcdaf198c fixing warnings from recent landing and uncommenting test cases I did not mean to comment out for the checkin 2001-11-01 05:18:35 +00:00
brendan%mozilla.org
3c38914b93 Fix nul-termination assumption hidden in lastIndexOf, broken by dependent strings fix for bug 56940 (107771, r=jag, sr=waterson). 2001-11-01 03:19:54 +00:00
jband%netscape.com
a2511b96a8 fix Mac bustage. I can't believe the Mac can't do this conversion without a cast! 2001-11-01 02:36:19 +00:00
jband%netscape.com
3ff792dd5d the HP compiler says that anonymous unions can't even have structs. So the union must be named. Fixing that bustage 2001-11-01 01:45:48 +00:00
jband%netscape.com
c052cc3bf0 fix Mac bustage (I hope). I think these names conflicted with other names 2001-11-01 01:15:53 +00:00
seawood%netscape.com
8a2a775382 Since '-framework Carbon' causes binaries to require console access to run, do not link using that flag by default. Otherwise, remote builds & non-console tinderboxes will break. Mac OSX Mach-O only.
Bug #107696 r=mozbot
2001-11-01 00:54:48 +00:00
pete%alphanumerica.com
b52992027b b=107823, r=ccarlen, sr=brendan
--pete
2001-11-01 00:11:15 +00:00
jband%netscape.com
2882268cda added files: mozilla/js/src/xpconnect/src/xpcvariant.cpp 2001-10-31 23:36:34 +00:00
jband%netscape.com
84bfc894a4 add support for nsIVariant and nsIPropertyBag. bug 44675 and bug 98209. sr=vidur r=dbradley 2001-10-31 23:35:07 +00:00
rginda%netscape.com
7491994718 bug 99601, don't install xpconnect debugger keyword handler if one is already there, r=jband, sr=brendan 2001-10-31 23:13:17 +00:00
brendan%mozilla.org
2caef4a183 Don't try to correct = to == if strict, do it only if downrev (106244, r=jband, sr=shaver). 2001-10-31 03:17:00 +00:00
pschwartau%netscape.com
fb838280d6 Initial add. Regression test for bug 94257. 2001-10-31 02:32:38 +00:00
nboyd%atg.com
3067721c3c Fix bug with test case:
var testArray = new Array(6);
testArray[1+1]+=2;
2001-10-30 14:06:58 +00:00
nboyd%atg.com
787b93699a Hello Norris
The following test case case leads to a compilation error in Rhino. In this
script alert is an user defined
function in the global object and it shows the value of the specified
parameter in a popup window. Save the script as a html file and run it under
Netscape and IE. The output via their JS engines is that alert(1)
executes but the execution of line fails as blks variable is undefined. The
Fix bug:

Rhino engine fails at compilation time itself and cannot excute the script.
It doesn't like the syntax of line.


Steven


/// ****************  test case **************    ///
<script>
alert(1);
  blks[ 10 << 2 ] |= true;
  alert(2);
</script>


/// **********************  Error Message ************************** ////
evaluating script: null
java.lang.NullPointerException
  at org.mozilla.javascript.Interpreter.generateICode(Compiled Code)
  at org.mozilla.javascript.Interpreter.generateICode(Compiled Code)
  at org.mozilla.javascript.Interpreter.generateICode(Compiled Code)
  at org.mozilla.javascript.Interpreter.generateICode(Compiled Code)
  at org.mozilla.javascript.Interpreter.generateICode(Compiled Code)
  at org.mozilla.javascript.Interpreter.generateICodeFromTree(Compiled Code)
  at
org.mozilla.javascript.Interpreter.generateScriptICode(Interpreter.java)
  at org.mozilla.javascript.Interpreter.compile(Interpreter.java)
  at org.mozilla.javascript.Context.compile(Context.java)
  at org.mozilla.javascript.Context.compile(Context.java)
2001-10-30 13:55:26 +00:00
rginda%netscape.com
db43fadc93 bug 99601, add filter support to js/jsd, r=jband sr=brendan
large addition to the jsd_xpc component allows arbitrary filtering of debug hooks by url pattern, line range, and global object.  also adds ability to begin instrumenting jsscripts at app startup.
2001-10-30 13:41:32 +00:00
nboyd%atg.com
0babafcaa0 Patch from Igor:
I must admit this is very subtitle, but still...

Here are the lines from
    public void defineProperty(String propertyName, Object delegateTo,
                               Method getter, Method setter, int attributes)


        GetterSlot slot = (GetterSlot)getSlotToSet(propertyName,
                                                   propertyName.hashCode(),
                                                   true);
        slot.delegateTo = delegateTo;
        slot.getter = getter;
        slot.setter = setter;
        slot.setterReturnsValue = setter != null && setter.getReturnType() != Void.TYPE;
        slot.value = null;
        slot.attributes = (short) attributes;
        slot.flags = (byte)flags;

Now suppose that after the new slot is added, another thread is accessing it. Then it would see not yet ready slot with all nasty consequences! For example,  SMP computer can re-arrange writes so the new value of slot.flags would be visible before slot.getter then another thread would generate null pointer exception.

race2_fix.diff fixes that by using the explicit Slot argument to addSlot instead of boolean flag so the new slot can be fully initialized and then inserted under synchronization to the table. I also call addSlot directly because it is supposed to be used with not-yet existed properties and split addSlot to addSlot and addSlotImpl so in case of table growth there is no need to re-enter already synchronized monitor.

This changes also allows to explicitly throw RuntimeException if defineProperty is called for the property that is already exists instead of either throwing cast exception in "GetterSlot slot = (GetterSlot)getSlotToSet(propertyName," or worth yet re-initializing already existed slot.

Regards, Igor
2001-10-30 13:07:00 +00:00
nboyd%atg.com
08247fcd49 Print either line or file name if either is present. 2001-10-30 12:59:30 +00:00
pschwartau%netscape.com
489809edc1 Adding reference to another Bugzilla bug this testcase covers. 2001-10-30 03:28:15 +00:00
brendan%mozilla.org
7000513580 Ensure atom strings are immutable -- duh! (107138, r=jag, sr=jband). 2001-10-30 02:33:41 +00:00
pschwartau%netscape.com
cd0a6755c1 Initial add. Regression test for bug 107138. 2001-10-30 00:20:03 +00:00
brendan%mozilla.org
671178cbdb Consolidate property cache flush under JS_ClearScope (107265, r=shaver, sr=jband). 2001-10-29 19:30:03 +00:00
brendan%mozilla.org
d27c4cb86f Followup to bug 56940's big patch, tighten GC-mark case analysis, assume atom strings are immutable. 2001-10-28 22:37:25 +00:00
brendan%mozilla.org
114a9d244c Ensure proper pointer alignment in oversized arena footers (105726, r/sr=jband,shaver). 2001-10-28 20:41:53 +00:00
brendan%mozilla.org
467cafd25f Avoid stack overflow in js_EmitTree on long left-associative operator chains (98901, r=jband, sr=shaver). 2001-10-27 18:38:16 +00:00
seawood%netscape.com
9b5ae05e33 Landing the rest of the mach-o OSX changes.
Bug #75653 r=cls sr=waterson
2001-10-27 07:38:18 +00:00
pschwartau%netscape.com
6a49244c08 Fixing a typo 2001-10-27 00:48:14 +00:00
rginda%netscape.com
a38f6a4b18 check in jband's fix for command paths on win2k, whitespace nits. 2001-10-26 21:37:51 +00:00
mike+mozilla%meer.net
41da6c554a Initial checkin of build file for Darwin1.4.mk. It just includes Darwin1.3.mk. Because I happened to be fooling around with an OS X system. 2001-10-26 09:38:43 +00:00
alecf%netscape.com
a6790acff4 other part of bug 106130, remove unicharutil dependency and linking (just requires updates) 2001-10-26 03:06:04 +00:00
brendan%mozilla.org
63754279fd epstein@tellme.com's patch implementing JS_ClearNewbornRoots (106790, r=brendan, sr=jband). 2001-10-26 02:38:10 +00:00
brendan%mozilla.org
862a59da87 khanson@netscape.com's fix for silent ValueIsLength failure (101488, r=rogerl, sr=me). 2001-10-26 02:35:01 +00:00
jst%netscape.com
05bb290330 Fixing bug 106823. Pass the length to nsAString::Assign() to make sure we don't loose embedded null characters in strings, and also to speed things up a bit. Also trunkate strings before 'voiding' them to make sure old string data is deleted from the string before it's reused. r=bzbarsky@mit.edu, rs=jband@netscape.com 2001-10-26 02:18:16 +00:00
dbradley%netscape.com
900bb81362 Bug 106130 - Remove dependancy of xpconnect on intl. r=alecf, sr=shaver, patch=jband 2001-10-25 12:07:23 +00:00
brendan%mozilla.org
894b19f8c3 Add mutable (growable or dependent, two subtypes) strings to solve O(n^2) and O(n^3) growth rates (56940, r=rogerl, sr=jband&shaver). 2001-10-25 00:26:38 +00:00
jaggernaut%netscape.com
1541469c6a Bug 53057: Fixing up users of implicit |CharT*| conversion operators for nsCString to use |.get()| instead, rr=dbaron, rs=scc 2001-10-24 09:43:59 +00:00
jst%netscape.com
ec6e6aa5da Fixing bug 69468. Finally adding support for string nullness to XPConnect. r=jaggernaut@netscape.com, shaver@mozilla.org, sr=jband@netscape.com 2001-10-24 07:15:06 +00:00
pschwartau%netscape.com
9565961ff0 Adding two more cases to the test. 2001-10-24 02:01:59 +00:00
pschwartau%netscape.com
53e1fc0bb1 Improving comments. 2001-10-23 23:02:25 +00:00
pschwartau%netscape.com
80bbc8630d Initial add. Test for regexps with global flag set. 2001-10-23 22:29:01 +00:00
pschwartau%netscape.com
a61d44caad More accurate comment. 2001-10-23 19:28:40 +00:00
pschwartau%netscape.com
fa37601fdb Correcting an error in comments. 2001-10-23 19:12:42 +00:00
pschwartau%netscape.com
37ce28ddd4 Minor changes in style. 2001-10-23 17:39:31 +00:00
cls%seawood.org
b41bf3571c Since the purpose of --enable-ultrasparc is to just flip on the ultrasparc-specific js compare & swap code, move the asflags/defines to turn it on back into js/src/Makefile.in rather than causing the entire project to be built with those flags. 2001-10-23 08:17:16 +00:00
pschwartau%netscape.com
4965e9aa2c Adding comments. 2001-10-22 23:59:20 +00:00
dougt%netscape.com
0a62d4e8d5 99163 - removing nsObserverService.h includes. Also fixing 106090, extra methods on nsObserverService. r=shaver@mozilla.org, sr=jband@netscape.com 2001-10-22 22:01:27 +00:00
alecf%netscape.com
c8469b7ac5 bug 100214 - add libunicharutil_s to all unix projects that require it, r=cls 2001-10-22 20:44:02 +00:00
pschwartau%netscape.com
e8e300d648 Improving readability. 2001-10-22 20:09:12 +00:00
pschwartau%netscape.com
53c5b4683a Initial add. Regression test for Bugzilla bug 105972. 2001-10-22 20:06:52 +00:00
jaggernaut%netscape.com
3e278e4913 Bug 105973: s/Observe/observe/ 2001-10-22 04:16:33 +00:00
dougt%netscape.com
d18d7e2b17 nsIObserver and nsIObserverService API freeze. r=rpotts@netscape.com, alecf@netscape.com. bug 99163 2001-10-19 20:52:59 +00:00
brendan%mozilla.org
ef987373e8 Avoid converting lock-free to lock-full scope from GC mark call-outs (105571, r=jst, sr=jband). 2001-10-19 03:02:41 +00:00
nboyd%atg.com
b2eea2f3d4 Patch from Igor:
Unsynchronized ScriptableObject.getSlotToSet contains references/modifications
to the slots array which is no go under multithreading. The attached patch
replaces references to slots by references to its local copy and moves code
to allocate the initial array to synchronized addSlot.

The patch also replace throwing of RuntimeException in case of broken code by
if (Context.check && badCondition) Context.codeBug();

Regards, Igor
2001-10-18 18:16:28 +00:00
nboyd%atg.com
eef3184d67 Apparently the "classic" compiler is not only deprecated in JDK 1.4, but it
also has a significant regression introduced in it.   The default compiler
not only works, but also is noticably faster.  Ant takes care of the
selection of the compiler automatically based on the JDK level, so the
following patch should make things better all around.
2001-10-17 12:59:48 +00:00
nboyd%atg.com
78ab3bb949 Remove deprecated class. 2001-10-17 12:59:18 +00:00
nboyd%atg.com
250051383e Remove deprecated FlattenedObject.
Patch from Igor:
The 2 attached patches allow to avoid wrapping of array indexes to Double object
when Interpreter knows that the index is an integer number. It speed up array
benchmark by 5-10%

array_access.diff adds to ScriptRuntime getStrIdElem and setStrIdElem to get/set
properties which known to be strings plus it modifies NativeArray to use these methods.

interpreter.diff contains the Interpreter modifications to call get/setElem for
integer or string properties when the property type is known for sure.
2001-10-17 12:59:02 +00:00
nboyd%atg.com
1bc0630719 Backslashes don't work. 2001-10-17 12:53:39 +00:00
dbradley%netscape.com
19f0e89f2b bug 103649 - Crash when rendering a page with hundreds of iframes - This reduces the number of calls to JS_ContextIterator from XPCJSRuntime::SyncXPCContextList. It is only the first step in addressing this bug. r=jband, sr=jst 2001-10-17 11:52:55 +00:00
brendan%mozilla.org
38b3c5bb4b Checking in scole@planetweb.com's patch to prefix str_escape with js_ (96084, r=rogerl, sr=brendan). 2001-10-17 08:16:53 +00:00
brendan%mozilla.org
43a911aeb6 Fixes for bug 80981 (``Need extended jump bytecode to avoid "script too large"
errors, etc.''):

We now ReportStatementTooLarge only if
- a jump offset overflows 32 bits, signed;
- there are 2**32 or more span dependencies in a script;
- a backpatch chain link is more than (2**30 - 1) bytecodes long;
- a source note's distance from the last note, or from script main entry
  point, is > 0x7fffff bytes.

Narrative of the patch, by file:

- js.c
  The js_SrcNoteName array of const char * is now a js_SrcNoteSpec array of
  "specifiers", structs that include a const char *name member.  Also, due to
  span-dependent jumps at the ends of basic blocks where the decompiler knows
  the basic block length, but not the jump format, we need an offset operand
  for SRC_COND, SRC_IF_ELSE, and SRC_WHILE (to tell the distance from the
  branch bytecode after the condition expression to the span-dependent jump).

- jsarena.[ch]
  JS arenas are used mainly for last-in-first-out allocation with _en masse_
  release to the malloc pool (or, optionally, to a private freelist).  But
  the code generator needs to allocate and grow (by doubling, to avoid O(n^2)
  growth) allocations that hold bytecode, source notes, and span-dependency
  records.  This exception to LIFO allocation works by claiming an entire
  arena from the pool and realloc'ing it, as soon as the allocation size
  reaches the pool's default arena size.  Call such an allocation a "large
  single allocation".

  This patch adds a new arena API, JS_ArenaFreeAllocation, which can be used
  to free a large single allocation.  If called with an allocation that's not
  a large single allocation, it will nevertheless attempt to retract the arena
  containing that allocation, if the allocation is last within its arena.
  Thus JS_ArenaFreeAllocation adds a non-LIFO "free" special case to match the
  non-LIFO "grow" special case already implemented under JS_ARENA_GROW for
  large single allocations.

  The code generator still benefits via this extension to arenas, over purely
  manual malloc/realloc/free, by virtue of _en masse_ free (JS_ARENA_RELEASE
  after code generation has completed, successfully or not).

  To avoid searching for the previous arena, in order to update its next
  member upon reallocation of the arena containing a large single allocation,
  the oversized arena has a back-pointer to that next member stored (but not
  as allocable space within the arena) in a (JSArena **) footer at its end.

- jscntxt.c
  I've observed for many scripts that the bytes of source notes and bytecode
  are of comparable lengths, but only now am I fixing the default arena size
  for cx->notePool to match the size for cx->codePool (1024 instead of 256).

- jsemit.c
  Span-dependent instructions in JS bytecode consist of the jump (JOF_JUMP)
  and switch (JOF_LOOKUPSWITCH, JOF_TABLESWITCH) format opcodes, subdivided
  into unconditional (gotos and gosubs), and conditional jumps or branches
  (which pop a value, test it, and jump depending on its value).  Most jumps
  have just one immediate operand, a signed offset from the jump opcode's pc
  to the target bytecode.  The lookup and table switch opcodes may contain
  many jump offsets.

  This patch adds "X" counterparts to the opcodes/formats (X is suffixed, btw,
  to prefer JSOP_ORX and thereby to avoid colliding on the JSOP_XOR name for
  the extended form of the JSOP_OR branch opcode).  The unextended or short
  formats have 16-bit signed immediate offset operands, the extended or long
  formats have 32-bit signed immediates.  The span-dependency problem consists
  of selecting as few long instructions as possible, or about as few -- since
  jumps can span other jumps, extending one jump may cause another to need to
  be extended.

  Most JS scripts are short, so need no extended jumps.  We optimize for this
  case by generating short jumps until we know a long jump is needed.  After
  that point, we keep generating short jumps, but each jump's 16-bit immediate
  offset operand is actually an unsigned index into cg->spanDeps, an array of
  JSSpanDep structs.  Each struct tells the top offset in the script of the
  opcode, the "before" offset of the jump (which will be the same as top for
  simplex jumps, but which will index further into the bytecode array for a
  non-initial jump offset in a lookup or table switch), the after "offset"
  adjusted during span-dependent instruction selection (initially the same
  value as the "before" offset), and the jump target (more below).

  Since we generate cg->spanDeps lazily, from within js_SetJumpOffset, we must
  ensure that all bytecode generated so far can be inspected to discover where
  the jump offset immediate operands lie within CG_CODE(cg).  But the bonus is
  that we generate span-dependency records sorted by their offsets, so we can
  binary-search when trying to find a JSSpanDep for a given bytecode offset,
  or the nearest JSSpanDep at or above a given pc.

  To avoid limiting scripts to 64K jumps, if the cg->spanDeps index overflows
  65534, we store SPANDEP_INDEX_HUGE in the jump's immediate operand.  This
  tells us that we need to binary-search for the cg->spanDeps entry by the
  jump opcode's bytecode offset (sd->before).

  Jump targets need to be maintained in a data structure that lets us look
  up an already-known target by its address (jumps may have a common target),
  and that also lets us update the addresses (script-relative, a.k.a. absolute
  offsets) of targets that come after a jump target (for when a jump below
  that target needs to be extended).  We use an AVL tree, implemented using
  recursion, but with some tricky optimizations to its height-balancing code
  (see http://www.enteract.com/~bradapp/ftp/src/libs/C++/AvlTrees.html).

  A final wrinkle: backpatch chains are linked by jump-to-jump offsets with
  positive sign, even though they link "backward" (i.e., toward lower bytecode
  address).  We don't want to waste space and search time in the AVL tree for
  such temporary backpatch deltas, so we use a single-bit wildcard scheme to
  tag true JSJumpTarget pointers and encode untagged, signed (positive) deltas
  in JSSpanDep.target pointers, depending on whether the JSSpanDep has a known
  target, or is still awaiting backpatching.

  Note that backpatch chains would present a problem for BuildSpanDepTable,
  which inspects bytecode to build cg->spanDeps on demand, when the first
  short jump offset overflows.  To solve this temporary problem, we emit a
  proxy bytecode (JSOP_BACKPATCH; JSOP_BACKPATCH_PUSH for jumps that push a
  result on the interpreter's stack, namely JSOP_GOSUB; or JSOP_BACKPATCH_POP
  for branch ops) whose nuses/ndefs counts help keep the stack balanced, but
  whose opcode format distinguishes its backpatch delta immediate operand from
  a normal jump offset.

  The cg->spanDeps array and JSJumpTarget structs are allocated from the
  cx->tempPool arena-pool.  This created a LIFO vs. non-LIFO conflict: there
  were two places under the TOK_SWITCH case in js_EmitTree that used tempPool
  to allocate and release a chunk of memory, during whose lifetime JSSpanDep
  and/or JSJumpTarget structs might also be allocated from tempPool -- the
  ensuing release would prove disastrous.  These bitmap and table temporaries
  are now allocated from the malloc heap.

- jsinterp.c
  Straightforward cloning and JUMP => JUMPX mutating of the jump and switch
  format bytecode cases.

- jsobj.c
  Silence warnings about %p used without (void *) casts.

- jsopcode.c
  Massive and scary decompiler whackage to cope with extended jumps, using
  source note offsets to help find jumps whose format (short or long) can't
  be discovered from properties of prior instructions in the script.

  One cute hack here: long || and && expressions are broken up to wrap before
  the 80th column, with the operator at the end of each non-terminal line.

- jsopcode.h, jsopcode.tbl
  The new extended jump opcodes, formats, and fundamental parameterization
  macros.  Also, more comments.

- jsparse.c
  Random and probably only aesthetic fix to avoid decorating a foo[i]++ or
  --foo[i] parse tree node with JSOP_SETCALL, wrongly (only foo(i)++ or
  --foo(i), or the other post- or prefix form operator, should have such an
  opcode decoration on its parse tree).

- jsscript.h
  Random macro naming sanity: use trailing _ rather than leading _ for macro
  local variables in order to avoid invading the standard C global namespace.
2001-10-17 03:16:48 +00:00
jaggernaut%netscape.com
ce6e434d2a More REQUIRES clean-up. 2001-10-16 22:08:55 +00:00
pschwartau%netscape.com
f28aa32398 Comment fix. 2001-10-16 19:22:47 +00:00
nboyd%atg.com
af90c96f02 Test not valid in JDK 1.4. 2001-10-16 18:33:38 +00:00
pschwartau%netscape.com
0c21f002ec Skip new test that uses the gc() function of SpiderMonkey. 2001-10-16 18:14:19 +00:00
pschwartau%netscape.com
d952a19514 Intial add. Regression test for Bugzilla bug 104584. 2001-10-16 17:46:26 +00:00
jband%netscape.com
e6e171574e trivial warning fix. rs=jband 2001-10-16 05:48:25 +00:00
brendan%mozilla.org
eb9671e246 Add SetAlphaBounds, TABLE_SIZE, and MIN_ALPHA APIs (103990, r=dbaron, sr=waterson). 2001-10-16 05:40:27 +00:00
dougt%netscape.com
4f3a44d63b API Freeze for nsIServiceManager r=shaver@mozilla.org, sr=rpotts@netscape.com bug 99147 2001-10-16 03:35:52 +00:00
brendan%mozilla.org
12d650dc85 Fix js_GC to mark max(#actuals, #formals) slots at fp->argv (104584, r=shaver, sr=jband). 2001-10-16 02:21:02 +00:00
bryner%netscape.com
7e89125660 Bug 102725 -- problems converting numbers to strings when using gcc -O2. r=bbaetz, sr=brendan. 2001-10-15 22:31:39 +00:00
nboyd%atg.com
9ccbb97cbb Fix 104493:
We have a tool that looks for a scary noop case of assigning an instance field
to itself. this usually comes from a constructor that assigns a argument to a
instance field with the same name and then later the argument changes name. we
ran our tool on all of our classes we have in our classpath here and found this
problem in your code.

rhino1_5R2/src/org/mozilla/javascript/regexp/NativeRegExp.java line 159 it has:
        this.flags = flags;

This seems to be a bad cut and paste from the CompilerState constructor on line
2155. or has some initialization that used to work been lost?
2001-10-13 12:06:16 +00:00
pschwartau%netscape.com
a6a85c77d4 Initial add. Regression test for bug 104375. 2001-10-12 21:28:43 +00:00
jband%netscape.com
e21b56807d not yet part of build. support tracking the iid in array of interfaces 2001-10-12 20:29:19 +00:00
pschwartau%netscape.com
9c84b7f6f0 Initial add. Regression test for bug 104077. 2001-10-10 20:50:27 +00:00
pschwartau%netscape.com
b650df504b Minor change to make test exactly the same as the one reported in bug 102725. 2001-10-10 20:36:17 +00:00
brendan%mozilla.org
064c4cae19 Avoid O(n**2) growth rate of token buffer arena-based reallocation (103042, r=jband, sr=shaver). 2001-10-10 20:19:12 +00:00
rginda%netscape.com
6c53ec4ba6 bug 103804, "Venkman doesn't like stopping in timeouts", r=jband, sr=shaver
add callback to the enterNestedEventLoop method
2001-10-10 06:35:46 +00:00
pschwartau%netscape.com
ee091c31af Initial add. Regression test for bug 102725. 2001-10-10 01:32:28 +00:00
jband%netscape.com
900a5bfba9 NOT PART OF BUILD. bug 44675. bug 98209. New files 2001-10-09 23:42:22 +00:00
pschwartau%netscape.com
2059c2f02a Skip this test for now. Currently uses the non-EMCA 'it' object of SpiderMonkey. 2001-10-09 23:28:21 +00:00
pschwartau%netscape.com
d6986f9388 Initial add. Regression test for bug 99663. 2001-10-09 23:12:16 +00:00
rginda%netscape.com
28b0c9fa5b bug 103831, r=cls, sr=jband
remove java stubs
2001-10-09 21:43:15 +00:00
dbradley%netscape.com
6907d52b27 bug 102750 - Can't call JSIID.equals from web content. r=mstoltz, sr=jband 2001-10-09 18:54:37 +00:00
nboyd%atg.com
2eb21c32b3 Fix name of function in error message 2001-10-09 00:54:49 +00:00
jband%netscape.com
5992cc2572 fix bug 103259. Avoid crasher by correctly marking sharedscriptable object so that JSClasses don't get collected prematurely even when wrapper is 'stillborn' and not reflected into JS. r=dbradley sr=vidur. 2001-10-08 19:56:25 +00:00
rginda%netscape.com
4d363f3ca0 bug 102785, r=dp, sr=shaver, a=asa
remove venkman startup listener so we don't have to load the dll at startup.
checking into 0.9.5 branch also.
2001-10-08 19:44:35 +00:00
nboyd%atg.com
f70b7e4c78 Fix for problem:
There is a bug in JavaScriptException which prevents it from being used with
out a Rhino Context.  When the getMessage() method is invoked on it, the
exception goes to the ScriptRuntime to toString the value.  If you have
already exited your context, the runtime will throw an error.  The solution
is to simply remove the overridden getMessage method from
JavaScriptException.  JavaScriptException's constructor calls the Exception
constructor with the toString'ed value.  The default implementation of
getMessage will return the exception message.

Jeff
2001-10-07 18:44:39 +00:00
nboyd%atg.com
6642d0e4f2 Fix for the following problem:
I'm having problems getting inner class objects with Rhino.

I create a Hashmap, which is an implementation of Map. Map.Entry is an
inner interface of Map with key-value pairs. If I have a Map object,
"property", I should be able to get the key element with the expression
"property.key".

When I look at the "property" class name that Rhino returns I get:
"java.util.HashMap$Entry". I don't believe Rhino has a notion of the
inner Map.Entry object. The expression "property" succeeds. The
expression "property.key", which should retrieve the Map.Entry
keyValue(), fails with a "unexpected IllegalAccessException accessing
Java field".

I'm including a simple example that illustrates the problem. I hope you
can shed some light on this. Thanks!

Justyna
< Justyna.Horwat@Sun.com >

----
import java.io.*;
import java.util.*;
import org.mozilla.javascript.*;


public class MapTest {

    public static void main(String argv[]) {
        Test test = new Test();
        test.testMap();
    }
}

class Test {
    Map map;
    Set set;
    Iterator it;
    Map.Entry entry;

    public void testMap() {
System.out.println("testMap");
        map = new HashMap();

        populate();

        set = map.entrySet();
        it = set.iterator();

        // let's see if Map is populated correctly
        while (it.hasNext()) {
            entry = (Map.Entry) it.next();
            System.out.println("entry: " + entry.getClass().getName());
            System.out.println("key: " + entry.getKey());
            System.out.println("value: " + entry.getValue());
        }

        evaluate();
    }

    void populate() {
        map.put("firstKey", "firstValue");
        map.put("secondKey", "secondValue");
        map.put("thirdKey", "thirdValue");
        map.put("fourthKey", "fourthValue");
    }

    public void evaluate() {

        Context cx = Context.enter();
        Scriptable scope = cx.initStandardObjects(null);

        set = map.entrySet();
        it = set.iterator();

        while (it.hasNext()) {
            entry = (Map.Entry) it.next();
            scope.put("property", scope, cx.toObject(entry,scope));
        }

        Object eval = null;

        try {
            // attempt to get Map.Entry key value using Rhino
            eval = cx.evaluateString(scope, "property.key", "", 0,
null);
            // Unwrap scoped object
            if (eval instanceof Wrapper)
                eval = ((Wrapper) eval).unwrap();

        } catch (JavaScriptException jse) {
            System.out.println("EXCEPTION: " + jse.getMessage());
        }

        // DELETE
        System.out.println("RHINO result: " + eval + ":");
        System.out.println("RHINO class: " + eval.getClass().getName());
    }
}
2001-10-07 18:42:09 +00:00
jaggernaut%netscape.com
0c2b3bc449 Bug 81444: eliminate |null_nsCOMPtr|. Eliminating all callers, r=syd, rs=mozbot. 2001-10-07 10:58:39 +00:00
jaggernaut%netscape.com
c39b98b2a4 Clean up REQUIRES lines. 2001-10-07 10:35:41 +00:00
brendan%mozilla.org
95df849df8 Fix bogus return JS_FALSE without error report for empty flat string regexp match/replace (83293, r=rogerl, sr=shaver). 2001-10-06 08:07:43 +00:00
pschwartau%netscape.com
6ca4e471c4 Improving comments and readability. 2001-10-05 20:32:12 +00:00
pschwartau%netscape.com
c26dfebaed Improving comments. 2001-10-05 18:36:06 +00:00
pschwartau%netscape.com
b44e470e4b Initial add. Tests sparse arrays. 2001-10-05 18:27:40 +00:00
pschwartau%netscape.com
9a3fc24abe Skip test of (non-ECMA) fileName, lineNumber properties of Error objects 2001-10-05 16:25:55 +00:00
pschwartau%netscape.com
69ab92c82f Initial add. Regression test for bug 50447. 2001-10-05 16:19:37 +00:00
pschwartau%netscape.com
00d691ea88 Slight changes - 2001-10-05 02:07:47 +00:00
pschwartau%netscape.com
657d299244 Improving readability - 2001-10-05 00:25:11 +00:00
pschwartau%netscape.com
c188eb0d39 Including more RegExps. Not checking expected vs. actual matches now; just that we don't crash. 2001-10-04 23:58:24 +00:00
pschwartau%netscape.com
8ad7d34603 Initial add. Regression test for bug 103087. 2001-10-04 19:54:04 +00:00
pschwartau%netscape.com
8e321ed4c9 Fixing bug that prevented -p option from working on the Mac (again!) 2001-10-04 02:08:16 +00:00
brendan%mozilla.org
9324b81dee Fix for bug 99663 (for loop resolves properties of the object being enumerated
with JSRESOLVE_ASSIGNING, wrongly), plus a few miscellaneous bugfixes.

- Combine the JSStackFrame members constructing, special, overrides, and
  reserved into a uint32 flags member.

- Separate JOF_ASSIGNING from the JOF_SET bytecode format flag, and impute
  JSRESOLVE_ASSIGNING from the presence of JOF_ASSIGNING among the current
  opcode's format flags.  To handle the for-in loop opcodes, which do more
  than simply assign -- in particular, they do property lookups whose resolve
  hook outcalls should not be flagged with JSRESOLVE_ASSIGNING -- a new frame
  flag, JSFRAME_ASSIGNING, has been added.

- Fix interpreter version selection to respect JS_SetVersion, whose effect on
  cx->version is "sticky".

- Fix js_DecompileValueGenerator to deal with JSOP_ENUMELEM -- it never had,
  as this testcase shows (it crashes without this patch):

    version(120);
    eval("function fe(s) { for (it[s] in this); }");
    try { fe('rdonly'); } catch (e) { print(e); }
2001-10-03 06:39:30 +00:00
dbradley%netscape.com
aa050fb3a4 bug 100665 - Maybe xpconnect should not init the XPCOutArg JSClass. r=jband, sr=shaver 2001-10-03 02:57:42 +00:00
dbradley%netscape.com
9bb2766908 Bug 102294 - printf has an extra parameter. r=jband 2001-10-03 02:48:40 +00:00
nboyd%atg.com
81d6990263 Patch from Igor:
My optimization for PreorderNodeIterator has a bug that would cause an attempt
to access stack[-1] in
    currentParent = (current == null) ? null : stack[stackTop - 1];
when current refers to a start node sibling. This is not visible in Rhino because
currently PreorderNodeIterator is always started from nodes with node.next == null.

iter.diff fixes that plus it removes currentParent field because it is always
available as stack[stackTop - 1] and code to access its value are executed less
frequently than the lines to update it in nextNode

Regarsd, Igor
2001-10-02 12:49:46 +00:00
dbaron%fas.harvard.edu
9a4acbab7a Bug 45797: replace remaining uses of deprecated macros NS_IMPL_QUERY_INTERFACE and friends with NS_IMPL_QUERY_INTERFACE1 and friends and remove the deprecated macros. r=jag sr=alecf 2001-10-02 03:18:08 +00:00
nboyd%atg.com
4ed02f7b8a Fix bug:
var passed = true;
try {
    eval("/* mello /* yello */");
    } catch (e) {
        print(e);
        passed = false;
    }
print(passed);

should print "true", not "false".
2001-10-01 14:25:30 +00:00