Branch: Tag:

2012-06-20

2012-06-20 04:43:06 by Per Hedbor <ph@opera.com>

[compiler][amd64] Cleaned up code somewhat and faster branches

Added FAST_BRANCH_WHEN{_,_NOT_}ZERO that knows that sp[-1] is an
integer. It can thus avoid doing any checking of types and the normal
pop_stack checks.

Also inlined the normal BRANCH_WHEN{_,_NON_}ZERO.

There is now a common function that is used to generate
modrm+sib+offset for the *mem* family of functions.

Also removed frame init/stack cleaning for Functions that just return
a constant.

384:   LOCAL BRANCH_WHEN_NON_ZERO : BRANCH_IF_LOCAL($1a) POINTER($2a)   LOCAL BRANCH_WHEN_ZERO : BRANCH_IF_NOT_LOCAL($1a) POINTER($2a)    + // quick_branch_when[_non]_zero _knows_ that the + // value on the stack is an integer. + GT BRANCH_WHEN_ZERO : GT QUICK_BRANCH_WHEN_ZERO($2a) + GE BRANCH_WHEN_ZERO : GE QUICK_BRANCH_WHEN_ZERO($2a) + LT BRANCH_WHEN_ZERO : LT QUICK_BRANCH_WHEN_ZERO($2a) + LE BRANCH_WHEN_ZERO : LE QUICK_BRANCH_WHEN_ZERO($2a) +  + GT BRANCH_WHEN_NON_ZERO : GT QUICK_BRANCH_WHEN_NON_ZERO($2a) + GE BRANCH_WHEN_NON_ZERO : GE QUICK_BRANCH_WHEN_NON_ZERO($2a) + LT BRANCH_WHEN_NON_ZERO : LT QUICK_BRANCH_WHEN_NON_ZERO($2a) + LE BRANCH_WHEN_NON_ZERO : LE QUICK_BRANCH_WHEN_NON_ZERO($2a) +  + // It is not really neccessary to set up a frame for these cases. + // Deluxe version: Also avoid the argument/local clearing, asm-level + // register pushing etc. + // + // These are functions returning a constant, and doing nothing else. + MARK_AT(0) POP_TO_MARK INIT_FRAME RETURN_0 : RETURN_0 + MARK_AT(0) POP_TO_MARK INIT_FRAME RETURN_1 : RETURN_1 + MARK_AT(0) POP_TO_MARK INIT_FRAME NUMBER RETURN : NUMBER RETURN + MARK_AT(0) POP_TO_MARK INIT_FRAME STRING RETURN : STRING RETURN + MARK_AT(0) POP_TO_MARK INIT_FRAME CONSTANT RETURN : CONSTANT RETURN + MARK_AT(0) POP_TO_MARK INIT_FRAME NUMBER RETURN : NUMBER RETURN + MARK_AT(0) POP_TO_MARK INIT_FRAME STRING RETURN : STRING RETURN + MARK_AT(0) POP_TO_MARK INIT_FRAME CONSTANT RETURN : CONSTANT RETURN +    // Branches that jump to the next instruction   // Basic branches   BRANCH LABEL($1a) : LABEL($1a)