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

Side by Side Diff: src/sampler.cc

Issue 148573005: A64: Synchronize with r16249. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 | « src/runtime.cc ('k') | src/stub-cache.h » ('j') | 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(__aarch64__)) && \ 52 (defined(__arm__) || defined(__aarch64__)) && \
50 !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT) 53 !defined(__BIONIC_HAVE_STRUCT_SIGCONTEXT)
51 #include <asm/sigcontext.h> 54 #include <asm/sigcontext.h>
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 if (!helper.Init(sampler, isolate)) return; 358 if (!helper.Init(sampler, isolate)) return;
356 helper.FillRegisters(&state); 359 helper.FillRegisters(&state);
357 // It possible that the simulator is interrupted while it is updating 360 // It possible that the simulator is interrupted while it is updating
358 // the sp or fp register. A64 simulator does this in two steps: 361 // the sp or fp register. A64 simulator does this in two steps:
359 // first setting it to zero and then setting it to the new value. 362 // first setting it to zero and then setting it to the new value.
360 // Bailout if sp/fp doesn't contain the new value. 363 // Bailout if sp/fp doesn't contain the new value.
361 if (state.sp == 0 || state.fp == 0) return; 364 if (state.sp == 0 || state.fp == 0) return;
362 #else 365 #else
363 // Extracting the sample from the context is extremely machine dependent. 366 // Extracting the sample from the context is extremely machine dependent.
364 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); 367 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
368 #if !defined(__OpenBSD__)
365 mcontext_t& mcontext = ucontext->uc_mcontext; 369 mcontext_t& mcontext = ucontext->uc_mcontext;
370 #endif
366 #if defined(__linux__) || defined(__ANDROID__) 371 #if defined(__linux__) || defined(__ANDROID__)
367 #if V8_HOST_ARCH_IA32 372 #if V8_HOST_ARCH_IA32
368 state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]); 373 state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]);
369 state.sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]); 374 state.sp = reinterpret_cast<Address>(mcontext.gregs[REG_ESP]);
370 state.fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]); 375 state.fp = reinterpret_cast<Address>(mcontext.gregs[REG_EBP]);
371 #elif V8_HOST_ARCH_X64 376 #elif V8_HOST_ARCH_X64
372 state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_RIP]); 377 state.pc = reinterpret_cast<Address>(mcontext.gregs[REG_RIP]);
373 state.sp = reinterpret_cast<Address>(mcontext.gregs[REG_RSP]); 378 state.sp = reinterpret_cast<Address>(mcontext.gregs[REG_RSP]);
374 state.fp = reinterpret_cast<Address>(mcontext.gregs[REG_RBP]); 379 state.fp = reinterpret_cast<Address>(mcontext.gregs[REG_RBP]);
375 #elif V8_HOST_ARCH_ARM 380 #elif V8_HOST_ARCH_ARM
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 #if V8_HOST_ARCH_IA32 419 #if V8_HOST_ARCH_IA32
415 state.pc = reinterpret_cast<Address>(mcontext.__gregs[_REG_EIP]); 420 state.pc = reinterpret_cast<Address>(mcontext.__gregs[_REG_EIP]);
416 state.sp = reinterpret_cast<Address>(mcontext.__gregs[_REG_ESP]); 421 state.sp = reinterpret_cast<Address>(mcontext.__gregs[_REG_ESP]);
417 state.fp = reinterpret_cast<Address>(mcontext.__gregs[_REG_EBP]); 422 state.fp = reinterpret_cast<Address>(mcontext.__gregs[_REG_EBP]);
418 #elif V8_HOST_ARCH_X64 423 #elif V8_HOST_ARCH_X64
419 state.pc = reinterpret_cast<Address>(mcontext.__gregs[_REG_RIP]); 424 state.pc = reinterpret_cast<Address>(mcontext.__gregs[_REG_RIP]);
420 state.sp = reinterpret_cast<Address>(mcontext.__gregs[_REG_RSP]); 425 state.sp = reinterpret_cast<Address>(mcontext.__gregs[_REG_RSP]);
421 state.fp = reinterpret_cast<Address>(mcontext.__gregs[_REG_RBP]); 426 state.fp = reinterpret_cast<Address>(mcontext.__gregs[_REG_RBP]);
422 #endif // V8_HOST_ARCH_* 427 #endif // V8_HOST_ARCH_*
423 #elif defined(__OpenBSD__) 428 #elif defined(__OpenBSD__)
424 USE(mcontext);
425 #if V8_HOST_ARCH_IA32 429 #if V8_HOST_ARCH_IA32
426 state.pc = reinterpret_cast<Address>(ucontext->sc_eip); 430 state.pc = reinterpret_cast<Address>(ucontext->sc_eip);
427 state.sp = reinterpret_cast<Address>(ucontext->sc_esp); 431 state.sp = reinterpret_cast<Address>(ucontext->sc_esp);
428 state.fp = reinterpret_cast<Address>(ucontext->sc_ebp); 432 state.fp = reinterpret_cast<Address>(ucontext->sc_ebp);
429 #elif V8_HOST_ARCH_X64 433 #elif V8_HOST_ARCH_X64
430 state.pc = reinterpret_cast<Address>(ucontext->sc_rip); 434 state.pc = reinterpret_cast<Address>(ucontext->sc_rip);
431 state.sp = reinterpret_cast<Address>(ucontext->sc_rsp); 435 state.sp = reinterpret_cast<Address>(ucontext->sc_rsp);
432 state.fp = reinterpret_cast<Address>(ucontext->sc_rbp); 436 state.fp = reinterpret_cast<Address>(ucontext->sc_rbp);
433 #endif // V8_HOST_ARCH_* 437 #endif // V8_HOST_ARCH_*
434 #elif defined(__sun) 438 #elif defined(__sun)
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 sample->Init(isolate_, state); 736 sample->Init(isolate_, state);
733 if (is_counting_samples_) { 737 if (is_counting_samples_) {
734 if (sample->state == JS || sample->state == EXTERNAL) { 738 if (sample->state == JS || sample->state == EXTERNAL) {
735 ++js_and_external_sample_count_; 739 ++js_and_external_sample_count_;
736 } 740 }
737 } 741 }
738 Tick(sample); 742 Tick(sample);
739 } 743 }
740 744
741 } } // namespace v8::internal 745 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698