Skip to content

Instantly share code, notes, and snippets.

@klaemo
Created September 12, 2012 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klaemo/3710789 to your computer and use it in GitHub Desktop.
Save klaemo/3710789 to your computer and use it in GitHub Desktop.
v8 deopt
// the function:
Helpers.prototype.round = function (num, decimals) {
decimals = decimals || this.precision
return Math.round( num * Math.pow(10, decimals) ) / Math.pow(10, decimals)
}
// snippet of the --trace-deopt output
**** DEOPT: Helpers.round at bailout #9, address 0x0, frame size 8
;;; Deferred code @54: number-tag-d.
[deoptimizing: begin 0x205174e0e251 Helpers.round @9]
translating Helpers.round => node=14, height=8
0x7fff5fbfe878: [top + 56] <- 0x205174eb48b1 ; [sp + 56] 0x205174eb48b1 <JS Object>
0x7fff5fbfe870: [top + 48] <- 0x21ff5c2c79f9 ; rax 0x21ff5c2c79f9 <Number: -0.09999999999999964>
0x7fff5fbfe868: [top + 40] <- 0x166d1a304121 ; [sp + 40] 0x166d1a304121 <undefined>
0x7fff5fbfe860: [top + 32] <- 0x2f247b70c0ee ; caller's pc
0x7fff5fbfe858: [top + 24] <- 0x7fff5fbfe898 ; caller's fp
0x7fff5fbfe850: [top + 16] <- 0x205174eb0309; context
0x7fff5fbfe848: [top + 8] <- 0x205174e0e251; function
0x7fff5fbfe840: [top + 0] <- 0x300000000 ; [sp + 0] 3
[deoptimizing: end 0x205174e0e251 Helpers.round => node=14, pc=0x2f247b7e5042, state=TOS_REG, alignment=no padding, took 0.048 ms]
[removing optimized code for: Helpers.round]
**** DEOPT: Helpers.round at bailout #9, address 0x0, frame size 8
;;; Deferred code @54: number-tag-d.
[deoptimizing: begin 0x205174e0e251 Helpers.round @9]
translating Helpers.round => node=14, height=8
0x7fff5fbfe878: [top + 56] <- 0x205174eb48b1 ; [sp + 56] 0x205174eb48b1 <JS Object>
0x7fff5fbfe870: [top + 48] <- 0x21ff5c2cf3e9 ; rax 0x21ff5c2cf3e9 <Number: -0.2000000000000028>
0x7fff5fbfe868: [top + 40] <- 0x166d1a304121 ; [sp + 40] 0x166d1a304121 <undefined>
0x7fff5fbfe860: [top + 32] <- 0x2f247b70c0ee ; caller's pc
0x7fff5fbfe858: [top + 24] <- 0x7fff5fbfe898 ; caller's fp
0x7fff5fbfe850: [top + 16] <- 0x205174eb0309; context
0x7fff5fbfe848: [top + 8] <- 0x205174e0e251; function
0x7fff5fbfe840: [top + 0] <- 0x300000000 ; [sp + 0] 3
[deoptimizing: end 0x205174e0e251 Helpers.round => node=14, pc=0x2f247b7e5042, state=TOS_REG, alignment=no padding, took 0.046 ms]
[removing optimized code for: Helpers.round]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment