Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | .LEVEL 1.1 |
michael@0 | 2 | framesz .EQU 128 |
michael@0 | 3 | |
michael@0 | 4 | ; XPTC_InvokeByIndex(nsISuppots* that, uint32_t methodIndex, |
michael@0 | 5 | ; uint32_t paramCount, nsXPTCVariant* params); |
michael@0 | 6 | |
michael@0 | 7 | ; g++ need to compile everything with -fvtable-thunks ! |
michael@0 | 8 | |
michael@0 | 9 | .SPACE $TEXT$,SORT=8 |
michael@0 | 10 | .SUBSPA $CODE$,QUAD=0,ALIGN=4,ACCESS=0x2c,CODE_ONLY,SORT=24 |
michael@0 | 11 | XPTC_InvokeByIndex |
michael@0 | 12 | .PROC |
michael@0 | 13 | .CALLINFO CALLER,FRAME=72,ENTRY_GR=%r3,SAVE_RP,SAVE_SP,ARGS_SAVED,ALLOCA_FRAME |
michael@0 | 14 | |
michael@0 | 15 | ; frame marker takes 48 bytes, |
michael@0 | 16 | ; register spill area takes 8 bytes, |
michael@0 | 17 | ; local stack area takes 72 bytes result in 128 bytes total |
michael@0 | 18 | |
michael@0 | 19 | .ENTRY |
michael@0 | 20 | STW %rp,-20(%sp) |
michael@0 | 21 | STW,MA %r3,128(%sp) |
michael@0 | 22 | |
michael@0 | 23 | LDO -framesz(%r30),%r28 |
michael@0 | 24 | STW %r28,-4(%r30) ; save previous sp |
michael@0 | 25 | STW %r19,-32(%r30) |
michael@0 | 26 | |
michael@0 | 27 | STW %r26,-36-framesz(%r30) ; save argument registers in |
michael@0 | 28 | STW %r25,-40-framesz(%r30) ; in PREVIOUS frame |
michael@0 | 29 | STW %r24,-44-framesz(%r30) ; |
michael@0 | 30 | STW %r23,-48-framesz(%r30) ; |
michael@0 | 31 | |
michael@0 | 32 | B,L .+8,%r2 |
michael@0 | 33 | ADDIL L'invoke_count_bytes-$PIC_pcrel$1+4,%r2,%r1 |
michael@0 | 34 | LDO R'invoke_count_bytes-$PIC_pcrel$2+8(%r1),%r1 |
michael@0 | 35 | $PIC_pcrel$1 |
michael@0 | 36 | LDSID (%r1),%r31 |
michael@0 | 37 | $PIC_pcrel$2 |
michael@0 | 38 | MTSP %r31,%sr0 |
michael@0 | 39 | .CALL ARGW0=GR,ARGW1=GR,ARGW2=GR ;in=24,25,26;out=28 |
michael@0 | 40 | BE,L 0(%sr0,%r1),%r31 |
michael@0 | 41 | COPY %r31,%r2 |
michael@0 | 42 | |
michael@0 | 43 | CMPIB,>= 0,%r28, .+76 |
michael@0 | 44 | COPY %r30,%r3 ; copy stack ptr to saved stack ptr |
michael@0 | 45 | ADD %r30,%r28,%r30 ; extend stack frame |
michael@0 | 46 | LDW -4(%r3),%r28 ; move frame |
michael@0 | 47 | STW %r28,-4(%r30) |
michael@0 | 48 | LDW -8(%r3),%r28 |
michael@0 | 49 | STW %r28,-8(%r30) |
michael@0 | 50 | LDW -12(%r3),%r28 |
michael@0 | 51 | STW %r28,-12(%r30) |
michael@0 | 52 | LDW -16(%r3),%r28 |
michael@0 | 53 | STW %r28,-16(%r30) |
michael@0 | 54 | LDW -20(%r3),%r28 |
michael@0 | 55 | STW %r28,-20(%r30) |
michael@0 | 56 | LDW -24(%r3),%r28 |
michael@0 | 57 | STW %r28,-24(%r30) |
michael@0 | 58 | LDW -28(%r3),%r28 |
michael@0 | 59 | STW %r28,-28(%r30) |
michael@0 | 60 | LDW -32(%r3),%r28 |
michael@0 | 61 | STW %r28,-32(%r30) |
michael@0 | 62 | |
michael@0 | 63 | LDO -40(%r30),%r26 ; load copy address |
michael@0 | 64 | LDW -44-framesz(%r3),%r25 ; load rest of 2 arguments |
michael@0 | 65 | LDW -48-framesz(%r3),%r24 ; |
michael@0 | 66 | |
michael@0 | 67 | LDW -32(%r30),%r19 ; shared lib call destroys r19; reload |
michael@0 | 68 | B,L .+8,%r2 |
michael@0 | 69 | ADDIL L'invoke_copy_to_stack-$PIC_pcrel$3+4,%r2,%r1 |
michael@0 | 70 | LDO R'invoke_copy_to_stack-$PIC_pcrel$4+8(%r1),%r1 |
michael@0 | 71 | $PIC_pcrel$3 |
michael@0 | 72 | LDSID (%r1),%r31 |
michael@0 | 73 | $PIC_pcrel$4 |
michael@0 | 74 | MTSP %r31,%sr0 |
michael@0 | 75 | .CALL ARGW0=GR,ARGW1=GR,ARGW2=GR ;in=24,25,26 |
michael@0 | 76 | BE,L 0(%sr0,%r1),%r31 |
michael@0 | 77 | COPY %r31,%r2 |
michael@0 | 78 | |
michael@0 | 79 | LDO -48(%r30),%r20 |
michael@0 | 80 | EXTRW,U,= %r28,31,1,%r22 |
michael@0 | 81 | FLDD 0(%r20),%fr7 ; load double arg 1 |
michael@0 | 82 | EXTRW,U,= %r28,30,1,%r22 |
michael@0 | 83 | FLDW 8(%r20),%fr5L ; load float arg 1 |
michael@0 | 84 | EXTRW,U,= %r28,29,1,%r22 |
michael@0 | 85 | FLDW 4(%r20),%fr6L ; load float arg 2 |
michael@0 | 86 | EXTRW,U,= %r28,28,1,%r22 |
michael@0 | 87 | FLDW 0(%r20),%fr7L ; load float arg 3 |
michael@0 | 88 | |
michael@0 | 89 | LDW -36-framesz(%r3),%r26 ; load ptr to 'that' |
michael@0 | 90 | LDW -40(%r30),%r25 ; load the rest of dispatch argument registers |
michael@0 | 91 | LDW -44(%r30),%r24 |
michael@0 | 92 | LDW -48(%r30),%r23 |
michael@0 | 93 | |
michael@0 | 94 | LDW -36-framesz(%r3),%r20 ; load vtable addr |
michael@0 | 95 | LDW -40-framesz(%r3),%r28 ; load index |
michael@0 | 96 | LDW 0(%r20),%r20 ; follow vtable |
michael@0 | 97 | LDO 16(%r20),%r20 ; offset vtable by 16 bytes (g++: 8, aCC: 16) |
michael@0 | 98 | SH2ADDL %r28,%r20,%r28 ; add 4*index to vtable entry |
michael@0 | 99 | LDW 0(%r28),%r22 ; load vtable entry |
michael@0 | 100 | |
michael@0 | 101 | B,L .+8,%r2 |
michael@0 | 102 | ADDIL L'$$dyncall_external-$PIC_pcrel$5+4,%r2,%r1 |
michael@0 | 103 | LDO R'$$dyncall_external-$PIC_pcrel$6+8(%r1),%r1 |
michael@0 | 104 | $PIC_pcrel$5 |
michael@0 | 105 | LDSID (%r1),%r31 |
michael@0 | 106 | $PIC_pcrel$6 |
michael@0 | 107 | MTSP %r31,%sr0 |
michael@0 | 108 | .CALL ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR |
michael@0 | 109 | ;in=22-26;out=28; |
michael@0 | 110 | BE,L 0(%sr0,%r1),%r31 |
michael@0 | 111 | COPY %r31,%r2 |
michael@0 | 112 | |
michael@0 | 113 | LDW -32(%r30),%r19 |
michael@0 | 114 | COPY %r3,%r30 ; restore saved stack ptr |
michael@0 | 115 | |
michael@0 | 116 | LDW -148(%sp),%rp |
michael@0 | 117 | BVE (%rp) |
michael@0 | 118 | .EXIT |
michael@0 | 119 | LDW,MB -128(%sp),%r3 |
michael@0 | 120 | |
michael@0 | 121 | .PROCEND ;in=23,24,25,26; |
michael@0 | 122 | |
michael@0 | 123 | .ALIGN 8 |
michael@0 | 124 | .SPACE $TEXT$ |
michael@0 | 125 | .SUBSPA $CODE$ |
michael@0 | 126 | .IMPORT $$dyncall_external,MILLICODE |
michael@0 | 127 | .IMPORT invoke_count_bytes,CODE |
michael@0 | 128 | .IMPORT invoke_copy_to_stack,CODE |
michael@0 | 129 | .EXPORT XPTC_InvokeByIndex,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR,ARGW2=GR,ARGW3=GR,RTNVAL=GR,LONG_RETURN |
michael@0 | 130 | .END |
michael@0 | 131 |