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

Side by Side Diff: src/platform-openbsd.cc

Issue 3043007: [Isolates] Fix compile under Win32 and presumably for FreeBSD, OpenBS... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 10 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 | « src/platform-nullos.cc ('k') | src/platform-solaris.cc » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 bool ThreadHandle::IsSelf() const { 373 bool ThreadHandle::IsSelf() const {
374 return pthread_equal(data_->thread_, pthread_self()); 374 return pthread_equal(data_->thread_, pthread_self());
375 } 375 }
376 376
377 377
378 bool ThreadHandle::IsValid() const { 378 bool ThreadHandle::IsValid() const {
379 return data_->thread_ != kNoThread; 379 return data_->thread_ != kNoThread;
380 } 380 }
381 381
382 382
383 Thread::Thread() : ThreadHandle(ThreadHandle::INVALID) { 383 Thread::Thread(Isolate* isolate)
384 : ThreadHandle(ThreadHandle::INVALID),
385 isolate_(isolate) {
384 } 386 }
385 387
386 388
387 Thread::~Thread() { 389 Thread::~Thread() {
388 } 390 }
389 391
390 392
391 static void* ThreadEntry(void* arg) { 393 static void* ThreadEntry(void* arg) {
392 Thread* thread = reinterpret_cast<Thread*>(arg); 394 Thread* thread = reinterpret_cast<Thread*>(arg);
393 // This is also initialized by the first argument to pthread_create() but we 395 // This is also initialized by the first argument to pthread_create() but we
394 // don't know which thread will run first (the original thread or the new 396 // don't know which thread will run first (the original thread or the new
395 // one) so we initialize it here too. 397 // one) so we initialize it here too.
396 thread->thread_handle_data()->thread_ = pthread_self(); 398 thread->thread_handle_data()->thread_ = pthread_self();
397 ASSERT(thread->IsValid()); 399 ASSERT(thread->IsValid());
400 Thread::SetThreadLocal(Isolate::isolate_key(), thread->isolate());
398 thread->Run(); 401 thread->Run();
399 return NULL; 402 return NULL;
400 } 403 }
401 404
402 405
403 void Thread::Start() { 406 void Thread::Start() {
404 pthread_create(&thread_handle_data()->thread_, NULL, ThreadEntry, this); 407 pthread_create(&thread_handle_data()->thread_, NULL, ThreadEntry, this);
405 ASSERT(IsValid()); 408 ASSERT(IsValid());
406 } 409 }
407 410
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 PlatformData() { 562 PlatformData() {
560 signal_handler_installed_ = false; 563 signal_handler_installed_ = false;
561 } 564 }
562 565
563 bool signal_handler_installed_; 566 bool signal_handler_installed_;
564 struct sigaction old_signal_handler_; 567 struct sigaction old_signal_handler_;
565 struct itimerval old_timer_value_; 568 struct itimerval old_timer_value_;
566 }; 569 };
567 570
568 571
569 Sampler::Sampler(int interval, bool profiling) 572 Sampler::Sampler(Isolate* isolate, int interval, bool profiling)
570 : interval_(interval), profiling_(profiling), active_(false) { 573 : isolate_(isolate),
574 interval_(interval),
575 profiling_(profiling),
576 active_(false) {
571 data_ = new PlatformData(); 577 data_ = new PlatformData();
572 } 578 }
573 579
574 580
575 Sampler::~Sampler() { 581 Sampler::~Sampler() {
576 delete data_; 582 delete data_;
577 } 583 }
578 584
579 585
580 void Sampler::Start() { 586 void Sampler::Start() {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 } 619 }
614 620
615 // This sampler is no longer the active sampler. 621 // This sampler is no longer the active sampler.
616 active_sampler_ = NULL; 622 active_sampler_ = NULL;
617 active_ = false; 623 active_ = false;
618 } 624 }
619 625
620 #endif // ENABLE_LOGGING_AND_PROFILING 626 #endif // ENABLE_LOGGING_AND_PROFILING
621 627
622 } } // namespace v8::internal 628 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-nullos.cc ('k') | src/platform-solaris.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698