Changeset 43047 in webkit for trunk/JavaScriptCore/jsc.cpp
- Timestamp:
- Apr 30, 2009, 12:52:27 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/jsc.cpp
r42989 r43047 78 78 static NO_RETURN JSValuePtr functionQuit(ExecState*, JSObject*, JSValuePtr, const ArgList&); 79 79 80 #if ENABLE(SAMPLING_FLAGS) 81 static JSValuePtr functionSetSamplingFlag(ExecState*, JSObject*, JSValuePtr, const ArgList&); 82 static JSValuePtr functionClearSamplingFlag(ExecState*, JSObject*, JSValuePtr, const ArgList&); 83 #endif 84 80 85 struct Script { 81 86 bool isFile; … … 181 186 putDirectFunction(globalExec(), new (globalExec()) PrototypeFunction(globalExec(), prototypeFunctionStructure(), 0, Identifier(globalExec(), "readline"), functionReadline)); 182 187 188 #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)); 191 #endif 192 183 193 JSObject* array = constructEmptyArray(globalExec()); 184 194 for (size_t i = 0; i < arguments.size(); ++i) … … 251 261 return result.value(); 252 262 } 263 264 #if ENABLE(SAMPLING_FLAGS) 265 JSValuePtr functionSetSamplingFlag(ExecState* exec, JSObject*, JSValuePtr, 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 277 return jsNull(); 278 } 279 280 JSValuePtr functionClearSamplingFlag(ExecState* exec, JSObject*, JSValuePtr, 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 292 return jsNull(); 293 } 294 #endif 253 295 254 296 JSValuePtr functionReadline(ExecState* exec, JSObject*, JSValuePtr, const ArgList&) … … 340 382 Interpreter* interpreter = globalObject->globalData()->interpreter; 341 383 interpreter->setSampler(new SamplingTool(interpreter)); 384 interpreter->sampler()->setup(); 385 #endif 386 #if ENABLE(SAMPLING_FLAGS) 387 SamplingFlags::start(); 342 388 #endif 343 389 … … 354 400 } 355 401 356 #if ENABLE(OPCODE_SAMPLING) 357 interpreter->sampler()->start(); 358 #endif 402 #if ENABLE(SAMPLING_THREAD) 403 SamplingThread::start(); 404 #endif 405 359 406 Completion completion = evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script, fileName)); 360 407 success = success && completion.complType() != Throw; … … 366 413 } 367 414 415 #if ENABLE(SAMPLING_THREAD) 416 SamplingThread::stop(); 417 #endif 418 368 419 globalObject->globalExec()->clearException(); 369 370 #if ENABLE(OPCODE_SAMPLING) 371 interpreter->sampler()->stop(); 372 #endif 373 } 374 420 } 421 422 #if ENABLE(SAMPLING_FLAGS) 423 SamplingFlags::stop(); 424 #endif 375 425 #if ENABLE(OPCODE_SAMPLING) 376 426 interpreter->sampler()->dump(globalObject->globalExec());
Note:
See TracChangeset
for help on using the changeset viewer.