Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: src/api.cc

Issue 968943002: check for null context on execution entry (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 15d141e5f7819fded0b9399849af0d314fbfa1e3..04e317b5cfa6eeb9c3d55ba3525563b3547a51d4 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -103,8 +103,7 @@ namespace v8 {
return bailout_value; \
} \
HandleScopeClass handle_scope(isolate); \
- CallDepthScope call_depth_scope(isolate, false); \
- v8::Context::Scope context_scope(context); \
+ CallDepthScope call_depth_scope(isolate, context, false); \
LOG_API(isolate, function_name); \
ENTER_V8(isolate); \
bool has_pending_exception = false
@@ -160,12 +159,19 @@ class InternalEscapableScope : public v8::EscapableHandleScope {
class CallDepthScope {
public:
- explicit CallDepthScope(i::Isolate* isolate, bool do_callback)
- : isolate_(isolate), escaped_(false), do_callback_(do_callback) {
+ explicit CallDepthScope(i::Isolate* isolate, Local<Context> context,
+ bool do_callback)
+ : isolate_(isolate),
+ context_(context),
+ escaped_(false),
+ do_callback_(do_callback) {
+ // TODO(dcarney): remove this when blink stops crashing.
DCHECK(!isolate_->external_caught_exception());
isolate_->handle_scope_implementer()->IncrementCallDepth();
+ if (!context_.IsEmpty()) context_->Enter();
}
~CallDepthScope() {
+ if (!context_.IsEmpty()) context_->Exit();
if (!escaped_) isolate_->handle_scope_implementer()->DecrementCallDepth();
if (do_callback_) isolate_->FireCallCompletedCallback();
}
@@ -181,6 +187,7 @@ class CallDepthScope {
private:
i::Isolate* const isolate_;
+ Local<Context> context_;
bool escaped_;
bool do_callback_;
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698