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

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

Issue 131393002: Fixed alignment issues of ProfilerEventsProcessor. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Simplified. Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « src/cpu-profiler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // Process remaining tick events. 149 // Process remaining tick events.
150 do { 150 do {
151 SampleProcessingResult result; 151 SampleProcessingResult result;
152 do { 152 do {
153 result = ProcessOneSample(); 153 result = ProcessOneSample();
154 } while (result == OneSampleProcessed); 154 } while (result == OneSampleProcessed);
155 } while (ProcessCodeEvent()); 155 } while (ProcessCodeEvent());
156 } 156 }
157 157
158 158
159 void* ProfilerEventsProcessor::operator new(size_t size) {
160 return AlignedAlloc(size, V8_ALIGNOF(ProfilerEventsProcessor));
161 }
162
163
164 void ProfilerEventsProcessor::operator delete(void* ptr) {
165 AlignedFree(ptr);
166 }
167
168
159 int CpuProfiler::GetProfilesCount() { 169 int CpuProfiler::GetProfilesCount() {
160 // The count of profiles doesn't depend on a security token. 170 // The count of profiles doesn't depend on a security token.
161 return profiles_->profiles()->length(); 171 return profiles_->profiles()->length();
162 } 172 }
163 173
164 174
165 CpuProfile* CpuProfiler::GetProfile(int index) { 175 CpuProfile* CpuProfiler::GetProfile(int index) {
166 return profiles_->profiles()->at(index); 176 return profiles_->profiles()->at(index);
167 } 177 }
168 178
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 442
433 443
434 void CpuProfiler::StartProcessorIfNotStarted() { 444 void CpuProfiler::StartProcessorIfNotStarted() {
435 if (processor_ == NULL) { 445 if (processor_ == NULL) {
436 Logger* logger = isolate_->logger(); 446 Logger* logger = isolate_->logger();
437 // Disable logging when using the new implementation. 447 // Disable logging when using the new implementation.
438 saved_is_logging_ = logger->is_logging_; 448 saved_is_logging_ = logger->is_logging_;
439 logger->is_logging_ = false; 449 logger->is_logging_ = false;
440 generator_ = new ProfileGenerator(profiles_); 450 generator_ = new ProfileGenerator(profiles_);
441 Sampler* sampler = logger->sampler(); 451 Sampler* sampler = logger->sampler();
442 #if V8_CC_MSVC && (_MSC_VER >= 1800)
443 // VS2013 reports "warning C4316: 'v8::internal::ProfilerEventsProcessor'
444 // : object allocated on the heap may not be aligned 64". We need to
445 // figure out if this is a legitimate warning or a compiler bug.
446 #pragma warning(push)
447 #pragma warning(disable:4316)
448 #endif
449 processor_ = new ProfilerEventsProcessor( 452 processor_ = new ProfilerEventsProcessor(
450 generator_, sampler, sampling_interval_); 453 generator_, sampler, sampling_interval_);
451 #if V8_CC_MSVC && (_MSC_VER >= 1800)
452 #pragma warning(pop)
453 #endif
454 is_profiling_ = true; 454 is_profiling_ = true;
455 // Enumerate stuff we already have in the heap. 455 // Enumerate stuff we already have in the heap.
456 ASSERT(isolate_->heap()->HasBeenSetUp()); 456 ASSERT(isolate_->heap()->HasBeenSetUp());
457 if (!FLAG_prof_browser_mode) { 457 if (!FLAG_prof_browser_mode) {
458 logger->LogCodeObjects(); 458 logger->LogCodeObjects();
459 } 459 }
460 logger->LogCompiledFunctions(); 460 logger->LogCompiledFunctions();
461 logger->LogAccessorCallbacks(); 461 logger->LogAccessorCallbacks();
462 LogBuiltins(); 462 LogBuiltins();
463 // Enable stack sampling. 463 // Enable stack sampling.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; 515 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_;
516 Builtins::Name id = static_cast<Builtins::Name>(i); 516 Builtins::Name id = static_cast<Builtins::Name>(i);
517 rec->start = builtins->builtin(id)->address(); 517 rec->start = builtins->builtin(id)->address();
518 rec->builtin_id = id; 518 rec->builtin_id = id;
519 processor_->Enqueue(evt_rec); 519 processor_->Enqueue(evt_rec);
520 } 520 }
521 } 521 }
522 522
523 523
524 } } // namespace v8::internal 524 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/cpu-profiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698