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
1 /* -*- Mode: asm; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * Version: MPL 1.1
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 /* This code is for MIPS using the O32 ABI. */
10 #include <sys/regdef.h>
11 #include <sys/asm.h>
13 .text
14 .globl PrepareAndDispatch
16 NARGSAVE=4 # extra space for the callee to use. gccism
17 # we can put our a0-a3 in our callers space.
18 LOCALSZ=2 # gp, ra
19 FRAMESZ=(((NARGSAVE+LOCALSZ)*SZREG)+ALSZ)&ALMASK
21 define(STUB_NAME, `Stub'$1`__14nsXPTCStubBase')
23 define(STUB_ENTRY,
24 ` .globl 'STUB_NAME($1)`
25 .align 2
26 .type 'STUB_NAME($1)`,@function
27 .ent 'STUB_NAME($1)`, 0
28 'STUB_NAME($1)`:
29 .frame sp, FRAMESZ, ra
30 .set noreorder
31 .cpload t9
32 .set reorder
33 subu sp, FRAMESZ
34 .cprestore 16
35 li t0, '$1`
36 b sharedstub
37 .end 'STUB_NAME($1)`
39 ')
41 define(SENTINEL_ENTRY, `')
43 include(xptcstubsdef.inc)
45 .globl sharedstub
46 .ent sharedstub
47 sharedstub:
49 REG_S ra, 20(sp)
51 REG_S a0, 24(sp)
52 REG_S a1, 28(sp)
53 REG_S a2, 32(sp)
54 REG_S a3, 36(sp)
56 # t0 is methodIndex
57 move a1, t0
59 # put the start of a1, a2, a3, and stack
60 move a2, sp
61 addi a2, 24 # have a2 point to sp + 24 (where a0 is)
63 # PrepareAndDispatch(that, methodIndex, args)
64 # a0 a1 a2
65 #
66 jal PrepareAndDispatch
68 REG_L ra, 20(sp)
69 REG_L a1, 28(sp)
70 REG_L a2, 32(sp)
72 addu sp, FRAMESZ
73 j ra
75 .end sharedstub