Commit Graph

4471 Commits

Author SHA1 Message Date
brendan%mozilla.org
7eefb1753b Report uncaught errors-as-exceptions from outermost JS_Compile*Function* API calls, just as for JS_Compile*Script* (150584, r=rginda, sr=jst). 2002-06-12 08:04:28 +00:00
igor%mir2.org
558b670d29 Removal of unused code for explicit JSObject support:
> Norris Boyd wrote:
>
> Igor Bukaniv wrote:
> >
> > I am curios, why there is a need to have a special JSObject support in Rhino? Was it used for anything? The implementation in the ICEbrowser does not use it as in rare cases where conversion from JSObject to/from JS type may be needed (like calling JSObject.getWindow from a script), it seems that WrapHandler (or similar modifications to pre Rhino 1.5R2 sources) and Wrapper are enough to cover all the cases.
> Yes, we should probably just remove the JSObject code. We added it early on when Rhino was first written and we thought we might need JSObject compatibility with the JS + Java implementation in Navigator 4.x. That's not important now, so we should just remove this code (which likely doesn't work at this point anyway).
2002-06-12 05:32:35 +00:00
brendan%mozilla.org
b051aea202 For the file input case, roll our own fgets replacement to handle NULs in files (148800, r=rogerl, sr=shaver). 2002-06-11 21:32:54 +00:00
brendan%mozilla.org
16f97be249 Drop non-ECMA f.a-for-arg/var-a-in-active-f support (137000, r=khanson, sr=shaver). 2002-06-11 20:43:50 +00:00
nboyd%atg.com
ace017b83d Add to log of changes. 2002-06-10 17:44:44 +00:00
nboyd%atg.com
1260918102 Add new API class WrapFactory. 2002-06-10 14:28:37 +00:00
nboyd%atg.com
a69e72afaf Update javadoc. 2002-06-10 14:27:43 +00:00
nboyd%atg.com
55ef80a864 Add PrimitiveWrapHandler example. 2002-06-10 14:23:32 +00:00
nboyd%atg.com
ae9ac3fc7e Add example of the use of a WrapFactory. 2002-06-10 14:19:09 +00:00
nboyd%atg.com
cc0bee4d2f Fix javadoc. 2002-06-10 14:09:26 +00:00
igor%mir2.org
3ba6e39e98 Deprecating NativeJavaObject.wrap and using Context.getWrapFactory().wrap() instead. 2002-06-09 15:58:15 +00:00
igor%mir2.org
2900073823 More comments 2002-06-09 15:57:03 +00:00
igor%mir2.org
35054857bd Documentation: points to watch when upgrading to WrapFactory 2002-06-09 15:56:12 +00:00
igor%mir2.org
01bf42fa82 Fixing broken logic in emulating custom WrapFactory via deprecated WrapHandler:
the code should not call setWrapFactory with null argument, but use new WrapFactory to restore default behaviour
2002-06-09 15:54:30 +00:00
igor%mir2.org
23b2b0a6e5 Introducing the WrapFactory class that should be used in place of the deprecated WrapHandler interface. 2002-06-09 09:23:00 +00:00
mcafee%netscape.com
76a4589d6e Splitting liveconnect off from the java module, new module is called liveconnect, similar to what was done for xpconnect (145347). r=blythe, sr=alecf, a=asa 2002-06-08 06:59:53 +00:00
pschwartau%netscape.com
da43044e45 Adding new sections authored by john@statesoftware.com from bug 150032. 2002-06-08 04:26:18 +00:00
alecf%netscape.com
bcf192e308 fix for bug 101761 - REQUIRES update - remove all REQUIRES that are no longer necessary.. r=cls, a=asa (build-only changes) 2002-06-06 20:28:14 +00:00
nboyd%atg.com
d99804ee87 Fix for bug 149285: Complier does not report the correct line number on
SyntaxError:Invalid assignment left-hand side.
2002-06-06 15:01:57 +00:00
igor%mir2.org
2e9219f6d7 Replacing check for unescaped characters in encode/decode from searching in a string to doing switch. It provides a noticeable speedup during encoding/decoding of long strings where almost all characters should be encoded. 2002-06-05 20:40:57 +00:00
brendan%mozilla.org
791ae0c843 Ensure a live keyHash *after* multiplying by the irrational (146907, r=dbaron, sr=shaver). 2002-06-05 00:47:38 +00:00
pschwartau%netscape.com
8c6c19e462 Cosmetic whitespace cleanup. 2002-06-04 19:51:59 +00:00
rogerl%netscape.com
029d6574b3 Corrected tests to match ECMA - unmatched paren contents need to have the
value 'undefined' rather than an empty string.
2002-06-04 18:51:05 +00:00
nboyd%atg.com
005f83880e Fix ClassCastException. 2002-06-04 18:37:21 +00:00
brendan%mozilla.org
1740ef44a7 Respect addProperty failure (148899, r=khanson, sr=shaver). 2002-06-04 18:13:55 +00:00
pschwartau%netscape.com
27f0823771 Initial add; regression test for bug 137000. 2002-06-04 02:19:48 +00:00
dbradley%netscape.com
b20ac26ede Fixes XPCONNECT_STANDALONE bustage - see bug 121438 for details 2002-05-31 13:51:08 +00:00
nboyd%atg.com
88e610fce6 Fix bug found by felix.meschberger@day.com:
given the following object :

----------------------------------------------
function SomeObject() {}
SomeObject.prototype.exec = function() {
  var local = this.someField;
}
----------------------------------------------

i create an 'instance', set a field and call the exec method :

----------------------------------------------
var someField = "global field value";
var anInstance = new SomeObject();
anInstance.someField = "instance field value";
anInstance.exec();
----------------------------------------------

then the local variable 'local' in the exec() method is assigned the value
of the global 'someField' variable instead of the instance field value.

the problem seems to be in the ScriptRuntime.callOrNewSpecial() method,
which is called, because the parser treats the name 'exec' specially. in
this method the exec() method gets called with

   return call(cx, fun, thisArg, args, scope);

where the 'thisArg' parameter really is the global this value instead of
the dynamic this value, which is in the jsThis variable and which would be
the one needed...

is it legitimate to replace the above call in callOrNewSpecial() with the
following line :

   return call(cx, fun, jsThis, args, scope);

this seems to only happen for methods named 'exec', which are identified as
special in the NodeTransformer.isSpecialCallName() method.

any help is appreciated. thank you very much for your time.

kind regards,
felix
2002-05-30 13:41:16 +00:00
khanson%netscape.com
32f096fe9c patch to speed up array.sort of strings by 40% r=brendan, sr=shaver 2002-05-27 05:53:57 +00:00
brendan%mozilla.org
f981dd90ae Don't emit JSOP_DEF{VAR,CONST} unless at top-level or in a heavyweight function (146596, r=jband, sr=shaver). 2002-05-26 00:33:23 +00:00
shaver%mozilla.org
5edfcc1ec0 146210: Add Date.now to mirror JS_Now in script. r=rginda, sr=brendan. 2002-05-24 01:55:15 +00:00
igor%mir2.org
9dd700b9b8 Back-indent the interpreter main loop to ease code following 2002-05-22 18:42:40 +00:00
igor%mir2.org
d1f2443a48 Fixing bug 145791: apply and call with null and undefined arguments behaves as required and Function.prototype.apply.length returns 2. 2002-05-22 16:46:28 +00:00
pschwartau%netscape.com
fda5ff5a27 Removing this test. It has been superseded by test ecma_3/Function/15.3.4.3-1.js 2002-05-22 06:01:09 +00:00
pschwartau%netscape.com
e62a49c193 Initial add. Tests language conformance to EMCA-262 Edition 3 Section 15.3.4.4 2002-05-22 05:54:58 +00:00
pschwartau%netscape.com
40851f4b70 Initial add. Tests language conformance to EMCA-262 Edition 3, Section 15.3.4.3 2002-05-22 05:54:21 +00:00
dbaron%fas.harvard.edu
412d54c9d6 Fix Mac bustage from brendan's checkin. 2002-05-22 00:53:12 +00:00
brendan%mozilla.org
f1f6f1398e Don't fail to call OBJ_CHECK_ACCESS for o.__proto__ = x, with enough mode bits to say what's happening (143369, r=shaver, sr=jst). 2002-05-22 00:06:40 +00:00
igor%mir2.org
47da51e506 Making HTML tag helper functions to convert thisObj to string to match SpiderMonkey and user expectations (was reported by Steven Beal <steven.beal@peregrine.com>) 2002-05-21 22:00:08 +00:00
igor%mir2.org
f45acbc9ee Optimization in toInt32/toUint32/toUint16 for common case of integer argument. 2002-05-21 20:18:15 +00:00
igor%mir2.org
c8e2d56fca Added indexOf and lastIndexOf 2002-05-21 20:14:10 +00:00
igor%mir2.org
9dadadad3e In getElements return ScriptRuntime.emptyArgs when array length is 0 2002-05-21 20:13:30 +00:00
pschwartau%netscape.com
e952ddec96 Initial add. Regression test for bug 145779. 2002-05-20 20:37:43 +00:00
bratell%lysator.liu.se
abb8bd42b5 Bug 85267 - clear internal jsdtoa caches when closing down the js engine. Patch by steve.taylor@ndsuk.com r=khanson@netscape.com, sr=brendan@mozilla.org 2002-05-20 20:07:48 +00:00
igor%mir2.org
77af40f3ba From the email:
The attached patch adds support for debugging eval and Function code transparently. It changes omj.NativeGlobal and omj.BaseFunction to embed  line number of origin of eval and Function scripts into source name and pass 1 as base line for script code. In this way a debugger implementation can treat eval and Function code in the same way as scripts loaded from some url while giving more information about error location in case of an error in eval code as the error source would contain both line number of eval origin and line number in eval code itself.
I chose to embed line numbers via patterns like

