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 |
60 #include <list> | 77 #include <list> |
61 #include <unordered_map> | |
62 | 78 |
63 #include "v8-vtune.h" | 79 #include "v8-vtune.h" |
64 #include "vtune-jit.h" | 80 #include "vtune-jit.h" |
65 | 81 |
66 namespace vTune { | 82 namespace vTune { |
67 namespace internal { | 83 namespace internal { |
68 | 84 |
69 | 85 |
70 // This class is used to record the JITted code position info for JIT | 86 // This class is used to record the JITted code position info for JIT |
71 // code profiling. | 87 // code profiling. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 }; | 119 }; |
104 | 120 |
105 struct HashForCodeObject { | 121 struct HashForCodeObject { |
106 uint32_t operator () (void* code) const { | 122 uint32_t operator () (void* code) const { |
107 static const uintptr_t kGoldenRatio = 2654435761u; | 123 static const uintptr_t kGoldenRatio = 2654435761u; |
108 uintptr_t hash = reinterpret_cast<uintptr_t>(code); | 124 uintptr_t hash = reinterpret_cast<uintptr_t>(code); |
109 return static_cast<uint32_t>(hash * kGoldenRatio); | 125 return static_cast<uint32_t>(hash * kGoldenRatio); |
110 } | 126 } |
111 }; | 127 }; |
112 | 128 |
113 typedef std::unordered_map<void*, void*, HashForCodeObject, SameCodeObjects> | 129 #ifdef WIN32 |
114 JitInfoMap; | 130 typedef hash_map<void*, void*> JitInfoMap; |
| 131 #else |
| 132 typedef hash_map<void*, void*, HashForCodeObject, SameCodeObjects> JitInfoMap; |
| 133 #endif |
115 | 134 |
116 static JitInfoMap* GetEntries() { | 135 static JitInfoMap* GetEntries() { |
117 static JitInfoMap* entries; | 136 static JitInfoMap* entries; |
118 if (entries == NULL) { | 137 if (entries == NULL) { |
119 entries = new JitInfoMap(); | 138 entries = new JitInfoMap(); |
120 } | 139 } |
121 return entries; | 140 return entries; |
122 } | 141 } |
123 | 142 |
124 static bool IsLineInfoTagged(void* ptr) { | 143 static bool IsLineInfoTagged(void* ptr) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 272 |
254 } // namespace internal | 273 } // namespace internal |
255 | 274 |
256 v8::JitCodeEventHandler GetVtuneCodeEventHandler() { | 275 v8::JitCodeEventHandler GetVtuneCodeEventHandler() { |
257 v8::V8::SetFlagsFromString("--nocompact_code_space", | 276 v8::V8::SetFlagsFromString("--nocompact_code_space", |
258 (int)strlen("--nocompact_code_space")); | 277 (int)strlen("--nocompact_code_space")); |
259 return vTune::internal::VTUNEJITInterface::event_handler; | 278 return vTune::internal::VTUNEJITInterface::event_handler; |
260 } | 279 } |
261 | 280 |
262 } // namespace vTune | 281 } // namespace vTune |
OLD | NEW |