Changeset 99374 in webkit for trunk/Source/JavaScriptCore


Ignore:
Timestamp:
Nov 6, 2011, 3:39:12 AM (14 years ago)
Author:
[email protected]
Message:

JSC should be able to sample itself in a more flexible way than just sampling flags
https://bugs.webkit.org/show_bug.cgi?id=71522

Source/JavaScriptCore:

Reviewed by Gavin Barraclough.

Added a construct that looks like SamplingRegion samplingRegion("name").

(JSC::SamplingRegion::Locker::Locker):
(JSC::SamplingRegion::Locker::~Locker):
(JSC::SamplingRegion::sample):
(JSC::SamplingRegion::dump):
(JSC::SamplingRegion::dumpInternal):
(JSC::SamplingThread::threadStartFunc):

  • bytecode/SamplingTool.h:

(JSC::SamplingRegion::SamplingRegion):
(JSC::SamplingRegion::~SamplingRegion):
(JSC::SamplingRegion::exchangeCurrent):

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::generate):

  • dfg/DFGDriver.cpp:

(JSC::DFG::compile):

  • heap/Heap.cpp:

(JSC::Heap::markRoots):
(JSC::Heap::collect):

  • heap/VTableSpectrum.cpp:

(JSC::VTableSpectrum::countVPtr):
(JSC::VTableSpectrum::dump):

  • heap/VTableSpectrum.h:
  • jsc.cpp:

(main):
(runWithScripts):

  • parser/Parser.h:

(JSC::parse):

  • runtime/Executable.cpp:

(JSC::EvalExecutable::compileInternal):
(JSC::ProgramExecutable::compileInternal):
(JSC::FunctionExecutable::compileForCallInternal):
(JSC::FunctionExecutable::compileForConstructInternal):

  • wtf/Atomics.h:

(WTF::weakCompareAndSwap):

  • wtf/Platform.h:
  • wtf/Spectrum.h: Added.

(WTF::Spectrum::Spectrum):
(WTF::Spectrum::add):
(WTF::Spectrum::get):
(WTF::Spectrum::begin):
(WTF::Spectrum::end):
(WTF::Spectrum::KeyAndCount::KeyAndCount):
(WTF::Spectrum::KeyAndCount::operator<):
(WTF::Spectrum::buildList):

  • wtf/wtf.pri:

Source/JavaScriptGlue:

Reviewed by Gavin Barraclough.

  • ForwardingHeaders/wtf/Spectrum.h: Added.

Source/WebCore:

Reviewed by Gavin Barraclough.

No new tests, since no functionality changed.

  • ForwardingHeaders/wtf/Spectrum.h: Added.
Location:
trunk/Source/JavaScriptCore
Files:
1 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r99358 r99374  
     12011-11-03  Filip Pizlo  <[email protected]>
     2
     3        JSC should be able to sample itself in a more flexible way than just sampling flags
     4        https://bugs.webkit.org/show_bug.cgi?id=71522
     5
     6        Reviewed by Gavin Barraclough.
     7       
     8        Added a construct that looks like SamplingRegion samplingRegion("name").
     9
     10        * JavaScriptCore.exp:
     11        * JavaScriptCore.xcodeproj/project.pbxproj:
     12        * bytecode/SamplingTool.cpp:
     13        (JSC::SamplingRegion::Locker::Locker):
     14        (JSC::SamplingRegion::Locker::~Locker):
     15        (JSC::SamplingRegion::sample):
     16        (JSC::SamplingRegion::dump):
     17        (JSC::SamplingRegion::dumpInternal):
     18        (JSC::SamplingThread::threadStartFunc):
     19        * bytecode/SamplingTool.h:
     20        (JSC::SamplingRegion::SamplingRegion):
     21        (JSC::SamplingRegion::~SamplingRegion):
     22        (JSC::SamplingRegion::exchangeCurrent):
     23        * bytecompiler/BytecodeGenerator.cpp:
     24        (JSC::BytecodeGenerator::generate):
     25        * dfg/DFGDriver.cpp:
     26        (JSC::DFG::compile):
     27        * heap/Heap.cpp:
     28        (JSC::Heap::markRoots):
     29        (JSC::Heap::collect):
     30        * heap/VTableSpectrum.cpp:
     31        (JSC::VTableSpectrum::countVPtr):
     32        (JSC::VTableSpectrum::dump):
     33        * heap/VTableSpectrum.h:
     34        * jsc.cpp:
     35        (main):
     36        (runWithScripts):
     37        * parser/Parser.h:
     38        (JSC::parse):
     39        * runtime/Executable.cpp:
     40        (JSC::EvalExecutable::compileInternal):
     41        (JSC::ProgramExecutable::compileInternal):
     42        (JSC::FunctionExecutable::compileForCallInternal):
     43        (JSC::FunctionExecutable::compileForConstructInternal):
     44        * wtf/Atomics.h:
     45        (WTF::weakCompareAndSwap):
     46        * wtf/Platform.h:
     47        * wtf/Spectrum.h: Added.
     48        (WTF::Spectrum::Spectrum):
     49        (WTF::Spectrum::add):
     50        (WTF::Spectrum::get):
     51        (WTF::Spectrum::begin):
     52        (WTF::Spectrum::end):
     53        (WTF::Spectrum::KeyAndCount::KeyAndCount):
     54        (WTF::Spectrum::KeyAndCount::operator<):
     55        (WTF::Spectrum::buildList):
     56        * wtf/wtf.pri:
     57
    1582011-11-05  Sam Weinig  <[email protected]>
    259
  • trunk/Source/JavaScriptCore/JavaScriptCore.exp

    r99357 r99374  
    180180__ZN3JSC14MachineThreads16addCurrentThreadEv
    181181__ZN3JSC14MarkStackArray6expandEv
     182__ZN3JSC14SamplingRegion4dumpEv
    182183__ZN3JSC14SamplingThread4stopEv
    183184__ZN3JSC14SamplingThread5startEj
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r99144 r99374  
    5151                0F16D726142C39C000CF784A /* BitVector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F16D724142C39A200CF784A /* BitVector.cpp */; };
    5252                0F242DA713F3B1E8007ADD4C /* WeakReferenceHarvester.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F242DA513F3B1BB007ADD4C /* WeakReferenceHarvester.h */; settings = {ATTRIBUTES = (Private, ); }; };
     53                0F2E5BF7146357D5003EB2EB /* Spectrum.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F2E5BF5146357D2003EB2EB /* Spectrum.h */; settings = {ATTRIBUTES = (Private, ); }; };
    5354                0F426A481460CBB300131F8F /* ValueRecovery.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F426A451460CBAB00131F8F /* ValueRecovery.h */; settings = {ATTRIBUTES = (Private, ); }; };
    5455                0F426A491460CBB700131F8F /* VirtualRegister.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F426A461460CBAB00131F8F /* VirtualRegister.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    814815                0F16D724142C39A200CF784A /* BitVector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BitVector.cpp; sourceTree = "<group>"; };
    815816                0F242DA513F3B1BB007ADD4C /* WeakReferenceHarvester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakReferenceHarvester.h; sourceTree = "<group>"; };
     817                0F2E5BF5146357D2003EB2EB /* Spectrum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Spectrum.h; sourceTree = "<group>"; };
    816818                0F426A451460CBAB00131F8F /* ValueRecovery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueRecovery.h; sourceTree = "<group>"; };
    817819                0F426A461460CBAB00131F8F /* VirtualRegister.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VirtualRegister.h; sourceTree = "<group>"; };
     
    18561858                        isa = PBXGroup;
    18571859                        children = (
     1860                                0F2E5BF5146357D2003EB2EB /* Spectrum.h */,
    18581861                                0FD52AAC1430359D0026DC9F /* UnionFind.h */,
    18591862                                0F636D9F142D27D200B2E66A /* PackedIntVector.h */,
     
    28982901                                0F426A491460CBB700131F8F /* VirtualRegister.h in Headers */,
    28992902                                0F426A4B1460CD6E00131F8F /* DataFormat.h in Headers */,
     2903                                0F2E5BF7146357D5003EB2EB /* Spectrum.h in Headers */,
    29002904                        );
    29012905                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/JavaScriptCore/bytecode/SamplingTool.cpp

    r95901 r99374  
    8484#endif
    8585
     86#if ENABLE(SAMPLING_REGIONS)
     87volatile uintptr_t SamplingRegion::s_currentOrReserved;
     88Spectrum<const char*>* SamplingRegion::s_spectrum;
     89unsigned long SamplingRegion::s_noneOfTheAbove;
     90unsigned SamplingRegion::s_numberOfSamplesSinceDump;
     91
     92SamplingRegion::Locker::Locker()
     93{
     94    uintptr_t previous;
     95    while (true) {
     96        previous = s_currentOrReserved;
     97        if (previous & 1) {
     98#if OS(UNIX)
     99            sched_yield();
     100#endif
     101            continue;
     102        }
     103        if (WTF::weakCompareAndSwap(&s_currentOrReserved, previous, previous | 1))
     104            break;
     105    }
     106}
     107
     108SamplingRegion::Locker::~Locker()
     109{
     110    // We don't need the CAS, but we do it out of an
     111    // abundance of caution (and because it gives us a memory fence, which is
     112    // never bad).
     113    uintptr_t previous;
     114    do {
     115        previous = s_currentOrReserved;
     116    } while (!WTF::weakCompareAndSwap(&s_currentOrReserved, previous, previous & ~1));
     117}
     118
     119void SamplingRegion::sample()
     120{
     121    // Make sure we lock s_current.
     122    Locker locker;
     123   
     124    // Create a spectrum if we don't have one already.
     125    if (!s_spectrum)
     126        s_spectrum = new Spectrum<const char*>();
     127   
     128    ASSERT(s_currentOrReserved & 1);
     129   
     130    // Walk the region stack, and record each region we see.
     131    SamplingRegion* region = bitwise_cast<SamplingRegion*>(s_currentOrReserved & ~1);
     132    if (region) {
     133        for (; region; region = region->m_previous)
     134            s_spectrum->add(region->m_name);
     135    } else
     136        s_noneOfTheAbove++;
     137   
     138    if (s_numberOfSamplesSinceDump++ == SamplingThread::s_hertz) {
     139        s_numberOfSamplesSinceDump = 0;
     140        dumpInternal();
     141    }
     142}
     143
     144void SamplingRegion::dump()
     145{
     146    Locker locker;
     147   
     148    dumpInternal();
     149}
     150
     151void SamplingRegion::dumpInternal()
     152{
     153    if (!s_spectrum) {
     154        printf("\nSamplingRegion: was never sampled.\n\n");
     155        return;
     156    }
     157   
     158    Vector<Spectrum<const char*>::KeyAndCount> list = s_spectrum->buildList();
     159   
     160    unsigned long total = s_noneOfTheAbove;
     161    for (unsigned i = list.size(); i--;)
     162        total += list[i].count;
     163   
     164    printf("\nSamplingRegion: sample counts for regions: (%lu samples)\n", total);
     165
     166    for (unsigned i = list.size(); i--;)
     167        printf("    %3.2lf%%  %s\n", (100.0 * list[i].count) / total, list[i].key);
     168}
     169#else // ENABLE(SAMPLING_REGIONS)
     170void SamplingRegion::dump() { }
     171#endif // ENABLE(SAMPLING_REGIONS)
     172
    86173/*
    87174  Start with flag 16 set.
     
    131218#if ENABLE(SAMPLING_FLAGS)
    132219        SamplingFlags::sample();
     220#endif
     221#if ENABLE(SAMPLING_REGIONS)
     222        SamplingRegion::sample();
    133223#endif
    134224#if ENABLE(OPCODE_SAMPLING)
  • trunk/Source/JavaScriptCore/bytecode/SamplingTool.h

    r95901 r99374  
    3535#include "SamplingCounter.h"
    3636#include <wtf/Assertions.h>
     37#include <wtf/Atomics.h>
    3738#include <wtf/HashMap.h>
     39#include <wtf/MainThread.h>
    3840#include <wtf/Threading.h>
    3941
     
    9395#endif
    9496    };
     97
     98#if ENABLE(SAMPLING_REGIONS)
     99    class SamplingRegion {
     100    public:
     101        // Create a scoped sampling region using a C string constant name that describes
     102        // what you are doing. This must be a string constant that persists for the
     103        // lifetime of the process and is immutable.
     104        SamplingRegion(const char* name)
     105        {
     106            if (!isMainThread()) {
     107                m_name = 0;
     108                return;
     109            }
     110           
     111            m_name = name;
     112            exchangeCurrent(this, &m_previous);
     113            ASSERT(!m_previous || m_previous > this);
     114        }
     115       
     116        ~SamplingRegion()
     117        {
     118            if (!m_name)
     119                return;
     120           
     121            ASSERT(bitwise_cast<SamplingRegion*>(s_currentOrReserved & ~1) == this);
     122            exchangeCurrent(m_previous);
     123        }
     124       
     125        static void sample();
     126       
     127        static void dump();
     128       
     129    private:
     130        const char* m_name;
     131        SamplingRegion* m_previous;
     132
     133        static void exchangeCurrent(SamplingRegion* current, SamplingRegion** previousPtr = 0)
     134        {
     135            uintptr_t previous;
     136            while (true) {
     137                previous = s_currentOrReserved;
     138               
     139                // If it's reserved (i.e. sampling thread is reading it), loop around.
     140                if (previous & 1) {
     141#if OS(UNIX)
     142                    sched_yield();
     143#endif
     144                    continue;
     145                }
     146               
     147                // If we're going to CAS, then make sure previous is set.
     148                if (previousPtr)
     149                    *previousPtr = bitwise_cast<SamplingRegion*>(previous);
     150               
     151                if (WTF::weakCompareAndSwap(&s_currentOrReserved, previous, bitwise_cast<uintptr_t>(current)))
     152                    break;
     153            }
     154        }
     155       
     156        static void dumpInternal();
     157
     158        class Locker {
     159        public:
     160            Locker();
     161            ~Locker();
     162        };
     163
     164        static volatile uintptr_t s_currentOrReserved;
     165       
     166        // rely on identity hashing of string constants
     167        static Spectrum<const char*>* s_spectrum;
     168       
     169        static unsigned long s_noneOfTheAbove;
     170       
     171        static unsigned s_numberOfSamplesSinceDump;
     172    };
     173#else // ENABLE(SAMPLING_REGIONS)
     174    class SamplingRegion {
     175    public:
     176        SamplingRegion(const char*) { }
     177        void dump();
     178    };
     179#endif // ENABLE(SAMPLING_REGIONS)
    95180
    96181    class CodeBlock;
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r98302 r99374  
    141141JSObject* BytecodeGenerator::generate()
    142142{
     143    SamplingRegion samplingRegion("Bytecode Generation");
     144   
    143145    m_codeBlock->setThisRegister(m_thisRegister.index());
    144146
  • trunk/Source/JavaScriptCore/dfg/DFGDriver.cpp

    r98082 r99374  
    3838inline bool compile(CompileMode compileMode, ExecState* exec, CodeBlock* codeBlock, JITCode& jitCode, MacroAssemblerCodePtr* jitCodeWithArityCheck)
    3939{
     40    SamplingRegion samplingRegion("DFG Compilation (Driver)");
     41   
    4042    JSGlobalData* globalData = &exec->globalData();
    4143    Graph dfg;
  • trunk/Source/JavaScriptCore/heap/Heap.cpp

    r98937 r99374  
    554554void Heap::markRoots(bool fullGC)
    555555{
     556    SamplingRegion samplingRegion("Garbage Collection: Tracing");
     557
    556558    COND_GCPHASE(fullGC, MarkFullRoots, MarkYoungRoots);
    557559    UNUSED_PARAM(fullGC);
     
    760762void Heap::collect(SweepToggle sweepToggle)
    761763{
     764    SamplingRegion samplingRegion("Garbage Collection");
     765   
    762766    GCPHASE(Collect);
    763767    ASSERT(globalData()->identifierTable == wtfThreadData().currentIdentifierTable());
     
    793797
    794798    if (sweepToggle == DoSweep) {
     799        SamplingRegion samplingRegion("Garbage Collection: Sweeping");
    795800        GCPHASE(Sweeping);
    796801        sweep();
  • trunk/Source/JavaScriptCore/heap/VTableSpectrum.cpp

    r95901 r99374  
    5050void VTableSpectrum::countVPtr(void* vTablePointer)
    5151{
    52     std::pair<HashMap<void*, unsigned long>::iterator, bool> result = m_map.add(vTablePointer, 1);
    53     if (!result.second)
    54         result.first->second++;
     52    add(vTablePointer);
    5553}
    5654
     
    6058}
    6159
    62 struct VTableAndCount {
    63     void* vtable;
    64     unsigned long count;
    65    
    66     VTableAndCount() { }
    67    
    68     VTableAndCount(void* vtable, unsigned long count)
    69         : vtable(vtable)
    70         , count(count)
    71     {
    72     }
    73    
    74     bool operator<(const VTableAndCount& other) const
    75     {
    76         if (count != other.count)
    77             return count < other.count;
    78         return vtable > other.vtable; // this results in lower-addressed vtables being printed first
    79     }
    80 };
    81 
    8260void VTableSpectrum::dump(FILE* output, const char* comment)
    8361{
    8462    fprintf(output, "%s:\n", comment);
    8563   
    86     HashMap<void*, unsigned long>::iterator begin = m_map.begin();
    87     HashMap<void*, unsigned long>::iterator end = m_map.end();
    88    
    89     Vector<VTableAndCount, 0> list;
    90    
    91     for (HashMap<void*, unsigned long>::iterator iter = begin; iter != end; ++iter)
    92         list.append(VTableAndCount(iter->first, iter->second));
    93    
    94     std::sort(list.begin(), list.end());
     64    Vector<KeyAndCount> list = buildList();
    9565   
    9666    for (size_t index = list.size(); index-- > 0;) {
    97         VTableAndCount item = list.at(index);
     67        KeyAndCount item = list.at(index);
    9868#if PLATFORM(MAC)
    9969        Dl_info info;
    100         if (dladdr(item.vtable, &info)) {
     70        if (dladdr(item.key, &info)) {
    10171            char* findResult = strrchr(info.dli_fname, '/');
    10272            const char* strippedFileName;
     
    10777                strippedFileName = info.dli_fname;
    10878           
    109             fprintf(output, "    %s:%s(%p): %lu\n", strippedFileName, info.dli_sname, item.vtable, item.count);
     79            fprintf(output, "    %s:%s(%p): %lu\n", strippedFileName, info.dli_sname, item.key, item.count);
    11080            continue;
    11181        }
    11282#endif
    113         fprintf(output, "    %p: %lu\n", item.vtable, item.count);
     83        fprintf(output, "    %p: %lu\n", item.key, item.count);
    11484    }
    11585   
  • trunk/Source/JavaScriptCore/heap/VTableSpectrum.h

    r95901 r99374  
    2828
    2929#include <stdio.h>
    30 #include <wtf/HashMap.h>
     30#include <wtf/Spectrum.h>
    3131
    3232namespace JSC {
     
    3434class JSCell;
    3535
    36 class VTableSpectrum {
     36class VTableSpectrum: Spectrum<void*> {
    3737public:
    3838    VTableSpectrum();
     
    4343   
    4444    void dump(FILE* output, const char* comment);
    45    
    46 private:
    47     HashMap<void*, unsigned long> m_map;
    4845};
    4946
  • trunk/Source/JavaScriptCore/jsc.cpp

    r99223 r99374  
    3232#include "JSLock.h"
    3333#include "JSString.h"
     34#include "MainThread.h"
    3435#include "SamplingTool.h"
    3536#include <math.h>
     
    405406
    406407    // Initialize JSC before getting JSGlobalData.
     408    WTF::initializeMainThread();
    407409    JSC::initializeThreading();
    408410
     
    472474#if ENABLE(SAMPLING_FLAGS)
    473475    SamplingFlags::stop();
     476#endif
     477#if ENABLE(SAMPLING_REGIONS)
     478    SamplingRegion::dump();
    474479#endif
    475480    globalData.dumpSampleData(globalObject->globalExec());
  • trunk/Source/JavaScriptCore/parser/Parser.h

    r98887 r99374  
    10301030PassRefPtr<ParsedNode> parse(JSGlobalData* globalData, JSGlobalObject* lexicalGlobalObject, const SourceCode& source, FunctionParameters* parameters, JSParserStrictness strictness, JSParserMode parserMode, Debugger* debugger, ExecState* execState, JSObject** exception)
    10311031{
     1032    SamplingRegion samplingRegion("Parsing");
    10321033    Parser parser(globalData, source, parameters, strictness, parserMode);
    10331034    return parser.parse<ParsedNode>(lexicalGlobalObject, debugger, execState, exception);
  • trunk/Source/JavaScriptCore/runtime/Executable.cpp

    r98916 r99374  
    149149JSObject* EvalExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType)
    150150{
     151    SamplingRegion samplingRegion(jitType == JITCode::BaselineJIT ? "Baseline Compilation (TOTAL)" : "DFG Compilation (TOTAL)");
     152   
    151153#if !ENABLE(JIT)
    152154    UNUSED_PARAM(jitType);
     
    281283JSObject* ProgramExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType)
    282284{
     285    SamplingRegion samplingRegion(jitType == JITCode::BaselineJIT ? "Baseline Compilation (TOTAL)" : "DFG Compilation (TOTAL)");
     286   
    283287#if !ENABLE(JIT)
    284288    UNUSED_PARAM(jitType);
     
    456460JSObject* FunctionExecutable::compileForCallInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType)
    457461{
     462    SamplingRegion samplingRegion(jitType == JITCode::BaselineJIT ? "Baseline Compilation (TOTAL)" : "DFG Compilation (TOTAL)");
     463   
    458464#if !ENABLE(JIT)
    459465    UNUSED_PARAM(exec);
     
    516522JSObject* FunctionExecutable::compileForConstructInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType)
    517523{
     524    SamplingRegion samplingRegion(jitType == JITCode::BaselineJIT ? "Baseline Compilation (TOTAL)" : "DFG Compilation (TOTAL)");
     525   
    518526#if !ENABLE(JIT)
    519527    UNUSED_PARAM(jitType);
  • trunk/Source/JavaScriptCore/wtf/Atomics.h

    r98937 r99374  
    127127        "lock; cmpxchgl %3, %2\n\t"
    128128        "sete %1"
    129         : "+a"(expected), "=r"(result), "+m"(*location)
     129        : "+a"(expected), "=q"(result), "+m"(*location)
    130130        : "r"(newValue)
    131131        : "memory"
     
    141141}
    142142
     143inline bool weakCompareAndSwap(void*volatile* location, void* expected, void* newValue)
     144{
     145    // FIXME: Implement COMPARE_AND_SWAP on other architectures and compilers. Currently
     146    // it only works on X86 or X86_64 with a GCC-style compiler.
     147#if ENABLE(COMPARE_AND_SWAP)
     148    bool result;
     149    asm volatile(
     150#if CPU(X86_64)
     151        "lock; cmpxchgq %3, %2\n\t"
     152#else
     153        "lock; cmpxchgl %3, %2\n\t"
     154#endif
     155        "sete %1"
     156        : "+a"(expected), "=q"(result), "+m"(*location)
     157        : "r"(newValue)
     158        : "memory"
     159        );
     160    return result;
     161#else // ENABLE(COMPARE_AND_SWAP)
     162    UNUSED_PARAM(location);
     163    UNUSED_PARAM(expected);
     164    UNUSED_PARAM(newValue);
     165    CRASH();
     166    return 0;
     167#endif // ENABLE(COMPARE_AND_SWAP)
     168}
     169
     170inline bool weakCompareAndSwap(volatile uintptr_t* location, uintptr_t expected, uintptr_t newValue)
     171{
     172    return weakCompareAndSwap(reinterpret_cast<void*volatile*>(location), reinterpret_cast<void*>(expected), reinterpret_cast<void*>(newValue));
     173}
     174
    143175} // namespace WTF
    144176
  • trunk/Source/JavaScriptCore/wtf/Platform.h

    r99222 r99374  
    809809#define ENABLE_SAMPLING_COUNTERS 0
    810810#define ENABLE_SAMPLING_FLAGS 0
     811#define ENABLE_SAMPLING_REGIONS 0
    811812#define ENABLE_OPCODE_SAMPLING 0
    812813#define ENABLE_CODEBLOCK_SAMPLING 0
     
    814815#error "CODEBLOCK_SAMPLING requires OPCODE_SAMPLING"
    815816#endif
    816 #if ENABLE(OPCODE_SAMPLING) || ENABLE(SAMPLING_FLAGS)
     817#if ENABLE(OPCODE_SAMPLING) || ENABLE(SAMPLING_FLAGS) || ENABLE(SAMPLING_REGIONS)
    817818#define ENABLE_SAMPLING_THREAD 1
    818819#endif
  • trunk/Source/JavaScriptCore/wtf/wtf.pri

    r99274 r99374  
    9898    wtf/RetainPtr.h \
    9999    wtf/SHA1.h \
     100    wtf/Spectrum.h \
    100101    wtf/StackBounds.h \
    101102    wtf/StaticConstructors.h \
Note: See TracChangeset for help on using the changeset viewer.