Changeset 37457 in webkit


Ignore:
Timestamp:
Oct 9, 2008 5:50:25 PM (16 years ago)
Author:
alp@webkit.org
Message:

2008-10-09 Alp Toker <alp@nuanti.com>

Reviewed by Mark Rowe.

https://bugs.webkit.org/show_bug.cgi?id=20760
Implement support for x86 Linux in CTI

Prepare to enable CTI/WREC on supported architectures.

Make it possible to use the CTI_ARGUMENT workaround with GCC as well
as MSVC by fixing some preprocessor conditionals.

Note that CTI/WREC no longer requires CTI_ARGUMENT on Linux so we
don't actually enable it except when building with MSVC. GCC on Win32
remains untested.

Adapt inline ASM code to use the global symbol underscore prefix only
on Darwin and to call the properly mangled Machine::cti_vm_throw
symbol name depending on CTI_ARGUMENT.

Also avoid global inclusion of the JIT infrastructure headers
throughout WebCore and WebKit causing recompilation of about ~1500
source files after modification to X86Assembler.h, CTI.h, WREC.h,
which are only used deep inside JavaScriptCore.

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r37403 r37457  
     12008-10-09  Alp Toker  <alp@nuanti.com>
     2
     3        Reviewed by Mark Rowe.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=20760
     6        Implement support for x86 Linux in CTI
     7
     8        Prepare to enable CTI/WREC on supported architectures. Will be
     9        switched on when the crasher introduced in r37386 is resolved.
     10
     11        * configure.ac:
     12
    1132008-10-07  Alp Toker  <alp@nuanti.com>
    214
  • trunk/JavaScriptCore/ChangeLog

    r37453 r37457  
     12008-10-09  Alp Toker  <alp@nuanti.com>
     2
     3        Reviewed by Mark Rowe.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=20760
     6        Implement support for x86 Linux in CTI
     7
     8        Prepare to enable CTI/WREC on supported architectures.
     9
     10        Make it possible to use the CTI_ARGUMENT workaround with GCC as well
     11        as MSVC by fixing some preprocessor conditionals.
     12
     13        Note that CTI/WREC no longer requires CTI_ARGUMENT on Linux so we
     14        don't actually enable it except when building with MSVC. GCC on Win32
     15        remains untested.
     16
     17        Adapt inline ASM code to use the global symbol underscore prefix only
     18        on Darwin and to call the properly mangled Machine::cti_vm_throw
     19        symbol name depending on CTI_ARGUMENT.
     20
     21        Also avoid global inclusion of the JIT infrastructure headers
     22        throughout WebCore and WebKit causing recompilation of about ~1500
     23        source files after modification to X86Assembler.h, CTI.h, WREC.h,
     24        which are only used deep inside JavaScriptCore.
     25
     26        * GNUmakefile.am:
     27        * VM/CTI.cpp:
     28        * VM/CTI.h:
     29        * VM/Machine.cpp:
     30        * VM/Machine.h:
     31        * kjs/regexp.cpp:
     32        (JSC::RegExp::RegExp):
     33        (JSC::RegExp::~RegExp):
     34        (JSC::RegExp::match):
     35        * kjs/regexp.h:
     36        * masm/X86Assembler.h:
     37        (JSC::X86Assembler::emitConvertToFastCall):
     38        (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
     39        (JSC::X86Assembler::emitRestoreArgumentReference):
     40
    1412008-10-09  Gavin Barraclough  <barraclough@apple.com>
    242
  • trunk/JavaScriptCore/GNUmakefile.am

    r36989 r37457  
    33        -I$(srcdir)/JavaScriptCore/ForwardingHeaders \
    44        -I$(srcdir)/JavaScriptCore/VM \
     5        -I$(srcdir)/JavaScriptCore/pcre \
    56        -I$(srcdir)/JavaScriptCore/profiler \
    67        -I$(srcdir)/JavaScriptCore/wtf/unicode \
     
    6364        JavaScriptCore/ForwardingHeaders/JavaScriptCore/WebKitAvailability.h \
    6465        JavaScriptCore/JavaScriptCorePrefix.h \
     66        JavaScriptCore/VM/CTI.cpp \
     67        JavaScriptCore/VM/CTI.h \
    6568        JavaScriptCore/VM/CodeBlock.cpp \
    6669        JavaScriptCore/VM/CodeBlock.h \
     
    200203        JavaScriptCore/kjs/regexp.h \
    201204        JavaScriptCore/kjs/ustring.h \
     205        JavaScriptCore/masm/X86Assembler.h \
    202206        JavaScriptCore/os-win32/stdbool.h \
    203207        JavaScriptCore/os-win32/stdint.h \
     
    223227        JavaScriptCore/profiler/TreeProfile.cpp \
    224228        JavaScriptCore/profiler/TreeProfile.h \
     229        JavaScriptCore/wrec/CharacterClassConstructor.cpp \
     230        JavaScriptCore/wrec/CharacterClassConstructor.h \
     231        JavaScriptCore/wrec/WREC.cpp \
     232        JavaScriptCore/wrec/WREC.h \
    225233        JavaScriptCore/wtf/ASCIICType.h \
    226234        JavaScriptCore/wtf/AVLTree.h \
  • trunk/JavaScriptCore/VM/CTI.cpp

    r37453 r37457  
    8585#if COMPILER(GCC) && PLATFORM(X86)
    8686
     87#if PLATFORM(DARWIN)
     88#define SYMBOL_STRING(name) "_" #name
     89#else
     90#define SYMBOL_STRING(name) #name
     91#endif
     92
    8793asm(
    88 ".globl _ctiTrampoline" "\n"
    89 "_ctiTrampoline:" "\n"
     94".globl " SYMBOL_STRING(ctiTrampoline) "\n"
     95SYMBOL_STRING(ctiTrampoline) ":" "\n"
    9096    "pushl %esi" "\n"
    9197    "pushl %edi" "\n"
     
    101107
    102108asm(
    103 ".globl _ctiVMThrowTrampoline" "\n"
    104 "_ctiVMThrowTrampoline:" "\n"
    105     "call __ZN3JSC7Machine12cti_vm_throwEPv" "\n"
     109".globl " SYMBOL_STRING(ctiVMThrowTrampoline) "\n"
     110SYMBOL_STRING(ctiVMThrowTrampoline) ":" "\n"
     111#if USE(CTI_ARGUMENT)
     112    "call " SYMBOL_STRING(_ZN3JSC7Machine12cti_vm_throwEPPv) "\n"
     113#else
     114    "call " SYMBOL_STRING(_ZN3JSC7Machine12cti_vm_throwEPv) "\n"
     115#endif
    106116    "addl $0x24, %esp" "\n"
    107117    "popl %edi" "\n"
  • trunk/JavaScriptCore/VM/CTI.h

    r37453 r37457  
    3131#define WTF_USE_CTI_REPATCH_PIC 1
    3232
     33#include "Machine.h"
    3334#include "Opcode.h"
    3435#include "RegisterFile.h"
     
    3738#include <wtf/AlwaysInline.h>
    3839#include <wtf/Vector.h>
    39 
    40 #if COMPILER(MSVC)
    41 #define CTI_ARGS void** args
    42 #define ARGS (args)
    43 #else
    44 #define CTI_ARGS void* args
    45 #define ARGS (&args)
    46 #endif
    4740
    4841#define CTI_ARGS_code 0x0C
     
    10396    struct OperandTypes;
    10497
    105     struct VoidPtrPair { void* first; void* second; };
    106 
    107 #if COMPILER(MSVC)
    108 
    109 #if USE(FAST_CALL_CTI_ARGUMENT)
    110 #define SFX_CALL __fastcall
    111 #else
    112 #define SFX_CALL __cdecl
    113 #endif
    114 
    115 #else
    116 #define SFX_CALL
    117 #endif
    118 
    11998    typedef JSValue* (SFX_CALL *CTIHelper_j)(CTI_ARGS);
    12099    typedef JSPropertyNameIterator* (SFX_CALL *CTIHelper_p)(CTI_ARGS);
  • trunk/JavaScriptCore/VM/Machine.cpp

    r37441 r37457  
    5656#include "SamplingTool.h"
    5757#include <stdio.h>
     58
     59#if ENABLE(CTI)
     60#include "CTI.h"
     61#endif
    5862
    5963#if PLATFORM(DARWIN)
  • trunk/JavaScriptCore/VM/Machine.h

    r37433 r37457  
    3737#include <wtf/HashMap.h>
    3838
    39 #if ENABLE(CTI)
    40 #include "CTI.h"
    41 #endif
    42 
    4339namespace JSC {
    4440
     
    4844    class Instruction;
    4945    class InternalFunction;
     46    class JITCodeBuffer;
    5047    class JSFunction;
    5148    class JSGlobalObject;
     
    5451    class ScopeChainNode;
    5552    class SamplingTool;
     53
     54#if ENABLE(CTI)
     55
     56#if USE(CTI_ARGUMENT)
     57#define CTI_ARGS void** args
     58#define ARGS (args)
     59#else
     60#define CTI_ARGS void* args
     61#define ARGS (&args)
     62#endif
     63
     64#if COMPILER(MSVC)
     65#if USE(FAST_CALL_CTI_ARGUMENT)
     66#define SFX_CALL __fastcall
     67#else
     68#define SFX_CALL __cdecl
     69#endif
     70#else
     71#define SFX_CALL
     72
     73#endif
     74
     75    struct VoidPtrPair { void* first; void* second; };
     76#endif
    5677
    5778    enum DebugHookID {
  • trunk/JavaScriptCore/kjs/regexp.cpp

    r37433 r37457  
    2828#include <stdlib.h>
    2929#include <string.h>
     30#include <wrec/WREC.h>
    3031#include <wtf/Assertions.h>
    3132#include <wtf/OwnArrayPtr.h>
     
    4142{
    4243#if ENABLE(WREC)
    43     m_wrecFunction = reinterpret_cast<WRECFunction>(CTI::compileRegExp(globalData->machine, pattern, &m_numSubpatterns, &m_constructionError));
     44    m_wrecFunction = CTI::compileRegExp(globalData->machine, pattern, &m_numSubpatterns, &m_constructionError);
    4445    if (m_wrecFunction)
    4546        return;
     
    8485
    8586#if ENABLE(WREC)
    86     m_wrecFunction = reinterpret_cast<WRECFunction>(CTI::compileRegExp(globalData->machine, pattern, &m_numSubpatterns, &m_constructionError, (m_flagBits & IgnoreCase), (m_flagBits & Multiline)));
     87    m_wrecFunction = CTI::compileRegExp(globalData->machine, pattern, &m_numSubpatterns, &m_constructionError, (m_flagBits & IgnoreCase), (m_flagBits & Multiline));
    8788    if (m_wrecFunction)
    8889        return;
     
    105106#if ENABLE(WREC)
    106107    if (m_wrecFunction)
    107         fastFree(reinterpret_cast<void*>(m_wrecFunction));
     108        fastFree(m_wrecFunction);
    108109#endif
    109110}
     
    132133            ovector->set(offsetVector);
    133134
    134         int result = m_wrecFunction(s.data(), i, s.size(), offsetVector);
     135        int result = reinterpret_cast<WRECFunction>(m_wrecFunction)(s.data(), i, s.size(), offsetVector);
    135136
    136137        if (result < 0) {
  • trunk/JavaScriptCore/kjs/regexp.h

    r37433 r37457  
    2525#include <wtf/Forward.h>
    2626#include <wtf/RefCounted.h>
    27 #include <wrec/WREC.h>
    2827
    2928struct JSRegExp;
     
    6867
    6968#if ENABLE(WREC)
    70         WRECFunction m_wrecFunction;
     69        // Called as a WRECFunction
     70        void* m_wrecFunction;
    7171#endif
    7272    };
  • trunk/JavaScriptCore/masm/X86Assembler.h

    r37453 r37457  
    10551055    }
    10561056
    1057 #if USE(CTI_ARGUMENT)
     1057#if COMPILER(MSVC)
    10581058    void emitConvertToFastCall()
    10591059    {
     
    10621062        movl_mr(12, X86::esp, X86::ecx);
    10631063    }
    1064 
     1064#else
     1065    void emitConvertToFastCall() {}
     1066#endif
     1067
     1068#if USE(CTI_ARGUMENT)
    10651069    void emitRestoreArgumentReference()
    10661070    {
     
    10771081        movl_rr(X86::esp, X86::ecx);
    10781082        addl_i32r(4, X86::ecx);
     1083#endif
     1084    }
    10791085#else
    1080 #endif
    1081     }
    1082 #else
    1083     void emitConvertToFastCall() {};
    1084     void emitRestoreArgumentReference() {};
    1085     void emitRestoreArgumentReferenceForTrampoline() {};
     1086    void emitRestoreArgumentReference() {}
     1087    void emitRestoreArgumentReferenceForTrampoline() {}
    10861088#endif
    10871089
  • trunk/configure.ac

    r37022 r37457  
    88
    99AC_CONFIG_HEADERS([autotoolsconfig.h])
     10AC_CANONICAL_SYSTEM
    1011
    1112WEBKIT_MAJOR_VERSION=webkit_major_version
     
    2425
    2526AM_INIT_AUTOMAKE([foreign subdir-objects])
    26 
    27 AC_CANONICAL_HOST
    2827
    2928# host checking - inspired by the GTK+ configure.in
     
    502501AC_MSG_RESULT([$enable_fast_malloc])
    503502
     503AC_MSG_CHECKING([whether to enable JIT compilation])
     504AC_ARG_ENABLE([jit],
     505              AC_HELP_STRING([--enable-jit],
     506                             [Enable JIT compilation default=no]),
     507              [],[enable_jit="no"])
     508if test "$enable_jit" = "yes"; then
     509    case "$target_cpu" in
     510        i*86)
     511            AC_DEFINE([ENABLE_CTI], [1], [Define to enable CTI])
     512            AC_DEFINE([ENABLE_WREC], [1], [Define to enable WREC])
     513        ;;
     514        *)
     515            enable_jit="no (CPU '$target_cpu' not supported)"
     516        ;;
     517    esac
     518fi
     519AC_MSG_RESULT([$enable_jit])
     520
    504521# determine the font backend
    505522AC_MSG_CHECKING([the font backend to use])
     
    659676 Optimized memory allocator                               : $enable_fast_malloc
    660677Features:
     678 JIT compilation                                          : $enable_jit
    661679 Dashboard support                                        : $enable_dashboard_support
    662680 HTML5 offline web applications support                   : $enable_offline_web_applications
Note: See TracChangeset for help on using the changeset viewer.