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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 char* temp_method_name = | 185 char* temp_method_name = |
186 GetFunctionNameFromMixedName(event->name.str, | 186 GetFunctionNameFromMixedName(event->name.str, |
187 static_cast<int>(event->name.len)); | 187 static_cast<int>(event->name.len)); |
188 iJIT_Method_Load jmethod; | 188 iJIT_Method_Load jmethod; |
189 memset(&jmethod, 0, sizeof jmethod); | 189 memset(&jmethod, 0, sizeof jmethod); |
190 jmethod.method_id = iJIT_GetNewMethodID(); | 190 jmethod.method_id = iJIT_GetNewMethodID(); |
191 jmethod.method_load_address = event->code_start; | 191 jmethod.method_load_address = event->code_start; |
192 jmethod.method_size = static_cast<unsigned int>(event->code_len); | 192 jmethod.method_size = static_cast<unsigned int>(event->code_len); |
193 jmethod.method_name = temp_method_name; | 193 jmethod.method_name = temp_method_name; |
194 | 194 |
195 Handle<Script> script = event->script; | 195 Handle<UnboundScript> script = event->script; |
196 | 196 |
197 if (*script != NULL) { | 197 if (*script != NULL) { |
198 // Get the source file name and set it to jmethod.source_file_name | 198 // Get the source file name and set it to jmethod.source_file_name |
199 if ((*script->GetUnboundScript()->GetScriptName())->IsString()) { | 199 if ((*script->GetScriptName())->IsString()) { |
200 Handle<String> script_name = | 200 Handle<String> script_name = |
201 script->GetUnboundScript()->GetScriptName()->ToString(); | 201 script->GetScriptName()->ToString(); |
202 temp_file_name = new char[script_name->Utf8Length() + 1]; | 202 temp_file_name = new char[script_name->Utf8Length() + 1]; |
203 script_name->WriteUtf8(temp_file_name); | 203 script_name->WriteUtf8(temp_file_name); |
204 jmethod.source_file_name = temp_file_name; | 204 jmethod.source_file_name = temp_file_name; |
205 } | 205 } |
206 | 206 |
207 JitInfoMap::iterator entry = | 207 JitInfoMap::iterator entry = |
208 GetEntries()->find(event->code_start); | 208 GetEntries()->find(event->code_start); |
209 if (entry != GetEntries()->end() && IsLineInfoTagged(entry->first)) { | 209 if (entry != GetEntries()->end() && IsLineInfoTagged(entry->first)) { |
210 JITCodeLineInfo* line_info = UntagLineInfo(entry->second); | 210 JITCodeLineInfo* line_info = UntagLineInfo(entry->second); |
211 // Get the line_num_info and set it to jmethod.line_number_table | 211 // Get the line_num_info and set it to jmethod.line_number_table |
212 std::list<JITCodeLineInfo::LineNumInfo>* vtunelineinfo = | 212 std::list<JITCodeLineInfo::LineNumInfo>* vtunelineinfo = |
213 line_info->GetLineNumInfo(); | 213 line_info->GetLineNumInfo(); |
214 | 214 |
215 jmethod.line_number_size = (unsigned int)vtunelineinfo->size(); | 215 jmethod.line_number_size = (unsigned int)vtunelineinfo->size(); |
216 jmethod.line_number_table = | 216 jmethod.line_number_table = |
217 reinterpret_cast<LineNumberInfo*>( | 217 reinterpret_cast<LineNumberInfo*>( |
218 malloc(sizeof(LineNumberInfo)*jmethod.line_number_size)); | 218 malloc(sizeof(LineNumberInfo)*jmethod.line_number_size)); |
219 | 219 |
220 std::list<JITCodeLineInfo::LineNumInfo>::iterator Iter; | 220 std::list<JITCodeLineInfo::LineNumInfo>::iterator Iter; |
221 int index = 0; | 221 int index = 0; |
222 for (Iter = vtunelineinfo->begin(); | 222 for (Iter = vtunelineinfo->begin(); |
223 Iter != vtunelineinfo->end(); | 223 Iter != vtunelineinfo->end(); |
224 Iter++) { | 224 Iter++) { |
225 jmethod.line_number_table[index].Offset = | 225 jmethod.line_number_table[index].Offset = |
226 static_cast<unsigned int>(Iter->pc_); | 226 static_cast<unsigned int>(Iter->pc_); |
227 jmethod.line_number_table[index++].LineNumber = | 227 jmethod.line_number_table[index++].LineNumber = |
228 script->GetUnboundScript()->GetLineNumber(Iter->pos_)+1; | 228 script->GetLineNumber(Iter->pos_)+1; |
229 } | 229 } |
230 GetEntries()->erase(event->code_start); | 230 GetEntries()->erase(event->code_start); |
231 } | 231 } |
232 } | 232 } |
233 | 233 |
234 iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, | 234 iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, |
235 reinterpret_cast<void*>(&jmethod)); | 235 reinterpret_cast<void*>(&jmethod)); |
236 if (temp_method_name) | 236 if (temp_method_name) |
237 delete []temp_method_name; | 237 delete []temp_method_name; |
238 if (temp_file_name) | 238 if (temp_file_name) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 void InitializeVtuneForV8() { | 275 void InitializeVtuneForV8() { |
276 if (v8::V8::Initialize()) { | 276 if (v8::V8::Initialize()) { |
277 v8::V8::SetFlagsFromString("--nocompact_code_space", | 277 v8::V8::SetFlagsFromString("--nocompact_code_space", |
278 (int)strlen("--nocompact_code_space")); | 278 (int)strlen("--nocompact_code_space")); |
279 v8::V8::SetJitCodeEventHandler(v8::kJitCodeEventDefault, | 279 v8::V8::SetJitCodeEventHandler(v8::kJitCodeEventDefault, |
280 vTune::internal::VTUNEJITInterface::event_handler); | 280 vTune::internal::VTUNEJITInterface::event_handler); |
281 } | 281 } |
282 } | 282 } |
283 | 283 |
284 } // namespace vTune | 284 } // namespace vTune |
OLD | NEW |