Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: src/platform-win32.cc

Issue 1737023: Turn some usages of NewArray with DeleteArray in the same scope into ScopedVector or SmartPointer. (Closed)
Patch Set: Disabling implicit constructors Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/platform-solaris.cc ('k') | src/utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 NULL); // TranslateAddress 1242 NULL); // TranslateAddress
1243 if (!ok) break; 1243 if (!ok) break;
1244 1244
1245 // Store the address. 1245 // Store the address.
1246 ASSERT((stack_frame.AddrPC.Offset >> 32) == 0); // 32-bit address. 1246 ASSERT((stack_frame.AddrPC.Offset >> 32) == 0); // 32-bit address.
1247 frames[frames_count].address = 1247 frames[frames_count].address =
1248 reinterpret_cast<void*>(stack_frame.AddrPC.Offset); 1248 reinterpret_cast<void*>(stack_frame.AddrPC.Offset);
1249 1249
1250 // Try to locate a symbol for this frame. 1250 // Try to locate a symbol for this frame.
1251 DWORD64 symbol_displacement; 1251 DWORD64 symbol_displacement;
1252 IMAGEHLP_SYMBOL64* symbol = NULL; 1252 SmartPointer<IMAGEHLP_SYMBOL64> symbol(
1253 symbol = NewArray<IMAGEHLP_SYMBOL64>(kStackWalkMaxNameLen); 1253 NewArray<IMAGEHLP_SYMBOL64>(kStackWalkMaxNameLen));
1254 if (!symbol) return kStackWalkError; // Out of memory. 1254 if (!symbol) return kStackWalkError; // Out of memory.
1255 memset(symbol, 0, sizeof(IMAGEHLP_SYMBOL64) + kStackWalkMaxNameLen); 1255 memset(*symbol, 0, sizeof(IMAGEHLP_SYMBOL64) + kStackWalkMaxNameLen);
1256 symbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64); 1256 symbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64);
1257 symbol->MaxNameLength = kStackWalkMaxNameLen; 1257 symbol->MaxNameLength = kStackWalkMaxNameLen;
1258 ok = _SymGetSymFromAddr64(process_handle, // hProcess 1258 ok = _SymGetSymFromAddr64(process_handle, // hProcess
1259 stack_frame.AddrPC.Offset, // Address 1259 stack_frame.AddrPC.Offset, // Address
1260 &symbol_displacement, // Displacement 1260 &symbol_displacement, // Displacement
1261 symbol); // Symbol 1261 *symbol); // Symbol
1262 if (ok) { 1262 if (ok) {
1263 // Try to locate more source information for the symbol. 1263 // Try to locate more source information for the symbol.
1264 IMAGEHLP_LINE64 Line; 1264 IMAGEHLP_LINE64 Line;
1265 memset(&Line, 0, sizeof(Line)); 1265 memset(&Line, 0, sizeof(Line));
1266 Line.SizeOfStruct = sizeof(Line); 1266 Line.SizeOfStruct = sizeof(Line);
1267 DWORD line_displacement; 1267 DWORD line_displacement;
1268 ok = _SymGetLineFromAddr64( 1268 ok = _SymGetLineFromAddr64(
1269 process_handle, // hProcess 1269 process_handle, // hProcess
1270 stack_frame.AddrPC.Offset, // dwAddr 1270 stack_frame.AddrPC.Offset, // dwAddr
1271 &line_displacement, // pdwDisplacement 1271 &line_displacement, // pdwDisplacement
(...skipping 15 matching lines...) Expand all
1287 // Make sure line termination is in place. 1287 // Make sure line termination is in place.
1288 frames[frames_count].text[kStackWalkMaxTextLen - 1] = '\0'; 1288 frames[frames_count].text[kStackWalkMaxTextLen - 1] = '\0';
1289 } else { 1289 } else {
1290 // No text representation of this frame 1290 // No text representation of this frame
1291 frames[frames_count].text[0] = '\0'; 1291 frames[frames_count].text[0] = '\0';
1292 1292
1293 // Continue if we are just missing a module (for non C/C++ frames a 1293 // Continue if we are just missing a module (for non C/C++ frames a
1294 // module will never be found). 1294 // module will never be found).
1295 int err = GetLastError(); 1295 int err = GetLastError();
1296 if (err != ERROR_MOD_NOT_FOUND) { 1296 if (err != ERROR_MOD_NOT_FOUND) {
1297 DeleteArray(symbol);
1298 break; 1297 break;
1299 } 1298 }
1300 } 1299 }
1301 DeleteArray(symbol);
1302 1300
1303 frames_count++; 1301 frames_count++;
1304 } 1302 }
1305 1303
1306 // Return the number of frames filled in. 1304 // Return the number of frames filled in.
1307 return frames_count; 1305 return frames_count;
1308 } 1306 }
1309 1307
1310 // Restore warnings to previous settings. 1308 // Restore warnings to previous settings.
1311 #pragma warning(pop) 1309 #pragma warning(pop)
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 1896
1899 // Release the thread handles 1897 // Release the thread handles
1900 CloseHandle(data_->sampler_thread_); 1898 CloseHandle(data_->sampler_thread_);
1901 CloseHandle(data_->profiled_thread_); 1899 CloseHandle(data_->profiled_thread_);
1902 } 1900 }
1903 1901
1904 1902
1905 #endif // ENABLE_LOGGING_AND_PROFILING 1903 #endif // ENABLE_LOGGING_AND_PROFILING
1906 1904
1907 } } // namespace v8::internal 1905 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-solaris.cc ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698