sourcefile#<line-number>(eval)
sourcefile#<line-number>(Function)

just to be able to to pass the constructed name to URL constructor if the original sourcefile is a valid URL but it is pretty arbitrary.
2002-05-20 11:40:17 +00:00
bratell%lysator.liu.se
6778e86241 Followup to checkin for bug 120992. It asserted in an edge case which this fixes. r=mozbot 2002-05-18 17:33:37 +00:00
bratell%lysator.liu.se
911958f715 Bug 120992 - avoid expensive locking when converting numbers to strings. Now we look once for the whole operation instead of over and over again any time we access a shared structure. r=khanson@netscape.com, sr=brendan@mozilla.org. 2002-05-18 06:21:49 +00:00
nboyd%atg.com
e7a091bc74 Fix bug:
I have noticed that attempting to call a java method like this:

public void foo(String foo, Serializable bar)
{
	// un-important details
}

from script using foo("foo", "bar"); fails because the second argument
is not deemed coercable to Serializable.  A preliminary look at the
coercion code shows that no check is made in this case with
isAssignableFrom().
The to type is only tested against StringClass and ObjectClass (non
primitive case).
(See NativeJavaObject.getConversionWeight())
2002-05-18 01:57:52 +00:00
jst%netscape.com
2fdb4e3b04 Checking in jband's fix for bug 143853. Make sure to refresh the cached prototype JSObject when a context is reinitialized and a global object is reused between pages in a window. r=dbradley@netscape.com, sr=jst@netscape.com 2002-05-17 22:36:54 +00:00
igor%mir2.org
e2ae944398 In evalSpecial do not allocate int[] buffer Context.getSourcePositionFromStack if line number is already known 2002-05-16 04:18:56 +00:00
igor%mir2.org
f7a3211e91 In jsConstructor use single StringBuffer to build function source 2002-05-16 04:17:04 +00:00
igor%mir2.org
e7988e8b2e Check in generateFunctionICode for own source to pass to debugger to cover new Function(...) case where top level function is not part of surrounding script 2002-05-15 21:27:46 +00:00
brendan%mozilla.org
c2c188c8cc Checking in khanson@netscape.com's patch fixing GMT offset day-overflow (65671, r=mccabe, sr=jband). 2002-05-15 19:44:34 +00:00
dougt%netscape.com
c683a217ab Fixes mozilla/strings requiring unfrozen nsCRT class. patch by scc, r=dougt, sr=jag, b=136756 2002-05-15 18:55:21 +00:00
seawood%netscape.com
4293400e69 Because js uses static data structures and is linked into other shared libraries, js must be built as a shared library.
Thanks to Colin Blake <colin@theblakes.com> for the original patch.
Bug #127442 r=bryner
2002-05-15 01:37:07 +00:00
rginda%netscape.com
2b14f2a566 add PERL_BIN and PERL_ARGS 2002-05-14 01:44:01 +00:00
rginda%netscape.com
28d3a51f59 initial add of js api documentation source 2002-05-14 01:39:03 +00:00
igor%mir2.org
4bb3f8ada0 Elimination of FileWindow.breakpoints and Main.breakpointsMap as reference to SourceInfo provides all necessary information 2002-05-11 18:28:44 +00:00
igor%mir2.org
ba0661c493 Removing itsFirstLine and itsEndLine from InterpreterData and replacing in DebuggableScript getFirstLine, getEndLine and getIntructionLines by getLineNumbers as Debugger imlementation can get all the necessary information from single call to getLineNumbers 2002-05-11 16:15:50 +00:00
igor%mir2.org
8cb98c5dfa Implementing DebuggableScript.getInstructionLines via scanning icode array for line number icode tokens thus removing the need to call Context.setGeneratingDebug(true) to get brekable lines in the script. 2002-05-10 21:33:51 +00:00
igor%mir2.org
6d860f39e3 From email about moving breakpoint support away from Rhino core:
I attach the patch to move away setting/quering for breakpoints from the Rhino core to application as a debugger implementation can check if a particular line has a breakpoint or not. The changes to omj/tools/debugger takes more then few lines I initially thought but they are mostly caused by refactoring to implement different view to set/query breakpoints.

The patch replaces getLineNumbers, placeBreakpoint and removeBreakpoint in DebuggableScript by getFirstLine, getEndLine and getInstructionLines where the last function fills a boolean array to indicate which script lines can ever occur in DebugFrame.onLineChange. These are read-only functions so InterpeterData are never mdofied by the debugger.

