WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
128941
Make it possible to start and stop the bytecode sampler.
https://bugs.webkit.org/show_bug.cgi?id=128941
Summary
Make it possible to start and stop the bytecode sampler.
Oliver Hunt
Reported
2014-02-17 16:30:46 PST
Make it possible to start and stop the bytecode sampler.
Attachments
Patch
(8.13 KB, patch)
2014-02-17 16:40 PST
,
Oliver Hunt
no flags
Details
Formatted Diff
Diff
Patch
(7.27 KB, patch)
2014-02-18 10:58 PST
,
Oliver Hunt
oliver
: review-
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Oliver Hunt
Comment 1
2014-02-17 16:40:18 PST
Created
attachment 224445
[details]
Patch
Filip Pizlo
Comment 2
2014-02-17 16:55:14 PST
Comment on
attachment 224445
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=224445&action=review
> Source/JavaScriptCore/ChangeLog:9 > + Refactor the bytecode sampler logic to allow us to start and stop > + profiling sessions dynamically.
What is this for?
> Source/JavaScriptCore/runtime/VM.cpp:419 > +void VM::initializeBytecodeProfiler() > +{ > + ASSERT(m_bytecodeProfilerEnabled); > + if (m_perBytecodeProfiler) > + return; > + > + m_perBytecodeProfiler = adoptPtr(new Profiler::Database(*this)); > +} > + > +void VM::startBytecodeProfiler() > +{ > + if (m_bytecodeProfilerEnabled) > + return; > + m_bytecodeProfilerEnabled = true; > + if (entryScope) > + entryScope->setRecompilationNeeded(true); > + else > + initializeBytecodeProfiler(); > + > +}
Why are starting and initializing two different things?
> Source/JavaScriptCore/runtime/VM.cpp:438 > +String VM::stopBytecodeProfiler() > +{ > + m_bytecodeProfilerEnabled = false; > + if (!m_perBytecodeProfiler) > + return String(); > + String result = m_perBytecodeProfiler->toJSON(); > + if (entryScope) > + entryScope->setRecompilationNeeded(true); > + else > + destroyBytecodeProfiler(); > + return result; > +}
I really don't like this API. I think it's weird that stopping the profiler, and getting its JSON, are part of the same thing. Why can't you have two separate APIs?
> Source/JavaScriptCore/runtime/VM.h:516 > + void prepareProfilerIfNecessary() > + { > + if (m_perBytecodeProfiler && !m_bytecodeProfilerEnabled) > + destroyBytecodeProfiler(); > + else if (m_bytecodeProfilerEnabled && !m_perBytecodeProfiler) > + initializeBytecodeProfiler(); > + }
This is really weird. A method called "prapare" that destroys the profiler, or initializes it? I don't understand this method.
Oliver Hunt
Comment 3
2014-02-17 17:12:52 PST
(In reply to
comment #2
)
> (From update of
attachment 224445
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=224445&action=review
> > > Source/JavaScriptCore/ChangeLog:9 > > + Refactor the bytecode sampler logic to allow us to start and stop > > + profiling sessions dynamically. > > What is this for?
So we'll be able to profile pages in browser
> > > Source/JavaScriptCore/runtime/VM.cpp:419 > > +void VM::initializeBytecodeProfiler() > > +{ > > + ASSERT(m_bytecodeProfilerEnabled); > > + if (m_perBytecodeProfiler) > > + return; > > + > > + m_perBytecodeProfiler = adoptPtr(new Profiler::Database(*this)); > > +} > > + > > +void VM::startBytecodeProfiler() > > +{ > > + if (m_bytecodeProfilerEnabled) > > + return; > > + m_bytecodeProfilerEnabled = true; > > + if (entryScope) > > + entryScope->setRecompilationNeeded(true); > > + else > > + initializeBytecodeProfiler(); > > + > > +} > > Why are starting and initializing two different things?
So you can start the profiler from inside JS, i guess that's not strictly necessary but it was useful for testing.
> > > Source/JavaScriptCore/runtime/VM.cpp:438 > > +String VM::stopBytecodeProfiler() > > +{ > > + m_bytecodeProfilerEnabled = false; > > + if (!m_perBytecodeProfiler) > > + return String(); > > + String result = m_perBytecodeProfiler->toJSON(); > > + if (entryScope) > > + entryScope->setRecompilationNeeded(true); > > + else > > + destroyBytecodeProfiler(); > > + return result; > > +} > > I really don't like this API. I think it's weird that stopping the profiler, and getting its JSON, are part of the same thing. Why can't you have two separate APIs?
If we don't have the ability to start/stop from js this ins't necessary
> > > Source/JavaScriptCore/runtime/VM.h:516 > > + void prepareProfilerIfNecessary() > > + { > > + if (m_perBytecodeProfiler && !m_bytecodeProfilerEnabled) > > + destroyBytecodeProfiler(); > > + else if (m_bytecodeProfilerEnabled && !m_perBytecodeProfiler) > > + initializeBytecodeProfiler(); > > + } > > This is really weird. A method called "prapare" that destroys the profiler, or initializes it? I don't understand this method.
Oliver Hunt
Comment 4
2014-02-18 10:58:07 PST
Created
attachment 224522
[details]
Patch
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug