Regarding the offset field in OP_for_of_next instruction #1108
-
Hey there! I’m trying to wrap my head around the purpose of the OP_for_of_next’s offset field. I’ve been trying to figure it out, but I’m not quite getting it. Does a non-zero value ever happen? If so, I’d love to understand how it works. From what I can gather, it seems to point to the stack index of the enumerator object on the stack, followed by the iterator method. Is it possible to reach this instruction with an unbalanced stack where this offset might be useful? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, with destructuring spreads. Example: function f(a = []) {
let [...b] = a
} Translates to bytecode like this:
|
Beta Was this translation helpful? Give feedback.
Yes, with destructuring spreads. Example:
Translates to bytecode like this: