I'm building a NES emulator in Javascript and there's a certain function of 
code that when gathering performance metrics in google chrome, shows that 
the self time for this method is over 30% of overall execution time. That's 
pretty excessive to what looks like a tree of if/else statements. I was 
wondering if anyone can look at it to see if there's something to this 
structure that would have the v8 engine choke on it.  I've also gathered a 
collection of v8's opt and deopt messages regarding this method and so far 
I'm having a very hard time finding documentation online to understand the 
deopt reasons and how to potentially code to safeguard against the constant 
deopts.

I've attached the code in the method as well as the opt/deopt log.  Would 
love any feedback!


-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[marking 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> for 
optimized recompilation, reason: hot and stable, ICs with typeinfo: 58/116 
(50%), generic ICs: 0/116 (0%)]
[compiling method 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> 
using TurboFan]
[optimizing 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> - took 
0.862, 7.577, 0.063 ms]
[completed optimizing 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)>]
[deoptimizing (DEOPT soft): begin 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> (opt #42) @3, FP to SP delta: 144, caller sp: 0x00ab833fd480]
            ;;; deoptimize at <http://localhost:3000/js/nesppu.js:250:27>, 
Insufficient type feedback for compare operation
  reading input frame tick => bytecode_offset=342, args=1, height=8; inputs:
      0: 0x63c41d22eee9 ;  [fp -  16]  0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)>
      1: 0x52e6f500f6e1 ;  [fp +  16]  0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89>
      2: 0x5f46ecc87b21 ;  [fp -  24]  0x5f46ecc87b21 <FunctionContext[5]>
      3: 0x000000000000 ;  [fp -  32]  0
      4: 0x00f000000000 ; rax 240
      5: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      6: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      7: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      8: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      9: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     10: 0x00f100000000 ; (literal  5) 241
  translating interpreted frame tick => bytecode_offset=342, height=64
    0x00ab833fd478: [top + 112] <- 0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89> ;  stack parameter (input #1)
    -------------------------
    0x00ab833fd470: [top + 104] <- 0x78c0c09c8af9 ;  caller's pc
    0x00ab833fd468: [top +  96] <- 0x00ab833fd500 ;  caller's fp
    0x00ab833fd460: [top +  88] <- 0x5f46ecc87b21 <FunctionContext[5]> ;  
context
 (input #0)
    0x00ab833fd458: [top +  80] <- 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> ;  function
 (input #0)
    0x00ab833fd450: [top +  72] <- 0x5237586fbf71 <BytecodeArray[941]> ;  
bytecode array
    0x00ab833fd448: [top +  64] <- 0x018f00000000 <Smi 399> ;  bytecode offset
    -------------------------
    0x00ab833fd440: [top +  56] <- 0x000000000000 <Smi 0> ;  stack parameter 
(input #3)
    0x00ab833fd438: [top +  48] <- 0x00f000000000 <Smi 240> ;  stack parameter 
(input #4)
    0x00ab833fd430: [top +  40] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #5)
    0x00ab833fd428: [top +  32] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #6)
    0x00ab833fd420: [top +  24] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #7)
    0x00ab833fd418: [top +  16] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #8)
    0x00ab833fd410: [top +   8] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #9)
    0x00ab833fd408: [top +   0] <- 0x00f100000000 <Smi 241> ;  accumulator 
(input #0)
[deoptimizing (soft): end 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> @3 => node=342, pc=0x7ff9cb961e20, caller sp=0x00ab833fd480, 
took 0.128 ms]


[marking 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> for 
optimized recompilation, reason: hot and stable, ICs with typeinfo: 65/116 
(56%), generic ICs: 0/116 (0%)]
[compiling method 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> 
using TurboFan]
[optimizing 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> - took 
0.869, 8.493, 0.137 ms]
[completed optimizing 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)>]


[deoptimizing (DEOPT soft): begin 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> (opt #58) @4, FP to SP delta: 144, caller sp: 0x00ab833fd4a8]
            ;;; deoptimize at <http://localhost:3000/js/nesppu.js:264:19>, 
Insufficient type feedback for compare operation
  reading input frame tick => bytecode_offset=422, args=1, height=8; inputs:
      0: 0x63c41d22eee9 ;  [fp -  16]  0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)>
      1: 0x52e6f500f6e1 ;  [fp +  16]  0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89>
      2: 0x5f46ecc87b21 ;  [fp -  24]  0x5f46ecc87b21 <FunctionContext[5]>
      3: 0x000000000000 ; rbx 0
      4: 0x010500000000 ; rax 261
      5: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      6: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      7: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      8: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      9: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     10: 0x010500000000 ; (literal  5) 261
  translating interpreted frame tick => bytecode_offset=422, height=64
    0x00ab833fd4a0: [top + 112] <- 0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89> ;  stack parameter (input #1)
    -------------------------
    0x00ab833fd498: [top + 104] <- 0x78c0c09cecc2 ;  caller's pc
    0x00ab833fd490: [top +  96] <- 0x00ab833fd500 ;  caller's fp
    0x00ab833fd488: [top +  88] <- 0x5f46ecc87b21 <FunctionContext[5]> ;  
context
 (input #0)
    0x00ab833fd480: [top +  80] <- 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> ;  function
 (input #0)
    0x00ab833fd478: [top +  72] <- 0x5237586fbf71 <BytecodeArray[941]> ;  
bytecode array
    0x00ab833fd470: [top +  64] <- 0x01df00000000 <Smi 479> ;  bytecode offset
    -------------------------
    0x00ab833fd468: [top +  56] <- 0x000000000000 <Smi 0> ;  stack parameter 
(input #3)
    0x00ab833fd460: [top +  48] <- 0x010500000000 <Smi 261> ;  stack parameter 
(input #4)
    0x00ab833fd458: [top +  40] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #5)
    0x00ab833fd450: [top +  32] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #6)
    0x00ab833fd448: [top +  24] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #7)
    0x00ab833fd440: [top +  16] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #8)
    0x00ab833fd438: [top +   8] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #9)
    0x00ab833fd430: [top +   0] <- 0x010500000000 <Smi 261> ;  accumulator 
(input #0)
[deoptimizing (soft): end 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> @4 => node=422, pc=0x7ff9cb961e20, caller sp=0x00ab833fd4a8, 
took 0.076 ms]
[marking 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> for 
optimized recompilation, reason: hot and stable, ICs with typeinfo: 98/116 
(84%), generic ICs: 0/116 (0%)]
[compiling method 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> 
using TurboFan]

[optimizing 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> - took 
1.811, 8.835, 0.068 ms]
[completed optimizing 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)>]

[deoptimizing (DEOPT soft): begin 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> (opt #64) @83, FP to SP delta: 152, caller sp: 
0x00ab833fd4a8]
            ;;; deoptimize at <http://localhost:3000/js/nesppu.js:257:16>, 
Insufficient type feedback for generic named access
  reading input frame tick => bytecode_offset=394, args=1, height=8; inputs:
      0: 0x63c41d22eee9 ;  [fp -  16]  0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)>
      1: 0x52e6f500f6e1 ;  [fp +  16]  0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89>
      2: 0x5f46ecc87b21 ;  [fp -  24]  0x5f46ecc87b21 <FunctionContext[5]>
      3: 0x000100000000 ;  [fp -  32]  1
      4: 0x00f100000000 ;  [fp -  40]  241
      5: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      6: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      7: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      8: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      9: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     10: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
  translating interpreted frame tick => bytecode_offset=394, height=64
    0x00ab833fd4a0: [top + 112] <- 0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89> ;  stack parameter (input #1)
    -------------------------
    0x00ab833fd498: [top + 104] <- 0x78c0c09cec07 ;  caller's pc
    0x00ab833fd490: [top +  96] <- 0x00ab833fd500 ;  caller's fp
    0x00ab833fd488: [top +  88] <- 0x5f46ecc87b21 <FunctionContext[5]> ;  
context
 (input #0)
    0x00ab833fd480: [top +  80] <- 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> ;  function
 (input #0)
    0x00ab833fd478: [top +  72] <- 0x5237586fbf71 <BytecodeArray[941]> ;  
bytecode array
    0x00ab833fd470: [top +  64] <- 0x01c300000000 <Smi 451> ;  bytecode offset
    -------------------------
    0x00ab833fd468: [top +  56] <- 0x000100000000 <Smi 1> ;  stack parameter 
(input #3)
    0x00ab833fd460: [top +  48] <- 0x00f100000000 <Smi 241> ;  stack parameter 
(input #4)
    0x00ab833fd458: [top +  40] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #5)
    0x00ab833fd450: [top +  32] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #6)
    0x00ab833fd448: [top +  24] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #7)
    0x00ab833fd440: [top +  16] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #8)
    0x00ab833fd438: [top +   8] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #9)
    0x00ab833fd430: [top +   0] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  accumulator (input #0)
[deoptimizing (soft): end 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> @83 => node=394, pc=0x7ff9cb961e20, caller 
sp=0x00ab833fd4a8, took 0.083 ms]

[marking 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> for 
optimized recompilation, reason: hot and stable, ICs with typeinfo: 101/116 
(87%), generic ICs: 0/116 (0%)]
[compiling method 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> 
using TurboFan]

[optimizing 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> - took 
1.070, 11.952, 0.076 ms]
[completed optimizing 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)>]

[deoptimizing (DEOPT soft): begin 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> (opt #67) @71, FP to SP delta: 152, caller sp: 
0x00ab833fd4a8]
            ;;; deoptimize at <http://localhost:3000/js/nesppu.js:269:39>, 
Insufficient type feedback for generic named access
  reading input frame tick => bytecode_offset=442, args=1, height=8; inputs:
      0: 0x63c41d22eee9 ;  [fp -  16]  0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)>
      1: 0x52e6f500f6e1 ;  [fp +  16]  0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89>
      2: 0x5f46ecc87b21 ;  [fp -  24]  0x5f46ecc87b21 <FunctionContext[5]>
      3: 0x013000000000 ;  [fp -  32]  304
      4: 0x010500000000 ;  [fp -  40]  261
      5: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      6: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      7: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      8: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      9: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     10: 0x23dce4e83211 ; (literal  3) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
  translating interpreted frame tick => bytecode_offset=442, height=64
    0x00ab833fd4a0: [top + 112] <- 0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89> ;  stack parameter (input #1)
    -------------------------
    0x00ab833fd498: [top + 104] <- 0x78c0c09e282e ;  caller's pc
    0x00ab833fd490: [top +  96] <- 0x00ab833fd500 ;  caller's fp
    0x00ab833fd488: [top +  88] <- 0x5f46ecc87b21 <FunctionContext[5]> ;  
context
 (input #0)
    0x00ab833fd480: [top +  80] <- 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> ;  function
 (input #0)
    0x00ab833fd478: [top +  72] <- 0x5237586fbf71 <BytecodeArray[941]> ;  
bytecode array
    0x00ab833fd470: [top +  64] <- 0x01f300000000 <Smi 499> ;  bytecode offset
    -------------------------
    0x00ab833fd468: [top +  56] <- 0x013000000000 <Smi 304> ;  stack parameter 
(input #3)
    0x00ab833fd460: [top +  48] <- 0x010500000000 <Smi 261> ;  stack parameter 
(input #4)
    0x00ab833fd458: [top +  40] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #5)
    0x00ab833fd450: [top +  32] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #6)
    0x00ab833fd448: [top +  24] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #7)
    0x00ab833fd440: [top +  16] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #8)
    0x00ab833fd438: [top +   8] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #9)
    0x00ab833fd430: [top +   0] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  accumulator (input #0)
[deoptimizing (soft): end 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> @71 => node=442, pc=0x7ff9cb961e20, caller 
sp=0x00ab833fd4a8, took 0.065 ms]

[marking 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> for 
optimized recompilation, reason: hot and stable, ICs with typeinfo: 106/116 
(91%), generic ICs: 0/116 (0%)]
[compiling method 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> 
using TurboFan]

[optimizing 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> - took 
1.419, 15.488, 0.130 ms]
[completed optimizing 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)>]
[deoptimizing (DEOPT soft): begin 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> (opt #77) @148, FP to SP delta: 152, caller sp: 
0x00ab833fd4a8]
            ;;; deoptimize at <http://localhost:3000/js/nesppu.js:847:17> 
inlined at <http://localhost:3000/js/nesppu.js:204:16>, Insufficient type 
feedback for binary operation
  reading input frame tick => bytecode_offset=50, args=1, height=8; inputs:
      0: 0x63c41d22eee9 ;  [fp -  16]  0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)>
      1: 0x52e6f500f6e1 ;  [fp +  16]  0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89>
      2: 0x5f46ecc87b21 ;  [fp -  24]  0x5f46ecc87b21 <FunctionContext[5]>
      3: 0x006400000000 ;  [fp -  32]  100
      4: 0x002e00000000 ;  [fp -  40]  46
      5: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      6: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      7: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      8: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      9: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     10: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
  reading input frame renderPixel => bytecode_offset=173, args=3, height=10; 
inputs:
      0: 0x6e9434792609 ; (literal  8) 0x6e9434792609 <JSFunction renderPixel 
(sfi = 00002354BCA31029)>
      1: 0x52e6f500f6e1 ; (literal  9) 0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89>
      2: 99 ; (int) [fp -  48] 
      3: 0x002e00000000 ;  [fp -  40]  46
      4: 0x65a539f860e9 ; (literal 10) 0x65a539f860e9 <NativeContext[248]>
      5: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      6: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      7: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      8: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      9: 3 ; (int) [fp -  64] 
     10: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     11: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     12: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     13: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     14: 99 ; (int) [fp -  48] 
  translating interpreted frame tick => bytecode_offset=50, height=56
    0x00ab833fd4a0: [top + 104] <- 0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89> ;  stack parameter (input #1)
    -------------------------
    0x00ab833fd498: [top +  96] <- 0x78c0c09e282e ;  caller's pc
    0x00ab833fd490: [top +  88] <- 0x00ab833fd500 ;  caller's fp
    0x00ab833fd488: [top +  80] <- 0x5f46ecc87b21 <FunctionContext[5]> ;  
context
 (input #0)
    0x00ab833fd480: [top +  72] <- 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> ;  function
 (input #0)
    0x00ab833fd478: [top +  64] <- 0x5237586fbf71 <BytecodeArray[941]> ;  
bytecode array
    0x00ab833fd470: [top +  56] <- 0x006b00000000 <Smi 107> ;  bytecode offset
    -------------------------
    0x00ab833fd468: [top +  48] <- 0x006400000000 <Smi 100> ;  stack parameter 
(input #3)
    0x00ab833fd460: [top +  40] <- 0x002e00000000 <Smi 46> ;  stack parameter 
(input #4)
    0x00ab833fd458: [top +  32] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #5)
    0x00ab833fd450: [top +  24] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #6)
    0x00ab833fd448: [top +  16] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #7)
    0x00ab833fd440: [top +   8] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #8)
    0x00ab833fd438: [top +   0] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #9)
  translating interpreted frame renderPixel => bytecode_offset=173, height=80
    0x00ab833fd430: [top + 144] <- 0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89> ;  stack parameter (input #1)
    0x00ab833fd428: [top + 136] <- 0x006300000000 <Smi 99> ;  stack parameter 
(input #2)
    0x00ab833fd420: [top + 128] <- 0x002e00000000 <Smi 46> ;  stack parameter 
(input #3)
    -------------------------
    0x00ab833fd418: [top + 120] <- 0x7ff9cb961d60 ;  caller's pc
    0x00ab833fd410: [top + 112] <- 0x00ab833fd490 ;  caller's fp
    0x00ab833fd408: [top + 104] <- 0x65a539f860e9 <NativeContext[248]> ;  
context
 (input #0)
    0x00ab833fd400: [top +  96] <- 0x6e9434792609 <JSFunction renderPixel (sfi 
= 00002354BCA31029)> ;  function
 (input #0)
    0x00ab833fd3f8: [top +  88] <- 0x5237586fcd71 <BytecodeArray[379]> ;  
bytecode array
    0x00ab833fd3f0: [top +  80] <- 0x00e600000000 <Smi 230> ;  bytecode offset
    -------------------------
    0x00ab833fd3e8: [top +  72] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #5)
    0x00ab833fd3e0: [top +  64] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #6)
    0x00ab833fd3d8: [top +  56] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #7)
    0x00ab833fd3d0: [top +  48] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #8)
    0x00ab833fd3c8: [top +  40] <- 0x000300000000 <Smi 3> ;  stack parameter 
(input #9)
    0x00ab833fd3c0: [top +  32] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #10)
    0x00ab833fd3b8: [top +  24] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #11)
    0x00ab833fd3b0: [top +  16] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #12)
    0x00ab833fd3a8: [top +   8] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #13)
    0x00ab833fd3a0: [top +   0] <- 0x006300000000 <Smi 99> ;  accumulator 
(input #0)
[deoptimizing (soft): end 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> @148 => node=173, pc=0x7ff9cb961e20, caller 
sp=0x00ab833fd4a8, took 0.238 ms]


[marking 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> for 
optimized recompilation, reason: hot and stable, ICs with typeinfo: 106/116 
(91%), generic ICs: 0/116 (0%)]
[compiling method 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> 
using TurboFan]




[optimizing 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)> - took 
1.219, 12.080, 0.083 ms]
[completed optimizing 0x63c41d22eee9 <JSFunction tick (sfi = 000063C41D22E281)>]

[deoptimizing (DEOPT soft): begin 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> (opt #207) @110, FP to SP delta: 152, caller sp: 
0x00ab833fd4a8]
            ;;; deoptimize at <http://localhost:3000/js/nesppu.js:739:42> 
inlined at <http://localhost:3000/js/nesppu.js:797:47> inlined at 
<http://localhost:3000/js/nesppu.js:204:16>, Insufficient type feedback for 
binary operation
  reading input frame tick => bytecode_offset=50, args=1, height=8; inputs:
      0: 0x63c41d22eee9 ;  [fp -  16]  0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)>
      1: 0x52e6f500f6e1 ;  [fp +  16]  0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89>
      2: 0x5f46ecc87b21 ;  [fp -  24]  0x5f46ecc87b21 <FunctionContext[5]>
      3: 0x00c500000000 ;  [fp -  32]  197
      4: 0x00c100000000 ;  [fp -  40]  193
      5: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      6: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      7: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      8: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      9: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     10: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
  reading input frame renderPixel => bytecode_offset=13, args=3, height=10; 
inputs:
      0: 0x6e9434792609 ; (literal  8) 0x6e9434792609 <JSFunction renderPixel 
(sfi = 00002354BCA31029)>
      1: 0x52e6f500f6e1 ; (literal  9) 0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89>
      2: 196 ; r15 
      3: 0x00c100000000 ;  [fp -  40]  193
      4: 0x65a539f860e9 ; (literal 10) 0x65a539f860e9 <NativeContext[248]>
      5: 0x00e0bdd235e9 ;  [fp -  56]  0x00e0bdd235e9 <JSArray[3]>
      6: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      7: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      8: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      9: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     10: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     11: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     12: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     13: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     14: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
  reading input frame fetchVisibleSpritePixelInformation => bytecode_offset=95, 
args=2, height=14; inputs:
      0: 0x6e9434792561 ; (literal 11) 0x6e9434792561 <JSFunction 
fetchVisibleSpritePixelInformation (sfi = 00002354BCA30E89)>
      1: 0x52e6f500f6e1 ; (literal  9) 0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89>
      2: 196 ; r15 
      3: 0x65a539f860e9 ; (literal 10) 0x65a539f860e9 <NativeContext[248]>
      4: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      5: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
      6: 0x00c400000000 ; rdx 196
      7: 0x000000000000 ; rcx 0
      8: 0x000400000000 ; rdi 4
      9: 0x23dce4e828c9 ; r8 0x23dce4e828c9 <true>
     10: 0x000000000000 ; r9 0
     11: 0x003800000000 ; rbx 56
     12: 0 ; rsi 
     13: 0x000200000000 ;  [fp -  72]  2
     14: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     15: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     16: 0x23dce4e83211 ; (literal  4) 0x23dce4e83211 <Odd Oddball: 
optimized_out>
     17: 0x00c400000000 ; rdx 196
  translating interpreted frame tick => bytecode_offset=50, height=56
    0x00ab833fd4a0: [top + 104] <- 0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89> ;  stack parameter (input #1)
    -------------------------
    0x00ab833fd498: [top +  96] <- 0x78c0c09e28e9 ;  caller's pc
    0x00ab833fd490: [top +  88] <- 0x00ab833fd500 ;  caller's fp
    0x00ab833fd488: [top +  80] <- 0x5f46ecc87b21 <FunctionContext[5]> ;  
context
 (input #0)
    0x00ab833fd480: [top +  72] <- 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> ;  function
 (input #0)
    0x00ab833fd478: [top +  64] <- 0x5237586fbf71 <BytecodeArray[941]> ;  
bytecode array
    0x00ab833fd470: [top +  56] <- 0x006b00000000 <Smi 107> ;  bytecode offset
    -------------------------
    0x00ab833fd468: [top +  48] <- 0x00c500000000 <Smi 197> ;  stack parameter 
(input #3)
    0x00ab833fd460: [top +  40] <- 0x00c100000000 <Smi 193> ;  stack parameter 
(input #4)
    0x00ab833fd458: [top +  32] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #5)
    0x00ab833fd450: [top +  24] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #6)
    0x00ab833fd448: [top +  16] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #7)
    0x00ab833fd440: [top +   8] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #8)
    0x00ab833fd438: [top +   0] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #9)
  translating interpreted frame renderPixel => bytecode_offset=13, height=72
    0x00ab833fd430: [top + 136] <- 0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89> ;  stack parameter (input #1)
    0x00ab833fd428: [top + 128] <- 0x00c400000000 <Smi 196> ;  stack parameter 
(input #2)
    0x00ab833fd420: [top + 120] <- 0x00c100000000 <Smi 193> ;  stack parameter 
(input #3)
    -------------------------
    0x00ab833fd418: [top + 112] <- 0x7ff9cb961d60 ;  caller's pc
    0x00ab833fd410: [top + 104] <- 0x00ab833fd490 ;  caller's fp
    0x00ab833fd408: [top +  96] <- 0x65a539f860e9 <NativeContext[248]> ;  
context
 (input #0)
    0x00ab833fd400: [top +  88] <- 0x6e9434792609 <JSFunction renderPixel (sfi 
= 00002354BCA31029)> ;  function
 (input #0)
    0x00ab833fd3f8: [top +  80] <- 0x5237586fcd71 <BytecodeArray[379]> ;  
bytecode array
    0x00ab833fd3f0: [top +  72] <- 0x004600000000 <Smi 70> ;  bytecode offset
    -------------------------
    0x00ab833fd3e8: [top +  64] <- 0x00e0bdd235e9 <JSArray[3]> ;  stack 
parameter (input #5)
    0x00ab833fd3e0: [top +  56] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #6)
    0x00ab833fd3d8: [top +  48] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #7)
    0x00ab833fd3d0: [top +  40] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #8)
    0x00ab833fd3c8: [top +  32] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #9)
    0x00ab833fd3c0: [top +  24] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #10)
    0x00ab833fd3b8: [top +  16] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #11)
    0x00ab833fd3b0: [top +   8] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #12)
    0x00ab833fd3a8: [top +   0] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #13)
  translating interpreted frame fetchVisibleSpritePixelInformation => 
bytecode_offset=95, height=112
    0x00ab833fd3a0: [top + 168] <- 0x52e6f500f6e1 <VueComponent map = 
00004308013D9D89> ;  stack parameter (input #1)
    0x00ab833fd398: [top + 160] <- 0x00c400000000 <Smi 196> ;  stack parameter 
(input #2)
    -------------------------
    0x00ab833fd390: [top + 152] <- 0x7ff9cb961d60 ;  caller's pc
    0x00ab833fd388: [top + 144] <- 0x00ab833fd410 ;  caller's fp
    0x00ab833fd380: [top + 136] <- 0x65a539f860e9 <NativeContext[248]> ;  
context
 (input #0)
    0x00ab833fd378: [top + 128] <- 0x6e9434792561 <JSFunction 
fetchVisibleSpritePixelInformation (sfi = 00002354BCA30E89)> ;  function
 (input #0)
    0x00ab833fd370: [top + 120] <- 0x5237586fd459 <BytecodeArray[251]> ;  
bytecode array
    0x00ab833fd368: [top + 112] <- 0x009800000000 <Smi 152> ;  bytecode offset
    -------------------------
    0x00ab833fd360: [top + 104] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #4)
    0x00ab833fd358: [top +  96] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #5)
    0x00ab833fd350: [top +  88] <- 0x00c400000000 <Smi 196> ;  stack parameter 
(input #6)
    0x00ab833fd348: [top +  80] <- 0x000000000000 <Smi 0> ;  stack parameter 
(input #7)
    0x00ab833fd340: [top +  72] <- 0x000400000000 <Smi 4> ;  stack parameter 
(input #8)
    0x00ab833fd338: [top +  64] <- 0x23dce4e828c9 <true> ;  stack parameter 
(input #9)
    0x00ab833fd330: [top +  56] <- 0x000000000000 <Smi 0> ;  stack parameter 
(input #10)
    0x00ab833fd328: [top +  48] <- 0x003800000000 <Smi 56> ;  stack parameter 
(input #11)
    0x00ab833fd320: [top +  40] <- 0x000000000000 <Smi 0> ;  stack parameter 
(input #12)
    0x00ab833fd318: [top +  32] <- 0x000200000000 <Smi 2> ;  stack parameter 
(input #13)
    0x00ab833fd310: [top +  24] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #14)
    0x00ab833fd308: [top +  16] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #15)
    0x00ab833fd300: [top +   8] <- 0x23dce4e83211 <Odd Oddball: optimized_out> 
;  stack parameter (input #16)
    0x00ab833fd2f8: [top +   0] <- 0x00c400000000 <Smi 196> ;  accumulator 
(input #0)
[deoptimizing (soft): end 0x63c41d22eee9 <JSFunction tick (sfi = 
000063C41D22E281)> @110 => node=95, pc=0x7ff9cb961e20, caller 
sp=0x00ab833fd4a8, took 0.287 ms]

this.tick = function () {
    // Create local vars to reduce scope chain crawling
    let cycle = this.cycle;
    let scanline = this.scanline;

    if (scanline <= 239) {
    if (cycle <= 256 && cycle > 0) {
        this.renderPixel(cycle - 1, scanline);
    }
    if (!(cycle % 8)) {
        if (cycle == 0) {
        // Set the cache data for this frame
        this.universalBackgroundColor = colors[this.vram.get(0x3f00)];

        ++this.cycle;
        return;
        }
        if (cycle <= 248) {
        this.shiftBackgroundRegisters();
        this.increaseHoriV();
        ++this.cycle;
        return;
        } else if (cycle == 256) {
        // inc vert(v)
        this.increaseVertV();
        // Build the scanline sprite cache for this scanline by reading OAM 
data and compiling
        // cache which is like secondary OAM
        this.buildScanlineSpriteCache(scanline);

        ++this.cycle;
        return;
        } else if (cycle == 328) {
        this.shiftBackgroundRegisters();
        this.increaseHoriV();
        ++this.cycle;
        return;
        } else if (cycle == 336) {
        // Since there was no rendering, we need to make sure to shift 
background registers
        this.backgroundTileFirstShiftRegister =
            this.backgroundTileFirstShiftRegister << 8;
        this.backgroundTileSecondShiftRegister =
            this.backgroundTileSecondShiftRegister << 8;
        this.shiftBackgroundRegisters();

        this.increaseHoriV();
        ++this.cycle;
        return;
        }
    } else if (cycle == 257) {
        this.copyHoriTtoHoriV();
        ++this.cycle;
        return;
    }
    } else if (scanline == 241 && cycle == 1) {
    // Fire off Vblank
    this.registers[0x02] |= 0b10000000;
    this.$parent.frameNotCompleted = false;

    // And fire VBlank NMI if PPUCTRL bit 7 is set
    if (this.NMIEnabled) {
        this.cpu.nmi = 1;
    }
    ++this.cycle;
    return;
    } else if (scanline == 261) {
    // OLD
    //if (cycle >= 280 && cycle <= 304) {
    if (cycle == 304) {
        // vert(v) = vert(t)
        // This would normally be done on cycles 280 to 304, but we do it on 
the last
        if (this.renderingEnabled) {
        // Copy over fine y scroll
        this.v_fineYScroll = this.t_fineYScroll;
        this.v_nametableSelect = (this.v_nametableSelect & 0b01) ^ 
(this.t_nametableSelect & 0b10);
        this.v_coarseYScroll = this.t_coarseYScroll;
        }
        ++this.cycle;
        return;
    }
    if (!(cycle % 8)) {
        if (cycle == 0) {
        // No need to set universal background color, just pass this according 
to 
        // rendering chart
        ++this.cycle;
        return;
        }
        if (cycle <= 256) {
        this.shiftBackgroundRegisters();
        this.increaseHoriV();
        ++this.cycle;
        return;
        }
        if (cycle == 256) {
        this.increaseVertV();
        // Build the scanline sprite cache for this scanline by reading OAM 
data and compiling
        // cache which is like secondary OAM
        this.buildScanlineSpriteCache(scanline);

        ++this.cycle;
        return;
        } else if (cycle == 328) {
        this.shiftBackgroundRegisters();
        this.increaseHoriV();
        ++this.cycle;
        return;
        } else if (cycle == 336) {
        // Since there was no rendering, we need to make sure to shift 
background registers
        this.backgroundTileFirstShiftRegister =
            this.backgroundTileFirstShiftRegister << 8;
        this.backgroundTileSecondShiftRegister =
            this.backgroundTileSecondShiftRegister << 8;
        this.shiftBackgroundRegisters();

        this.increaseHoriV();
        ++this.cycle;
        return;
        }

    } // end if mod 8
    if (cycle == 1) {
        // Clearing VBlank and sprite 0
        this.registers[0x02] = this.registers[0x02] & 0b00111111;
        ++this.cycle;
        return;
    }
    if (cycle == 257) {
        this.copyHoriTtoHoriV();
        ++this.cycle;
        return;
    }

    }
    if (cycle == 339) {
    if (this.odd && this.renderingEnabled) {
        // It's an odd frame, so we will skip it
        // We only do this if rendering is enabled btw
        this.cycle = 0;
        this.scanline = scanline == 261 ? 0 : scanline + 1;
        if (this.scanline == 0) {
        this.odd = !this.odd;
        }
        return;
    }
    ++this.cycle;
    return;
    } else if (cycle == 340) {
    this.cycle = 0;
    this.scanline = scanline == 261 ? 0 : scanline + 1;
    if (this.scanline == 0) {
        this.odd = !this.odd;
    }
    return;
    }
    ++this.cycle;
};

Reply via email to