Changeset 37235 in webkit for trunk/JavaScriptCore/VM


Ignore:
Timestamp:
Oct 3, 2008, 4:11:55 AM (17 years ago)
Author:
[email protected]
Message:

Replace SSE3 check with an SSE2 check, and implement SSE2 check on windows.

Reviewed by Maciej Stachowiak

5.6% win on SunSpider on windows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/CTI.cpp

    r37160 r37235  
    4343
    4444#if PLATFORM(MAC)
    45 bool isSSE3Present()
    46 {
    47     struct SSE3Check {
    48         SSE3Check()
     45bool isSSE2Present()
     46{
     47    return true; // All X86 Macs are guaranteed to support at least SSE2
     48}
     49#else COMPILER(MSVC)
     50bool isSSE2Present()
     51{
     52    static const int SSE2FeatureBit = 1 << 26;
     53    struct SSE2Check {
     54        SSE2Check()
    4955        {
    50             int hasSSE3 = 0;
    51             size_t length = sizeof(hasSSE3);
    52             int error = sysctlbyname("hw.optional.sse3", &hasSSE3, &length, NULL, 0);
    53             present = hasSSE3 && !error;
     56            int flags;
     57#if COMPILER(MSVC)
     58            _asm {
     59                mov eax, 1 // cpuid function 1 gives us the standard feature set
     60                cpuid;
     61                mov flags, edx;
     62            }
     63#else
     64            flags = 0;
     65            // FIXME: Add GCC code to do above asm
     66#endif
     67            present = (flags & SSE2FeatureBit) != 0;
    5468        }
    5569        bool present;
    5670    };
    57     static SSE3Check check;
     71    static SSE2Check check;
    5872    return check.present;
    59 }
    60 #else
    61 bool isSSE3Present()
    62 {
    63     return false;
    6473}
    6574#endif
     
    672681    emitGetArg(src2, X86::edx);
    673682
    674     if (types.second().isReusable() && isSSE3Present()) {
     683    if (types.second().isReusable() && isSSE2Present()) {
    675684        ASSERT(types.second().mightBeNumber());
    676685
     
    719728        m_jit.link(op2imm, m_jit.label());
    720729        emitJumpSlowCaseIfNotImmNum(X86::eax, i);
    721     } else if (types.first().isReusable() && isSSE3Present()) {
     730    } else if (types.first().isReusable() && isSSE2Present()) {
    722731        ASSERT(types.first().mightBeNumber());
    723732
     
    790799    emitPutResult(dst);
    791800
    792     if (types.second().isReusable() && isSSE3Present()) {
     801    if (types.second().isReusable() && isSSE2Present()) {
    793802        m_jit.link(wasJSNumberCell2, m_jit.label());
    794803        m_jit.link(wasJSNumberCell2b, m_jit.label());
    795804    }
    796     else if (types.first().isReusable() && isSSE3Present()) {
     805    else if (types.first().isReusable() && isSSE2Present()) {
    797806        m_jit.link(wasJSNumberCell1, m_jit.label());
    798807        m_jit.link(wasJSNumberCell1b, m_jit.label());
     
    804813    X86Assembler::JmpDst here = m_jit.label();
    805814    m_jit.link(iter->from, here);
    806     if (types.second().isReusable() && isSSE3Present()) {
     815    if (types.second().isReusable() && isSSE2Present()) {
    807816        if (!types.first().definitelyIsNumber()) {
    808817            m_jit.link((++iter)->from, here);
     
    814823        }
    815824        m_jit.link((++iter)->from, here);
    816     } else if (types.first().isReusable() && isSSE3Present()) {
     825    } else if (types.first().isReusable() && isSSE2Present()) {
    817826        if (!types.first().definitelyIsNumber()) {
    818827            m_jit.link((++iter)->from, here);
Note: See TracChangeset for help on using the changeset viewer.