mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-13 20:55:32 +08:00
Summary: @public For better grepping, we define all `YGNodeStyle...` accessors explicitely. This also replaces all macros with a set of templates that can easily be updated when we switch to style accessors on `YGNode`. Transitioning to a consistent set of templates also allowed to end up with a single *needs update* / *do update* / *mark dirty* block. The new template code also takes full advantage of the properties of `YGOptional` (constructor call with *not a number* creates an empty optional) and `detail::CompactValue` (conversions of *auto* and *undefined* are always well-formed) to get rid of some additional code: Removed `NAN` check: ``` _YGNodeStyleSetFlex: pushq %rbp movq %rsp, %rbp movss 0x34(%rdi), %xmm1 ucomiss %xmm0, %xmm1 jne 0x____ jnp 0x____ ucomiss %xmm0, %xmm0 jnp 0x____ ucomiss %xmm1, %xmm1 jnp 0x____ popq %rbp retq - ucomiss %xmm0, %xmm0 - movd %xmm0, %eax - movl $0x7fc00000, %ecx - cmovnpl %eax, %ecx - movl %ecx, 0x34(%rdi) + movss %xmm0, 0x34(%rdi) popq %rbp jmp 0x____ - nopw %cs:(%rax,%rax) - nop + nopw (%rax,%rax) ``` Removed well-formedness check: ``` _YGNodeStyleGetPosition: pushq %rbp movq %rsp, %rbp movl %esi, %eax movl 0x68(%rdi,%rax,4), %ecx + xorl %eax, %eax movq (%rip), %rcx movl (%rcx), %eax movl 0x4(%rcx), %ecx - movq %rcx, %rdx - shlq $0x20, %rdx + shlq $0x20, %rcx movl %eax, %eax - orq %rdx, %rax - cmpl $0x3, %ecx - je 0x____ - testl %ecx, %ecx - jne 0x____ - movl $0x7fc00000, %ecx - jmp 0x____ - movq %rax, %rcx - movabsq $-0x100000000, %rdx - andq %rax, %rdx - movl %ecx, %eax - orq %rdx, %rax + orq %rcx, %rax popq %rbp retq nopw (%rax,%rax) ``` Reviewed By: SidharthGuglani Differential Revision: D14911973 fbshipit-source-id: db6eef65f8fdaf70875f7fe8799919ca88bd50ee