Guest User

Untitled

a guest
Nov 18th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.81 KB | None | 0 0
  1. diff -ur v8/SConstruct v8/SConstruct
  2. --- v8/SConstruct 2012-06-18 21:39:33.000000000 +0900
  3. +++ v8/SConstruct 2012-06-19 17:38:46.000000000 +0900
  4. @@ -130,6 +134,12 @@
  5. 'LIBPATH' : ['/usr/local/lib'],
  6. 'CCFLAGS': ['-ansi'],
  7. },
  8. + 'os:netbsd': {
  9. + 'CPPPATH' : ['/usr/pkg/include'],
  10. + 'LIBPATH' : ['/usr/pkg/lib'],
  11. + 'CCFLAGS': ['-ansi', '-fPIC'],
  12. + 'CXXFLAGS': ['-fPIC'],
  13. + },
  14. 'os:solaris': {
  15. # On Solaris, to get isinf, INFINITY, fpclassify and other macros one
  16. # needs to define __C99FEATURES__.
  17. @@ -364,6 +374,9 @@
  18. 'os:openbsd': {
  19. 'LIBS': ['execinfo', 'pthread']
  20. },
  21. + 'os:netbsd': {
  22. + 'LIBS': ['execinfo', 'pthread']
  23. + },
  24. 'os:win32': {
  25. 'LIBS': ['winmm', 'ws2_32'],
  26. },
  27. @@ -424,6 +437,9 @@
  28. 'os:openbsd': {
  29. 'LIBS': ['execinfo', 'pthread']
  30. },
  31. + 'os:netbsd': {
  32. + 'LIBS': ['execinfo', 'pthread']
  33. + },
  34. 'os:win32': {
  35. 'LIBS': ['winmm', 'ws2_32']
  36. },
  37.  
  38. @@ -480,6 +496,10 @@
  39. 'LIBPATH' : ['/usr/local/lib'],
  40. 'LIBS': ['execinfo', 'pthread']
  41. },
  42. + 'os:netbsd': {
  43. + 'LIBPATH' : ['/usr/pkg/lib'],
  44. + 'LIBS': ['execinfo', 'pthread']
  45. + },
  46. 'os:win32': {
  47. 'LIBS': ['winmm', 'ws2_32']
  48. },
  49. @@ -801,6 +821,9 @@
  50. 'os:openbsd': {
  51. 'LIBS': ['pthread'],
  52. },
  53. + 'os:netbsd': {
  54. + 'LIBS': ['pthread'],
  55. + },
  56. 'os:win32': {
  57. 'LIBS': ['winmm', 'ws2_32'],
  58. },
  59. @@ -880,7 +903,7 @@
  60. 'help': 'the architecture to build for'
  61. },
  62. 'os': {
  63. - 'values': ['freebsd', 'linux', 'macos', 'win32', 'openbsd', 'solaris', 'cygwin'],
  64. + 'values': ['freebsd', 'linux', 'macos', 'win32', 'openbsd', 'netbsd', 'solaris', 'cygwin'],
  65. 'guess': GuessOS,
  66. 'help': 'the os to build for'
  67. },
  68.  
  69. diff -ur v8/src/SConscript v8/src/SConscript
  70. --- v8/src/SConscript 2012-06-18 21:39:33.000000000 +0900
  71. +++ v8/src/SConscript 2012-06-19 17:45:20.000000000 +0900
  72. @@ -213,6 +213,7 @@
  73. 'simulator:mips': ['mips/simulator-mips.cc'],
  74. 'os:freebsd': ['platform-freebsd.cc', 'platform-posix.cc'],
  75. 'os:openbsd': ['platform-openbsd.cc', 'platform-posix.cc'],
  76. + 'os:netbsd': ['platform-openbsd.cc', 'platform-posix.cc'],
  77. 'os:linux': ['platform-linux.cc', 'platform-posix.cc'],
  78. 'os:android': ['platform-linux.cc', 'platform-posix.cc'],
  79. 'os:macos': ['platform-macos.cc', 'platform-posix.cc'],
  80. diff -ur v8/src/flags.cc v8/src/flags.cc
  81. --- v8/src/flags.cc 2012-06-18 21:39:34.000000000 +0900
  82. +++ v8/src/flags.cc 2012-06-18 22:07:44.000000000 +0900
  83. @@ -456,13 +456,13 @@
  84.  
  85.  
  86. static char* SkipWhiteSpace(char* p) {
  87. - while (*p != '\0' && isspace(*p) != 0) p++;
  88. + while (*p != '\0' && isspace(*((unsigned char *)p)) != 0) p++;
  89. return p;
  90. }
  91.  
  92.  
  93. static char* SkipBlackSpace(char* p) {
  94. - while (*p != '\0' && isspace(*p) == 0) p++;
  95. + while (*p != '\0' && isspace(*((unsigned char *)p)) == 0) p++;
  96. return p;
  97. }
  98.  
  99.  
  100. diff -ur v8/src/platform-openbsd.cc v8/src/platform-openbsd.cc
  101. --- v8/src/platform-openbsd.cc 2012-06-18 21:39:34.000000000 +0900
  102. +++ v8/src/platform-openbsd.cc 2012-06-19 19:50:55.000000000 +0900
  103. @@ -297,7 +297,7 @@
  104. // There may be no filename in this line. Skip to next.
  105. if (start_of_path == NULL) continue;
  106. buffer[bytes_read] = 0;
  107. - LOG(SharedLibraryEvent(start_of_path, start, end));
  108. + LOG(ISOLATE, SharedLibraryEvent(start_of_path, start, end));
  109. }
  110. close(fd);
  111. #endif
  112. @@ -368,7 +368,7 @@
  113.  
  114.  
  115. Thread::Thread(Isolate* isolate, const Options& options)
  116. - : data_(new PlatformData()),
  117. + :data_(new PlatformData()),
  118. isolate_(isolate),
  119. stack_size_(options.stack_size) {
  120. set_name(options.name);
  121. @@ -376,7 +376,7 @@
  122.  
  123.  
  124. Thread::Thread(Isolate* isolate, const char* name)
  125. - : data_(new PlatfromData()),
  126. + :data_(new PlatformData()),
  127. isolate_(isolate),
  128. stack_size_(0) {
  129. set_name(name);
  130. @@ -483,6 +483,15 @@
  131. int result = pthread_mutex_unlock(&mutex_);
  132. return result;
  133. }
  134.  
  135. + virtual bool TryLock() {
  136. + int result = pthread_mutex_trylock(&mutex_);
  137. + // Return false if the lock is busy and locking failed.
  138. + if (result == EBUSY) {
  139. + return false;
  140. + }
  141. + ASSERT(result == 0); // Verify no other errors.
  142. + return true;
  143. + }
  144.  
  145. private:
  146. pthread_mutex_t mutex_; // Pthread mutex for POSIX platforms.
  147. @@ -557,14 +566,50 @@
  148. static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
  149. USE(info);
  150. if (signal != SIGPROF) return;
  151. - if (active_sampler_ == NULL) return;
  152. -
  153. - TickSample sample;
  154. -
  155. - // We always sample the VM state.
  156. - sample.state = VMState::current_state();
  157. -
  158. - active_sampler_->Tick(&sample);
  159. + Isolate* isolate = Isolate::UncheckedCurrent();
  160. + if (isolate == NULL || !isolate->IsInitialized() || !isolate->IsInUse()) {
  161. + // We require a fully initialized and entered isolate.
  162. + return;
  163. + }
  164. + if (v8::Locker::IsActive() &&
  165. + !isolate->thread_manager()->IsLockedByCurrentThread()) {
  166. + return;
  167. + }
  168. +
  169. + Sampler* sampler = isolate->logger()->sampler();
  170. + if (sampler == NULL || !sampler->IsActive()) return;
  171. +
  172.  
  173. + TickSample sample_obj;
  174. + TickSample* sample = CpuProfiler::TickSampleEvent(isolate);
  175. + if (sample == NULL) sample = &sample_obj;
  176. +
  177. + // Extracting the sample from the context is extremely machine dependent.
  178. + sample->state = isolate->current_vm_state();
  179. + ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
  180. +#ifdef __NetBSD__
  181. + mcontext_t& mcontext = ucontext->uc_mcontext;
  182. +#if V8_HOST_ARCH_IA32
  183. + sample->pc = reinterpret_cast<Address>(mcontext.__gregs[_REG_EIP]);
  184. + sample->sp = reinterpret_cast<Address>(mcontext.__gregs[_REG_ESP]);
  185. + sample->fp = reinterpret_cast<Address>(mcontext.__gregs[_REG_EBP]);
  186. +#elif V8_HOST_ARCH_X64
  187. + sample->pc = reinterpret_cast<Address>(mcontext.__gregs[_REG_RIP]);
  188. + sample->sp = reinterpret_cast<Address>(mcontext.__gregs[_REG_RSP]);
  189. + sample->fp = reinterpret_cast<Address>(mcontext.__gregs[_REG_RBP]);
  190. +#endif // V8_HOST_ARCH
  191. +#else // OpenBSD
  192. +#if V8_HOST_ARCH_IA32
  193. + sample->pc = reinterpret_cast<Address>(ucontext->sc_eip);
  194. + sample->sp = reinterpret_cast<Address>(ucontext->sc_esp);
  195. + sample->fp = reinterpret_cast<Address>(ucontext->sc_ebp);
  196. +#elif V8_HOST_ARCH_X64
  197. + sample->pc = reinterpret_cast<Address>(ucontext->sc_rip);
  198. + sample->sp = reinterpret_cast<Address>(ucontext->sc_rsp);
  199. + sample->fp = reinterpret_cast<Address>(ucontext->sc_rbp);
  200. +#endif // V8_HOST_ARCH
  201. +#endif // __NetBSD__
  202. + sampler->SampleStack(sample);
  203. + sampler->Tick(sample);
  204. }
  205.  
  206.  
  207.  
  208. diff -ur v8/tools/utils.py v8/tools/utils.py
  209. --- v8/tools/utils.py 2012-06-18 21:39:34.000000000 +0900
  210. +++ v8/tools/utils.py 2012-06-18 21:54:03.000000000 +0900
  211. @@ -59,6 +59,8 @@
  212. return 'freebsd'
  213. elif id == 'OpenBSD':
  214. return 'openbsd'
  215. + elif id == 'NetBSD':
  216. + return 'netbsd'
  217. elif id == 'SunOS':
  218. return 'solaris'
  219. else:
Add Comment
Please, Sign In to add comment