Граф коммитов

1338 Коммитов

Автор SHA1 Сообщение Дата
igor%mir2.org e7c259d18c The code to deal with caught Java exceptions and transfer control to script finally/catch is transfered to CATCH bytecode which is now always added to the and of script bytecode. In this way if Context.observeInstructionCount throws an exception, a proper cleanup to restore Interpreter runtime will still be carried out. It also allowed to transfer control directly to catch/finally code when script call throw instead of throwing Java exception just to capture it immediately.
This special CATCH bytecode is a simple way to workaround lack of goto in Java which makes writing interpreters more complex then necessary...
2003-06-30 19:31:44 +00:00
igor%mir2.org 6edb24a69c Added ScriptRuntime.getCatchObject() for extracting JS object to pass as the argument to JS catch statement. 2003-06-30 19:21:41 +00:00
igor%mir2.org e9a24f4c38 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=210682 :
A slightly modified version of Brian Gugliemetti fix for bad interaction in TokenStream.getToken()/peekTokenSameLine() when dealing with EOL.
2003-06-30 19:18:31 +00:00
igor%mir2.org be6ac6dc93 Removal of deprecated DefiningClassLoader 2003-06-29 22:32:52 +00:00
igor%mir2.org c3de7c7797 Exception handling cleanup: use CATCH bytecode to extract JS object from Trowable so any exception that happens during this process will be handled properly. 2003-06-29 22:12:48 +00:00
igor%mir2.org fb888bfa6d Cosmetics: removal of unused import 2003-06-29 21:58:01 +00:00
igor%mir2.org 6434e11894 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=208293 :
Patch from Steve Beal to fix my bug in Context.readReader.
2003-06-11 13:27:23 +00:00
igor%mir2.org 7e7475f7b5 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=207999 :
EcmaError constructor now takes a generic Scriptable and not NativeError so classes outside org.mozilla.javascript can use it.
2003-06-11 07:36:11 +00:00
igor%mir2.org 64c08e0506 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=207968 :
As suggested by Roland Knight, WrappedException does not call exception.fillInStackTrace() to prevent hiding of the original stack trace.
2003-06-11 07:33:22 +00:00
igor%mir2.org 228ed52ca0 To store properties, replace UintMap by a linked list. The former creates 2 objects (UintMap itself and int array) to store int properties and 3 objects (additional object array) to store object properties but vast majority of Nodes has no more then 2 properties with single-property-node contributing most to the majority. 2003-06-02 06:35:57 +00:00
igor%mir2.org 413322eb2a Pass IRFactory to Parser.parse instead of Parser constructor so Parser initialization would not require IRFactory which needs Interpreter in turn . 2003-05-21 12:09:08 +00:00
igor%mir2.org 60d7e7b824 Layout cosmetics 2003-05-21 11:48:32 +00:00
igor%mir2.org 66d047350d Added WrapFactory.wrapAsJavaObject to simplify customization of LiveConnect 2003-05-20 12:46:09 +00:00
igor%mir2.org 8368c94269 Adding missed final qualifier to the declaration of js_NaN_date_str field 2003-05-20 08:10:48 +00:00
igor%mir2.org c6db00699d Addition of seal function to Rhino shell to seal all supplied arguments. 2003-05-19 15:53:23 +00:00
igor%mir2.org 335b23c60e Resolving http://bugzilla.mozilla.org/show_bug.cgi?id=203013 :
Changing behavior of sealed objects to throw an exception on any attempt to modify them including changing values of existing properties. In the same time making object sealed does not affect read-only status of its properties which allows to override properties of objects with a sealed object as a prototype.

Rhino shell now accepts -sealedlib option to seal all standard objects.
2003-05-16 14:25:57 +00:00
igor%mir2.org 8795bde8a6 Optimizations in NativeDate mostly to reduce amount of various format strings runtime has to initialize. 2003-05-16 08:32:58 +00:00
igor%mir2.org 5c174e00c9 NativeObject is split into NativeObject and NativeObjectPrototype subclass not to have prototypeFlag field in each and every object instance. 2003-05-15 13:12:41 +00:00
igor%mir2.org 3a4259f580 Resolving http://bugzilla.mozilla.org/show_bug.cgi?id=205661 :
In setBySetter when start != this setters with delegators and setters without one if start is not an instance of this class are not invoked on start. Instead the standard JS rules applies so x.a = 1 would not change a in x.__proto__ if a in x.__proto__ is controlled by setter.
2003-05-15 07:29:46 +00:00
igor%mir2.org 83a3ee7978 In getByGetter/setBySetter with slot.delegateTo avoid potentially expensive checks for start type if this == start. 2003-05-14 14:51:00 +00:00
igor%mir2.org d61a682a8d Changing JavaAdapter not to define JavaAdapter.prototype since new JavaAdapter create JS objects with __proto__ pointing to Object.prototype. It removes the need to extend from ScriptableObject in JavaAdapter and effectively makes it a collection of static methods.
To implement JavaAdapter JS call I used JIFunction subclass so the method implementing this functionality can be package private.
2003-05-14 12:44:24 +00:00
igor%mir2.org 2db5b5aa69 More layout fixes and renames to make the following commit smaller. 2003-05-14 09:45:59 +00:00
igor%mir2.org b48900f554 In jsConstructor catch reflection exceptions and rethrow them as WrappedException not to create InvocationTargetException proxy that will be converted to WrappedException by the runtime in any case. 2003-05-14 09:37:39 +00:00
igor%mir2.org 6e8c35eed6 Removal of overridden equals that simply calls super.equals since JavaAdapter does not need to define the method for ScriptableObject.defineClass to work and layout cosmetics. 2003-05-14 06:24:00 +00:00
igor%mir2.org 49a339a54b Replace catch for various exceptions that reflection methods can throw by single catch (Exception ex) to have smaller code. 2003-05-13 10:07:44 +00:00
igor%mir2.org 4249f507ee Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=205297 2003-05-12 16:54:41 +00:00
igor%mir2.org 5e2e66cdab Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=201896 :
New helper class JIFunction for easy implementation of JS functions in Java without using reflection and its usage in ImporterTopLevel and NativeJavaPackage
2003-05-06 18:59:22 +00:00
igor%mir2.org f8bd7bf48c Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=204210 2003-05-06 18:53:16 +00:00
nboyd%atg.com c496d0ae06 Fix suggested by Bojan Cekrlic in Bugzilla Bug 203752:
While you are messing arround with JavaScriptException, is it possible to add

if(value instanceof Throwable) {
	initCause((Throwable) value);
}

I know it's a Java 1.4 feature and not directly connected to this bug and don't
know what's the Rhino's policy of supported Java versions, but it in the end it
could be done with method.invoke() or something similar.

This would help debugging a lot.
2003-05-06 16:56:38 +00:00
igor%mir2.org f7808560ee Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=204513 2003-05-06 15:29:36 +00:00
igor%mir2.org d9ff563fdb Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=204576
Using (x instanceof Wrapper) instead of (x instanceof NativeJavaObject) which replaces the previous fix of unwrapping NativeJavaObject.call arguments for the custom wrappers problem.
2003-05-06 10:51:24 +00:00
igor%mir2.org c4883770d2 Cosmetics: removal of NativeJavaObject. prefix when calling NativeJavaObject methods. 2003-05-05 16:15:50 +00:00
igor%mir2.org 0ec8c3be9c When marking parse tree nodes as special calls, use explicit integer id to specify node type, note a generic boolean flag. It would allow for simpler code during special calls evaluation. 2003-05-02 14:00:19 +00:00
igor%mir2.org 6db53c35e3 In ScriptRuntime.callOrNewSpecial remove special handling of exec calls since it is never used. 2003-05-02 12:16:05 +00:00
igor%mir2.org 1460a34ed2 Simpler code in Codegen.visitRegularCall to select which runtime method to call. 2003-05-02 11:34:05 +00:00
igor%mir2.org f22082da7c Cosmetics: tabs and end-of-line whitespace removal 2003-05-02 10:27:56 +00:00
igor%mir2.org 4fa57f3d80 More comments on IdFunction.createObject and layout cosmetics. 2003-05-01 10:34:19 +00:00
igor%mir2.org 811cae74fb Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=203909 :
1. Reorganization of BaseFunction.construct to always call createObject to avoid the need to re-implement construct in IdFunction and FunctionObject when much simpler code for subclassing createObject will do the job.

