Closed Bug 998158 Opened 10 years ago Closed 10 years ago

Tidy up SSE feature detection

Categories

(Core :: JavaScript Engine: JIT, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: sunfish, Assigned: sunfish)

Details

Attachments

(4 files)

The following is a series of patches which tity up SSE hardware feature detection.
Make JSC::MacroAssembler::isSSE2Present and friends public, and use them to implement AssemblerX86Shared::HasSSE2 and friends. This is a minor change, but it prepares for a later patch.

Also, define HasSSE2 in debug mode only for use in asserts, since the JIT requires SSE2.
Assignee: nobody → sunfish
Attachment #8408711 - Flags: review?(sstangl)
No functionality change; this just moves code out of line.
Attachment #8408715 - Flags: review?(sstangl)
Simplify the inline asm code used to invoke cpuid. don't save and restore %rbx on x64, simplify the use of constraints, and drop unnecessary volatile qualifiers.
Attachment #8408718 - Flags: review?(sstangl)
Use predefined SSE target macros, when available, to detect SSE availability. This eliminates the need for a special case for Mac OS, as MacOS always defines the SSE target macros.
Attachment #8408721 - Flags: review?(sstangl)
Comment on attachment 8408711 [details] [diff] [review]
ssecheck-cleanup.patch

Review of attachment 8408711 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jit/shared/Assembler-x86-shared.h
@@ +780,5 @@
>      void breakpoint() {
>          masm.int3();
>      }
>  
> +#ifndef NDEBUG

NDEBUG is a WebKit-ism that doesn't belong outside of codebases imported from Apple.

#ifdef DEBUG?
Attachment #8408711 - Flags: review?(sstangl) → review+
Attachment #8408715 - Flags: review?(sstangl) → review+
Attachment #8408718 - Flags: review?(sstangl) → review+
Comment on attachment 8408721 [details] [diff] [review]
ssecheck-ifdef.patch

Review of attachment 8408721 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/assembler/assembler/MacroAssemblerX86Common.h
@@ +1320,5 @@
>      }
>  
>      static bool isSSE2Present()
>      {
> +#if defined(__SSE2__) && !defined(DEBUG)  

nit: trailing whitespace
Attachment #8408721 - Flags: review?(sstangl) → review+
You need to log in before you can comment on or make changes to this bug.