Changeset 43216 in webkit for trunk/JavaScriptCore/jsc.cpp


Ignore:
Timestamp:
May 5, 2009, 1:58:17 AM (16 years ago)
Author:
[email protected]
Message:

2009-05-05 Gavin Barraclough <[email protected]>

Reviewed by Oliver Hunt.

For convenience, let the sampling flags tool clear multiple flags at once.

  • jsc.cpp: (GlobalObject::GlobalObject): (functionSetSamplingFlags): (functionClearSamplingFlags):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jsc.cpp

    r43122 r43216  
    7979
    8080#if ENABLE(SAMPLING_FLAGS)
    81 static JSValue functionSetSamplingFlag(ExecState*, JSObject*, JSValue, const ArgList&);
    82 static JSValue functionClearSamplingFlag(ExecState*, JSObject*, JSValue, const ArgList&);
     81static JSValue functionSetSamplingFlags(ExecState*, JSObject*, JSValue, const ArgList&);
     82static JSValue functionClearSamplingFlags(ExecState*, JSObject*, JSValue, const ArgList&);
    8383#endif
    8484
     
    187187
    188188#if ENABLE(SAMPLING_FLAGS)
    189     putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "setSamplingFlag"), functionSetSamplingFlag));
    190     putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "clearSamplingFlag"), functionClearSamplingFlag));
     189    putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "setSamplingFlags"), functionSetSamplingFlags));
     190    putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "clearSamplingFlags"), functionClearSamplingFlags));
    191191#endif
    192192
     
    263263
    264264#if ENABLE(SAMPLING_FLAGS)
    265 JSValue functionSetSamplingFlag(ExecState* exec, JSObject*, JSValue, const ArgList& args)
    266 {
    267     unsigned flag = static_cast<unsigned>(args.at(0).toNumber(exec));
    268 
    269     // Sanitize the input into the range 1..32.
    270     if (flag > 32)
    271         flag &= 31;
    272     if (!flag)
    273         flag = 32;
    274 
    275     SamplingFlags::setFlag(flag);
    276 
     265JSValue functionSetSamplingFlags(ExecState* exec, JSObject*, JSValue, const ArgList& args)
     266{
     267    for (unsigned i = 0; i < args.size(); ++i) {
     268        unsigned flag = static_cast<unsigned>(args.at(i).toNumber(exec));
     269        if ((flag >= 1) && (flag <= 32))
     270            SamplingFlags::setFlag(flag);
     271    }
    277272    return jsNull();
    278273}
    279274
    280 JSValue functionClearSamplingFlag(ExecState* exec, JSObject*, JSValue, const ArgList& args)
    281 {
    282     unsigned flag = static_cast<unsigned>(args.at(0).toNumber(exec));
    283 
    284     // Sanitize the input into the range 1..32.
    285     if (flag > 32)
    286         flag &= 31;
    287     if (!flag)
    288         flag = 32;
    289 
    290     SamplingFlags::clearFlag(flag);
    291 
     275JSValue functionClearSamplingFlags(ExecState* exec, JSObject*, JSValue, const ArgList& args)
     276{
     277    for (unsigned i = 0; i < args.size(); ++i) {
     278        unsigned flag = static_cast<unsigned>(args.at(i).toNumber(exec));
     279        if ((flag >= 1) && (flag <= 32))
     280            SamplingFlags::clearFlag(flag);
     281    }
    292282    return jsNull();
    293283}
Note: See TracChangeset for help on using the changeset viewer.