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

1074 Коммитов

Автор SHA1 Сообщение Дата
igor%mir2.org 92a551206e 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 10ade407d8 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 20b582d079 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 a3b7d765da 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 9aa69b8a87 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 4fa07f31de 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 88b8903a58 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 b5b153abb8 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 a055ed5694 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 607b4b7a6c 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 4588ddb780 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 483f99db82 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 e326be8a4b 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 9222756901 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 e87a1ef790 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 e70e26e2a5 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 601bdbff9a 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 a8882e7d5a 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 eb1ab4ff3a Removal of deprecated SecuritySupport as a part of work on 198208. 2003-03-31 08:43:40 +00:00
nboyd%atg.com aaabfae631 change to 1.5R5 prerelease 2003-03-25 19:13:29 +00:00
nboyd%atg.com 0917d39fa2 Switch to 1.5R5pre. 2003-03-25 19:11:58 +00:00
igor%mir2.org 59d6f7f69d 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 5aa0865e56 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 ad1ace93ca Removal of deprecated classes from the list of API docs 2003-03-19 14:14:29 +00:00
igor%mir2.org 067aaa3e0b Fixing JavaSoc documentation tag usage 2003-03-19 14:13:41 +00:00
igor%mir2.org 255e90bedc 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 12ada0ce5c 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 4c4f4e4fc8 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 9a9f82103c 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 254d313fa4 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 200e03d717 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 23f35a0f28 Inlinning of generateRegExpLiterals into generateInit for simple code 2003-03-13 22:50:04 +00:00
igor%mir2.org cdd74e7e8c 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 ddc73696f3 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 e1320b934c 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 67b44fd9d9 Making class public 2003-03-13 07:52:07 +00:00
igor%mir2.org bcd8181007 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 3bbdba7f56 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 90ebda38fe Introduction of Codegen.mainCodegen to hold the main generator object and layout cosmetics. 2003-03-11 10:01:32 +00:00
igor%mir2.org 47a9d77f0f 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 134f5d732f 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 26a9318291 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 c0145a6724 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 bc0b7a93d9 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 9d6bb8957e 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 1b6885bd21 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 c6efcf460c 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 11d0e9760b 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 fd3dee4c56 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 a8e6f7c025 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