Closed Bug 85880 Opened 23 years ago Closed 23 years ago

Clearing of <function-name>.arguments after function calls in interpreter mode

Categories

(Rhino Graveyard :: Core, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: user, Assigned: norrisboyd)

Details

Attachments

(2 files)

When run in interpreter mode (java org.mozilla.javascript.tools.shell.Main -opt
-1), the following prints "null" instead of expected "[object Arguments]":

function g(x) {
}

function f() {
	g();
	return f.arguments;
}

print(f(0))

I beliave this is caused by the following code in omj/ScriptRuntime.java, lines
1725-1727:

stack[stackTop] = ScriptRuntime.call(cx, lhs, rhs, 
                                     outArgs, 
                                     calleeScope);
if (theData.itsNeedsActivation) {
    ScriptRuntime.popActivation(cx);
}

which removes activation object after each function call.
The attached patch moves ScriptRuntime.popActivation(cx) to the call method of
omj.InterpretedFunction in the similar way omj.optimizer.CdeGen does and removes
unused outside NativeCall NativeCall(Context, Scriptable, NativeFunction,
Scriptable) constructor by inlining its code.
Committed patch, marking fixed. Thanks, Igor.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Testcase addded to JS test suite:

          js/tests/ecma_3/Function/regress-85880.js


Before fix, failing in Rhino interpreted mode only.
Passing in Rhino complied mode; passing in SpiderMonkey.
After fix, testcase passing in both Rhino modes on WinNT.
Marking VERIFIED FIXED -
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: