Optimizer regression: this.name += expression generates wrong code.

RESOLVED FIXED in 1.6R1

Status

Rhino
Compiler
--
major
RESOLVED FIXED
14 years ago
14 years ago

People

(Reporter: Igor Bukanov, Assigned: Igor Bukanov)

Tracking

Details

Attachments

(1 attachment)

(Assignee)

Description

14 years ago
Consider the following example:

function F()
{
	this.name = "A";
	this.name += "B";
}

new F();

With Rhino from CVS it produces with optimization mode 0 or greater:
(Assignee)

Comment 1

14 years ago
Created attachment 157408 [details] [diff] [review]
Fix: it should ScriptRuntime.getObjectProp, not OptRuntime.thisGet


E4X support added ScriptRuntime.getObjectProp which was equivalent to
OptRuntime.thisGet but I forgot to update the code generation to call the new
method.
(Assignee)

Comment 2

14 years ago
I cimmitted the fix
Status: NEW → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.5R6
(Assignee)

Comment 3

14 years ago
(In reply to comment #0)
> Consider the following example:
> 
> function F()
> {
> 	this.name = "A";
> 	this.name += "B";
> }
> 
> new F();
> 
> With Rhino from CVS it produces with optimization mode 0 or greater:

It was cut, not paste for the bug output when copied the error output:

Exception in thread "main" java.lang.NoSuchMethodError:
org.mozilla.javascript.optimizer.OptRuntime.thisGet(Lorg/mozilla/javascript/Scriptable;Ljava/lang/String;Lorg/mozilla/javascript/Scriptable;)Ljava/lang/Object;
        at org.mozilla.javascript.gen.c1._c1(/home/igor/s/x.js:4)
        at org.mozilla.javascript.gen.c1.call(/home/igor/s/x.js)
        at org.mozilla.javascript.BaseFunction.construct(BaseFunction.java:306)
        at org.mozilla.javascript.ScriptRuntime.newObject(ScriptRuntime.java:2156)
        at org.mozilla.javascript.gen.c1._c0(/home/igor/s/x.js:7)
        at org.mozilla.javascript.gen.c1.call(/home/igor/s/x.js)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2864)
        at org.mozilla.javascript.gen.c1.call(/home/igor/s/x.js)
        at org.mozilla.javascript.gen.c1.exec(/home/igor/s/x.js)
        at org.mozilla.javascript.Context.evaluateReader(Context.java:1179)
        at org.mozilla.javascript.tools.shell.Main.evaluateScript(Main.java:389)
        at org.mozilla.javascript.tools.shell.Main.processFileSecure(Main.java:376)
        at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:313)
        at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:305)
        at org.mozilla.javascript.tools.shell.Main$1.run(Main.java:119)
        at org.mozilla.javascript.Context.call(Context.java:498)
        at org.mozilla.javascript.Context.call(Context.java:413)
        at org.mozilla.javascript.tools.shell.Main.withContext(Main.java:155)
        at org.mozilla.javascript.tools.shell.Main.exec(Main.java:96)
        at org.mozilla.javascript.tools.shell.Main.main(Main.java:77)

Now the test works and prints nothing as expected
You need to log in before you can comment on or make changes to this bug.