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
igor%mir2.org
406437f686
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
3f34720cd5
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
3a43240845
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
ae7bb2620d
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
2b5b9f76d8
Allow to set null for sourceName, encodedSource and originalSource
2003-02-18 00:52:34 +00:00
igor%mir2.org
511c2e945f
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
7c4d921fe0
Store function array inside ScriptOrFnNode as field, not as a node property.
2003-02-17 17:39:26 +00:00
igor%mir2.org
3abddeba71
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
5a9259c0aa
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
2e981e4365
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
ca4e80328a
Adjusted to refer to 1.5R4 as the last release
2003-02-17 00:06:06 +00:00
igor%mir2.org
32a501abe2
Fixing links
2003-02-17 00:05:27 +00:00
igor%mir2.org
19e12f45e4
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
9ad003b9a0
*** empty log message ***
2003-02-16 20:28:55 +00:00
igor%mir2.org
bed15cd944
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
56c3f65ac9
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
2c7161713c
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
75697022cf
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
c914122b03
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
de021ba69a
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
cb81ad7f8d
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
d32dddbf0c
Remove the last argument "args" from generateInit as it is never used.
2003-02-15 13:05:38 +00:00
igor%mir2.org
c386a1cc35
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
9f52d081d9
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
ade76dc700
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
2660547dee
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
ca577aa247
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