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

Side by Side Diff: src/sampler.cc

Issue 21705003: openbsd: fix platform build (Closed)
Patch Set: Created 7 years, 4 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
« 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 20 matching lines...) Expand all
31 || defined(__NetBSD__) || defined(__sun) || defined(__ANDROID__) \ 31 || defined(__NetBSD__) || defined(__sun) || defined(__ANDROID__) \
32 || defined(__native_client__) 32 || defined(__native_client__)
33 33
34 #define USE_SIGNALS 34 #define USE_SIGNALS
35 35
36 #include <errno.h> 36 #include <errno.h>
37 #include <pthread.h> 37 #include <pthread.h>
38 #include <signal.h> 38 #include <signal.h>
39 #include <sys/time.h> 39 #include <sys/time.h>
40 #include <sys/syscall.h> 40 #include <sys/syscall.h>
41 #if !defined(__ANDROID__) || defined(__BIONIC_HAVE_UCONTEXT_T) 41 // OpenBSD doesn't have <ucontext.h>. ucontext_t lives in <signal.h>
42 // and is a typedef for struct sigcontext. There is no uc_mcontext.
43 #if (!defined(__ANDROID__) || defined(__BIONIC_HAVE_UCONTEXT_T)) \
44 && !defined(__OpenBSD__)
42 #include <ucontext.h> 45 #include <ucontext.h>
43 #endif 46 #endif
44 #include <unistd.h> 47 #include <unistd.h>
45 48
46 // GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'. 49 // GLibc on ARM defines mcontext_t has a typedef for 'struct sigcontext'.
47 // Old versions of the C library <signal.h> didn't define the type. 50 // Old versions of the C library <signal.h> didn't define the type.
48 #if defined(__ANDROID__) && !defined(__BIONIC_HAVE_UCONTEXT_T) && \ 51 #if defined(__ANDROID__) && !defined(__BIONIC_HAVE_UCONTEXT_T) && \
49 defined(__arm__) && !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT) 52 defined(__arm__) && !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT)
50 #include <asm/sigcontext.h> 53 #include <asm/sigcontext.h>
51 #endif 54 #endif
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 326
324 RegisterState state; 327 RegisterState state;
325 328
326 #if defined(USE_SIMULATOR) 329 #if defined(USE_SIMULATOR)
327 SimulatorHelper helper; 330 SimulatorHelper helper;
328 if (!helper.Init(sampler, isolate)) return; 331 if (!helper.Init(sampler, isolate)) return;
329 helper.FillRegisters(&state); 332 helper.FillRegisters(&state);
330 #else 333 #else
331 // Extracting the sample from the context is extremely machine dependent. 334 // Extracting the sample from the context is extremely machine dependent.
332 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); 335 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
336 #if !defined(__OpenBSD__)
333 mcontext_t& mcontext = ucontext->uc_mcontext; 337 mcontext_t& mcontext = ucontext->uc_mcontext;
338 #endif
334 #if defined(__linux__) || defined(__ANDROID__) 339 #if defined(__linux__) || defined(__ANDROID__)
335 #if V8_HOST_ARCH_IA32 340 #if V8_HOST_ARCH_IA32
336 state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]); 341 state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]);
337 state.sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]); 342 state.sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]);
338 state.fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]); 343 state.fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]);
339 #elif V8_HOST_ARCH_X64 344 #elif V8_HOST_ARCH_X64
340 state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_RIP]); 345 state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_RIP]);
341 state.sp = reinterpret_cast<Address>(mcontext.gregs[REG_RSP]); 346 state.sp = reinterpret_cast<Address>(mcontext.gregs[REG_RSP]);
342 state.fp = reinterpret_cast<Address>(mcontext.gregs[REG_RBP]); 347 state.fp = reinterpret_cast<Address>(mcontext.gregs[REG_RBP]);
343 #elif V8_HOST_ARCH_ARM 348 #elif V8_HOST_ARCH_ARM
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 #if V8_HOST_ARCH_IA32 382 #if V8_HOST_ARCH_IA32
378 state.pc = reinterpret_cast<Address>(mcontext.__gregs[_REG_EIP]); 383 state.pc = reinterpret_cast<Address>(mcontext.__gregs[_REG_EIP]);
379 state.sp = reinterpret_cast<Address>(mcontext.__gregs[_REG_ESP]); 384 state.sp = reinterpret_cast<Address>(mcontext.__gregs[_REG_ESP]);
380 state.fp = reinterpret_cast<Address>(mcontext.__gregs[_REG_EBP]); 385 state.fp = reinterpret_cast<Address>(mcontext.__gregs[_REG_EBP]);
381 #elif V8_HOST_ARCH_X64 386 #elif V8_HOST_ARCH_X64
382 state.pc = reinterpret_cast<Address>(mcontext.__gregs[_REG_RIP]); 387 state.pc = reinterpret_cast<Address>(mcontext.__gregs[_REG_RIP]);
383 state.sp = reinterpret_cast<Address>(mcontext.__gregs[_REG_RSP]); 388 state.sp = reinterpret_cast<Address>(mcontext.__gregs[_REG_RSP]);
384 state.fp = reinterpret_cast<Address>(mcontext.__gregs[_REG_RBP]); 389 state.fp = reinterpret_cast<Address>(mcontext.__gregs[_REG_RBP]);
385 #endif // V8_HOST_ARCH_* 390 #endif // V8_HOST_ARCH_*
386 #elif defined(__OpenBSD__) 391 #elif defined(__OpenBSD__)
387 USE(mcontext);
388 #if V8_HOST_ARCH_IA32 392 #if V8_HOST_ARCH_IA32
389 state.pc = reinterpret_cast<Address>(ucontext->sc_eip); 393 state.pc = reinterpret_cast<Address>(ucontext->sc_eip);
390 state.sp = reinterpret_cast<Address>(ucontext->sc_esp); 394 state.sp = reinterpret_cast<Address>(ucontext->sc_esp);
391 state.fp = reinterpret_cast<Address>(ucontext->sc_ebp); 395 state.fp = reinterpret_cast<Address>(ucontext->sc_ebp);
392 #elif V8_HOST_ARCH_X64 396 #elif V8_HOST_ARCH_X64
393 state.pc = reinterpret_cast<Address>(ucontext->sc_rip); 397 state.pc = reinterpret_cast<Address>(ucontext->sc_rip);
394 state.sp = reinterpret_cast<Address>(ucontext->sc_rsp); 398 state.sp = reinterpret_cast<Address>(ucontext->sc_rsp);
395 state.fp = reinterpret_cast<Address>(ucontext->sc_rbp); 399 state.fp = reinterpret_cast<Address>(ucontext->sc_rbp);
396 #endif // V8_HOST_ARCH_* 400 #endif // V8_HOST_ARCH_*
397 #elif defined(__sun) 401 #elif defined(__sun)
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 sample->Init(isolate_, state); 700 sample->Init(isolate_, state);
697 if (is_counting_samples_) { 701 if (is_counting_samples_) {
698 if (sample->state == JS || sample->state == EXTERNAL) { 702 if (sample->state == JS || sample->state == EXTERNAL) {
699 ++js_and_external_sample_count_; 703 ++js_and_external_sample_count_;
700 } 704 }
701 } 705 }
702 Tick(sample); 706 Tick(sample);
703 } 707 }
704 708
705 } } // namespace v8::internal 709 } } // 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