| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 } | 191 } |
| 192 #endif | 192 #endif |
| 193 | 193 |
| 194 template <bool do_callback> | 194 template <bool do_callback> |
| 195 class CallDepthScope { | 195 class CallDepthScope { |
| 196 public: | 196 public: |
| 197 explicit CallDepthScope(i::Isolate* isolate, Local<Context> context) | 197 explicit CallDepthScope(i::Isolate* isolate, Local<Context> context) |
| 198 : isolate_(isolate), context_(context), escaped_(false) { | 198 : isolate_(isolate), context_(context), escaped_(false) { |
| 199 // TODO(dcarney): remove this when blink stops crashing. | 199 // TODO(dcarney): remove this when blink stops crashing. |
| 200 DCHECK(!isolate_->external_caught_exception()); | 200 DCHECK(!isolate_->external_caught_exception()); |
| 201 isolate_->IncrementJsCallsFromApiCounter(); | |
| 202 isolate_->handle_scope_implementer()->IncrementCallDepth(); | 201 isolate_->handle_scope_implementer()->IncrementCallDepth(); |
| 203 if (!context.IsEmpty()) { | 202 if (!context.IsEmpty()) { |
| 204 i::Handle<i::Context> env = Utils::OpenHandle(*context); | 203 i::Handle<i::Context> env = Utils::OpenHandle(*context); |
| 205 i::HandleScopeImplementer* impl = isolate->handle_scope_implementer(); | 204 i::HandleScopeImplementer* impl = isolate->handle_scope_implementer(); |
| 206 if (isolate->context() != nullptr && | 205 if (isolate->context() != nullptr && |
| 207 isolate->context()->native_context() == env->native_context() && | 206 isolate->context()->native_context() == env->native_context() && |
| 208 impl->LastEnteredContextWas(env)) { | 207 impl->LastEnteredContextWas(env)) { |
| 209 context_ = Local<Context>(); | 208 context_ = Local<Context>(); |
| 210 } else { | 209 } else { |
| 211 context_->Enter(); | 210 context_->Enter(); |
| (...skipping 9559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9771 Address callback_address = | 9770 Address callback_address = |
| 9772 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9771 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 9773 VMState<EXTERNAL> state(isolate); | 9772 VMState<EXTERNAL> state(isolate); |
| 9774 ExternalCallbackScope call_scope(isolate, callback_address); | 9773 ExternalCallbackScope call_scope(isolate, callback_address); |
| 9775 callback(info); | 9774 callback(info); |
| 9776 } | 9775 } |
| 9777 | 9776 |
| 9778 | 9777 |
| 9779 } // namespace internal | 9778 } // namespace internal |
| 9780 } // namespace v8 | 9779 } // namespace v8 |
| OLD | NEW |