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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 #define REGISTER_FIELD(name) e ## name | 552 #define REGISTER_FIELD(name) e ## name |
553 #endif // __DARWIN_UNIX03 | 553 #endif // __DARWIN_UNIX03 |
554 #else | 554 #else |
555 #error Unsupported Mac OS X host architecture. | 555 #error Unsupported Mac OS X host architecture. |
556 #endif // V8_HOST_ARCH | 556 #endif // V8_HOST_ARCH |
557 | 557 |
558 if (thread_get_state(profiled_thread_, | 558 if (thread_get_state(profiled_thread_, |
559 flavor, | 559 flavor, |
560 reinterpret_cast<natural_t*>(&state), | 560 reinterpret_cast<natural_t*>(&state), |
561 &count) == KERN_SUCCESS) { | 561 &count) == KERN_SUCCESS) { |
562 sample.pc = state.REGISTER_FIELD(ip); | 562 sample.pc = reinterpret_cast<Address>(state.REGISTER_FIELD(ip)); |
563 sample.sp = state.REGISTER_FIELD(sp); | 563 sample.sp = reinterpret_cast<Address>(state.REGISTER_FIELD(sp)); |
564 sample.fp = state.REGISTER_FIELD(bp); | 564 sample.fp = reinterpret_cast<Address>(state.REGISTER_FIELD(bp)); |
565 sampler_->SampleStack(&sample); | 565 sampler_->SampleStack(&sample); |
566 } | 566 } |
567 thread_resume(profiled_thread_); | 567 thread_resume(profiled_thread_); |
568 } | 568 } |
569 | 569 |
570 // We always sample the VM state. | 570 // We always sample the VM state. |
571 sample.state = Logger::state(); | 571 sample.state = Logger::state(); |
572 // Invoke tick handler with program counter and stack pointer. | 572 // Invoke tick handler with program counter and stack pointer. |
573 sampler_->Tick(&sample); | 573 sampler_->Tick(&sample); |
574 | 574 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 | 634 |
635 // Deallocate Mach port for thread. | 635 // Deallocate Mach port for thread. |
636 if (IsProfiling()) { | 636 if (IsProfiling()) { |
637 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); | 637 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); |
638 } | 638 } |
639 } | 639 } |
640 | 640 |
641 #endif // ENABLE_LOGGING_AND_PROFILING | 641 #endif // ENABLE_LOGGING_AND_PROFILING |
642 | 642 |
643 } } // namespace v8::internal | 643 } } // namespace v8::internal |
OLD | NEW |