OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/api.h" | 5 #include "src/api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 } | 727 } |
728 | 728 |
729 | 729 |
730 SealHandleScope::SealHandleScope(Isolate* isolate) { | 730 SealHandleScope::SealHandleScope(Isolate* isolate) { |
731 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); | 731 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); |
732 | 732 |
733 isolate_ = internal_isolate; | 733 isolate_ = internal_isolate; |
734 i::HandleScopeData* current = internal_isolate->handle_scope_data(); | 734 i::HandleScopeData* current = internal_isolate->handle_scope_data(); |
735 prev_limit_ = current->limit; | 735 prev_limit_ = current->limit; |
736 current->limit = current->next; | 736 current->limit = current->next; |
737 prev_sealed_level_ = current->sealed_level; | 737 prev_level_ = current->level; |
738 current->sealed_level = current->level; | 738 current->level = 0; |
739 } | 739 } |
740 | 740 |
741 | 741 |
742 SealHandleScope::~SealHandleScope() { | 742 SealHandleScope::~SealHandleScope() { |
743 i::HandleScopeData* current = isolate_->handle_scope_data(); | 743 i::HandleScopeData* current = isolate_->handle_scope_data(); |
| 744 DCHECK_EQ(0, current->level); |
| 745 current->level = prev_level_; |
744 DCHECK_EQ(current->next, current->limit); | 746 DCHECK_EQ(current->next, current->limit); |
745 current->limit = prev_limit_; | 747 current->limit = prev_limit_; |
746 DCHECK_EQ(current->level, current->sealed_level); | |
747 current->sealed_level = prev_sealed_level_; | |
748 } | 748 } |
749 | 749 |
750 | 750 |
751 void Context::Enter() { | 751 void Context::Enter() { |
752 i::Handle<i::Context> env = Utils::OpenHandle(this); | 752 i::Handle<i::Context> env = Utils::OpenHandle(this); |
753 i::Isolate* isolate = env->GetIsolate(); | 753 i::Isolate* isolate = env->GetIsolate(); |
754 ENTER_V8(isolate); | 754 ENTER_V8(isolate); |
755 i::HandleScopeImplementer* impl = isolate->handle_scope_implementer(); | 755 i::HandleScopeImplementer* impl = isolate->handle_scope_implementer(); |
756 impl->EnterContext(env); | 756 impl->EnterContext(env); |
757 impl->SaveContext(isolate->context()); | 757 impl->SaveContext(isolate->context()); |
(...skipping 7695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8453 Address callback_address = | 8453 Address callback_address = |
8454 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8454 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8455 VMState<EXTERNAL> state(isolate); | 8455 VMState<EXTERNAL> state(isolate); |
8456 ExternalCallbackScope call_scope(isolate, callback_address); | 8456 ExternalCallbackScope call_scope(isolate, callback_address); |
8457 callback(info); | 8457 callback(info); |
8458 } | 8458 } |
8459 | 8459 |
8460 | 8460 |
8461 } // namespace internal | 8461 } // namespace internal |
8462 } // namespace v8 | 8462 } // namespace v8 |
OLD | NEW |