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

Unified Diff: src/api.h

Issue 2155503004: Reland^2 "Don't compile functions in a context the caller doesn't have access to" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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 | « include/v8.h ('k') | src/api.cc » ('j') | src/api.cc » ('J')
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 18425789a21d40822abaa33f520c8fc1cf7e8008..a5c39ba698e214380fd2e78d29dfeafd896f8cd7 100644
--- a/src/api.h
+++ b/src/api.h
@@ -453,6 +453,7 @@ class HandleScopeImplementer {
blocks_(0),
entered_contexts_(0),
saved_contexts_(0),
+ microtask_context_(nullptr),
spare_(NULL),
call_depth_(0),
microtasks_depth_(0),
@@ -519,6 +520,10 @@ class HandleScopeImplementer {
// contexts have been entered.
inline Handle<Context> LastEnteredContext();
+ inline void EnterMicrotaskContext(Handle<Context> context);
+ inline void LeaveMicrotaskContext();
+ inline Handle<Context> MicrotaskContext();
+
inline void SaveContext(Context* context);
inline Context* RestoreContext();
inline bool HasSavedContexts();
@@ -537,6 +542,7 @@ class HandleScopeImplementer {
blocks_.Initialize(0);
entered_contexts_.Initialize(0);
saved_contexts_.Initialize(0);
+ microtask_context_ = nullptr;
spare_ = NULL;
last_handle_before_deferred_block_ = NULL;
call_depth_ = 0;
@@ -546,6 +552,7 @@ class HandleScopeImplementer {
DCHECK(blocks_.length() == 0);
DCHECK(entered_contexts_.length() == 0);
DCHECK(saved_contexts_.length() == 0);
+ DCHECK(!microtask_context_);
blocks_.Free();
entered_contexts_.Free();
saved_contexts_.Free();
@@ -565,6 +572,7 @@ class HandleScopeImplementer {
List<Context*> entered_contexts_;
// Used as a stack to keep track of saved contexts.
List<Context*> saved_contexts_;
+ Context* microtask_context_;
Object** spare_;
int call_depth_;
int microtasks_depth_;
@@ -637,6 +645,20 @@ Handle<Context> HandleScopeImplementer::LastEnteredContext() {
return Handle<Context>(entered_contexts_.last());
}
+void HandleScopeImplementer::EnterMicrotaskContext(Handle<Context> context) {
+ DCHECK(!microtask_context_);
+ microtask_context_ = *context;
+}
+
+void HandleScopeImplementer::LeaveMicrotaskContext() {
+ DCHECK(microtask_context_);
+ microtask_context_ = nullptr;
+}
+
+Handle<Context> HandleScopeImplementer::MicrotaskContext() {
+ if (microtask_context_) return Handle<Context>(microtask_context_);
+ return Handle<Context>::null();
+}
// If there's a spare block, use it for growing the current scope.
internal::Object** HandleScopeImplementer::GetSpareOrNewBlock() {
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | src/api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698