omj/tools/debugger/Main uses this information to check whether it is possible to place breakpoint at a particular line, and if possible, it sets to true entry at the boolean breakpoint array. In this way testing for break in onLineChange is simple and fast as it just needs to check if breakpoint array holds true at the given line number position.
2002-05-10 16:17:33 +00:00
darin%netscape.com
6fd5862e6e fixes bug 142870 "nsIFile should use UCS-2 instead of UTF-8"
r=dougt sr=alecf
2002-05-07 23:07:19 +00:00
brendan%mozilla.org
3f518e626f Avoid toSource bloat in e.stack; fix related crash due to unrooted errObject in js_ErrorToException (139316, r=rginda, sr=shaver). 2002-05-07 08:34:51 +00:00
brendan%mozilla.org
4d9e715520 Fix old bogus static dollarStr thread-safety bug (142651, r=jband, sr=shaver). 2002-05-07 08:29:39 +00:00
bryner%netscape.com
7f766daf07 Adding the functions JS_LockGCThingRT and JS_UnlockGCThingRT, which are variants that only require a JSRuntime, not a JSContext. Converted some internal callers to use the new interface. Bug 141356, patch from shaver, r=bryner, sr=brendan. 2002-05-04 05:28:09 +00:00
pschwartau%netscape.com
8edbfc6e50 Initial add. Regression test for bug 140974. 2002-05-04 01:13:40 +00:00
igor%mir2.org
aa545a86e2 Replace when possible usage of API available only since JDK 1.2 by their JDK 1.1 analogous or by classes available in the Rhino core to make port to JDK 1.1 easier. 2002-05-03 19:42:36 +00:00
darin%netscape.com
9508d71adc fixes build bustage with --enable-xpctools
patch=dmose r/sr=darin
2002-05-03 19:04:14 +00:00
igor%mir2.org
122f8247c5 Store only single instance of any string in InterpreterData.itsStringTable and remove itsStringTableIndex and itsDoubleTableIndex from InterpreterData as they are used only during code generation 2002-05-02 21:19:43 +00:00
igor%mir2.org
43c6776e19 Allow to put null keys to ObjToIntMap and optimize Iterator not to search through key array tail after processing the last key. 2002-05-02 21:15:33 +00:00
igor%mir2.org
462217172b In remove set int key value to 0 so a new key with the same slot would get initial 0 after put(int, Object) 2002-05-02 21:11:05 +00:00
brendan%mozilla.org
bf8e80d0d1 Fix js_SetProtoOrParent to handle non-native and native-but-incompatible-class-change proto-setting scenarios (140164, r=khanson, sr=jband). 2002-05-02 20:59:35 +00:00
nboyd%atg.com
91b5becea4 Fix broken link 2002-05-01 19:21:51 +00:00
nboyd%atg.com
2fcb287555 Now pass 104077. 2002-05-01 16:47:25 +00:00
igor%mir2.org
416882ec3a Allow in UintMap for any key to hold int and object values simultaneously, as the old code could only detect that the key is allowed to hold an object value only if there are no other keys with int values. In the new version, if the key is present, it always has both int and object values, but they default to 0 or int if not specified in put. It is effectively the old behavior when the map contained at least one int key, but at least it is documented. 2002-05-01 14:10:41 +00:00
brendan%mozilla.org
30322b2b64 Don't 'constant-fold' if(false)var foo=42 into nothing (140974, r=khanson, sr=shaver). 2002-04-30 23:28:34 +00:00
igor%mir2.org
b4d17bfe98 LabelTable cleanup:
1. Targeting of labels with 0x80000000 biscuits is moved from LabelTable to ClassFileWriter as this is classfile specific and is not necessary in Interpreter.
2. LabelTable allows for pc > Short.MAX_VALUE as this restriction is classfile specific. The only requirement is for jump offsets to stay within short range.
3. LabelTable is made private member of Interpreter and ClassFileWriter instead of being classes' superclass to avoid API leakage that forced optimizer.Codegen to declare few utility methods public as they got the same signature as LabelTable methods visible throw Interpreter inheritance.
2002-04-29 19:21:57 +00:00
igor%mir2.org
ff45d81768 I replaced java.util.Enumeration type for result and arguments of ScriptRuntime.initEnum/ScriptRuntime.nextEnum by Object to allow for greater flexibility in for (...in...) implementation. 2002-04-29 17:31:11 +00:00
nboyd%atg.com
435f28cf26 Remove skip for bug 120194 2002-04-29 00:58:40 +00:00
nboyd%atg.com
4509cada43 Patch from Igor to fix 120194 2002-04-29 00:56:30 +00:00
igor%mir2.org
b41bc47f81 Do not call acquireLabel/addLabelFixup/markLabel if label is not stored in parse tree and can be resolved immediately after node subtree generation (see new addForwardsGoto and resolveForwardGoto methods) 2002-04-28 15:17:24 +00:00
igor%mir2.org
90d91c1e22 Do not allocate Label object and instead store label's PC and fixups in itsFixupTable and itsFixupTable arrays 2002-04-27 12:27:14 +00:00
igor%mir2.org
59fedca6b1 Hiding details of omj.LabelTable implementation behind new getLabelPC, addLabelFixup, fixLabelGotos and clearLabels methods and making all its fields private. 2002-04-27 09:13:28 +00:00
darin%netscape.com
e554d83626 fixes bug 129279 "nsIFile unicode/utf8/ascii task"
r=dougt sr=alecf
2002-04-27 05:33:09 +00:00
igor%mir2.org
2c519e3fb5 Refactoring interpreter initialization to follow code more easily 2002-04-26 23:18:08 +00:00
igor%mir2.org
d8b73f2048 Tab removal 2002-04-26 23:14:50 +00:00
rginda%netscape.com
6d9b0eac20 - venkman only -
bug 139883, "ErrorHookProc can be tricked into thinking it never finished running", r=peterv
fixes bad early return in jsds_ErrorHookProc
test for correct max params (12, not 8) in CreatePPLineMap
use nsnull instead of 0 for null pointer return value
2002-04-26 20:57:35 +00:00
igor%mir2.org
e497d2b898 I changed VariableTable to store arbitrary Object as variable data to avoid allocation of LocalVariable in the interpreter mode as in this case only the variable name is used and it can be stored directly. It allows to remove omj.LocalVariable and omj.optimizer.OptVariableTable for the cost of having omc.JavaVariable which omj.optimizer.OptLocalVariable implement to pass to omc.ClassFileWriter debug information about the variable. 2002-04-26 08:01:29 +00:00
jband%netscape.com
8c580862e8 fix bug 139243. Remove reference count based rooting of JS objects of wrapped natives and replace it with GC-time marking. This is a pretty good DOM performance win. r=dbradley sr=jst. 2002-04-26 06:08:35 +00:00
brendan%mozilla.org
d4e55c2951 Purge the deflated string cache entry, if any, before finalizing external strings (140070, r=jband, sr=shaver). 2002-04-25 22:55:03 +00:00
khanson%netscape.com
dd8c0773df Reverse of Patch 66477 for bug #121744. Bug #131348, r=shaver, sr=brendan. 2002-04-25 20:33:33 +00:00
igor%mir2.org
4de1175e71 Links update 2002-04-25 06:46:47 +00:00
khanson%netscape.com
d817cc069a fixes memory leak in jsdtoa.c bug 138666, sr=brendan, r=khanson 2002-04-24 23:36:48 +00:00
igor%mir2.org
0877a53dd0 I replaced Vector by ObjArray when it was used from the single thread and similarly replaced Hashatble by ObjToIntMap when it was used from the single thread to mark keys presence ignoring values. It avoids unnecessary synchronization and save memory. To simplify the replacement I added to ObjArray and ObjToIntMap few utility methods. 2002-04-24 21:37:36 +00:00
igor%mir2.org
45b366e32d Initial version 2002-04-24 07:44:52 +00:00
igor%mir2.org
10cadaaf81 Serialization change: implement only Serializable with custom readObject/writeObject instead of Externalizable not to invent own versioning support. 2002-04-23 22:39:25 +00:00
igor%mir2.org
fe448dc961 Updating the debugger to reflect changes in Rhino debug API. 2002-04-22 20:47:51 +00:00
igor%mir2.org
1d93746ffc Debugger interface changes:
1. Replacing omj.debug.Debugger.enterFrame() by omj.debug.Debugger.getFrame() and omj.debug.DebugFrame.onEnter() to allow to return null from omj.debug.Debugger.getFrame to enable full optimization with debugger set if it is not interested in monitoring a particular frame