2. Throwing TypeError in IdFunction.createObject if it is not marked explicitly as constructor to satisfy EcmaScript standard:

first page of ECMAScript Edition 3, chapter 15: "None of the built-in
functions described in this section shall implement the internal
[[Construct]] method unless otherwise specified ...."

For more details, see http://bugzilla.mozilla.org/show_bug.cgi?id=202019
2003-05-01 10:22:58 +00:00
igor%mir2.org 4b63a150a1 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=203841 :
To fix the issue I moved away from generateCodeFromNode code to merge boolean
checks and conditional jumps into separated generateIfJump method that tries to
apply this optimization and if it is not possible, it calls
generateCodeFromNode and adds a generic jump.
2003-05-01 10:07:23 +00:00
igor%mir2.org 341ffcaf63 Implement Serializable by recently introduced ImporterFunctions as this is required for scope serialization. 2003-04-29 13:56:57 +00:00
igor%mir2.org 507f6e1571 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=203752 :
NativeGlobal implements Serializable to allow scope serialization.
2003-04-29 13:54:22 +00:00
igor%mir2.org 7aef73e908 Renaming getIdDefaultAttributes to getIdAttributes in IdScriptable and its descendants to better reflect method semantic change in the previous IdScriptable commit plus layout cosmetics. 2003-04-29 12:06:17 +00:00
igor%mir2.org 0b0e3d9fb7 Removal of support for altering attributes of id-based properties. If such support is required, a subclass should override IdScriptable.setIdAttributes which by default throws an runtime exception unless new attributes are the same as the old ones. 2003-04-29 08:54:55 +00:00
igor%mir2.org 9cde635841 IdScriptable.nextInstanceCheck is replaced by IdScriptable.incompatibleCallError to reflect proper semantic and simplify id-related code. 2003-04-28 16:27:57 +00:00
igor%mir2.org 5dc7316f87 Replacing protected by private/package private to allow for better optimization. 2003-04-28 12:54:59 +00:00
igor%mir2.org 9e9fa17082 Removal of unused private static SEAL_FUNCTIONS_FLAG 2003-04-28 12:53:15 +00:00
igor%mir2.org 9cf97b6988 Replacing prototypePropertyAttrs by simple boolean flag isPrototypePropertyImmune for simpler code. 2003-04-28 12:52:21 +00:00
igor%mir2.org 65790b9103 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=203402 :
In Codegen do not pass trueLabel, falseLabel to recursive
generateCodeFromNode from ADD node and use -1 , -1 instead to indicate non-jump node.
2003-04-28 09:50:56 +00:00
igor%mir2.org 03ffd6752b Restoring toStringTreeHelper functionality to print nested functions as a part of the tree. The regression was caused by changes to store function reference as index and not function node. 2003-04-28 09:44:19 +00:00
igor%mir2.org d6cb9bf88b In debug mode print instruction names, not their bytecode values. 2003-04-27 08:12:18 +00:00
igor%mir2.org 3aafae2f86 1. Consistently use ScriptRutime.<ClassName>Class instead of Classname.class to decrease code size and loading time
2. Small optimization in ScriptRuntime.toNuber
2003-04-26 12:01:38 +00:00
igor%mir2.org 8113ba21d9 Deprecation of toObject in Context and ScriptRuntime forms that takes a static type argument.
The static type argument to toObject is effectively never used since it always assumes that instances of String, Number and Boolean represent primitive JS values and handled via ScriptRuntime.newObject and in the rest of cases static type was not checked by WrapFactory.
2003-04-25 10:08:44 +00:00
igor%mir2.org 38b60c25d7 More comments about NativeJavaMethod.findFunction requirements 2003-04-24 17:16:21 +00:00
igor%mir2.org f87766bec4 Changing NativeJavaClass.construct and NativeJavaMethod.call not to modify passed argument array with unwrapped values. Instead a new array is allocated if any unwrapped value would be different from the original JS argument. 2003-04-24 17:13:57 +00:00
nboyd%atg.com 4b1dee847c Add new document on scripting java. 2003-04-24 13:14:00 +00:00
igor%mir2.org adbcef8ac9 Resolving http://bugzilla.mozilla.org/show_bug.cgi?id=203013 :
Changing semantics of a sealed object to mean that all its properties are ReadOnly in addition to DontDelete.
2003-04-24 12:15:30 +00:00
igor%mir2.org b2420d4dec Resolving http://bugzilla.mozilla.org/show_bug.cgi?id=202872 :
public static Method[] findMethods(Class clazz, String name)

is replaced by

static Method findSingleMethod(Method[] methods, String name)
2003-04-24 12:08:23 +00:00
igor%mir2.org 3f7db604b7 Replacing try { cast } catch (ClassCastException ex) { action if not instance } by if (instanceof) { } else { action if not instance }.
Such optimization wins very little with modern JVMs if cast succeeds and produces very big overhead if cast fails. Moreover, it may prevent jits from doing more aggressive optimizations and makes class files bigger.

The change also made code in many places smaller since insanceof check take ensure that object is not null as well and with ClassCastException such check had to be done explicitly.
2003-04-23 14:47:09 +00:00
igor%mir2.org 27f1930196 Removal of support for special handling of this for read-only methods exposed by IdScriptable under dynamic scoping. It was never used and its semantic had little to do with dynamic scoping itself. 2003-04-22 16:09:40 +00:00
nboyd%atg.com 6dad9c8e6d Update for 1.5R4.1. 2003-04-22 00:27:10 +00:00
igor%mir2.org d7e2bd92bd Resolving http://bugzilla.mozilla.org/show_bug.cgi?id=202255 :
Support for pre 1.5R1 rules for defining JS classes by ScriptableObject.defineClass is removed.
2003-04-21 23:53:24 +00:00
nboyd%atg.com a35bc69e51 Fix bug 202344 (which was not fully fixed by the previous change.) 2003-04-21 19:43:45 +00:00
nboyd%atg.com 9bf962a79e Fix bug 202344. 2003-04-21 14:59:22 +00:00
nboyd%atg.com 13da7c74ae Restore method used by Batik. 2003-04-21 13:38:49 +00:00
igor%mir2.org 393606bb3f FunctionObject changes:
1. Disable invoker optimization for methods with variable number of arguments since currently to call optimized invoker a new argument array has to be allocated in any case which makes the optimization irrelevant.

