| 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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 if (sampler_->IsProfiling() | 512 if (sampler_->IsProfiling() |
| 513 && KERN_SUCCESS == thread_suspend(profiled_thread_)) { | 513 && KERN_SUCCESS == thread_suspend(profiled_thread_)) { |
| 514 #if V8_HOST_ARCH_X64 | 514 #if V8_HOST_ARCH_X64 |
| 515 thread_state_flavor_t flavor = x86_THREAD_STATE64; | 515 thread_state_flavor_t flavor = x86_THREAD_STATE64; |
| 516 x86_thread_state64_t state; | 516 x86_thread_state64_t state; |
| 517 mach_msg_type_number_t count = x86_THREAD_STATE64_COUNT; | 517 mach_msg_type_number_t count = x86_THREAD_STATE64_COUNT; |
| 518 #if __DARWIN_UNIX03 | 518 #if __DARWIN_UNIX03 |
| 519 #define REGISTER_FIELD(name) __r ## name | 519 #define REGISTER_FIELD(name) __r ## name |
| 520 #else | 520 #else |
| 521 #define REGISTER_FIELD(name) r ## name | 521 #define REGISTER_FIELD(name) r ## name |
| 522 #endif // __DARWIN_UNIX03 | 522 #endif // __DARWIN_UNIX03 |
| 523 #elif V8_HOST_ARCH_IA32 | 523 #elif V8_HOST_ARCH_IA32 |
| 524 thread_state_flavor_t flavor = i386_THREAD_STATE; | 524 thread_state_flavor_t flavor = i386_THREAD_STATE; |
| 525 i386_thread_state_t state; | 525 i386_thread_state_t state; |
| 526 mach_msg_type_number_t count = i386_THREAD_STATE_COUNT; | 526 mach_msg_type_number_t count = i386_THREAD_STATE_COUNT; |
| 527 #if __DARWIN_UNIX03 | 527 #if __DARWIN_UNIX03 |
| 528 #define REGISTER_FIELD(name) __e ## name | 528 #define REGISTER_FIELD(name) __e ## name |
| 529 #else | 529 #else |
| 530 #define REGISTER_FIELD(name) e ## name | 530 #define REGISTER_FIELD(name) e ## name |
| 531 #endif // __DARWIN_UNIX03 | 531 #endif // __DARWIN_UNIX03 |
| 532 #else | 532 #else |
| 533 #error Unsupported Mac OS X host architecture. | 533 #error Unsupported Mac OS X host architecture. |
| 534 #endif // V8_HOST_ARCH | 534 #endif // V8_HOST_ARCH |
| 535 | 535 |
| 536 if (thread_get_state(profiled_thread_, | 536 if (thread_get_state(profiled_thread_, |
| 537 flavor, | 537 flavor, |
| 538 reinterpret_cast<natural_t*>(&state), | 538 reinterpret_cast<natural_t*>(&state), |
| 539 &count) == KERN_SUCCESS) { | 539 &count) == KERN_SUCCESS) { |
| 540 sample.pc = state.REGISTER_FIELD(ip); | 540 sample.pc = state.REGISTER_FIELD(ip); |
| 541 sample.sp = state.REGISTER_FIELD(sp); | 541 sample.sp = state.REGISTER_FIELD(sp); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 | 612 |
| 613 // Deallocate Mach port for thread. | 613 // Deallocate Mach port for thread. |
| 614 if (IsProfiling()) { | 614 if (IsProfiling()) { |
| 615 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); | 615 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); |
| 616 } | 616 } |
| 617 } | 617 } |
| 618 | 618 |
| 619 #endif // ENABLE_LOGGING_AND_PROFILING | 619 #endif // ENABLE_LOGGING_AND_PROFILING |
| 620 | 620 |
| 621 } } // namespace v8::internal | 621 } } // namespace v8::internal |
| OLD | NEW |