From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/JavaScriptCore/profiler/ProfilerDatabase.h | 34 ++++++++--------------- 1 file changed, 11 insertions(+), 23 deletions(-) (limited to 'Source/JavaScriptCore/profiler/ProfilerDatabase.h') 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 #include +#include #include -#include #include #include #include @@ -51,7 +51,7 @@ public: Bytecodes* ensureBytecodesFor(CodeBlock*); void notifyDestruction(CodeBlock*); - void addCompilation(PassRefPtr); + void addCompilation(CodeBlock*, Ref&&); // 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 m_bytecodes; HashMap m_bytecodesMap; - Vector> m_compilations; + Vector> m_compilations; + HashMap> m_compilationMap; + Vector m_events; bool m_shouldSaveAtExit; CString m_atExitSaveFilename; Database* m_nextRegisteredDatabase; @@ -103,6 +94,3 @@ private: }; } } // namespace JSC::Profiler - -#endif // ProfilerDatabase_h - -- cgit v1.2.1