| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 363 |
| 364 | 364 |
| 365 char* StackGuard::RestoreStackGuard(char* from) { | 365 char* StackGuard::RestoreStackGuard(char* from) { |
| 366 ExecutionAccess access; | 366 ExecutionAccess access; |
| 367 memcpy(reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal)); | 367 memcpy(reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal)); |
| 368 isolate_->heap()->SetStackLimits(); | 368 isolate_->heap()->SetStackLimits(); |
| 369 return from + sizeof(ThreadLocal); | 369 return from + sizeof(ThreadLocal); |
| 370 } | 370 } |
| 371 | 371 |
| 372 | 372 |
| 373 static internal::Thread::LocalStorageKey stack_limit_key = | |
| 374 internal::Thread::CreateThreadLocalKey(); | |
| 375 | |
| 376 | |
| 377 void StackGuard::FreeThreadResources() { | 373 void StackGuard::FreeThreadResources() { |
| 378 Thread::SetThreadLocal( | 374 Thread::SetThreadLocal( |
| 379 stack_limit_key, | 375 stack_limit_key_, |
| 380 reinterpret_cast<void*>(thread_local_.real_climit_)); | 376 reinterpret_cast<void*>(thread_local_.real_climit_)); |
| 381 } | 377 } |
| 382 | 378 |
| 383 | 379 |
| 384 void StackGuard::ThreadLocal::Clear() { | 380 void StackGuard::ThreadLocal::Clear() { |
| 385 real_jslimit_ = kIllegalLimit; | 381 real_jslimit_ = kIllegalLimit; |
| 386 jslimit_ = kIllegalLimit; | 382 jslimit_ = kIllegalLimit; |
| 387 real_climit_ = kIllegalLimit; | 383 real_climit_ = kIllegalLimit; |
| 388 climit_ = kIllegalLimit; | 384 climit_ = kIllegalLimit; |
| 389 nesting_ = 0; | 385 nesting_ = 0; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 413 | 409 |
| 414 | 410 |
| 415 void StackGuard::ClearThread(const ExecutionAccess& lock) { | 411 void StackGuard::ClearThread(const ExecutionAccess& lock) { |
| 416 thread_local_.Clear(); | 412 thread_local_.Clear(); |
| 417 isolate_->heap()->SetStackLimits(); | 413 isolate_->heap()->SetStackLimits(); |
| 418 } | 414 } |
| 419 | 415 |
| 420 | 416 |
| 421 void StackGuard::InitThread(const ExecutionAccess& lock) { | 417 void StackGuard::InitThread(const ExecutionAccess& lock) { |
| 422 if (thread_local_.Initialize()) isolate_->heap()->SetStackLimits(); | 418 if (thread_local_.Initialize()) isolate_->heap()->SetStackLimits(); |
| 423 void* stored_limit = Thread::GetThreadLocal(stack_limit_key); | 419 void* stored_limit = Thread::GetThreadLocal(stack_limit_key_); |
| 424 // You should hold the ExecutionAccess lock when you call this. | 420 // You should hold the ExecutionAccess lock when you call this. |
| 425 if (stored_limit != NULL) { | 421 if (stored_limit != NULL) { |
| 426 StackGuard::SetStackLimit(reinterpret_cast<intptr_t>(stored_limit)); | 422 StackGuard::SetStackLimit(reinterpret_cast<intptr_t>(stored_limit)); |
| 427 } | 423 } |
| 428 } | 424 } |
| 429 | 425 |
| 430 | 426 |
| 431 // --- C a l l s t o n a t i v e s --- | 427 // --- C a l l s t o n a t i v e s --- |
| 432 | 428 |
| 433 #define RETURN_NATIVE_CALL(name, argc, argv, has_pending_exception) \ | 429 #define RETURN_NATIVE_CALL(name, argc, argv, has_pending_exception) \ |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 // All allocation spaces other than NEW_SPACE have the same effect. | 730 // All allocation spaces other than NEW_SPACE have the same effect. |
| 735 HEAP->CollectAllGarbage(false); | 731 HEAP->CollectAllGarbage(false); |
| 736 return v8::Undefined(); | 732 return v8::Undefined(); |
| 737 } | 733 } |
| 738 | 734 |
| 739 | 735 |
| 740 static GCExtension kGCExtension; | 736 static GCExtension kGCExtension; |
| 741 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension); | 737 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension); |
| 742 | 738 |
| 743 } } // namespace v8::internal | 739 } } // namespace v8::internal |
| OLD | NEW |