2. Changing type for the source argument in omj.debug.Debugger.handleCompilationDone from StringBuffer to String as Debugger instances should not be able to modify source even by chance.
2002-04-22 20:46:43 +00:00
nboyd%atg.com
d3bdf13043 Implement support for new Package(<classLoader>) 2002-04-21 01:50:43 +00:00
igor%mir2.org
da6a3546f0 Removing one more time creating of bogus activation for InterpretedScript added with the previous change 2002-04-19 20:58:03 +00:00
igor%mir2.org
394848a46d Making interpreter bytecode independent from Context.isGeneratingDebug so debugger can handle scripts compiled without Context.isGeneratingDebug: if itsNeedsActivation is false with debugger present, Interpreter.interpret creates activation scope and check in variable queries/assignments if they should be made against activation object and not stack[VAR_SHIFT+...] array. 2002-04-19 07:19:07 +00:00
seawood%netscape.com
97531eb92c Add make -j support to win32 gmake builds.
Bug #132848 r=bryner
2002-04-19 02:42:28 +00:00
igor%mir2.org
794d568298 Fixing bug 137181 so after delete arguments[i], arguments[i] and corresponding function parameter in activation are not shared:
The patch uses the special NOT_FOUND value to flag deleted indexes. It also
make sure that original array object passed to Function.call is not modified,
as all changes goes to cloned copy. It is not necessary for the fix, but it is
the only place in the current Rhino that can alter Object[] array passed to
Function.call and I think it is better to remove this exceptional case.
2002-04-16 07:28:40 +00:00
igor%mir2.org
ab6d7edc2f In setAttributes(int,...) mask out unused attributes bits in the same as setAttributes(String,...) does 2002-04-16 07:24:50 +00:00
igor%mir2.org
65e2a91173 Replace VariableTable.getVariable(name) != null by VariableTable.hasVariable(name) and use ObjToIntMap in place of Hashtable 2002-04-14 21:32:19 +00:00
igor%mir2.org
b85e4660f0 Make all fields in VariableTable private and use access API to get them in optimizer/OptVariableTable to allow to change VariableTable implementation without changing its usage 2002-04-14 21:29:35 +00:00
pschwartau%netscape.com
c6332db1ed Initial add. Regression test for bug 137181. 2002-04-12 21:06:15 +00:00
pschwartau%netscape.com
d10245bf7e Updating status messages to the current format. 2002-04-12 20:23:33 +00:00
igor%mir2.org
f5de7691ed As Christopher Oliver <coliver@mminternet.com> pointed out, in many execution paths calls to Scriptable.put follows corresponding Scriptable.has with the same name/id, and although the put method implementations in ScriptableObject and IdScriptable use cache for a previously accessed name to avoid expensive name lookups, the corresponding has implementation do use the cache.
These changes add the cache optimization to the has methods and remove cache update from the put methods under the assumption that newly assigned properties would not be used immediately.
2002-04-11 21:59:45 +00:00
igor%mir2.org
050ea5f4cf As the scope parameter for the bind and getBase methods should never be null, make sure they trigger NullPointerException on "scope == null" to detect bad API usage earlier. 2002-04-11 21:36:31 +00:00
pschwartau%netscape.com
621ae10832 Adding an early return for Rhino; we only want to run this test in SpiderMonkey for now. 2002-04-11 16:11:53 +00:00
nboyd%atg.com
69e288aec4 Fix for following problem:
hi Norris,

