CallNative redundant code




JavaScript Engine: JIT
2 years ago
2 years ago


(Reporter: lth, Unassigned)


Firefox Tracking Flags

(Not tracked)



(1 attachment)

337 bytes, application/x-javascript


2 years ago
Just some observations.  I'm not saying these are all easy (or necessarily desirable) to fix.

Here's code from a call that passes five parameters.

One of the tests at A and A' is redundant.
The mov at B is dead.
The mov at C is redundant.
The bic at D is redundant, given the assertion at A.
Given D and the two instructions after, A' is especially redundant.
Given that D is redundant, E is redundant too.
Given that D is redundant, arguably G and G' are redundant too.
The nop at F is dead.

   026fd6d8  e31d0007       tst sp, #7               A
   026fd6dc  0a800000       beq  -> 1028f            A
   026fd6e0  e1201179       bkpt 281                 A
   026fd6e4  e28dd030       add sp, sp, #48
   026fd6e8  e3e0c077       mvn ip, #119
   026fd6ec  e52dc004       str ip, [sp, #-4]!
   026fd6f0  e300c9a0       movw ip, #2464
   026fd6f4  e340c256       movt ip, #598
   026fd6f8  e52dc004       str ip, [sp, #-4]!
   026fd6fc  e30d00f8       movw r0, #53496
   026fd700  e3400222       movt r0, #546
   026fd704  e5900000       ldr r0, [r0, #+0]
   026fd708  e3a01005       mov r1, #5
   026fd70c  e1a0200d       mov r2, sp               B
   026fd710  e52d1004       str r1, [sp, #-4]!
   026fd714  e3a0ceb8       mov ip, #2944
   026fd718  e52dc004       str ip, [sp, #-4]!
   026fd71c  e52df004       str pc, [sp, #-4]!
   026fd720  e320f000       nop                      F
   026fd724  e30dc0f4       movw ip, #53492
   026fd728  e340c222       movt ip, #546
   026fd72c  e58cd000       str sp, [ip, #+0]
   026fd730  e3a0c000       mov ip, #0
   026fd734  e52dc004       str ip, [sp, #-4]!
   026fd738  e3a0c000       mov ip, #0               C
   026fd73c  e52dc004       str ip, [sp, #-4]!
   026fd740  e1a0300d       mov r3, sp               E
   026fd744  e3cdd007       bic sp, sp, #7           D
   026fd748  e52d3004       str r3, [sp, #-4]!       G
   026fd74c  e24dd004       sub sp, sp, #4           G
   026fd750  e31d0007       tst sp, #7               A'
   026fd754  0a800000       beq  -> 1030f            A'
   026fd758  e120117a       bkpt 282                 A'
   026fd75c  e30ac154       movw ip, #41300
   026fd760  e340c26c       movt ip, #620
   026fd764  e12fff3c       blx ip
   026fd768  e28dd004       add sp, sp, #4           G'
   026fd76c  e59dd000       ldr sp, [sp, #+0]        G'
   026fd770  e31000ff       tst r0, #255
   026fd774  0a800000       beq  -> 1032f
   026fd778  e1cd21d4       ldrd r2, [sp, #+20]
   026fd77c  e24dd014       sub sp, sp, #20

Comment 1

2 years ago
Created attachment 8669707 [details]

(That code is probably from a debug build, accounting for the code at A and A'.  Attaching the code.  Run on ARM simulator with -D.)

Comment 2

2 years ago
There's nothing actionable here (in a release build) that does not fall under the purview of general peephole optimization.
Last Resolved: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.