OLD | NEW |
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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 if (active_sampler_ == NULL) return; | 548 if (active_sampler_ == NULL) return; |
549 | 549 |
550 TickSample sample; | 550 TickSample sample; |
551 | 551 |
552 // If profiling, we extract the current pc and sp. | 552 // If profiling, we extract the current pc and sp. |
553 if (active_sampler_->IsProfiling()) { | 553 if (active_sampler_->IsProfiling()) { |
554 // Extracting the sample from the context is extremely machine dependent. | 554 // Extracting the sample from the context is extremely machine dependent. |
555 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); | 555 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); |
556 mcontext_t& mcontext = ucontext->uc_mcontext; | 556 mcontext_t& mcontext = ucontext->uc_mcontext; |
557 #if V8_HOST_ARCH_IA32 | 557 #if V8_HOST_ARCH_IA32 |
558 sample.pc = mcontext.mc_eip; | 558 sample.pc = reinterpret_cast<Address>(mcontext.mc_eip); |
559 sample.sp = mcontext.mc_esp; | 559 sample.sp = reinterpret_cast<Address>(mcontext.mc_esp); |
560 sample.fp = mcontext.mc_ebp; | 560 sample.fp = reinterpret_cast<Address>(mcontext.mc_ebp); |
561 #elif V8_HOST_ARCH_X64 | 561 #elif V8_HOST_ARCH_X64 |
562 sample.pc = mcontext.mc_rip; | 562 sample.pc = reinterpret_cast<Address>(mcontext.mc_rip); |
563 sample.sp = mcontext.mc_rsp; | 563 sample.sp = reinterpret_cast<Address>(mcontext.mc_rsp); |
564 sample.fp = mcontext.mc_rbp; | 564 sample.fp = reinterpret_cast<Address>(mcontext.mc_rbp); |
565 #elif V8_HOST_ARCH_ARM | 565 #elif V8_HOST_ARCH_ARM |
566 sample.pc = mcontext.mc_r15; | 566 sample.pc = reinterpret_cast<Address>(mcontext.mc_r15); |
567 sample.sp = mcontext.mc_r13; | 567 sample.sp = reinterpret_cast<Address>(mcontext.mc_r13); |
568 sample.fp = mcontext.mc_r11; | 568 sample.fp = reinterpret_cast<Address>(mcontext.mc_r11); |
569 #endif | 569 #endif |
570 active_sampler_->SampleStack(&sample); | 570 active_sampler_->SampleStack(&sample); |
571 } | 571 } |
572 | 572 |
573 // We always sample the VM state. | 573 // We always sample the VM state. |
574 sample.state = Logger::state(); | 574 sample.state = Logger::state(); |
575 | 575 |
576 active_sampler_->Tick(&sample); | 576 active_sampler_->Tick(&sample); |
577 } | 577 } |
578 | 578 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 } | 636 } |
637 | 637 |
638 // This sampler is no longer the active sampler. | 638 // This sampler is no longer the active sampler. |
639 active_sampler_ = NULL; | 639 active_sampler_ = NULL; |
640 active_ = false; | 640 active_ = false; |
641 } | 641 } |
642 | 642 |
643 #endif // ENABLE_LOGGING_AND_PROFILING | 643 #endif // ENABLE_LOGGING_AND_PROFILING |
644 | 644 |
645 } } // namespace v8::internal | 645 } } // namespace v8::internal |
OLD | NEW |