diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/profiler/ProfilerDatabase.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/JavaScriptCore/profiler/ProfilerDatabase.h')
-rw-r--r-- | Source/JavaScriptCore/profiler/ProfilerDatabase.h | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/Source/JavaScriptCore/profiler/ProfilerDatabase.h b/Source/JavaScriptCore/profiler/ProfilerDatabase.h index 7d4f3cf2c..b9ef36c03 100644 --- a/Source/JavaScriptCore/profiler/ProfilerDatabase.h +++ b/Source/JavaScriptCore/profiler/ProfilerDatabase.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012, 2013 Apple Inc. All rights reserved. + * Copyright (C) 2012-2013, 2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,17 +23,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ProfilerDatabase_h -#define ProfilerDatabase_h +#pragma once #include "JSCJSValue.h" #include "ProfilerBytecodes.h" #include "ProfilerCompilation.h" #include "ProfilerCompilationKind.h" +#include "ProfilerEvent.h" #include <wtf/FastMalloc.h> #include <wtf/HashMap.h> +#include <wtf/Lock.h> #include <wtf/Noncopyable.h> -#include <wtf/PassRefPtr.h> #include <wtf/SegmentedVector.h> #include <wtf/ThreadingPrimitives.h> #include <wtf/text/WTFString.h> @@ -51,7 +51,7 @@ public: Bytecodes* ensureBytecodesFor(CodeBlock*); void notifyDestruction(CodeBlock*); - void addCompilation(PassRefPtr<Compilation>); + void addCompilation(CodeBlock*, Ref<Compilation>&&); // Converts the database to a JavaScript object that is suitable for JSON stringification. // Note that it's probably a good idea to use an ExecState* associated with a global @@ -69,22 +69,11 @@ public: void registerToSaveAtExit(const char* filename); + JS_EXPORT_PRIVATE void logEvent(CodeBlock* codeBlock, const char* summary, const CString& detail); + private: - // Use a full-blown adaptive mutex because: - // - There is only one ProfilerDatabase per VM. The size overhead of the system's - // mutex is negligible if you only have one of them. - // - It's locked infrequently - once per bytecode generation, compilation, and - // code block collection - so the fact that the fast path still requires a - // function call is neglible. - // - It tends to be held for a while. Currently, we hold it while generating - // Profiler::Bytecodes for a CodeBlock. That's uncommon and shouldn't affect - // performance, but if we did have contention, we would want a sensible, - // power-aware backoff. An adaptive mutex will do this as a matter of course, - // but a spinlock won't. - typedef Mutex Lock; - typedef MutexLocker Locker; + Bytecodes* ensureBytecodesFor(const LockHolder&, CodeBlock*); - void addDatabaseToAtExit(); void removeDatabaseFromAtExit(); void performAtExitSave() const; @@ -95,7 +84,9 @@ private: VM& m_vm; SegmentedVector<Bytecodes> m_bytecodes; HashMap<CodeBlock*, Bytecodes*> m_bytecodesMap; - Vector<RefPtr<Compilation>> m_compilations; + Vector<Ref<Compilation>> m_compilations; + HashMap<CodeBlock*, Ref<Compilation>> m_compilationMap; + Vector<Event> m_events; bool m_shouldSaveAtExit; CString m_atExitSaveFilename; Database* m_nextRegisteredDatabase; @@ -103,6 +94,3 @@ private: }; } } // namespace JSC::Profiler - -#endif // ProfilerDatabase_h - |