• Lucian Grijincu's avatar
    folly: Range: outline exception throwing · d6c0ba01
    Lucian Grijincu authored
    Summary:
    Here's some godbolt: https://godbolt.org/g/9K36Km
    
      advanceNoInline(S):
              movq    %rdi, %rax
              sarq    $32, %rax
              cmpl    %eax, %edi
              jg      .L20
              leal    1(%rdi), %eax
              ret
      .L20:
              subq    $8, %rsp
              call    S::outOfRange() [clone .isra.0]
    
    vs previous implementation
    
      advance(S):
              movq    %rdi, %rdx
              sarq    $32, %rdx
              cmpl    %edx, %edi
              jg      .L14
              leal    1(%rdi), %eax
              ret
      .L14:
              pushq   %rbp
              pushq   %rbx
              movl    $16, %edi
              subq    $8, %rsp
              call    __cxa_allocate_exception
              movl    $.LC0, %esi
              movq    %rax, %rdi
              movq    %rax, %rbx
              call    std::out_of_range::out_of_range(char const*)
              movl    std::out_of_range::~out_of_range(), %edx
              movl    typeinfo for std::out_of_range, %esi
              movq    %rbx, %rdi
              call    __cxa_throw
              movq    %rax, %rbp
              movq    %rbx, %rdi
              call    __cxa_free_exception
              movq    %rbp, %rdi
              call    _Unwind_Resume
    
    Reviewed By: ot
    
    Differential Revision: D3940968
    
    fbshipit-source-id: b47a41e7cdd863fcef099ff3c21860b2979ee6e8
    d6c0ba01
Range.h 34.8 KB