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

Side by Side Diff: src/cpu-profiler.cc

Issue 6895014: Avoid hidden TLS access in CpuProfiler::is_profiling(). (Closed)
Patch Set: Created 9 years, 8 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/cpu-profiler.h ('k') | src/heap.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 } 281 }
282 282
283 283
284 void CpuProfiler::StartProfiling(String* title) { 284 void CpuProfiler::StartProfiling(String* title) {
285 ASSERT(Isolate::Current()->cpu_profiler() != NULL); 285 ASSERT(Isolate::Current()->cpu_profiler() != NULL);
286 Isolate::Current()->cpu_profiler()->StartCollectingProfile(title); 286 Isolate::Current()->cpu_profiler()->StartCollectingProfile(title);
287 } 287 }
288 288
289 289
290 CpuProfile* CpuProfiler::StopProfiling(const char* title) { 290 CpuProfile* CpuProfiler::StopProfiling(const char* title) {
291 return is_profiling() ? 291 Isolate* isolate = Isolate::Current();
292 Isolate::Current()->cpu_profiler()->StopCollectingProfile(title) : NULL; 292 return is_profiling(isolate) ?
293 isolate->cpu_profiler()->StopCollectingProfile(title) : NULL;
293 } 294 }
294 295
295 296
296 CpuProfile* CpuProfiler::StopProfiling(Object* security_token, String* title) { 297 CpuProfile* CpuProfiler::StopProfiling(Object* security_token, String* title) {
297 return is_profiling() ? 298 Isolate* isolate = Isolate::Current();
298 Isolate::Current()->cpu_profiler()->StopCollectingProfile( 299 return is_profiling(isolate) ?
300 isolate->cpu_profiler()->StopCollectingProfile(
299 security_token, title) : NULL; 301 security_token, title) : NULL;
300 } 302 }
301 303
302 304
303 int CpuProfiler::GetProfilesCount() { 305 int CpuProfiler::GetProfilesCount() {
304 ASSERT(Isolate::Current()->cpu_profiler() != NULL); 306 ASSERT(Isolate::Current()->cpu_profiler() != NULL);
305 // The count of profiles doesn't depend on a security token. 307 // The count of profiles doesn't depend on a security token.
306 return Isolate::Current()->cpu_profiler()->profiles_->Profiles( 308 return Isolate::Current()->cpu_profiler()->profiles_->Profiles(
307 TokenEnumerator::kNoSecurityToken)->length(); 309 TokenEnumerator::kNoSecurityToken)->length();
308 } 310 }
(...skipping 20 matching lines...) Expand all
329 return isolate->cpu_profiler()->processor_->TickSampleEvent(); 331 return isolate->cpu_profiler()->processor_->TickSampleEvent();
330 } else { 332 } else {
331 return NULL; 333 return NULL;
332 } 334 }
333 } 335 }
334 336
335 337
336 void CpuProfiler::DeleteAllProfiles() { 338 void CpuProfiler::DeleteAllProfiles() {
337 Isolate* isolate = Isolate::Current(); 339 Isolate* isolate = Isolate::Current();
338 ASSERT(isolate->cpu_profiler() != NULL); 340 ASSERT(isolate->cpu_profiler() != NULL);
339 if (is_profiling()) 341 if (is_profiling(isolate)) {
340 isolate->cpu_profiler()->StopProcessor(); 342 isolate->cpu_profiler()->StopProcessor();
343 }
341 isolate->cpu_profiler()->ResetProfiles(); 344 isolate->cpu_profiler()->ResetProfiles();
342 } 345 }
343 346
344 347
345 void CpuProfiler::DeleteProfile(CpuProfile* profile) { 348 void CpuProfiler::DeleteProfile(CpuProfile* profile) {
346 ASSERT(Isolate::Current()->cpu_profiler() != NULL); 349 ASSERT(Isolate::Current()->cpu_profiler() != NULL);
347 Isolate::Current()->cpu_profiler()->profiles_->RemoveProfile(profile); 350 Isolate::Current()->cpu_profiler()->profiles_->RemoveProfile(profile);
348 delete profile; 351 delete profile;
349 } 352 }
350 353
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 #ifdef ENABLE_LOGGING_AND_PROFILING 600 #ifdef ENABLE_LOGGING_AND_PROFILING
598 Isolate* isolate = Isolate::Current(); 601 Isolate* isolate = Isolate::Current();
599 if (isolate->cpu_profiler() != NULL) { 602 if (isolate->cpu_profiler() != NULL) {
600 delete isolate->cpu_profiler(); 603 delete isolate->cpu_profiler();
601 } 604 }
602 isolate->set_cpu_profiler(NULL); 605 isolate->set_cpu_profiler(NULL);
603 #endif 606 #endif
604 } 607 }
605 608
606 } } // namespace v8::internal 609 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/cpu-profiler.h ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698