in our product, which makes heavy use of Rhino, we have many Java Objects
we wrap with ECMAScript wrappers, which extend the ScriptableObject class
and implement the Wrapper interface. Those wrappers automagically wrap the
native Java object with the help of a WrapHandler implementation.

we now ran into a problem :

we have a java class with two overloaded static methods like this :
     public class Test {
         public static String create(File f) {}
         public static String create(Custom c) {}
     }

The Custom class exists as a native Java implementation like
     public class Custom {}

and a accompanying ECMAScript wrapper like
     public class CustomWrapper
        extends ScriptableObject
        implements Wrapper {}

in our ECMAScripts we make the wrapper class known as a host object along
the lines of
     defineClass("CustomWrapper");
and can then use the object as a normal ECMAScript host object. no big deal
and working great.

but : the code
     var s = Test.creat( new Custom( "xyz") );
fails with the information, that the methods are ambiguous, which of course
they are not.

Looking at the code of NativeJavaMethod.findFunction() and the helpers in
NativeJavaObject it seems, that the fact of the Custom host object being a
Wrapper is not taken into account. in an easy fix of
NativeJavaMethod.findFunction(), i simply replace all arguments, which are
Wrapper imlpementation by the wrapped object. this solves my problem, but
of course i'm not sure on side effects.

i attach the testcase as well as the fixed NativeJavaMethod class in the
jar file. to run the test with and without the fix, extract the jar and do
     ant test

please let me know, what you think of this.

regards and thanks, f.

Felix Meschberger
2002-04-11 12:56:24 +00:00
nboyd%atg.com
887959238b Use hasProperty rather than getProperty to avoid creation of lazily evaluated properties. 2002-04-11 12:54:16 +00:00
igor%mir2.org
f689d29f4a Move code to finalize activation setup from ScriptRuntime to NativeCall not to depend in ScriptRuntime on internals of NativeCall 2002-04-11 09:15:44 +00:00
igor%mir2.org
e555ebca97 Removal of "|| caller.originalArgs == null" in the get method as caller.originalArgs is always != null 2002-04-11 09:12:45 +00:00
pschwartau%netscape.com
774ab94e93 Adding an early return for SpiderMonkey; we only want to run this test in Rhino. 2002-04-10 22:52:26 +00:00
pschwartau%netscape.com
301e5af1d6 Improving comment. 2002-04-10 22:50:42 +00:00
pschwartau%netscape.com
ce07e9f072 Improving Rhino detection by using the new inRhino() function in the utility file shell.js 2002-04-10 22:44:14 +00:00
pschwartau%netscape.com
23d222431f Adding a utility function to detect the Rhino shell. 2002-04-10 22:39:16 +00:00
pschwartau%netscape.com
a2459dc77d Initial add. Regression test for bug 131348. 2002-04-10 22:18:32 +00:00
igor%mir2.org
f296bcee63 Removal of unused maxInstanceId (I forgot to do it during 1.20 update) 2002-04-09 23:24:19 +00:00
igor%mir2.org
4c1b0e1195 Inherit from IdScriptable to save memory on hash table structures for callee, caller and length properties and speedup arguments initialization. 2002-04-09 21:00:54 +00:00
igor%mir2.org
6169deaa3c Do not alias UniqueTag.NULL_VALUE as IdScriptable.NULL_TAG and use it directly 2002-04-09 20:58:27 +00:00
igor%mir2.org
b3d3b12044 Elimination of InterpreterData.idFunction as it duplicate InterpreterData.itsFunctionType != 0 2002-04-09 18:19:01 +00:00
igor%mir2.org
548e050b50 Use int instead of byte for type of FunctionNode.itsFunctionType to have less (byte) casts. 2002-04-09 18:16:48 +00:00
igor%mir2.org
5bb1c2ac17 In Interpreter.interpret move initialization of debug frame after the setup of nested functions so they are visible to debugger on debug frame creation 2002-04-08 21:52:10 +00:00
nboyd%atg.com
a81c4b5ada Hi Norris,
I think there's a small problem with Igor's changes.  The modifed Interpreter.java
seems to create unnecessary activation objects for InterpretedScripts.  You can
see this in the debugger (local variables are present even for top level scripts).
I believe the attached change will fix the problem.

Regards,

Chris
2002-04-08 15:54:57 +00:00
igor%mir2.org
ed22f7158e Proprty access cleanup: use ScriptableObject.get/set/hasProperty to get/set/query properties on the prototype chain in ScriptRuntime to avoid code duplication 2002-04-08 08:19:21 +00:00
igor%mir2.org
6bbac51c73 In NativeObject.toSource and NativeArray.toStringHelper methods set cx.iterating to null when done to prevent Hashtable with potentially ever growing internal buffers to lay around. Use ObjToIntMap instead of Hashtable for cx.iterating, it servers the same purpose as using JDK 1.2 HashSet, but without breaking 1.1 compatibility. 2002-04-08 08:15:23 +00:00
igor%mir2.org
760e4b4196 Clear jiles warning:
VariableModel.java:220:30:220:40: Caution: This try block cannot throw a "checked exception" (JLS section 14.7) that can be caught here. You may have intended to catch a RuntimeException instead of an Exception.
2002-04-06 17:33:33 +00:00
igor%mir2.org
3b5657f132 This was for the very old implementation. Nothing there is relevant now 2002-04-06 14:34:56 +00:00
igor%mir2.org
8975e9eb32 Uodate with info on Break on Function Enter/Exit options 2002-04-06 14:18:32 +00:00
igor%mir2.org
c31e40fc89 From the email about debug API changes:
Changes to omj.tools.debugger are mostly due to renames and refactoring, the new code is limited to ContextData class which contains simplified version of the code for DebugFrame stack from the current DebuggableEngineImplementation and FrameHelper class implementing DebugFrame.
2002-04-06 13:57:24 +00:00
igor%mir2.org
b3d321243c From the email about debug API changes:
...
The idea is to make Debugger responsible for creation of DebugFrame in
Interpreter.interpret which gives simple way for a Debugger implementation to
observe function enter/exit while completely removing the need to have code
for debug frame stack in the Rhino core as the Debugger implementation can
easily support this on its own when necessary. So I suggest to have:

public interface Debugger { ... }

and

public interface DebugFrame { ... }

which eliminates omj.InterpreterFrame and as DebuggableEngine shrinks down to
3 methods set/getDebugger and getDebuggerContextData, I simply moved them to
Context. The 3rd method is useful to refer to per Context debug data from a
Debugger implementation, but it can be removed as well as the same effect can
be achieved via Context.set/getThreadLocal.
2002-04-06 13:54:48 +00:00
igor%mir2.org
a070528256 When re-throwing exception in Interpreter.interpret, always use original caught exception object, not exception it wraps as in the case of WrappedException instances 2002-04-06 05:58:23 +00:00
nboyd%atg.com
ecd8a089b7 Makefiles no longer supported: use Ant. 2002-04-06 01:56:50 +00:00
bnesse%netscape.com
56adb62c30 Fix for smoketest blocker 135697. Bump up version on the compiler test to force JS to be compiled with opt level 2. a=leaf. 2002-04-05 19:06:29 +00:00
brendan%mozilla.org
3f8594ea0e Forgot to #ifdef JS_THREADSAFE last change (no effect on Mozilla build; fixes broken standalone/single-threaded JS builds, sanity-sr=shaver). 2002-04-04 18:02:59 +00:00
brendan%mozilla.org
e424e842c6 Followup fix to synchronize with a nt-last-destroy-context racing GC when unpinning pinned atoms (133773, r=shaver, sr=jband, a=rjesup). 2002-04-03 20:38:39 +00:00
nboyd%atg.com
dab3f9ac65 Added support for a DebuggableObject interface that can be implemented for
non-ScriptableObject implementations of Scriptable.

I checked in fixes for the problems of serializing objects with FunctionObjects or
GetterSlots. With Foo.class in the current directory, I can now do:

[rhino] java -classpath 'build/rhino1_5R4pre/js.jar;.' org.mozilla.javascript.tools.shell.Main
Rhino 1.5 release 4 0000 00 00 (in progress)
js> defineClass("Foo")
js> f = new Foo
[object Foo]
js> print(f.counter)
0
js> print(f.counter)
1
js> serialize(f, "f.ser")
js> quit()
[rhino] java -classpath 'build/rhino1_5R4pre/js.jar;.' org.mozilla.javascript.tools.shell.Main
Rhino 1.5 release 4 0000 00 00 (in progress)
js> f = deserialize("f.ser")
[object Foo]
js> f.counter
2
js> f.counter
3
2002-04-03 01:55:50 +00:00
nboyd%atg.com
8fc68d6900 Fixed problem with -opt 9:
Hi Norris,

I encountered the following exception with the below script in compiled
mode with RhinoLatest.zip:

java.lang.NullPointerException
 at
org.mozilla.javascript.optimizer.Codegen.visitCall(Codegen.java:1790)
 at
org.mozilla.javascript.optimizer.Codegen.generateCodeFromNode(Codegen.java:567)

 at
org.mozilla.javascript.optimizer.Codegen.visitReturn(Codegen.java:2283)
 at
org.mozilla.javascript.optimizer.Codegen.generateCodeFromNode(Codegen.java:592)

 at
org.mozilla.javascript.optimizer.Codegen.generateCodeFromNode(Codegen.java:546)

 at
org.mozilla.javascript.optimizer.Codegen.generateCodeFromNode(Codegen.java:546)

 at
org.mozilla.javascript.optimizer.Codegen.generateCodeFromNode(Codegen.java:546)

 at
org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:497)
 at
org.mozilla.javascript.optimizer.Codegen.generateFunctionInits(Codegen.java:1292)

 at
org.mozilla.javascript.optimizer.Codegen.generateInit(Codegen.java:1186)

 at
org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:481)
 at org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:88)
 at org.mozilla.javascript.Context.compile(Context.java:1965)
 at org.mozilla.javascript.Context.compile(Context.java:1874)
 at org.mozilla.javascript.Context.compileReader(Context.java:895)
 at org.mozilla.javascript.Context.evaluateReader(Context.java:813)
 at
org.mozilla.javascript.tools.shell.Main.evaluateReader(Main.java:318)
 at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:309)
 at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:248)

 at org.mozilla.javascript.tools.shell.Main.exec(Main.java:95)
 at org.mozilla.javascript.tools.shell.Main.main(Main.java:68)
Exception in thread "main"

function tak(x, y, z, k) {
    if (!(y < x)) {
        return k(z);
    } else {
        return tak(x - 1,
                   y,
                   z,
                   function(v1) {
            return tak(y - 1,
                       z,
                       x,
                       function(v2) {
                return tak(z - 1,
                           x,
                           y,
                           function(v3) {
                    return tak(v1, v2, v3, k);
                });
            });
        });
    }
}

function cpstak(x, y, z) {
    return tak(x, y, z, function(a) {return a;});
}

//;;; call: (cpstak 18 12 6)

//(run-benchmark "CPSTAK" (lambda () (cpstak 18 12 6)))

var start = new Date();
var res = cpstak(18, 12, 6);
var end = new Date();
print(res +": elapsed: " + (end - start));
2002-04-03 01:20:27 +00:00
beard%netscape.com
8f9516a234 Fixes an installer crash on pre-PCI PowerMacs, bug # 125411. sr=sfraser, r=sdagley, a=asa 2002-04-02 23:27:55 +00:00
colin%theblakes.com
9b779d9dd5 Do not define MODULE_NAME for components which are shareable even in
static builds.
b=134650 r=cls sr=dveditz a=asa
2002-04-02 13:36:56 +00:00
seawood%netscape.com
090c63d423 More cruft removal. Remove platform.h xp_debug.h xpassert.h & xp_trace.h from the build.
Replace currently unused references to XP_ASSERT with one of NS_ASSERTION & friends.
Bug #38061 r=bryner sr=alecf a=tor/drivers a=putterman/adt
2002-04-02 07:57:02 +00:00
brendan%mozilla.org
0555817eef Fix next-to-last vs. last context GC race, plus ClaimScope vs. js_DestroyContext race; removed js_ForceGC from the FRIEND JS API (133773, sr=jband&shaver, a=asa). 2002-04-02 04:23:21 +00:00
nboyd%atg.com
750bfdb52c Patch from Chris Oliver:
Hi Norris,

Can you check in the attached Main.java which works around a problem with using
JTreeTable in JDK 1.4.

Thanks,

Chris
2002-04-01 22:12:11 +00:00
seawood%netscape.com
2d941f53cc Do not set EXPORT_LIBRARY for libs that we do _not_ want in the static link list.
Bug #134012 r=rjesup sr=dveditz a=leaf
2002-03-30 01:46:52 +00:00
pschwartau%netscape.com
70dfff7f09 Correcting mistake in location of JS2 debug shell on Windows. 2002-03-30 00:35:16 +00:00
pschwartau%netscape.com
66b70399fe Added another big function to compile, from duplicate bug 133897. 2002-03-29 15:46:09 +00:00
sfraser%netscape.com
85b2719aac Bug 133412: Changes to allow for upgrading to CodeWarrior Pro 7.2 tools -- depending on the tools version, remove the clamp on the optimization level, since the optimizer bug is fixed. r=sdagley, sr=scc, a=asa 2002-03-27 04:10:46 +00:00