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

Side by Side Diff: src/sampler.cc

Issue 18023019: Fix Mac compilation after r15484 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 void SampleContext(Sampler* sampler) { 489 void SampleContext(Sampler* sampler) {
490 if (!SignalHandler::Installed()) return; 490 if (!SignalHandler::Installed()) return;
491 pthread_t tid = sampler->platform_data()->vm_tid(); 491 pthread_t tid = sampler->platform_data()->vm_tid();
492 pthread_kill(tid, SIGPROF); 492 pthread_kill(tid, SIGPROF);
493 } 493 }
494 494
495 #elif defined(__MACH__) 495 #elif defined(__MACH__)
496 496
497 void SampleContext(Sampler* sampler) { 497 void SampleContext(Sampler* sampler) {
498 thread_act_t profiled_thread = sampler->platform_data()->profiled_thread(); 498 thread_act_t profiled_thread = sampler->platform_data()->profiled_thread();
499 Isolate* isolate = sampler->isolate();
500 499
501 #if defined(USE_SIMULATOR) 500 #if defined(USE_SIMULATOR)
502 SimulatorHelper helper; 501 SimulatorHelper helper;
502 Isolate* isolate = sampler->isolate();
503 if (!helper.Init(sampler, isolate)) return; 503 if (!helper.Init(sampler, isolate)) return;
504 #endif 504 #endif
505 505
506 if (KERN_SUCCESS != thread_suspend(profiled_thread)) return; 506 if (KERN_SUCCESS != thread_suspend(profiled_thread)) return;
507 507
508 #if V8_HOST_ARCH_X64 508 #if V8_HOST_ARCH_X64
509 thread_state_flavor_t flavor = x86_THREAD_STATE64; 509 thread_state_flavor_t flavor = x86_THREAD_STATE64;
510 x86_thread_state64_t state; 510 x86_thread_state64_t thread_state;
511 mach_msg_type_number_t count = x86_THREAD_STATE64_COUNT; 511 mach_msg_type_number_t count = x86_THREAD_STATE64_COUNT;
512 #if __DARWIN_UNIX03 512 #if __DARWIN_UNIX03
513 #define REGISTER_FIELD(name) __r ## name 513 #define REGISTER_FIELD(name) __r ## name
514 #else 514 #else
515 #define REGISTER_FIELD(name) r ## name 515 #define REGISTER_FIELD(name) r ## name
516 #endif // __DARWIN_UNIX03 516 #endif // __DARWIN_UNIX03
517 #elif V8_HOST_ARCH_IA32 517 #elif V8_HOST_ARCH_IA32
518 thread_state_flavor_t flavor = i386_THREAD_STATE; 518 thread_state_flavor_t flavor = i386_THREAD_STATE;
519 i386_thread_state_t state; 519 i386_thread_state_t thread_state;
520 mach_msg_type_number_t count = i386_THREAD_STATE_COUNT; 520 mach_msg_type_number_t count = i386_THREAD_STATE_COUNT;
521 #if __DARWIN_UNIX03 521 #if __DARWIN_UNIX03
522 #define REGISTER_FIELD(name) __e ## name 522 #define REGISTER_FIELD(name) __e ## name
523 #else 523 #else
524 #define REGISTER_FIELD(name) e ## name 524 #define REGISTER_FIELD(name) e ## name
525 #endif // __DARWIN_UNIX03 525 #endif // __DARWIN_UNIX03
526 #else 526 #else
527 #error Unsupported Mac OS X host architecture. 527 #error Unsupported Mac OS X host architecture.
528 #endif // V8_HOST_ARCH 528 #endif // V8_HOST_ARCH
529 529
530 if (thread_get_state(profiled_thread, 530 if (thread_get_state(profiled_thread,
531 flavor, 531 flavor,
532 reinterpret_cast<natural_t*>(&state), 532 reinterpret_cast<natural_t*>(&thread_state),
533 &count) == KERN_SUCCESS) { 533 &count) == KERN_SUCCESS) {
534 RegisterState state; 534 RegisterState state;
535 #if defined(USE_SIMULATOR) 535 #if defined(USE_SIMULATOR)
536 helper.FillRegisters(&state); 536 helper.FillRegisters(&state);
537 #else 537 #else
538 state.pc = reinterpret_cast<Address>(state.REGISTER_FIELD(ip)); 538 state.pc = reinterpret_cast<Address>(thread_state.REGISTER_FIELD(ip));
539 state.sp = reinterpret_cast<Address>(state.REGISTER_FIELD(sp)); 539 state.sp = reinterpret_cast<Address>(thread_state.REGISTER_FIELD(sp));
540 state.fp = reinterpret_cast<Address>(state.REGISTER_FIELD(bp)); 540 state.fp = reinterpret_cast<Address>(thread_state.REGISTER_FIELD(bp));
541 #endif // USE_SIMULATOR 541 #endif // USE_SIMULATOR
542 #undef REGISTER_FIELD 542 #undef REGISTER_FIELD
543 sampler->SampleStack(state); 543 sampler->SampleStack(state);
544 } 544 }
545 thread_resume(profiled_thread); 545 thread_resume(profiled_thread);
546 } 546 }
547 547
548 #elif defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__) 548 #elif defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
549 549
550 void SampleContext(Sampler* sampler) { 550 void SampleContext(Sampler* sampler) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 void Sampler::SampleStack(const RegisterState& state) { 684 void Sampler::SampleStack(const RegisterState& state) {
685 TickSample* sample = isolate_->cpu_profiler()->TickSampleEvent(); 685 TickSample* sample = isolate_->cpu_profiler()->TickSampleEvent();
686 TickSample sample_obj; 686 TickSample sample_obj;
687 if (sample == NULL) sample = &sample_obj; 687 if (sample == NULL) sample = &sample_obj;
688 sample->Init(isolate_, state); 688 sample->Init(isolate_, state);
689 if (++samples_taken_ < 0) samples_taken_ = 0; 689 if (++samples_taken_ < 0) samples_taken_ = 0;
690 Tick(sample); 690 Tick(sample);
691 } 691 }
692 692
693 } } // namespace v8::internal 693 } } // 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