本文整理汇总了C++中samplingRegion函数的典型用法代码示例。如果您正苦于以下问题:C++ samplingRegion函数的具体用法?C++ samplingRegion怎么用?C++ samplingRegion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了samplingRegion函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compile
inline bool compile(CompileMode compileMode, JSGlobalData& globalData, CodeBlock* codeBlock, JITCode& jitCode, MacroAssemblerCodePtr* jitCodeWithArityCheck)
{
SamplingRegion samplingRegion("DFG Compilation (Driver)");
ASSERT(codeBlock);
ASSERT(codeBlock->alternative());
ASSERT(codeBlock->alternative()->getJITType() == JITCode::BaselineJIT);
#if DFG_ENABLE(DEBUG_VERBOSE)
dataLog("DFG compiling code block %p(%p), number of instructions = %u.\n", codeBlock, codeBlock->alternative(), codeBlock->instructionCount());
#endif
Graph dfg;
if (!parse(dfg, &globalData, codeBlock))
return false;
if (compileMode == CompileFunction)
dfg.predictArgumentTypes(codeBlock);
propagate(dfg, &globalData, codeBlock);
JITCompiler dataFlowJIT(&globalData, dfg, codeBlock);
if (compileMode == CompileFunction) {
ASSERT(jitCodeWithArityCheck);
dataFlowJIT.compileFunction(jitCode, *jitCodeWithArityCheck);
} else {
ASSERT(compileMode == CompileOther);
ASSERT(!jitCodeWithArityCheck);
dataFlowJIT.compile(jitCode);
}
return true;
}
示例2: createRegExpMatchesArray
JSArray* createRegExpMatchesArray(ExecState* exec, JSString* input, RegExp* regExp, MatchResult result)
{
ASSERT(result);
VM& vm = exec->vm();
JSArray* array = JSArray::tryCreateUninitialized(vm, exec->lexicalGlobalObject()->arrayStructureForIndexingTypeDuringAllocation(ArrayWithContiguous), regExp->numSubpatterns() + 1);
RELEASE_ASSERT(array);
SamplingRegion samplingRegion("Reifying substring properties");
array->initializeIndex(vm, 0, jsSubstring(exec, input, result.start, result.end - result.start), ArrayWithContiguous);
if (unsigned numSubpatterns = regExp->numSubpatterns()) {
Vector<int, 32> subpatternResults;
int position = regExp->match(vm, input->value(exec), result.start, subpatternResults);
ASSERT_UNUSED(position, position >= 0 && static_cast<size_t>(position) == result.start);
ASSERT(result.start == static_cast<size_t>(subpatternResults[0]));
ASSERT(result.end == static_cast<size_t>(subpatternResults[1]));
for (unsigned i = 1; i <= numSubpatterns; ++i) {
int start = subpatternResults[2 * i];
if (start >= 0)
array->initializeIndex(vm, i, jsSubstring(exec, input, start, subpatternResults[2 * i + 1] - start), ArrayWithContiguous);
else
array->initializeIndex(vm, i, jsUndefined(), ArrayWithContiguous);
}
}
array->putDirect(vm, vm.propertyNames->index, jsNumber(result.start));
array->putDirect(vm, vm.propertyNames->input, input);
return array;
}
示例3: samplingRegion
JSObject* EvalExecutable::compileInternal(ExecState* exec, ScopeChainNode* scopeChainNode, JITCode::JITType jitType)
{
SamplingRegion samplingRegion(jitType == JITCode::BaselineJIT ? "Baseline Compilation (TOTAL)" : "DFG Compilation (TOTAL)");
#if !ENABLE(JIT)
UNUSED_PARAM(jitType);
#endif
JSObject* exception = 0;
JSGlobalData* globalData = &exec->globalData();
JSGlobalObject* lexicalGlobalObject = exec->lexicalGlobalObject();
if (!!m_evalCodeBlock && m_evalCodeBlock->canProduceCopyWithBytecode()) {
BytecodeDestructionBlocker blocker(m_evalCodeBlock.get());
OwnPtr<EvalCodeBlock> newCodeBlock = adoptPtr(new EvalCodeBlock(CodeBlock::CopyParsedBlock, *m_evalCodeBlock));
newCodeBlock->setAlternative(static_pointer_cast<CodeBlock>(m_evalCodeBlock.release()));
m_evalCodeBlock = newCodeBlock.release();
} else {
if (!lexicalGlobalObject->evalEnabled())
return throwError(exec, createEvalError(exec, "Eval is disabled"));
RefPtr<EvalNode> evalNode = parse<EvalNode>(globalData, lexicalGlobalObject, m_source, 0, isStrictMode() ? JSParseStrict : JSParseNormal, EvalNode::isFunctionNode ? JSParseFunctionCode : JSParseProgramCode, lexicalGlobalObject->debugger(), exec, &exception);
if (!evalNode) {
ASSERT(exception);
return exception;
}
recordParse(evalNode->features(), evalNode->hasCapturedVariables(), evalNode->lineNo(), evalNode->lastLine());
JSGlobalObject* globalObject = scopeChainNode->globalObject.get();
OwnPtr<CodeBlock> previousCodeBlock = m_evalCodeBlock.release();
ASSERT((jitType == JITCode::bottomTierJIT()) == !previousCodeBlock);
m_evalCodeBlock = adoptPtr(new EvalCodeBlock(this, globalObject, source().provider(), scopeChainNode->localDepth(), previousCodeBlock.release()));
OwnPtr<BytecodeGenerator> generator(adoptPtr(new BytecodeGenerator(evalNode.get(), scopeChainNode, m_evalCodeBlock->symbolTable(), m_evalCodeBlock.get(), !!m_evalCodeBlock->alternative() ? OptimizingCompilation : FirstCompilation)));
if ((exception = generator->generate())) {
m_evalCodeBlock = static_pointer_cast<EvalCodeBlock>(m_evalCodeBlock->releaseAlternative());
evalNode->destroyData();
return exception;
}
evalNode->destroyData();
m_evalCodeBlock->copyPostParseDataFromAlternative();
}
#if ENABLE(JIT)
if (!jitCompileIfAppropriate(*globalData, m_evalCodeBlock, m_jitCodeForCall, jitType))
return 0;
#endif
#if ENABLE(JIT)
#if ENABLE(INTERPRETER)
if (!m_jitCodeForCall)
Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_evalCodeBlock));
else
#endif
Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_evalCodeBlock) + m_jitCodeForCall.size());
#else
Heap::heap(this)->reportExtraMemoryCost(sizeof(*m_evalCodeBlock));
#endif
return 0;
}
示例4: samplingRegion
void Heap::markRoots(double gcStartTime, void* stackOrigin, void* stackTop, MachineThreads::RegisterState& calleeSavedRegisters)
{
SamplingRegion samplingRegion("Garbage Collection: Marking");
GCPHASE(MarkRoots);
ASSERT(isValidThreadState(m_vm));
#if ENABLE(GGC)
Vector<const JSCell*> rememberedSet(m_slotVisitor.markStack().size());
m_slotVisitor.markStack().fillVector(rememberedSet);
#else
Vector<const JSCell*> rememberedSet;
#endif
#if ENABLE(DFG_JIT)
DFG::clearCodeBlockMarks(*m_vm);
#endif
if (m_operationInProgress == EdenCollection)
m_codeBlocks.clearMarksForEdenCollection(rememberedSet);
else
m_codeBlocks.clearMarksForFullCollection();
// We gather conservative roots before clearing mark bits because conservative
// gathering uses the mark bits to determine whether a reference is valid.
ConservativeRoots conservativeRoots(&m_objectSpace.blocks(), &m_storageSpace);
gatherStackRoots(conservativeRoots, stackOrigin, stackTop, calleeSavedRegisters);
gatherJSStackRoots(conservativeRoots);
gatherScratchBufferRoots(conservativeRoots);
clearLivenessData();
m_sharedData.didStartMarking();
m_slotVisitor.didStartMarking();
HeapRootVisitor heapRootVisitor(m_slotVisitor);
{
ParallelModeEnabler enabler(m_slotVisitor);
visitExternalRememberedSet();
visitSmallStrings();
visitConservativeRoots(conservativeRoots);
visitProtectedObjects(heapRootVisitor);
visitArgumentBuffers(heapRootVisitor);
visitException(heapRootVisitor);
visitStrongHandles(heapRootVisitor);
visitHandleStack(heapRootVisitor);
traceCodeBlocksAndJITStubRoutines();
converge();
}
// Weak references must be marked last because their liveness depends on
// the liveness of the rest of the object graph.
visitWeakHandles(heapRootVisitor);
clearRememberedSet(rememberedSet);
m_sharedData.didFinishMarking();
updateObjectCounts(gcStartTime);
resetVisitors();
}
示例5: compileImpl
static CompilationResult compileImpl(
VM& vm, CodeBlock* codeBlock, CodeBlock* profiledDFGCodeBlock, CompilationMode mode,
unsigned osrEntryBytecodeIndex, const Operands<JSValue>& mustHandleValues,
PassRefPtr<DeferredCompilationCallback> callback)
{
SamplingRegion samplingRegion("DFG Compilation (Driver)");
numCompilations++;
ASSERT(codeBlock);
ASSERT(codeBlock->alternative());
ASSERT(codeBlock->alternative()->jitType() == JITCode::BaselineJIT);
ASSERT(!profiledDFGCodeBlock || profiledDFGCodeBlock->jitType() == JITCode::DFGJIT);
if (logCompilationChanges(mode))
dataLog("DFG(Driver) compiling ", *codeBlock, " with ", mode, ", number of instructions = ", codeBlock->instructionCount(), "\n");
// Make sure that any stubs that the DFG is going to use are initialized. We want to
// make sure that all JIT code generation does finalization on the main thread.
vm.getCTIStub(osrExitGenerationThunkGenerator);
vm.getCTIStub(throwExceptionFromCallSlowPathGenerator);
if (mode == DFGMode) {
vm.getCTIStub(linkCallThunkGenerator);
vm.getCTIStub(linkConstructThunkGenerator);
vm.getCTIStub(linkClosureCallThunkGenerator);
vm.getCTIStub(virtualCallThunkGenerator);
vm.getCTIStub(virtualConstructThunkGenerator);
} else {
vm.getCTIStub(linkCallThatPreservesRegsThunkGenerator);
vm.getCTIStub(linkConstructThatPreservesRegsThunkGenerator);
vm.getCTIStub(linkClosureCallThatPreservesRegsThunkGenerator);
vm.getCTIStub(virtualCallThatPreservesRegsThunkGenerator);
vm.getCTIStub(virtualConstructThatPreservesRegsThunkGenerator);
}
if (CallEdgeLog::isEnabled())
vm.ensureCallEdgeLog().processLog();
if (vm.typeProfiler())
vm.typeProfilerLog()->processLogEntries(ASCIILiteral("Preparing for DFG compilation."));
RefPtr<Plan> plan = adoptRef(
new Plan(codeBlock, profiledDFGCodeBlock, mode, osrEntryBytecodeIndex, mustHandleValues));
if (Options::enableConcurrentJIT()) {
Worklist* worklist = ensureGlobalWorklistFor(mode);
plan->callback = callback;
if (logCompilationChanges(mode))
dataLog("Deferring DFG compilation of ", *codeBlock, " with queue length ", worklist->queueLength(), ".\n");
worklist->enqueue(plan);
return CompilationDeferred;
}
plan->compileInThread(*vm.dfgState, 0);
return plan->finalizeWithoutNotifyingCallback();
}
示例6: collect
void Heap::collectAndSweep(HeapOperation collectionType)
{
if (!m_isSafeToCollect)
return;
collect(collectionType);
SamplingRegion samplingRegion("Garbage Collection: Sweeping");
DeferGCForAWhile deferGC(*this);
m_objectSpace.sweep();
m_objectSpace.shrink();
sweepAllLogicallyEmptyWeakBlocks();
}
示例7: compile
inline bool compile(CompileMode compileMode, JSGlobalData& globalData, CodeBlock* codeBlock, JITCode& jitCode, MacroAssemblerCodePtr* jitCodeWithArityCheck)
{
SamplingRegion samplingRegion("DFG Compilation (Driver)");
ASSERT(codeBlock);
ASSERT(codeBlock->alternative());
ASSERT(codeBlock->alternative()->getJITType() == JITCode::BaselineJIT);
#if DFG_ENABLE(DEBUG_VERBOSE)
dataLog("DFG compiling code block %p(%p), number of instructions = %u.\n", codeBlock, codeBlock->alternative(), codeBlock->instructionCount());
#endif
Graph dfg(globalData, codeBlock);
if (!parse(dfg))
return false;
if (compileMode == CompileFunction)
dfg.predictArgumentTypes();
performRedundantPhiElimination(dfg);
performPredictionPropagation(dfg);
performFixup(dfg);
performCSE(dfg);
performVirtualRegisterAllocation(dfg);
performCFA(dfg);
#if DFG_ENABLE(DEBUG_VERBOSE)
dataLog("Graph after optimization:\n");
dfg.dump();
#endif
JITCompiler dataFlowJIT(dfg);
bool result;
if (compileMode == CompileFunction) {
ASSERT(jitCodeWithArityCheck);
result = dataFlowJIT.compileFunction(jitCode, *jitCodeWithArityCheck);
} else {
ASSERT(compileMode == CompileOther);
ASSERT(!jitCodeWithArityCheck);
result = dataFlowJIT.compile(jitCode);
}
return result;
}
示例8: currentTimeMS
void Plan::compileInThread(LongLivedState& longLivedState, ThreadData* threadData)
{
this->threadData = threadData;
double before = 0;
if (reportCompileTimes())
before = currentTimeMS();
SamplingRegion samplingRegion("DFG Compilation (Plan)");
CompilationScope compilationScope;
if (logCompilationChanges(mode))
dataLog("DFG(Plan) compiling ", *codeBlock, " with ", mode, ", number of instructions = ", codeBlock->instructionCount(), "\n");
CompilationPath path = compileInThreadImpl(longLivedState);
RELEASE_ASSERT(finalizer);
if (reportCompileTimes()) {
const char* pathName;
switch (path) {
case FailPath:
pathName = "N/A (fail)";
break;
case DFGPath:
pathName = "DFG";
break;
case FTLPath:
pathName = "FTL";
break;
default:
RELEASE_ASSERT_NOT_REACHED();
pathName = "";
break;
}
double now = currentTimeMS();
dataLog("Optimized ", *codeBlock, " using ", mode, " with ", pathName, " into ", finalizer->codeSize(), " bytes in ", now - before, " ms");
if (path == FTLPath)
dataLog(" (DFG: ", beforeFTL - before, ", LLVM: ", now - beforeFTL, ")");
dataLog(".\n");
}
}
示例9: samplingRegion
void JITCompiler::compile()
{
SamplingRegion samplingRegion("DFG Backend");
setStartOfCode();
compileEntry();
m_speculative = adoptPtr(new SpeculativeJIT(*this));
compileBody();
setEndOfMainPath();
// Generate slow path code.
m_speculative->runSlowPathGenerators();
compileExceptionHandlers();
linkOSRExits();
// Create OSR entry trampolines if necessary.
m_speculative->createOSREntries();
setEndOfCode();
}
示例10: samplingRegion
void JITCompiler::compile()
{
SamplingRegion samplingRegion("DFG Backend");
setStartOfCode();
compileEntry();
m_speculative = adoptPtr(new SpeculativeJIT(*this));
addPtr(TrustedImm32(m_graph.stackPointerOffset() * sizeof(Register)), GPRInfo::callFrameRegister, stackPointerRegister);
checkStackPointerAlignment();
compileBody();
setEndOfMainPath();
// Generate slow path code.
m_speculative->runSlowPathGenerators();
compileExceptionHandlers();
linkOSRExits();
// Create OSR entry trampolines if necessary.
m_speculative->createOSREntries();
setEndOfCode();
}
示例11: samplingRegion
bool JITCompiler::compile(JITCode& entry)
{
SamplingRegion samplingRegion("DFG Backend");
setStartOfCode();
compileEntry();
SpeculativeJIT speculative(*this);
compileBody(speculative);
setEndOfMainPath();
// Generate slow path code.
speculative.runSlowPathGenerators();
compileExceptionHandlers();
linkOSRExits();
// Create OSR entry trampolines if necessary.
speculative.createOSREntries();
setEndOfCode();
LinkBuffer linkBuffer(*m_vm, this, m_codeBlock, JITCompilationCanFail);
if (linkBuffer.didFailToAllocate())
return false;
link(linkBuffer);
speculative.linkOSREntries(linkBuffer);
if (shouldShowDisassembly())
m_disassembler->dump(linkBuffer);
if (m_graph.m_compilation)
m_disassembler->reportToProfiler(m_graph.m_compilation.get(), linkBuffer);
entry = JITCode(
linkBuffer.finalizeCodeWithoutDisassembly(),
JITCode::DFGJIT);
return true;
}
示例12: samplingRegion
void Heap::markRoots()
{
SamplingRegion samplingRegion("Garbage Collection: Tracing");
GCPHASE(MarkRoots);
ASSERT(isValidThreadState(m_vm));
#if ENABLE(OBJECT_MARK_LOGGING)
double gcStartTime = WTF::monotonicallyIncreasingTime();
#endif
void* dummy;
// We gather conservative roots before clearing mark bits because conservative
// gathering uses the mark bits to determine whether a reference is valid.
ConservativeRoots machineThreadRoots(&m_objectSpace.blocks(), &m_storageSpace);
m_jitStubRoutines.clearMarks();
{
GCPHASE(GatherConservativeRoots);
m_machineThreads.gatherConservativeRoots(machineThreadRoots, &dummy);
}
ConservativeRoots stackRoots(&m_objectSpace.blocks(), &m_storageSpace);
m_codeBlocks.clearMarks();
{
GCPHASE(GatherStackRoots);
stack().gatherConservativeRoots(stackRoots, m_jitStubRoutines, m_codeBlocks);
stack().sanitizeStack();
}
#if ENABLE(DFG_JIT)
ConservativeRoots scratchBufferRoots(&m_objectSpace.blocks(), &m_storageSpace);
{
GCPHASE(GatherScratchBufferRoots);
m_vm->gatherConservativeRoots(scratchBufferRoots);
}
#endif
{
GCPHASE(ClearLivenessData);
m_objectSpace.clearNewlyAllocated();
m_objectSpace.clearMarks();
}
m_sharedData.didStartMarking();
SlotVisitor& visitor = m_slotVisitor;
visitor.setup();
HeapRootVisitor heapRootVisitor(visitor);
{
ParallelModeEnabler enabler(visitor);
m_vm->smallStrings.visitStrongReferences(visitor);
{
GCPHASE(VisitMachineRoots);
MARK_LOG_ROOT(visitor, "C++ Stack");
visitor.append(machineThreadRoots);
visitor.donateAndDrain();
}
{
GCPHASE(VisitStackRoots);
MARK_LOG_ROOT(visitor, "Stack");
visitor.append(stackRoots);
visitor.donateAndDrain();
}
#if ENABLE(DFG_JIT)
{
GCPHASE(VisitScratchBufferRoots);
MARK_LOG_ROOT(visitor, "Scratch Buffers");
visitor.append(scratchBufferRoots);
visitor.donateAndDrain();
}
#endif
{
GCPHASE(VisitProtectedObjects);
MARK_LOG_ROOT(visitor, "Protected Objects");
markProtectedObjects(heapRootVisitor);
visitor.donateAndDrain();
}
{
GCPHASE(VisitTempSortVectors);
MARK_LOG_ROOT(visitor, "Temp Sort Vectors");
markTempSortVectors(heapRootVisitor);
visitor.donateAndDrain();
}
{
GCPHASE(MarkingArgumentBuffers);
if (m_markListSet && m_markListSet->size()) {
MARK_LOG_ROOT(visitor, "Argument Buffers");
MarkedArgumentBuffer::markLists(heapRootVisitor, *m_markListSet);
visitor.donateAndDrain();
}
}
if (m_vm->exception()) {
GCPHASE(MarkingException);
MARK_LOG_ROOT(visitor, "Exceptions");
heapRootVisitor.visit(m_vm->addressOfException());
visitor.donateAndDrain();
//.........这里部分代码省略.........
示例13: performDCE
bool performDCE(Graph& graph)
{
SamplingRegion samplingRegion("DFG DCE Phase");
return runPhase<DCEPhase>(graph);
}
示例14: performSSALowering
bool performSSALowering(Graph& graph)
{
SamplingRegion samplingRegion("DFG SSA Lowering Phase");
return runPhase<SSALoweringPhase>(graph);
}
示例15: performTierUpCheckInjection
bool performTierUpCheckInjection(Graph& graph)
{
SamplingRegion samplingRegion("DFG Tier-up Check Injection");
return runPhase<TierUpCheckInjectionPhase>(graph);
}