Commit c9d7b8d2 authored by barraclough@apple.com's avatar barraclough@apple.com

2009-05-05 Gavin Barraclough <barraclough@apple.com>

        Reviewed by Oliver Hunt.

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

        * jsc.cpp:
        (GlobalObject::GlobalObject):
        (functionSetSamplingFlags):
        (functionClearSamplingFlags):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d0295906
2009-05-05 Gavin Barraclough <barraclough@apple.com>
Reviewed by Oliver Hunt.
For convenience, let the sampling flags tool clear multiple flags at once.
* jsc.cpp:
(GlobalObject::GlobalObject):
(functionSetSamplingFlags):
(functionClearSamplingFlags):
2009-05-04 Maciej Stachowiak <mjs@apple.com>
Rubber stamped by Gavin.
......@@ -78,8 +78,8 @@ static JSValue functionReadline(ExecState*, JSObject*, JSValue, const ArgList&);
static NO_RETURN JSValue functionQuit(ExecState*, JSObject*, JSValue, const ArgList&);
#if ENABLE(SAMPLING_FLAGS)
static JSValue functionSetSamplingFlag(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue functionClearSamplingFlag(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue functionSetSamplingFlags(ExecState*, JSObject*, JSValue, const ArgList&);
static JSValue functionClearSamplingFlags(ExecState*, JSObject*, JSValue, const ArgList&);
#endif
struct Script {
......@@ -186,8 +186,8 @@ GlobalObject::GlobalObject(const Vector<UString>& arguments)
putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 0, Identifier(globalExec(), "readline"), functionReadline));
#if ENABLE(SAMPLING_FLAGS)
putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "setSamplingFlag"), functionSetSamplingFlag));
putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "clearSamplingFlag"), functionClearSamplingFlag));
putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "setSamplingFlags"), functionSetSamplingFlags));
putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 1, Identifier(globalExec(), "clearSamplingFlags"), functionClearSamplingFlags));
#endif
JSObject* array = constructEmptyArray(globalExec());
......@@ -262,33 +262,23 @@ JSValue functionLoad(ExecState* exec, JSObject*, JSValue, const ArgList& args)
}
#if ENABLE(SAMPLING_FLAGS)
JSValue functionSetSamplingFlag(ExecState* exec, JSObject*, JSValue, const ArgList& args)
JSValue functionSetSamplingFlags(ExecState* exec, JSObject*, JSValue, const ArgList& args)
{
unsigned flag = static_cast<unsigned>(args.at(0).toNumber(exec));
// Sanitize the input into the range 1..32.
if (flag > 32)
flag &= 31;
if (!flag)
flag = 32;
SamplingFlags::setFlag(flag);
for (unsigned i = 0; i < args.size(); ++i) {
unsigned flag = static_cast<unsigned>(args.at(i).toNumber(exec));
if ((flag >= 1) && (flag <= 32))
SamplingFlags::setFlag(flag);
}
return jsNull();
}
JSValue functionClearSamplingFlag(ExecState* exec, JSObject*, JSValue, const ArgList& args)
JSValue functionClearSamplingFlags(ExecState* exec, JSObject*, JSValue, const ArgList& args)
{
unsigned flag = static_cast<unsigned>(args.at(0).toNumber(exec));
// Sanitize the input into the range 1..32.
if (flag > 32)
flag &= 31;
if (!flag)
flag = 32;
SamplingFlags::clearFlag(flag);
for (unsigned i = 0; i < args.size(); ++i) {
unsigned flag = static_cast<unsigned>(args.at(i).toNumber(exec));
if ((flag >= 1) && (flag <= 32))
SamplingFlags::clearFlag(flag);
}
return jsNull();
}
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment