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

Unified Diff: src/runtime.cc

Issue 14416011: Fix yield inside with (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Add assertion Created 7 years, 8 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 | « src/parser.cc ('k') | src/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index a45caf4d4286f04ff7c1084d90d95ce2fa9181f1..c942d029d45e0614ee8e5cd6cf84ebf84fc962b2 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -2459,16 +2459,18 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SuspendJSGeneratorObject) {
ASSERT_EQ(generator_object->operand_stack(),
isolate->heap()->empty_fixed_array());
// If there are no operands on the stack, there shouldn't be a handler
- // active either. Also, the active context will be the same as the function
- // itself, so there is no need to save the context.
- ASSERT_EQ(frame->context(), generator_object->context());
+ // active either.
ASSERT(!frame->HasHandler());
} else {
- generator_object->set_context(Context::cast(frame->context()));
// TODO(wingo): Save the operand stack and/or the stack handlers.
UNIMPLEMENTED();
}
+ // It's possible for the context to be other than the initial context even if
+ // there is no stack handler active. For example, this is the case in the
+ // body of a "with" statement. Therefore we always save the context.
+ generator_object->set_context(Context::cast(frame->context()));
+
// The return value is the hole for a suspend return, and anything else for a
// resume return.
return isolate->heap()->the_hole_value();
« no previous file with comments | « src/parser.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698