| 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 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 prev_next_ = current->next; | 971 prev_next_ = current->next; |
| 972 prev_limit_ = current->limit; | 972 prev_limit_ = current->limit; |
| 973 current->level++; | 973 current->level++; |
| 974 } | 974 } |
| 975 | 975 |
| 976 | 976 |
| 977 HandleScope::~HandleScope() { | 977 HandleScope::~HandleScope() { |
| 978 i::HandleScope::CloseScope(isolate_, prev_next_, prev_limit_); | 978 i::HandleScope::CloseScope(isolate_, prev_next_, prev_limit_); |
| 979 } | 979 } |
| 980 | 980 |
| 981 V8_NORETURN void* HandleScope::operator new(size_t) { |
| 982 base::OS::Abort(); |
| 983 abort(); |
| 984 } |
| 985 |
| 986 void HandleScope::operator delete(void*, size_t) { base::OS::Abort(); } |
| 981 | 987 |
| 982 int HandleScope::NumberOfHandles(Isolate* isolate) { | 988 int HandleScope::NumberOfHandles(Isolate* isolate) { |
| 983 return i::HandleScope::NumberOfHandles( | 989 return i::HandleScope::NumberOfHandles( |
| 984 reinterpret_cast<i::Isolate*>(isolate)); | 990 reinterpret_cast<i::Isolate*>(isolate)); |
| 985 } | 991 } |
| 986 | 992 |
| 987 | 993 |
| 988 i::Object** HandleScope::CreateHandle(i::Isolate* isolate, i::Object* value) { | 994 i::Object** HandleScope::CreateHandle(i::Isolate* isolate, i::Object* value) { |
| 989 return i::HandleScope::CreateHandle(isolate, value); | 995 return i::HandleScope::CreateHandle(isolate, value); |
| 990 } | 996 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1009 Utils::ApiCheck((*escape_slot_)->IsTheHole(heap->isolate()), | 1015 Utils::ApiCheck((*escape_slot_)->IsTheHole(heap->isolate()), |
| 1010 "EscapableHandleScope::Escape", "Escape value set twice"); | 1016 "EscapableHandleScope::Escape", "Escape value set twice"); |
| 1011 if (escape_value == NULL) { | 1017 if (escape_value == NULL) { |
| 1012 *escape_slot_ = heap->undefined_value(); | 1018 *escape_slot_ = heap->undefined_value(); |
| 1013 return NULL; | 1019 return NULL; |
| 1014 } | 1020 } |
| 1015 *escape_slot_ = *escape_value; | 1021 *escape_slot_ = *escape_value; |
| 1016 return escape_slot_; | 1022 return escape_slot_; |
| 1017 } | 1023 } |
| 1018 | 1024 |
| 1025 V8_NORETURN void* EscapableHandleScope::operator new(size_t) { |
| 1026 base::OS::Abort(); |
| 1027 abort(); |
| 1028 } |
| 1029 |
| 1030 void EscapableHandleScope::operator delete(void*, size_t) { base::OS::Abort(); } |
| 1031 |
| 1019 SealHandleScope::SealHandleScope(Isolate* isolate) | 1032 SealHandleScope::SealHandleScope(Isolate* isolate) |
| 1020 : isolate_(reinterpret_cast<i::Isolate*>(isolate)) { | 1033 : isolate_(reinterpret_cast<i::Isolate*>(isolate)) { |
| 1021 i::HandleScopeData* current = isolate_->handle_scope_data(); | 1034 i::HandleScopeData* current = isolate_->handle_scope_data(); |
| 1022 prev_limit_ = current->limit; | 1035 prev_limit_ = current->limit; |
| 1023 current->limit = current->next; | 1036 current->limit = current->next; |
| 1024 prev_sealed_level_ = current->sealed_level; | 1037 prev_sealed_level_ = current->sealed_level; |
| 1025 current->sealed_level = current->level; | 1038 current->sealed_level = current->level; |
| 1026 } | 1039 } |
| 1027 | 1040 |
| 1028 | 1041 |
| 1029 SealHandleScope::~SealHandleScope() { | 1042 SealHandleScope::~SealHandleScope() { |
| 1030 i::HandleScopeData* current = isolate_->handle_scope_data(); | 1043 i::HandleScopeData* current = isolate_->handle_scope_data(); |
| 1031 DCHECK_EQ(current->next, current->limit); | 1044 DCHECK_EQ(current->next, current->limit); |
| 1032 current->limit = prev_limit_; | 1045 current->limit = prev_limit_; |
| 1033 DCHECK_EQ(current->level, current->sealed_level); | 1046 DCHECK_EQ(current->level, current->sealed_level); |
| 1034 current->sealed_level = prev_sealed_level_; | 1047 current->sealed_level = prev_sealed_level_; |
| 1035 } | 1048 } |
| 1036 | 1049 |
| 1050 V8_NORETURN void* SealHandleScope::operator new(size_t) { |
| 1051 base::OS::Abort(); |
| 1052 abort(); |
| 1053 } |
| 1054 |
| 1055 void SealHandleScope::operator delete(void*, size_t) { base::OS::Abort(); } |
| 1037 | 1056 |
| 1038 void Context::Enter() { | 1057 void Context::Enter() { |
| 1039 i::Handle<i::Context> env = Utils::OpenHandle(this); | 1058 i::Handle<i::Context> env = Utils::OpenHandle(this); |
| 1040 i::Isolate* isolate = env->GetIsolate(); | 1059 i::Isolate* isolate = env->GetIsolate(); |
| 1041 ENTER_V8(isolate); | 1060 ENTER_V8(isolate); |
| 1042 i::HandleScopeImplementer* impl = isolate->handle_scope_implementer(); | 1061 i::HandleScopeImplementer* impl = isolate->handle_scope_implementer(); |
| 1043 impl->EnterContext(env); | 1062 impl->EnterContext(env); |
| 1044 impl->SaveContext(isolate->context()); | 1063 impl->SaveContext(isolate->context()); |
| 1045 isolate->set_context(*env); | 1064 isolate->set_context(*env); |
| 1046 } | 1065 } |
| (...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2507 // If an exception was caught but is still scheduled because no API call | 2526 // If an exception was caught but is still scheduled because no API call |
| 2508 // promoted it, then it is canceled to prevent it from being propagated. | 2527 // promoted it, then it is canceled to prevent it from being propagated. |
| 2509 // Note that this will not cancel termination exceptions. | 2528 // Note that this will not cancel termination exceptions. |
| 2510 isolate_->CancelScheduledExceptionFromTryCatch(this); | 2529 isolate_->CancelScheduledExceptionFromTryCatch(this); |
| 2511 } | 2530 } |
| 2512 isolate_->UnregisterTryCatchHandler(this); | 2531 isolate_->UnregisterTryCatchHandler(this); |
| 2513 i::SimulatorStack::UnregisterCTryCatch(isolate_); | 2532 i::SimulatorStack::UnregisterCTryCatch(isolate_); |
| 2514 } | 2533 } |
| 2515 } | 2534 } |
| 2516 | 2535 |
| 2536 V8_NORETURN void* v8::TryCatch::operator new(size_t) { |
| 2537 base::OS::Abort(); |
| 2538 abort(); |
| 2539 } |
| 2540 |
| 2541 void v8::TryCatch::operator delete(void*, size_t) { base::OS::Abort(); } |
| 2517 | 2542 |
| 2518 bool v8::TryCatch::HasCaught() const { | 2543 bool v8::TryCatch::HasCaught() const { |
| 2519 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(isolate_); | 2544 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(isolate_); |
| 2520 } | 2545 } |
| 2521 | 2546 |
| 2522 | 2547 |
| 2523 bool v8::TryCatch::CanContinue() const { | 2548 bool v8::TryCatch::CanContinue() const { |
| 2524 return can_continue_; | 2549 return can_continue_; |
| 2525 } | 2550 } |
| 2526 | 2551 |
| (...skipping 7377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9904 Address callback_address = | 9929 Address callback_address = |
| 9905 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9930 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 9906 VMState<EXTERNAL> state(isolate); | 9931 VMState<EXTERNAL> state(isolate); |
| 9907 ExternalCallbackScope call_scope(isolate, callback_address); | 9932 ExternalCallbackScope call_scope(isolate, callback_address); |
| 9908 callback(info); | 9933 callback(info); |
| 9909 } | 9934 } |
| 9910 | 9935 |
| 9911 | 9936 |
| 9912 } // namespace internal | 9937 } // namespace internal |
| 9913 } // namespace v8 | 9938 } // namespace v8 |
| OLD | NEW |