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

Unified Diff: src/isolate.cc

Issue 332923003: Run JS micro tasks in the appropriate context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index a4b311f6ecacd7d4b4a760931475bf4d9405c2ec..a387c20b28cc964ec2ec02895f7eb4ae9e7bbdb7 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -2292,12 +2292,10 @@ void Isolate::EnqueueMicrotask(Handle<Object> microtask) {
void Isolate::RunMicrotasks() {
- // TODO(adamk): This ASSERT triggers in mjsunit tests which
- // call the %RunMicrotasks runtime function. But it should
- // never happen outside of tests, so it would be nice to
- // uncomment it.
- //
- // ASSERT(handle_scope_implementer()->CallDepthIsZero());
+ // In some mjsunit tests %RunMicrotasks is called explicitly, violating
+ // this assertion. Therefore we also check for --allow-natives-syntax.
+ ASSERT(FLAG_allow_natives_syntax ||
+ handle_scope_implementer()->CallDepthIsZero());
// Increase call depth to prevent recursive callbacks.
v8::Isolate::SuppressMicrotaskExecutionScope suppress(
@@ -2317,6 +2315,8 @@ void Isolate::RunMicrotasks() {
if (microtask->IsJSFunction()) {
Handle<JSFunction> microtask_function =
Handle<JSFunction>::cast(microtask);
+ SaveContext save(this);
+ set_context(microtask_function->context()->native_context());
Handle<Object> exception;
MaybeHandle<Object> result = Execution::TryCall(
microtask_function, factory()->undefined_value(),
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698