public Frame mergeWith(Frame other) {
    LocalsArray resultLocals;
    ExecutionStack resultStack;
    IntList resultSubroutines;

    resultLocals = getLocals().merge(other.getLocals());
    resultStack = getStack().merge(other.getStack());
    resultSubroutines = mergeSubroutineLists(other.subroutines);

    resultLocals = adjustLocalsForSubroutines(resultLocals, resultSubroutines);

    if ((resultLocals == getLocals())
        && (resultStack == getStack())
        && subroutines == resultSubroutines) {
      return this;
    }

    return new Frame(resultLocals, resultStack, resultSubroutines);
  }
Merges two frames. If the merged result is the same as this frame, then this instance is
returned.

@param other {@code non-null;} another frame
@return {@code non-null;} the result of merging the two frames
android/android_framework/dex-maker/src/main/java/com/android/dx/cf/code/Frame.java