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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 class CallDepthScope { | 151 class CallDepthScope { |
152 public: | 152 public: |
153 explicit CallDepthScope(i::Isolate* isolate, Local<Context> context, | 153 explicit CallDepthScope(i::Isolate* isolate, Local<Context> context, |
154 bool do_callback) | 154 bool do_callback) |
155 : isolate_(isolate), | 155 : isolate_(isolate), |
156 context_(context), | 156 context_(context), |
157 escaped_(false), | 157 escaped_(false), |
158 do_callback_(do_callback) { | 158 do_callback_(do_callback) { |
159 // TODO(dcarney): remove this when blink stops crashing. | 159 // TODO(dcarney): remove this when blink stops crashing. |
160 DCHECK(!isolate_->external_caught_exception()); | 160 DCHECK(!isolate_->external_caught_exception()); |
| 161 isolate_->IncrementJsCallsFromApiCounter(); |
161 isolate_->handle_scope_implementer()->IncrementCallDepth(); | 162 isolate_->handle_scope_implementer()->IncrementCallDepth(); |
162 if (!context_.IsEmpty()) context_->Enter(); | 163 if (!context_.IsEmpty()) context_->Enter(); |
163 } | 164 } |
164 ~CallDepthScope() { | 165 ~CallDepthScope() { |
165 if (!context_.IsEmpty()) context_->Exit(); | 166 if (!context_.IsEmpty()) context_->Exit(); |
166 if (!escaped_) isolate_->handle_scope_implementer()->DecrementCallDepth(); | 167 if (!escaped_) isolate_->handle_scope_implementer()->DecrementCallDepth(); |
167 if (do_callback_) isolate_->FireCallCompletedCallback(); | 168 if (do_callback_) isolate_->FireCallCompletedCallback(); |
168 } | 169 } |
169 | 170 |
170 void Escape() { | 171 void Escape() { |
(...skipping 8291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8462 Address callback_address = | 8463 Address callback_address = |
8463 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8464 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8464 VMState<EXTERNAL> state(isolate); | 8465 VMState<EXTERNAL> state(isolate); |
8465 ExternalCallbackScope call_scope(isolate, callback_address); | 8466 ExternalCallbackScope call_scope(isolate, callback_address); |
8466 callback(info); | 8467 callback(info); |
8467 } | 8468 } |
8468 | 8469 |
8469 | 8470 |
8470 } // namespace internal | 8471 } // namespace internal |
8471 } // namespace v8 | 8472 } // namespace v8 |
OLD | NEW |