1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  * vim: set ts=8 sts=4 et sw=4 tw=99:
3  * This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 #ifndef vtune_vtunewrapper_h
8 #define vtune_vtunewrapper_h
9 
10 #ifdef MOZ_VTUNE
11 
12 #include "vtune/jitprofiling.h"
13 
14 #include "jit/IonCode.h"
15 #include "vm/JSScript.h"
16 
17 namespace js {
18 namespace vtune {
19 
20 bool Initialize();
21 void Shutdown();
22 
23 // VTune profiling may be attached/detached at any time, but there is no API for
24 // attaching a callback to execute at attachment time. Methods compiled before
25 // VTune was most recently attached therefore do not provide any information to
26 // VTune.
27 bool IsProfilingActive();
28 
29 // Wrapper exists in case we need locking in the future.
30 uint32_t GenerateUniqueMethodID();
31 
32 void MarkStub(const js::jit::JitCode* code, const char* name);
33 
34 void MarkRegExp(const js::jit::JitCode* code, bool match_only);
35 
36 void MarkScript(const js::jit::JitCode* code, const JSScript* script,
37                 const char* module);
38 
39 void MarkWasm(unsigned methodId, const char* name, void* start, uintptr_t size);
40 
41 void UnmarkCode(const js::jit::JitCode* code);
42 
43 void UnmarkBytes(void* bytes, unsigned size);
44 
45 }  // namespace vtune
46 }  // namespace js
47 
48 #endif  // MOZ_VTUNE
49 
50 #endif  // vtune_vtunewrapper_h
51