Bug 39408 - Unify JIT/interpreter return behaviour.
Summary: Unify JIT/interpreter return behaviour.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Gavin Barraclough
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-19 23:19 PDT by Gavin Barraclough
Modified: 2010-05-20 13:12 PDT (History)
0 users

See Also:


Attachments
The patch (49.40 KB, patch)
2010-05-19 23:24 PDT, Gavin Barraclough
oliver: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gavin Barraclough 2010-05-19 23:19:02 PDT
Presently the JIT and the interpreter have differing implementations in how they handle storing the result of a function call back to the register file.  In both cases the op_call ( / _eval / _varargs / op_construct) opcode has an operand indicating the VM register in which the result should be stored.  The JIT plants code after the call to store the result, so the value will be stored as soon as the callee has returned.  In the interpreter the call passes the return value register id into the callee via the callee callframe, and the callee is responsible for writing the result back into its callers register file after it has restored the parents callframe pointer, but before returning.

Instead, move the task of writing the call result to the register file into a new opcode (op_call_put_result), and after returning the callee should leave the return value in a canonical location.  In the case of the interpreter, this canonical location is a local variable in privateExecute (functionReturnValue), in the case of the JIT this is the normal return value registers (regT0, or regT1:regT0 in JSVALUE32_64).  op_call_put_result stores the result from the canonical location to the registerfile.

In addition to unifying JIT & interpreter behaviour this change allows us to remove a slot from the callframe, omit the write of the result where the return value from the call is not used, and provides a 2% speedup on sunspider in the interpreter.
Comment 1 Gavin Barraclough 2010-05-19 23:24:40 PDT
Created attachment 56566 [details]
The patch
Comment 2 Oliver Hunt 2010-05-20 12:59:21 PDT
Comment on attachment 56566 [details]
The patch

r=me
Comment 3 Gavin Barraclough 2010-05-20 13:12:54 PDT
Transmitting file data ............
Committed revision 59860.