2. Never modify elements of the args array in constructor, instead avoid allocation of the new argument array iff all js argument can be passed to java without type conversion.
2003-04-16 13:05:48 +00:00
igor%mir2.org d37001ed6e In NativeString.js_concat in the case of single argument call target.concat(arg) to avoid allocating StringBuffer instance. 2003-04-16 12:51:20 +00:00
igor%mir2.org f5bea75e19 In callVarargs to test if it is called from construct use thisObj==null condition instead of using separated flag. 2003-04-15 18:45:57 +00:00
igor%mir2.org fe0dcfe65f Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=200551 :
I added Context.getApplicationClassLoader() that is now used in all
cases as a parent loader for generated classes and as the default class loader
for NativeJavaPackage. The default implementation tries to use
Thread.getContextClassLoader, but only when it is available and if Rhino
classes is available through it. Otherwise the loader for Context instance is
used. In this way if Rhino is loaded through a custom loader, it will be used,
and if Rhino classes are placed in lib/ext,  Thread.getContextClassLoader still
give the application loader.

And if this default policy would not work in a particular application,
Context.getApplicationClassLoader() can be overridden to in that application.
2003-04-15 07:48:18 +00:00
igor%mir2.org 8c7fe87c7e Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=201989 :
use IdFunction.initAsConstructor to initialize Error constructors in
NativeGlobal.init and remove setFunctionType and corresponding getFunctionType in IdFunction and use a simple private boolean field there to mark functions that can be called as constructors since NativeGlobal.init was the only place that used that.
2003-04-15 07:43:30 +00:00
igor%mir2.org 99d83af296 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=201987 :
Use toObject() in ScriptRuntime.delete to convert non-Scriptable delete target to Object which required to pass Context and scope to the method and update Interpreter and optimizer/Codegen accordingly.
2003-04-15 07:33:17 +00:00
igor%mir2.org fedeaf5b90 Duplicated code from IdFunction and FunctionObject to initialize prototype and scope of the result of call invocation when it is used as a part of constructor code is moved to a utility method initCallResultAsNewObject in BaseFunction. 2003-04-14 14:38:04 +00:00
igor%mir2.org 1771cf5e7c Replace code to generate:
if (val != null && val != Undefined.instance && val instanceof Scriptable) ...

by code to generate:

if (val instanceof Scriptable && val != Undefined.instance) ...

since (val instanceof Scriptable) => (val != null)
2003-04-14 13:53:18 +00:00
igor%mir2.org a29c7a81fa Instead of using the special _packages_ properties to store imported packages, use a field in ImporterTopLevel for simpler code. 2003-04-13 10:57:06 +00:00
igor%mir2.org c012edd6f6 Switch to use IdFunction to define ImporterTopLevel script methods. A separated class is used to implement IdFunctionMaster interface to avoid interface clashes with possible ImporterTopLevel subclasses implementing the same interface. 2003-04-13 08:57:57 +00:00
igor%mir2.org ca7b131ae5 1. In NativeJavaPackage.init define global properties only when NativeJavaPackage instance is fully initialized.
2. Memory optimization: instead of string array for predefined known packages, use single string which is split into substrings when necessary.
2003-04-13 08:54:09 +00:00
igor%mir2.org ef61833bb1 Switch to use the new utility IdFunction.define() method to define function properties instead of explicit code for function initialization and inlining of getMethod call since it is used only once to make code smaller. 2003-04-13 08:47:19 +00:00
igor%mir2.org b0a14f7279 I added static IdFunction.define utility method to define IdFunction instances as properties in the given scope. 2003-04-13 08:40:43 +00:00
igor%mir2.org 8b1123e397 Switch to use ClassFileWriter.addInvoke() taking full method signature including the result part as a single argument instead of deprecated 4-argument ClassFileWriter.add(). 2003-04-13 08:38:52 +00:00
igor%mir2.org f426f26c1d Commiting Hannes Wallnoefer patch to allow LiveConnect to convert JS Date to Java Data, see http://bugzilla.mozilla.org/show_bug.cgi?id=201326 2003-04-12 10:48:39 +00:00
igor%mir2.org 729a139dc3 Working on http://bugzilla.mozilla.org/show_bug.cgi?id=198208 :
I removed deprecated methods to access ClassNameHelper functionality through Context instance.
2003-04-01 14:52:27 +00:00
igor%mir2.org 64af9c759b Work for http://bugzilla.mozilla.org/show_bug.cgi?id=198208 :
I removed deprecated since 1.5R3 omj.ClassOutput and moved some of code from omj/ClassNameHelper.java to omj/optimizer/OptClassNameHelper so if one does not need the optimizer package, the jar will be smaller.
2003-04-01 11:39:08 +00:00
igor%mir2.org 9e16916a56 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=199051 :
Initialize invoker in FunctionObject constructor, not during first call and catch possible SecurityException. In this way initialization will happen without script code on java stack which may not have permissions to create class loaders.
2003-03-31 13:18:04 +00:00
igor%mir2.org 2c0d284a12 Removal of deprecated SecuritySupport as a part of work on 198208. 2003-03-31 08:43:40 +00:00
nboyd%atg.com 0d0a9b51e2 change to 1.5R5 prerelease 2003-03-25 19:13:29 +00:00
nboyd%atg.com 3532c8b351 Switch to 1.5R5pre. 2003-03-25 19:11:58 +00:00
igor%mir2.org 9a1096723f Added ScriptRuntime.newInstanceOrNull to call class.newInstance() and return null if it fails. It allows to replace in few places try/3 different catch by a simple method call. 2003-03-20 15:46:37 +00:00
igor%mir2.org 591352c0ed Make ScriptRuntime.getClassOrNull() package private and use it in place of Class.forName() to avoid ever catching ClassNotFind and Security exceptions. 2003-03-19 19:04:24 +00:00
igor%mir2.org 071e6626a2 Removal of deprecated classes from the list of API docs 2003-03-19 14:14:29 +00:00
igor%mir2.org d8a4f2b19c Fixing JavaSoc documentation tag usage 2003-03-19 14:13:41 +00:00
igor%mir2.org cdf7a42c64 For concatenation of 2 strings that are not null use str1.concat(str2) instead of str1+str2 to avoid construction of temporary StringBuffer all together. 2003-03-19 12:36:48 +00:00
igor%mir2.org ec1028b7f8 Use ClassFileWriter.addInvoke to add method invocation code instead of deprecated 4-argument ClassFileWriter.add() to avoid unnecessary string concatenation to build full method signature from parameter and result signatures. 2003-03-19 11:19:21 +00:00
igor%mir2.org fde8484707 Use ClassFileWriter.addInvoke() instead of ClassFileWriter.add() to add method calls to avoid string concatenation when constructing full method signature from separated parameter and return signatures. 2003-03-17 12:39:19 +00:00
igor%mir2.org 11821416bb A version of the add method to add an invoke bytecode is deprectaed in favor of addInvoke that takes a full method signature in place of separated parameter and result signatures. It allow not use a string concatenination to build a full signature. 2003-03-16 17:45:34 +00:00
igor%mir2.org f05f484947 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=197682 :
replace static fields to hold targets of direct call optimization by an instance fields in the class representing the main script object.
2003-03-16 13:53:41 +00:00
igor%mir2.org 52b3708d95 1. When generating various support methods like script main, function constructor etc., use classFile.startMethod instead of startNewMethod since the later is intended for generation of main code for script/function.
2. Do not use trivialInit optimization for scripts since the following changes makes generation of initScript function mandatory.
2003-03-14 10:05:01 +00:00
igor%mir2.org c40f2bfc54 Inlinning of generateRegExpLiterals into generateInit for simple code 2003-03-13 22:50:04 +00:00
igor%mir2.org 203b0ffbd9 I changes ClassFileField to store its attribute as simple short fields to avoid allocation of short[4] array for each field. 2003-03-13 14:03:03 +00:00
igor%mir2.org bc7b9d73d8 I replaced explicit encoding of int, long and short values into byte arrays by new utility methods putInt16, putInt32, putInt64 2003-03-13 13:59:02 +00:00
igor%mir2.org 514bf87a5c 1.More checks are added for bad usage of ClassFileWriter methods.
2. Hashtable is replaced by ObjToIntMap or UintMap to minimize memory usage.

3. Converting of strings to utf8 encoding is coded  explicitly to avoid overhead  of creating many objects.
2003-03-13 09:31:01 +00:00
igor%mir2.org ec5530c862 Making class public 2003-03-13 07:52:07 +00:00
igor%mir2.org c157c1a306 Removal of generation of non-operational dup/pop when creating function objects for function statements. 2003-03-12 09:39:16 +00:00
igor%mir2.org bb0cf4e75a Fixing a regression in Codegen.transform which effectively disabled direct call optimization: FunctionNode.FUNCTION_STATEMENT should be compared against fn.getFunctionType(), not fn.getType() 2003-03-11 17:17:57 +00:00
igor%mir2.org 30a59ec178 Introduction of Codegen.mainCodegen to hold the main generator object and layout cosmetics. 2003-03-11 10:01:32 +00:00
igor%mir2.org 546ec4d6df Use (size + 31) >> 5, not (size >> 5) + 1 as a size for int array buffer so in the case when size % 32 == 0 array would not hold a never used tail element. 2003-03-11 09:59:39 +00:00
igor%mir2.org 6d4df4405d 1. Consistently use Context.inFunction and Context.fnCurrent instead of calling instanceof/cast for OptFunctionNode on Context.scriptOrFn
2. Removal of Codegen.superClassSlashName field since Codegen.superSlashName since it is never used as a part of a signature and ClassFileWriter converts . into / in type name automatically.
2003-03-11 07:25:13 +00:00
igor%mir2.org 9be8d46c8f Since NodeTransformer.transform(tree) never replaces tree, change its signature to return void which allows to eliminate ScriptOrFnNode.replaceFunctionNode. 2003-03-10 20:26:58 +00:00
igor%mir2.org d64c42ff29 Simplification of optimized node transformer: search for direct call optimization targets in Codegen.transform before constructing ObjTransformer instance to avoid additional checks for top-level script in ObjTransformer.transform 2003-03-10 20:24:06 +00:00
igor%mir2.org 51de1c8d84 Added API to make array read only, after which any attempt to modify it will trigger RuntimeException 2003-03-10 20:19:22 +00:00
igor%mir2.org 1acdc5f2f0 1. Removal of unused fields and methods:
Codegen.java:
-    private int ordinal;
-    private short scriptRuntimeIndex;
-    private short debug_pcLocal;
-    private short debugStopSubRetLocal;

