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

Unified Diff: src/api.h

Issue 2350933007: Make sure to use the correct context for eval checks (Closed)
Patch Set: updates Created 4 years, 3 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 | src/builtins/builtins.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.h
diff --git a/src/api.h b/src/api.h
index 233be0ea9eeb8f6e7041923b4631cd47aa140b60..ad83ca7a3cb54924e7f7f92dc27bdd246b64479f 100644
--- a/src/api.h
+++ b/src/api.h
@@ -389,6 +389,7 @@ class HandleScopeImplementer {
call_depth_(0),
microtasks_depth_(0),
microtasks_suppressions_(0),
+ entered_context_count_during_microtasks_(0),
#ifdef DEBUG
debug_microtasks_depth_(0),
#endif
@@ -454,6 +455,11 @@ class HandleScopeImplementer {
inline void EnterMicrotaskContext(Handle<Context> context);
inline void LeaveMicrotaskContext();
inline Handle<Context> MicrotaskContext();
+ inline bool MicrotaskContextIsLastEnteredContext() const {
+ return microtask_context_ &&
+ entered_context_count_during_microtasks_ ==
+ entered_contexts_.length();
+ }
inline void SaveContext(Context* context);
inline Context* RestoreContext();
@@ -474,6 +480,7 @@ class HandleScopeImplementer {
entered_contexts_.Initialize(0);
saved_contexts_.Initialize(0);
microtask_context_ = nullptr;
+ entered_context_count_during_microtasks_ = 0;
spare_ = NULL;
last_handle_before_deferred_block_ = NULL;
call_depth_ = 0;
@@ -508,6 +515,7 @@ class HandleScopeImplementer {
int call_depth_;
int microtasks_depth_;
int microtasks_suppressions_;
+ int entered_context_count_during_microtasks_;
#ifdef DEBUG
int debug_microtasks_depth_;
#endif
@@ -579,11 +587,13 @@ Handle<Context> HandleScopeImplementer::LastEnteredContext() {
void HandleScopeImplementer::EnterMicrotaskContext(Handle<Context> context) {
DCHECK(!microtask_context_);
microtask_context_ = *context;
+ entered_context_count_during_microtasks_ = entered_contexts_.length();
}
void HandleScopeImplementer::LeaveMicrotaskContext() {
DCHECK(microtask_context_);
microtask_context_ = nullptr;
+ entered_context_count_during_microtasks_ = 0;
}
Handle<Context> HandleScopeImplementer::MicrotaskContext() {
« no previous file with comments | « no previous file | src/builtins/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698