Commit Graph

921 Commits

Author SHA1 Message Date
igor%mir2.org
650a6e1763 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
30863897ad 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
8e6db6ff11 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
1e2bf2efec 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
5aa3180827 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
fa14609cd7 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
3626a138ec 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
1e02010066 Wrap restoring of the original optimization level into finally block 2002-11-25 16:46:16 +00:00
igor%mir2.org
8f8ec48385 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
9be5d10e5c 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
cd8a03eb8a Fixing in Interpreter.dumpICode reading of index from a wrong offset 2002-11-13 10:22:46 +00:00
igor%mir2.org
b09ef875a4 Fixing misspellings comments 2002-11-13 10:13:40 +00:00
igor%mir2.org
efd9f298ab Call NativeArray.getLength() instead of deprecated NativeArray.jsGet_length() 2002-11-12 09:41:09 +00:00
igor%mir2.org
6e859f553a Cosmetics: use consistent naming and layout for internal methods providing JS library implementation. 2002-11-12 09:37:43 +00:00
igor%mir2.org
8cd90d6557 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
594696279f 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
82ea401577 Cosmetics: use consistent naming and layout for internal methods providing JS library implementation 2002-11-12 09:29:57 +00:00
igor%mir2.org
99c0da59df 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
f8386f2604 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
7ef61113d0 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
af3cca93fd 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
e33d132a12 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
9b6ae7fdf7 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
6c91eb5274 Cosmetics: use uniform indentation in switch statements 2002-11-02 14:54:35 +00:00
igor%mir2.org
9c88f342b2 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
498ccb82fe 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
85132aacd6 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
b9a8bd50ee 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
902aee2f8d 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
86a5bceb04 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
a086d887a9 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
32dcd895ba 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
7fe4fdbc33 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
igor%mir2.org
5c85c4f1ae Add isGeneratedScript to DebuggableScript and its implementations to allow debuger to distinguish between scripts and functions coming from external files or ones defined vvia exec or new Function() 2002-09-26 20:19:39 +00:00
igor%mir2.org
984ec2e982 Fixing 169830: I replaced in jsFunction_concat calls to hasLengthPropert by ScriptRuntime.instanceOf and as hasLengthPropert is no longer used, I removed it as well. 2002-09-24 15:57:58 +00:00
igor%mir2.org
a63ccf0cc5 In newObject pass top level scope to the constructor, not ctor.getParentScope() to take into account hasCompileFunctionsWithDynamicScope() 2002-09-24 14:14:00 +00:00
igor%mir2.org
6f4b833c59 In getClassPrototype replace ScriptRuntime.getTopLevelProp by getProperty to avoid double call to getTopLevelScope 2002-09-24 14:10:53 +00:00
igor%mir2.org
e3402dd61f In jsFunction_concat inline ScriptRuntime.newObject to throw JavaScriptException if array constructor throws one and avoid double call to ScriptableObject.getTopLevelScope() 2002-09-24 14:08:22 +00:00
igor%mir2.org
0a4b0ef2af Change ScriptRuntime.getTopLevelPropery to call ScriptableObject.getProperty in place of explicit loop over the prototype chain. It makes sure that all Scriptable.get(property, start) on the prototype chain are called with a proper start value.
Add getExistingCtor to get existing constructor property or throw an exception.
2002-09-24 14:05:24 +00:00
igor%mir2.org
8e32c0c8a1 Remove the minimalAllocation field and instead pre-allocate data array in the constructor if necessary. 2002-09-24 11:21:19 +00:00
igor%mir2.org
5f6a565762 Change NativeArray.getLengthProperty to return long instead of double as its results are always uint32 and adjust its usage accordingly . Fix Context.getElements documentation to state that it returns empty array, not null, if object does not have a reasonable length property. 2002-09-24 09:29:27 +00:00
igor%mir2.org
6c61080e81 Reduce "new X" usage by inlining few classes or packing their members into long field 2002-09-18 12:57:09 +00:00
igor%mir2.org
afd43edcb3 C relics removal: no need to check for null after "new X" 2002-09-18 12:50:51 +00:00
igor%mir2.org
c0c5171c48 Store line number and operation type as int field instead of wrapping them into Integer; use Node subclass for nodes with string data; add few explicit checks about node structure assumptions. 2002-09-04 09:28:58 +00:00
igor%mir2.org
9068084e6a Use Node subclass to represent number literals to avoid creation of Double object. 2002-09-03 12:34:56 +00:00
igor%mir2.org
5381cd9877 Workaround in JS Math.pow implementation for java.lang.Math.pow brokeness in some JVM. 2002-08-27 08:14:49 +00:00
igor%mir2.org
21946b7034 Fixing a bug reported by Steven Beal where Interpreter.icodeTokenLength() and In
terpreter.dumpICode() used wrong size for CLOSURE opcode arguments.
2002-08-27 08:12:25 +00:00
igor%mir2.org
265a588aaf Fixing a bug reported by Steven Beal where Interpreter.icodeTokenLength() and Interpreter.dumpICode() used wrong size for REGEXP opcode arguments. 2002-08-26 09:11:54 +00:00
igor%mir2.org
dd4a08ede4 Renaming the TokenStream.OBJECT constant to TokenStream.REGEXP for better reflection of semantics. 2002-08-26 08:06:27 +00:00
igor%mir2.org
b481986e42 Fixing line number generation for the empty return statement which was reported by Steven Beal. It was caused by missed update of lineno in statementHelper when dealing with return;. 2002-08-16 06:42:27 +00:00