OptFunctionNode.java
-    private ObjArray itsDirectCallTargets;
-    void addDirectCallTarget(FunctionNode target) {
-    ObjArray getDirectCallTargets() {

2. Better naming and method moves in Codegen.java for better readability
2003-03-10 17:46:32 +00:00
igor%mir2.org 4540bdf06a Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=196017 :
Use Thread.getContextClassLoader() as the last resort when searching for classes.
2003-03-06 09:29:00 +00:00
igor%mir2.org 39dbbb0550 Integration of VariableTable into ScriptOrFnNode to avoid the need to have a separated wrapper class around ObjArray/ObjToIntMap 2003-03-04 15:10:20 +00:00
igor%mir2.org c63cb1b35a Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=96270 :
proper implementation of Scriptable.has in ImporterTopLevel and NativeJavaPackages
2003-02-25 09:17:43 +00:00
igor%mir2.org 8ebcc7f9af Fix http://bugzilla.mozilla.org/show_bug.cgi?id=194364:
no assignment of function expression statements to script result
2003-02-25 09:15:08 +00:00
igor%mir2.org e12bd87db4 Parsing changes: for regular expression literals construct a tree node with regular expression number during parsing instead of generating a special subtree that is converted to such node during tree transformation. 2003-02-20 13:11:21 +00:00
igor%mir2.org dc46d02971 Praising changes: remove direct access to VariableTable in ScriptOrFnNode and instead provide methods to access its functionality. In this way VariableTable can be changed without affecting the rest of code. 2003-02-20 09:18:12 +00:00
igor%mir2.org 1af98b56aa More parser internal changes: move all logic to initialize variable table to ScriptOrFnNode.finishParsing and its overrides in FunctionNode/OptFunctionNode so it will be constructed during parsing to avoid checks for function types in NodeTransformer. 2003-02-19 23:50:42 +00:00
igor%mir2.org 69801b0254 During parsing collect all nested function in script or function directly into array in ScriptOrFnNode. In this way there is no need to walk over tree to find nested functions during tree transformation since the function nodes are available directly. 2003-02-19 14:50:30 +00:00
igor%mir2.org 449d35d64e Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=193700 :
Attempts to access/modify properties of null or undefined are explicitly checked to include in error messages the property name so it would be possible on error in x.y.z to know if it is x or y that was undefined or null.

Inspired by suggestion from Russell Gold.
2003-02-19 08:51:51 +00:00
igor%mir2.org f015d87d5f Allow to set null for sourceName, encodedSource and originalSource 2003-02-18 00:52:34 +00:00
igor%mir2.org 3f0b27bbf6 Store number of locals as a field in ScriptOrFnNode and not as int node property. 2003-02-17 17:41:04 +00:00
igor%mir2.org 93721f0a59 Store function array inside ScriptOrFnNode as field, not as a node property. 2003-02-17 17:39:26 +00:00
igor%mir2.org fc20f85a8f Pass ScriptOrFnNode explicitly to function expecting script or function top node and fix OptTransformer problem where it marked nested functions of function as suitable for direct call optimization which was caused by removal of parameter name subtree in FunctionNode. 2003-02-17 17:34:20 +00:00
igor%mir2.org e6090539e4 Introduction of ScriptOrFnNode as a Node to represent scripts and a base class for FunctionNode so it can be used to store variable tables, line information, regular expressions etc. instead of using special Node properties. 2003-02-17 08:51:00 +00:00
igor%mir2.org 50ba7d1f8c Removal of a separated tree walking phase in NodeTransformer to collect variables as this is done now during parsing 2003-02-17 00:10:24 +00:00
igor%mir2.org 7ed732d3bf Adjusted to refer to 1.5R4 as the last release 2003-02-17 00:06:06 +00:00
igor%mir2.org ef2778d047 Fixing links 2003-02-17 00:05:27 +00:00
igor%mir2.org b3bb2de24a Remove code duplication when reporting syntax errors in NodeTransformer, ToekStream, IRFactory and Parser and add a method to create FunctionNode to Interpreter/Codegen to remove the need to have OptIRFactory. 2003-02-16 20:28:56 +00:00
igor%mir2.org 6d98f1ebc6 *** empty log message *** 2003-02-16 20:28:55 +00:00
igor%mir2.org 714bc85d53 Creating and filling VariableTable directly during parsing phase and then accessing it in NodeTransformer. It still does not remove the need to have a separated walk through the tree for variables but now it only checks for function name / variable name clashes.
And http://bugzilla.mozilla.org/show_bug.cgi?id=193555 is now fixed as well.
2003-02-16 11:34:54 +00:00
igor%mir2.org c62a606a26 Do explicit parsing of function expression statements so a correct function type will be passed to IRFactory during node creation and fix incorrect code generation when FEATURE_MEMBER_EXPR_AS_FUNCTION_NAME is true.
I also added explicit flags to Parser: languageVersion and allowMemberExprAsFunctionName and set them from Context. In this way Parser can be used without Context which is useful for debugging.
2003-02-15 23:30:02 +00:00
igor%mir2.org aab18156df VariableTable changes toward removal of a separated NodeTransformer pass over the parser tree for variable initialization: the code to support a table of optimized variables for functions in the optimizer is moved to optimizer/OptFunctionNode and VariableTable holds only parameters/variables names now. It allowed to simplify VariableTable initialization in NodeTransformer. 2003-02-15 21:35:58 +00:00
igor%mir2.org 90c8869435 Remove synchronization on Context instances as Context should only be accessed from one thread. 2003-02-15 21:23:54 +00:00
igor%mir2.org 01cfb2bc49 Decoupling JavaAdapter from ClassRepository logic: JavaAdapter.createAdapterClass is replaced by JavaAdapter.createAdapterCode which just generates byte array with the adapter class file code and Codegen then passes this array to ClassRepository to save the class if necessary. In this way if repository do not need to load classes, adapter class will not be loaded at all. 2003-02-15 17:47:13 +00:00
igor%mir2.org a1914aa7a0 ClassNameHelper cleanup:
1. It is not passed as a parameter to Interpreter/Codegen, instead Codegen access it directly when necessary.

2. ClassNameHelper.reset method is removed as inherently thread unsafe and data that should be used during compilation of single script is stored in Codegen itself.

3. Instead of a special DefaultClassRepository null is used to indicate that generated classes should not be stored and JavaAdapter is modified to take ClassRepository as a parameter, not ClassNameHelper.
2003-02-15 14:21:33 +00:00
igor%mir2.org cae3ab647d When parsing function parameters, collect all parameters names into array instead of generating a separated syntax subtree for them. 2003-02-15 13:54:22 +00:00
igor%mir2.org 4e715dcffc Remove the last argument "args" from generateInit as it is never used. 2003-02-15 13:05:38 +00:00
igor%mir2.org 5539dfbf29 Make Optimizer class a package private and turn most of its methods into private ones. 2003-02-15 12:56:21 +00:00
igor%mir2.org 2e4cd83bf8 I changed PreorderNodeIterator so a pattern for its usage will be:
PreorderNodeIterator iter = new PreorderNodeIterator();
for (iter.start(tree); !iter.done(); iter.next()) {
    Node node = iter.getCurrent();
    ...
}

instead of

PreorderNodeIterator iter = tree.getPreorderIterator();
Node node;
while ((node = iter.nextNode()) != null) {
}

to allow for more flexible usage and added PreorderNodeIterator.nextSkipSubtree to skip iteration of the last visited node subtree which allows to have simple code  in Optimizer.buildStatementList when iterating over statements.
2003-02-15 12:47:45 +00:00
igor%mir2.org 7eb47250fe Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=193418 :
The bug caused by a missed check in StmtNodeIterator.nextNode for a possible null result of findFirstInterestingNode inside the search loop which made search to stop preliminary with non-empty stack.

The changes fixe this and integrate StmtNodeIterator into
Optimizer.buildStatementList as StmtNodeIterator was used only by
buildStatementList and the new version is simpler.
2003-02-15 10:33:31 +00:00
igor%mir2.org c0bc03b5bf Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=191276 :
The reason for the bug was that omj/optimizer/Optimizer.java when optimizing code for this[name] (see GETELEM switch, line 665) assumed a number context for GETELEM index node unconditionally which is wrong.

The fix uses number context only if [] argument is known for sure to be a number.
2003-02-14 23:56:34 +00:00
igor%mir2.org 41b3e5345d Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=192288 :
The bug was caused by a double call to Codegen.addNumberConstant, the first
time correctly from Codegen.visitLiteral and the second time wrongfully from
the loop in emitConstantDudeInitializers where loop index should be used
instead of calling addNumberConstant. As addNumberConstant would return the
same index for same numbers, the bug surfaces only with NaN as
addNumberConstant does not recognizes already added NaN. The bug also visible
only with optimization set to 1 or higher since only then constant folding can
produce NaN literal.

The fix removes the second call to addNumberConstant and uses
ScriptRuntime.NaNobj for NaNs.
2003-02-14 23:53:32 +00:00
igor%mir2.org 23e626144d Make ScriptRuntime.NaN, ScriptRuntime.NaNobj and ScriptRuntime.negativeZero static final again as now a workaround for MS JVM uses Double.longBitsToDouble to get the necessary values. 2003-02-14 23:51:28 +00:00
igor%mir2.org fa68d2fa82 I made Context.codeBug public so optimizer can use it. 2003-02-14 23:47:11 +00:00
igor%mir2.org 7f8725b63d Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=192105 :
The reason for the bug is that emitDirectConstructor generates code to call
setPrototype twice instead of setPrototype/setParentScope pair during new JS
object construction. The fix replaces that setup by a single call to
BaseFunction.createObject which is used by Interpreter as well.
2003-02-14 22:38:49 +00:00
igor%mir2.org 448e323877 Optimization: In OptFunctionNode.getDirectCallParameterSignature use static strings for common cases of 0, 1 and 2 direct parameters. 2003-02-14 22:36:58 +00:00
igor%mir2.org 9245b512bf Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=191633 :
Replace tail recursion in TokenStream.getToken by a loop.
2003-02-14 20:20:46 +00:00
igor%mir2.org 13732c460e Mostly cosmetics: use consistent layout for case statements and add additional {} block around main code in TokenStream.getToken() so the following patch to fix http://bugzilla.mozilla.org/show_bug.cgi?id=191633 will be small. 2003-02-14 20:19:07 +00:00
igor%mir2.org edac1d4aee Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=191668 :
Integration of LineBuffer into TokenStream code which now uses a special buffer for unreading of several chars to follow SM more closely. In this way there is no problem with a possible backtracking of 3 chars on failed attempt to match <!-- at the last minus.

TokenStream is also modified to accept a string with a source directly which avoids the need to construct intermediate StringReader in Context and allows to remove DebugReader class which is replaced by a simple function to read all Reader data into string.
2003-02-14 17:09:19 +00:00
igor%mir2.org cd30738141 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=192226 :
Codegen.visitRegularCall should not try to apply the simple call optimization
when firstArgDone is true indicating directly called function. The patch also
replaces generation of code to call new Object[0] by loading the
ScripRuntime.emptyArgs field.
2003-02-14 16:55:40 +00:00
igor%mir2.org ed08275994 Use x instanceof Type checks in place of x.getClass() = TypeClass as instanceof is significantly faster then calling getClass. 2003-02-14 16:53:14 +00:00
igor%mir2.org 3d8356af78 Patch from Steven Beal fixing a bug due to my changes:
I just noticed that the changes introduced with
v1.29 of Main.java broke the ability to do hot
reloads of scripts.  To be more explicit, the script
is actually reloaded but the source in the debugger
is not updated to reflect the newly loaded code.
...
Attached is a patch that restores the original behavior.
The refactorings are preserved but the handling of
previously loaded SourceInfo objects is restored and the
check for previously loaded ScriptItem instances
removed.
2003-02-13 03:01:09 +00:00
nboyd%atg.com 6e07b50784 Remove language about "release candidate" now that we have a final. 2003-02-11 15:04:12 +00:00
nboyd%atg.com 8954cfc5cd Update for final release 2003-02-11 01:50:26 +00:00
nboyd%atg.com 69902644af Update release date. 2003-02-10 15:36:42 +00:00
igor%mir2.org 08597a3128 More info on new security interfaces 2003-02-07 20:44:47 +00:00
nboyd%atg.com 6258e019ce fix bug 106831 2003-02-03 01:17:44 +00:00
rogerl%netscape.com 9eafe44563 Fixing bug #190685, re-allowing '{' as un-quantifier literal. 2003-01-27 21:13:15 +00:00
igor%mir2.org 31bbfe30dd Added log for more fixed bugs 2003-01-27 20:04:13 +00:00
igor%mir2.org d116b752fb Do not call setSelectedIndex on frame JList if there are no frames. 2003-01-26 18:33:30 +00:00
igor%mir2.org b869da1525 Added documentation strings for runCommnad and spawn is changed to pass empty argument array instead of null if function arguments are not specified to avoid a null pointer exception in InterpretedFunction.call 2003-01-26 18:28:26 +00:00
igor%mir2.org 1e22de7bf6 Documentation about runCommand in shell 2003-01-26 18:01:43 +00:00
igor%mir2.org 1e2468a7fc Added runCommand to execute external processes 2003-01-26 15:43:50 +00:00
igor%mir2.org 77021f2325 Added list of resolved Bugzilla reports 2003-01-26 14:30:47 +00:00
rogerl%netscape.com 1c5429c960 Fixed bug #189898, replace not working with string argument. Also added
error checking for bad quantifiers (see bug 188206)
2003-01-22 18:55:41 +00:00
igor%mir2.org 2081b5922b Patch from Christopher Oliver to fix http://bugzilla.mozilla.org/show_bug.cgi?id=189183 2003-01-20 15:09:45 +00:00
igor%mir2.org 6e95a8f71f Small fixes in links 2003-01-17 16:40:45 +00:00
nboyd%atg.com 0631478dd4 UPdate to rc 3 2003-01-16 20:29:43 +00:00
igor%mir2.org b4fd495c94 Note about scripting of classes from any class loader 2003-01-16 17:22:40 +00:00
nboyd%atg.com fa159104bb Add implmentation version date. 2003-01-16 14:24:03 +00:00
igor%mir2.org 9cf41eb233 Committing patch from Steven Beal:
Have you considered adding a "Go" method to Main.java with
public visibility (same behavior as pressing the "Go" button in the debugger UI).

This would be a big help in a system where the debugger has been
embedded.  Being able to close the debugger and ensure that any
breakpoints were removed and any blocked threads notified would
be a nice feature.  Without this, closing the debugger can either
a) halt the application or b) destroy the debugger leaving blocked
threads in a permanent wait state.  Note that the debugger is
not actually destroyed in this case because the waiting threads
prevent it from being wholly GCed.
2003-01-15 10:42:56 +00:00
nboyd%atg.com 61e4970b2a Update to R4. 2003-01-14 16:42:16 +00:00
igor%mir2.org 1fdf60d476 Fixing mnemonics shortcuts for Debug menu 2003-01-14 14:44:46 +00:00
igor%mir2.org 2b475ccedd From Steaven Beal:
This looks like a simple case of using the Hashtable key
instead of the value...

    public void clearAllBreakpoints() {
        // Igor - Use of keys() is inappropriate here.  It produces
        // a ClassCastException on the assignment below.  The
        // keys are String instances, not SourceInfo instances...
        //
        //Enumeration e = sourceNames.keys();
        Enumeration e = sourceNames.elements();
	...
    }
