isolate units of work/logic to prevent deopts in merge and its variants

in progress
this function doesn't touch arguments directly, so it doesn't get deoptimized by v8, only the outer extend fn gets deopted.