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