Upgrade V8 to 5.1.281.57 DO NOT MERGE
FPIIM-449
Change-Id: Id981b686b4d587ac31697662eb98bb34be42ad90
(cherry picked from commit 3b9bc31999c9787eb726ecdbfd5796bfdec32a18)
diff --git a/src/api.h b/src/api.h
index 5567652..cb2b5c3 100644
--- a/src/api.h
+++ b/src/api.h
@@ -452,6 +452,12 @@
saved_contexts_(0),
spare_(NULL),
call_depth_(0),
+ microtasks_depth_(0),
+ microtasks_suppressions_(0),
+#ifdef DEBUG
+ debug_microtasks_depth_(0),
+#endif
+ microtasks_policy_(v8::MicrotasksPolicy::kAuto),
last_handle_before_deferred_block_(NULL) { }
~HandleScopeImplementer() {
@@ -472,10 +478,36 @@
inline internal::Object** GetSpareOrNewBlock();
inline void DeleteExtensions(internal::Object** prev_limit);
+ // Call depth represents nested v8 api calls.
inline void IncrementCallDepth() {call_depth_++;}
inline void DecrementCallDepth() {call_depth_--;}
inline bool CallDepthIsZero() { return call_depth_ == 0; }
+ // Microtasks scope depth represents nested scopes controlling microtasks
+ // invocation, which happens when depth reaches zero.
+ inline void IncrementMicrotasksScopeDepth() {microtasks_depth_++;}
+ inline void DecrementMicrotasksScopeDepth() {microtasks_depth_--;}
+ inline int GetMicrotasksScopeDepth() { return microtasks_depth_; }
+
+ // Possibly nested microtasks suppression scopes prevent microtasks
+ // from running.
+ inline void IncrementMicrotasksSuppressions() {microtasks_suppressions_++;}
+ inline void DecrementMicrotasksSuppressions() {microtasks_suppressions_--;}
+ inline bool HasMicrotasksSuppressions() { return !!microtasks_suppressions_; }
+
+#ifdef DEBUG
+ // In debug we check that calls not intended to invoke microtasks are
+ // still correctly wrapped with microtask scopes.
+ inline void IncrementDebugMicrotasksScopeDepth() {debug_microtasks_depth_++;}
+ inline void DecrementDebugMicrotasksScopeDepth() {debug_microtasks_depth_--;}
+ inline bool DebugMicrotasksScopeDepthIsZero() {
+ return debug_microtasks_depth_ == 0;
+ }
+#endif
+
+ inline void set_microtasks_policy(v8::MicrotasksPolicy policy);
+ inline v8::MicrotasksPolicy microtasks_policy() const;
+
inline void EnterContext(Handle<Context> context);
inline void LeaveContext();
inline bool LastEnteredContextWas(Handle<Context> context);
@@ -532,6 +564,12 @@
List<Context*> saved_contexts_;
Object** spare_;
int call_depth_;
+ int microtasks_depth_;
+ int microtasks_suppressions_;
+#ifdef DEBUG
+ int debug_microtasks_depth_;
+#endif
+ v8::MicrotasksPolicy microtasks_policy_;
Object** last_handle_before_deferred_block_;
// This is only used for threading support.
HandleScopeData handle_scope_data_;
@@ -550,6 +588,17 @@
const int kHandleBlockSize = v8::internal::KB - 2; // fit in one page
+void HandleScopeImplementer::set_microtasks_policy(
+ v8::MicrotasksPolicy policy) {
+ microtasks_policy_ = policy;
+}
+
+
+v8::MicrotasksPolicy HandleScopeImplementer::microtasks_policy() const {
+ return microtasks_policy_;
+}
+
+
void HandleScopeImplementer::SaveContext(Context* context) {
saved_contexts_.Add(context);
}