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

1112 Коммитов

Автор SHA1 Сообщение Дата
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