Reviewers: Sven Panne,

Message:
Committed patchset #3 (id:40001) manually as
5f49fef32594090eec7fd1a1bb71c99f568c3622 (presubmit successful).

Description:
check for null context on execution entry

blink is incorrectly calling api functions without a context. we need this to
find those places

[email protected]

BUG=v8:3929
LOG=y

Committed:
https://chromium.googlesource.com/v8/v8/+/5f49fef32594090eec7fd1a1bb71c99f568c3622

Please review this at https://codereview.chromium.org/968943002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+11, -4 lines):
  M src/api.cc


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_;
 };


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to