| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 LOG_API(isolate, "DisposeGlobal"); | 666 LOG_API(isolate, "DisposeGlobal"); |
| 667 if (!isolate->IsInitialized()) return; | 667 if (!isolate->IsInitialized()) return; |
| 668 isolate->global_handles()->Destroy(obj); | 668 isolate->global_handles()->Destroy(obj); |
| 669 } | 669 } |
| 670 | 670 |
| 671 // --- H a n d l e s --- | 671 // --- H a n d l e s --- |
| 672 | 672 |
| 673 | 673 |
| 674 HandleScope::HandleScope() { | 674 HandleScope::HandleScope() { |
| 675 i::Isolate* isolate = i::Isolate::Current(); | 675 i::Isolate* isolate = i::Isolate::Current(); |
| 676 if (i::FLAG_optimize_in_parallel && |
| 677 !isolate->thread_manager()->IsLockedByCurrentThread()) { |
| 678 has_isolate_lock_ = true; |
| 679 isolate->thread_manager()->Lock(); |
| 680 } else { |
| 681 has_isolate_lock_ = false; |
| 682 } |
| 683 |
| 676 API_ENTRY_CHECK(isolate, "HandleScope::HandleScope"); | 684 API_ENTRY_CHECK(isolate, "HandleScope::HandleScope"); |
| 677 v8::ImplementationUtilities::HandleScopeData* current = | 685 v8::ImplementationUtilities::HandleScopeData* current = |
| 678 isolate->handle_scope_data(); | 686 isolate->handle_scope_data(); |
| 679 isolate_ = isolate; | 687 isolate_ = isolate; |
| 680 prev_next_ = current->next; | 688 prev_next_ = current->next; |
| 681 prev_limit_ = current->limit; | 689 prev_limit_ = current->limit; |
| 682 is_closed_ = false; | 690 is_closed_ = false; |
| 683 current->level++; | 691 current->level++; |
| 684 } | 692 } |
| 685 | 693 |
| 686 | 694 |
| 687 HandleScope::~HandleScope() { | 695 HandleScope::~HandleScope() { |
| 688 if (!is_closed_) { | 696 if (!is_closed_) { |
| 689 Leave(); | 697 Leave(); |
| 690 } | 698 } |
| 699 if (has_isolate_lock_) { |
| 700 isolate_->thread_manager()->Unlock(); |
| 701 } |
| 691 } | 702 } |
| 692 | 703 |
| 693 | 704 |
| 694 void HandleScope::Leave() { | 705 void HandleScope::Leave() { |
| 695 ASSERT(isolate_ == i::Isolate::Current()); | 706 ASSERT(isolate_ == i::Isolate::Current()); |
| 696 v8::ImplementationUtilities::HandleScopeData* current = | 707 v8::ImplementationUtilities::HandleScopeData* current = |
| 697 isolate_->handle_scope_data(); | 708 isolate_->handle_scope_data(); |
| 698 current->level--; | 709 current->level--; |
| 699 ASSERT(current->level >= 0); | 710 ASSERT(current->level >= 0); |
| 700 current->next = prev_next_; | 711 current->next = prev_next_; |
| (...skipping 5710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6411 | 6422 |
| 6412 | 6423 |
| 6413 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 6424 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
| 6414 HandleScopeImplementer* scope_implementer = | 6425 HandleScopeImplementer* scope_implementer = |
| 6415 reinterpret_cast<HandleScopeImplementer*>(storage); | 6426 reinterpret_cast<HandleScopeImplementer*>(storage); |
| 6416 scope_implementer->IterateThis(v); | 6427 scope_implementer->IterateThis(v); |
| 6417 return storage + ArchiveSpacePerThread(); | 6428 return storage + ArchiveSpacePerThread(); |
| 6418 } | 6429 } |
| 6419 | 6430 |
| 6420 } } // namespace v8::internal | 6431 } } // namespace v8::internal |
| OLD | NEW |