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

Side by Side Diff: src/sampler.cc

Issue 146803002: A64: Skip samples that have sp = 0 in CPU profiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: 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 | « no previous file | 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 333
334 Sampler* sampler = isolate->logger()->sampler(); 334 Sampler* sampler = isolate->logger()->sampler();
335 if (sampler == NULL || !sampler->IsActive()) return; 335 if (sampler == NULL || !sampler->IsActive()) return;
336 336
337 SampleHelper helper; 337 SampleHelper helper;
338 TickSample* sample = helper.Init(sampler, isolate); 338 TickSample* sample = helper.Init(sampler, isolate);
339 if (sample == NULL) return; 339 if (sample == NULL) return;
340 340
341 #if defined(USE_SIMULATOR) 341 #if defined(USE_SIMULATOR)
342 helper.FillRegisters(sample); 342 helper.FillRegisters(sample);
343 // It possible that the simulator is interrupted while it is updating
344 // the sp register. A64 simulator does this in two steps:
345 // first setting it to zero and then setting it to the new value.
346 // Bailout if sp doesn't contain the new value.
347 if (sample->sp == 0) return;
343 #else 348 #else
344 // Extracting the sample from the context is extremely machine dependent. 349 // Extracting the sample from the context is extremely machine dependent.
345 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); 350 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
346 mcontext_t& mcontext = ucontext->uc_mcontext; 351 mcontext_t& mcontext = ucontext->uc_mcontext;
347 sample->state = isolate->current_vm_state(); 352 sample->state = isolate->current_vm_state();
348 #if defined(__linux__) || defined(__ANDROID__) 353 #if defined(__linux__) || defined(__ANDROID__)
349 #if V8_HOST_ARCH_IA32 354 #if V8_HOST_ARCH_IA32
350 sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]); 355 sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]);
351 sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]); 356 sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]);
352 sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]); 357 sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]);
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 SamplerThread::RemoveActiveSampler(this); 703 SamplerThread::RemoveActiveSampler(this);
699 SetActive(false); 704 SetActive(false);
700 } 705 }
701 706
702 void Sampler::SampleStack(TickSample* sample) { 707 void Sampler::SampleStack(TickSample* sample) {
703 sample->Trace(isolate_); 708 sample->Trace(isolate_);
704 if (++samples_taken_ < 0) samples_taken_ = 0; 709 if (++samples_taken_ < 0) samples_taken_ = 0;
705 } 710 }
706 711
707 } } // namespace v8::internal 712 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698