• Leszek Swirski's avatar
    [liveedit] Patch changed SFIs' constant pools · 084d472f
    Leszek Swirski authored
    When live edit patches a script, it distinguishes between 'changed' and
    'unchanged' functions, and unchanged functions have their position and
    source script patched to the new script instead of being replaced by a
    new SFI.
    
    However, if a 'changed' function has an inner 'unchanged' function, it
    also holds a pointer to the inner function in its bytecode constant
    pool. This constant pool entry was not being updated for changed
    functions (it was for unchanged), and therefore the outer changed
    function would compile the redundant new function instead of the old,
    patched, unchanged function.
    
    This patch fixes this by patching 'changed' functions' bytecode constant
    pools. This is done by swapping the script and script function list
    position of the old new and old 'unchanged' function, rather than just
    setting the script (and position) on the old one, and using the new
    function (now pointing at the old script) to read off the old function
    literal id. This could also be done by reading the function_literal_id
    off the new function, but we are soon removing that field anyway.
    
    Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
    Change-Id: Ib22078c06539c795b418d29a493d8224ecea182e
    Reviewed-on: https://chromium-review.googlesource.com/1127941Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
    Reviewed-by: 's avatarAleksey Kozyatinskiy <kozyatinskiy@chromium.org>
    Commit-Queue: Leszek Swirski <leszeks@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#54321}
    084d472f
liveedit.cc 44.5 KB