OLD | NEW |
1 /* | 1 /* |
2 This file is provided under a dual BSD/GPLv2 license. When using or | 2 This file is provided under a dual BSD/GPLv2 license. When using or |
3 redistributing this file, you may do so under either license. | 3 redistributing this file, you may do so under either license. |
4 | 4 |
5 GPL LICENSE SUMMARY | 5 GPL LICENSE SUMMARY |
6 | 6 |
7 Copyright(c) 2005-2012 Intel Corporation. All rights reserved. | 7 Copyright(c) 2005-2012 Intel Corporation. All rights reserved. |
8 | 8 |
9 This program is free software; you can redistribute it and/or modify | 9 This program is free software; you can redistribute it and/or modify |
10 it under the terms of version 2 of the GNU General Public License as | 10 it under the terms of version 2 of the GNU General Public License as |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 50 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
51 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 51 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
52 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 52 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
53 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 53 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
54 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 54 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
55 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 55 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
56 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 56 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
57 */ | 57 */ |
58 #include <string.h> | 58 #include <string.h> |
59 | 59 |
60 #ifdef WIN32 | |
61 #include <hash_map> | |
62 using namespace std; | |
63 #else | |
64 // To avoid GCC 4.4 compilation warning about hash_map being deprecated. | |
65 #define OLD_DEPRECATED __DEPRECATED | |
66 #undef __DEPRECATED | |
67 #if defined (ANDROID) | |
68 #include <hash_map> | |
69 using namespace std; | |
70 #else | |
71 #include <ext/hash_map> | |
72 using namespace __gnu_cxx; | |
73 #endif | |
74 #define __DEPRECATED OLD_DEPRECATED | |
75 #endif | |
76 | |
77 #include <list> | 60 #include <list> |
| 61 #include <unordered_map> |
78 | 62 |
79 #include "v8-vtune.h" | 63 #include "v8-vtune.h" |
80 #include "vtune-jit.h" | 64 #include "vtune-jit.h" |
81 | 65 |
82 namespace vTune { | 66 namespace vTune { |
83 namespace internal { | 67 namespace internal { |
84 | 68 |
85 | 69 |
86 // This class is used to record the JITted code position info for JIT | 70 // This class is used to record the JITted code position info for JIT |
87 // code profiling. | 71 // code profiling. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 }; | 103 }; |
120 | 104 |
121 struct HashForCodeObject { | 105 struct HashForCodeObject { |
122 uint32_t operator () (void* code) const { | 106 uint32_t operator () (void* code) const { |
123 static const uintptr_t kGoldenRatio = 2654435761u; | 107 static const uintptr_t kGoldenRatio = 2654435761u; |
124 uintptr_t hash = reinterpret_cast<uintptr_t>(code); | 108 uintptr_t hash = reinterpret_cast<uintptr_t>(code); |
125 return static_cast<uint32_t>(hash * kGoldenRatio); | 109 return static_cast<uint32_t>(hash * kGoldenRatio); |
126 } | 110 } |
127 }; | 111 }; |
128 | 112 |
129 #ifdef WIN32 | 113 typedef std::unordered_map<void*, void*, HashForCodeObject, SameCodeObjects> |
130 typedef hash_map<void*, void*> JitInfoMap; | 114 JitInfoMap; |
131 #else | |
132 typedef hash_map<void*, void*, HashForCodeObject, SameCodeObjects> JitInfoMap; | |
133 #endif | |
134 | 115 |
135 static JitInfoMap* GetEntries() { | 116 static JitInfoMap* GetEntries() { |
136 static JitInfoMap* entries; | 117 static JitInfoMap* entries; |
137 if (entries == NULL) { | 118 if (entries == NULL) { |
138 entries = new JitInfoMap(); | 119 entries = new JitInfoMap(); |
139 } | 120 } |
140 return entries; | 121 return entries; |
141 } | 122 } |
142 | 123 |
143 static bool IsLineInfoTagged(void* ptr) { | 124 static bool IsLineInfoTagged(void* ptr) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 253 |
273 } // namespace internal | 254 } // namespace internal |
274 | 255 |
275 v8::JitCodeEventHandler GetVtuneCodeEventHandler() { | 256 v8::JitCodeEventHandler GetVtuneCodeEventHandler() { |
276 v8::V8::SetFlagsFromString("--nocompact_code_space", | 257 v8::V8::SetFlagsFromString("--nocompact_code_space", |
277 (int)strlen("--nocompact_code_space")); | 258 (int)strlen("--nocompact_code_space")); |
278 return vTune::internal::VTUNEJITInterface::event_handler; | 259 return vTune::internal::VTUNEJITInterface::event_handler; |
279 } | 260 } |
280 | 261 |
281 } // namespace vTune | 262 } // namespace vTune |
OLD | NEW |