2003-01-14 11:24:47 +00:00
nboyd%atg.com cce6a656a9 Update for RC2 2003-01-01 20:17:17 +00:00
igor%mir2.org 251c25a5c3 Deprecating ClassOutput in favor of ClassRepository and Context methods to access ClassNameHelper functionality in favor of directly calling ClassNameHelper methods. For that I changed ClassNameHelper from interface to abstract class and added ClassNameHelper.get(Context cx) method to get name helper object that is used for the given Context object. 2002-12-31 18:21:32 +00:00
igor%mir2.org 517a191c91 Allow application to customize class loader used for loading generated code.
For that I added new method createClasssLoader to Context, which by default returns new instance of DefiningClassLoader and changed the code to use this method instead of creating DefiningClassLoader directly. I moved DefiningClassLoader to org.mozilla.javascript package so core Rhino classes would not depend on org.mozilla.classfile package. I also changed SecurityController.createClasssLoader to take additional parentLoader argument to explicitly specify which class loader should be parent for generated code.
2002-12-31 09:42:42 +00:00
igor%mir2.org d76cc2c78f Eliminating calls to Thread.getContextClassLoader().
From my mail to Norris Boyd:

When considering http://bugzilla.mozilla.org/show_bug.cgi?id=166530 I realized that my 2 years old suggestion to use Thread.getContextClassLoader() in org.mozilla.classfile.DefiningClassLoader was wrong, as it does not follow class loader chain pattern Rhino embeddings can use. Moreover, it is wrong to use Thread.getContextClassLoader() when searching for Rhino classes as if Rhino is available via the system class loader and an application uses its copy from another loader, Thread.getContextClassLoader() would return incompatible class while simple Class.forName() would do proper job of loading the requested class from a loader of Class.forName() caller.

The only place where Thread.getContextClassLoader() can be useful is when searching for classes in NativeJavaPackage, but even there with a new option to use Package with an explicit class loader argument it is not necessary as one can write in a script
Packages(java.lang.Thread.contextClassLoader) to get necessary behavior.
2002-12-30 18:22:58 +00:00
igor%mir2.org 2907a50485 Replace ScriptRuntime#main(String scriptClassName, String[] args) by ScriptRuntime#main(Class scriptClass, String[] args) and to optimizer.Codegen#generateMain code to generate call to Class.forName before calling ScriptRuntime#main. In this way script byte code can access Class object if generated script is loaded via different class loader then Rhino classes. 2002-12-30 06:49:10 +00:00
igor%mir2.org d530d25fb5 When checking for a nested class, try to load it from class loader for the parent class, not from the loader for Rhino classes. 2002-12-30 00:50:57 +00:00
igor%mir2.org e6a341b490 Move code to try to load a class from getPkgProperty to the separated findClass method and add catching of SecurityException there. 2002-12-30 00:49:11 +00:00
igor%mir2.org 1eab2d8d61 Change FunctionObject to extends BaseFunction, not NativeFunction as the later is more tailored for function representing JavaScript code. 2002-12-30 00:43:33 +00:00
igor%mir2.org c376184557 To map a class name to the corresponding Class instance from the adapter code generate code to call Class.forName instead of calling ScriptRuntime.loadClassName so a class loader for the generated code will be used to access the Class instance, not the loader for the Rhino classes. 2002-12-29 20:21:06 +00:00
igor%mir2.org e4c61f1f60 In createInvoker I replaced classLoader.loadClass by classLoader.linkClass to remove catching ClassNotFoundException 2002-12-29 10:52:10 +00:00
igor%mir2.org bbb8216d37 Fixing design flaw in SecurityController:
The new SecurityController in its current form does not allow to define more then one generated class class in the same class loader effectively preventing to use optimizer which needs to define classes that refer each other and should be defined in the same loader.

To fix this I replaced the defineClass method in SecurityController by
    public GeneratedClassLoader createClassLoader(Object securityDomain);
which returns instance of the new GeneratedClassLoader interface which can be used to define several classes. I also made DefiningClassLoader to implement this interface to simplify code in JavaAdapter.java and optimizer/Codegen.java.
2002-12-28 05:37:43 +00:00
igor%mir2.org 265cc938cc Preparations for 1.5R4 release 2002-12-24 01:34:45 +00:00
igor%mir2.org bc8cf2ec2c Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=184107
Always put function expression statements into initial activation object ignoring the with statement to follow SpiderMonkey
2002-12-23 15:01:53 +00:00
igor%mir2.org 556bf1547d Mostly cosmetics: use consistent naming for new API for function object initialization. 2002-12-23 14:56:58 +00:00
igor%mir2.org 8bede8d38b Eliminate double creation of Function objects representing nested functions in scripts/functions and use ScriptRutime.putFunction to bind function objects with activation scope. 2002-12-22 22:39:10 +00:00
igor%mir2.org f4d9cbcb9e Use Context.enter() try { } finally { Context.exit() } instead of try { Context.enter() } finally { Context.exit() } as Context.exit should only be called if Context.enter() returns successfully. 2002-12-22 19:12:50 +00:00
igor%mir2.org 0e61cfe41a Move code to put functions as properties of activation object to ScriptRuntime.putFunction so it can reused by optimizer. 2002-12-22 19:08:52 +00:00
igor%mir2.org e4f92d4b98 Do not put "anonymous" into BaseFunction.functionName for functions created via new Function. Instead NativeFunction.getFunctionName() returns "anonymous" for function name for such functions which allows to assume that BaseFunction.functionName always holds real name. 2002-12-22 19:06:26 +00:00
igor%mir2.org 4ca1e42665 I replaced exception handlers for InstantiationException and friends during Class/Constructor.newInstance calls to construct NativeFunction/NativeScript instances via single catch (Exception ex) as the handlers rethrow exceptions as RuntimeException in any case. As it reduces OptRuntime.newOptFunction to few lines, its single usage in Codegen is inlined. 2002-12-22 02:51:16 +00:00
igor%mir2.org 740cb754dc I removed constants denoting _QUICK bytecodes as valid bytecode can not contain them. To catch possible bugs with passing invalid opcode I also replaced extra, opcodeCount and stackChange arrays by functions with switch statements that throws IllegalArgumentException on bad opcode. It also has an advantage of reducing class file size due to lack of support in JVM for efficient array initialization. 2002-12-22 02:42:40 +00:00
igor%mir2.org 6c35405455 I removed dependency of Parser.decompile on NativeFunction. Now Parser.decompile takes as argument a tree structure describing encoded source for script or function and their nested functions. In case of interpreter the tree is built from interpreter runtime data while the optimizer puts a static function to construct tree into the class file representing compiled script or function. This function is called via reflection.
The change removes the need to have instances of NativeFunction representing nested functions constructed before they are needed as a part of script execution.
2002-12-21 12:43:55 +00:00
igor%mir2.org de12281a35 I removed code to add EmptyArray field to generated field in Codegen.generateInit as it was redundant to ScriptRuntime.emptyArgs 2002-12-20 16:14:51 +00:00
igor%mir2.org e2396df076 In Codegen.visitFunction I replaced code generating call to createFunctionObject that would use reflection to instantiate function object by a direct calling of function constructor and a separated call to function initialization in OptRuntime.setupFunction. 2002-12-20 12:21:35 +00:00
igor%mir2.org 4b60a96846 I removed debug_level and debug_srcName fields as they are never used. 2002-12-20 12:12:41 +00:00
igor%mir2.org d0a8a8ff9c I moved optimizer related code to initialize a function from ScriptRuntime to optimizer/OptRuntime and replaced common code to initialize function prototype and scope in few places by ScriptRuntime.initFunction 2002-12-19 19:48:55 +00:00
igor%mir2.org 8c7e5dc265 Cosmetics: expanding tabs 2002-12-17 20:56:08 +00:00
igor%mir2.org 2fbe052b90 Cosmetics: removal of junk white-space at line end 2002-12-17 20:48:35 +00:00
igor%mir2.org b5a37b538c I replaced all ScriptableObject.getClassPrototype(scope, "Function") by ScriptableObject.getFunctionPrototype(scope) 2002-12-17 16:36:23 +00:00
igor%mir2.org bbb7ddba42 I moved details of debugger API changes since 1.5R3 to a separated document. 2002-12-17 09:26:48 +00:00
nboyd%atg.com 02d69352ae Add link to release candidate. 2002-12-16 16:51:33 +00:00
igor%mir2.org be3d62d882 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=181834
Ignore dynamic scope flag for nested functions and functions defined inside with statements
2002-12-14 18:56:27 +00:00
igor%mir2.org ad78fea1cf *** empty log message *** 2002-12-13 18:26:31 +00:00
igor%mir2.org 756b2e0885 *** empty log message *** 2002-12-13 18:16:12 +00:00
igor%mir2.org 2c4ee7b4e5 Document update 2002-12-13 14:21:38 +00:00
igor%mir2.org 1208207c71 Fix for http://bugzilla.mozilla.org/show_bug.cgi?id=185165
I made ScriptRuntime.escapeString to escape \ and remove code to escape single quote ' as it is unreachable due to if (' ' <= c && c <= '~' && c != '"' && c != '\\') check as ' should not be escaped.
2002-12-13 11:56:54 +00:00
igor%mir2.org f4cfc98e4d I removed InterpretedFunction.itsClosure as it was effectively used only itsClosure != null test and the effect can be done via setting InterpretedFunction.useDynamicScope to false. 2002-12-12 10:46:52 +00:00
igor%mir2.org d652c3179a I moved itsUseDynamicScope from InterpreterData to InterpretedFunction as this flag affects only functions, not scripts and to initialize this flag not during script compilation but during function creation which happens at the start of script execution. It allows to alter the flag for already compiled scripts before their execution. 2002-12-11 22:28:00 +00:00
igor%mir2.org 257dba7ca7 Fixed link 2002-12-10 11:19:02 +00:00
igor%mir2.org 15866816e2 I changed InterpreterData.itsNestedFunctions from InterpretedFunction[] to InterpreterData[] because due recent changes/fixes InterpreterData.itsNestedFunctions was used effectively only to get information already available InterpreterData. 2002-12-09 17:50:20 +00:00
igor%mir2.org 908a8ed8b5 Move creation of InterpretedFunction instances to createFunction (former createFunctionObject) to have function initialization at one place. 2002-12-09 13:37:13 +00:00
igor%mir2.org febcbadf03 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=184111
Patch from Marcus Crafter:
...
After speaking with Christopher Oliver, the problem seems to be a general JDK
1.4 bug that caches selected values in JComboBox, even after removeAllItems() is
called. Since its a general defect Christopher and I thought we'd report and get
it fixed in the main CVS tree.
...
2002-12-08 21:06:45 +00:00
igor%mir2.org 69c1384530 If debugger does not get function or script source via handleCompilationDone, try to read it from supplied URL. 2002-12-08 20:49:39 +00:00
igor%mir2.org 559c58d034 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=154693
On function/script start create and initialize instance of InterpretedFunction for each function statement.
2002-12-07 14:15:27 +00:00
igor%mir2.org bbd9c6e220 Cosmetics: layout fix 2002-12-06 16:38:38 +00:00
igor%mir2.org bac1e710a5 isJavaPrimitiveWrap/setJavaPrimitiveWrap are made final as sublasses should not be override them when customizing WrapFactory 2002-12-06 16:36:25 +00:00
igor%mir2.org 88ad54171f Remove generation of closure icode for function statements as they are initialized at script/function start, not at point of declaration. This redundant closure icodes were effectively no-operation but caused bigger stack to be allocated then necessary. 2002-12-05 21:04:30 +00:00
igor%mir2.org 87b0cf6408 Remove closure constructor from InterpretedFunction and initialize InterpretedFunction.itsClosure constructor in Interpreter directly. This besides reducing code size will help to make fix for http://bugzilla.mozilla.org/show_bug.cgi?id=154693 smaller 2002-12-04 09:49:07 +00:00
igor%mir2.org 663dff2a7a To allow straightforward detection of functions created via Function(...) constructor, I added the fromFunctionConstructor boolean flag to NativeFunction which allows to simplify code dealing with the EcmaScript requirement to return anonymous as a name for such functions. 2002-12-03 12:43:14 +00:00
igor%mir2.org d676aa578a 1. Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=182028
Now caching of the last access slot covers GetterSlot instances as well and getter is always called for such slots

2. Fixing a potential race condition in setBySetter when a setter slot becomes an ordinary slot in response to a setter returning a value.

During execution of setBySetter a different thread can see initial null value in slot.value instead of the result of setter call as it is possible that JVM will first update slot.flags and only then slot.value for that thread. The fix replaces the old getter slot  by an ordinary one under synchronized block for that I added new getSlotPosition method and updated the rest of code accordingly.
2002-12-03 12:38:55 +00:00
igor%mir2.org b4cf6c06fc I moved decompilation code from NativeFunction to Parser so changes in compressed source structure will affect only one file. 2002-11-26 08:00:44 +00:00
igor%mir2.org e081e489da Add args and argCount to InterpreterData to emphasize that InterpretedScript/InterpretedFunction are just runtime wrappers around InterpreterData 2002-11-25 21:33:56 +00:00
igor%mir2.org 3f7f541282 Wrap restoring of the original optimization level into finally block 2002-11-25 16:46:16 +00:00
igor%mir2.org 7226fda62b Fixing 181654: Error.prototype.toString is a generic function now
printing this.name + ": " + this.message for any this.
2002-11-25 16:44:30 +00:00
igor%mir2.org 8223942873 Replace getScriptable() by getFunctionName() in omj/debug/DebuggableScript.java as the debugger used DebuggableScript.getScriptable() only to query function names.
It allows to implement the DebuggableScript interface only  by omj/InterpreterData instead of 2 identical implementations by InterpretedFunction and InterpretedScript.
2002-11-14 21:12:36 +00:00
igor%mir2.org 5d1d7ed31a Fixing in Interpreter.dumpICode reading of index from a wrong offset 2002-11-13 10:22:46 +00:00
igor%mir2.org 4e4f06390c Fixing misspellings comments 2002-11-13 10:13:40 +00:00
igor%mir2.org c19e43d0d6 Call NativeArray.getLength() instead of deprecated NativeArray.jsGet_length() 2002-11-12 09:41:09 +00:00
igor%mir2.org d8a693fc56 Cosmetics: use consistent naming and layout for internal methods providing JS library implementation. 2002-11-12 09:37:43 +00:00
igor%mir2.org bb604c8dd8 1. Deprecation jsGet_length in favour of getLength
2. Cosmetics: use consistent naming and layout for internal methods providing JS library implementation.
2002-11-12 09:36:40 +00:00
igor%mir2.org e2b3906c85 1. In js_concat determine the the size of the resulting string to avoid reallocations in StringBuffer .
2. Cosmetics: use consistent naming and layout for internal methods providing JS library implementation.
2002-11-12 09:33:48 +00:00
igor%mir2.org ef5115e651 Cosmetics: use consistent naming and layout for internal methods providing JS library implementation 2002-11-12 09:29:57 +00:00
igor%mir2.org 710f9f5c64 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=179068
Allow to use char sequences exceeding 64K when storing source for decompilation

The current 64K limit for string literals comes from omj/Parser.java where it constructs the internal script presentation for future decompilation. The patch extends this form to allow string sequences with more then 64K characters and modifes decompilation code in omj/NativeFunction.java accordingly.
2002-11-12 09:24:54 +00:00
igor%mir2.org b85ee6ab63 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=179366
Assume --> after a possible whitespace after line start means comments to end-of-line. The change follows the SpiderMonkey solution.
2002-11-12 09:20:09 +00:00
igor%mir2.org 1d647c70a9 Cosmetics: refactor decompile without changing its functionality so a possible future patch to allow literal strings greater then 64K would be less intrusive. 2002-11-08 12:08:52 +00:00
igor%mir2.org 49661822bb I made FunctionNode to inherit from Node instead of Node.StringNode as FunctionNode is never used as a string source. 2002-11-03 01:26:29 +00:00
igor%mir2.org c27bf53f4e I removed method duplication in Node where getNext() was duplicated as getNextSibling() and code was using both of them and similarly for getFirstChild()/getFirst(). 2002-11-02 22:08:00 +00:00
igor%mir2.org 00fbdbeb1f Allow for TokenStream.COMMA node in the parsed tree to contain more then 2 children to avoid too-deep recursion during code generation for long array and object initialization lists. 2002-11-02 18:01:26 +00:00
igor%mir2.org 39c11eb5ff Cosmetics: use uniform indentation in switch statements 2002-11-02 14:54:35 +00:00
igor%mir2.org 542ef1dbaf Avoid potentially expensive calls to Node.addChildBefore which may need to traverse a long child list to find the previous child when a reference to the previous child is available from context. 2002-11-02 12:52:11 +00:00
igor%mir2.org 70475da4ec Clear reference to sourceBuffer array as soon as it is no longer needed to allow its earlier GC. 2002-11-02 12:46:28 +00:00
igor%mir2.org cbf53f2e8f Fixing 159334: store bytecode indexes as uint16 to extend limit on maximum number of different strings to 64K 2002-11-01 14:43:34 +00:00
igor%mir2.org d67e88e84d Fixing regression introduced by 1.93: during generation of code for NEW and CALL do not assume that function name index would be the index of the last string in the string table as due to name sharing it can be any index. Instead NEW and CALL generator uses lastStringIndex which is updated in addString and holds the last used string index. 2002-10-31 01:19:53 +00:00
igor%mir2.org 2b7d0e47c2 Fixing 177314:
TokenStream.java: third octal digit is a part of the octal escape in strings only if the result is <= 0377.

resources/Messages.properties: removal of unused msg.oct.esc.too.large
2002-10-30 09:20:00 +00:00
igor%mir2.org 3b79862ea3 Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=173906: change Codegen.visitCall to check for dynamic scope flag when calling
direct call target
2002-10-24 10:05:36 +00:00
igor%mir2.org ba3a798e63 Using ThreadLocal under JDK >= 1.2 in Context.enter/Context.exit so they do not need to synchronize on global Context.threadContexts object as java.lang.ThreadLocal allows to associate a Context instance with the current thread in a completely synchronization-free way.
When ThreadLocal is not available (JDK 1.1), the old way of doing things is used.
2002-10-24 10:04:30 +00:00
igor%mir2.org d7a9329429 I modified Context.enter/Context.exit to remove explicit synchronization on threadContexts as implicit implicit synchronization when calling threadContexts.get/threadContexts.put/threadContexts.remove is enough to ensure thread safety. It reduces time spend in synchronized code so Context.enter/Context.exit is less problematic with script execution on many threads.
The change also allows with simple modifications of Context.getCurrentContext and Context.setThreadContext to use java.lang.ThreadLocal from JDK 1.2 to remove any synchronization on global data structures during Context.enter/Context.exit/Context.getCurrentContext.
2002-10-23 09:56:26 +00:00
igor%mir2.org 8bd679943a Fixing http://bugzilla.mozilla.org/show_bug.cgi?id=173180
Merges utf8ToOneUcs4Char body into the decode method and adds checks
for overlongs to follow SpiderMonkey.
2002-10-22 21:22:44 +00:00