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

Unified Diff: src/runtime/runtime-generator.cc

Issue 1883443003: [generators] Simplify %CreateJSGeneratorObject (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add back initialization of continuation, just to be on the safe side. Created 4 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/runtime/runtime.h ('k') | test/cctest/test-ast-expression-visitor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-generator.cc
diff --git a/src/runtime/runtime-generator.cc b/src/runtime/runtime-generator.cc
index 5e64a477bc98ae235b316398cb6474c9cbe6ceb8..eeac3ad6b64b934b897387313139d88ccaa6eb4e 100644
--- a/src/runtime/runtime-generator.cc
+++ b/src/runtime/runtime-generator.cc
@@ -14,22 +14,18 @@ namespace internal {
RUNTIME_FUNCTION(Runtime_CreateJSGeneratorObject) {
HandleScope scope(isolate);
- DCHECK(args.length() == 0);
-
- JavaScriptFrameIterator it(isolate);
- JavaScriptFrame* frame = it.frame();
- Handle<JSFunction> function(frame->function());
+ DCHECK(args.length() == 2);
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
+ CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1);
RUNTIME_ASSERT(function->shared()->is_generator());
- Handle<JSGeneratorObject> generator;
- DCHECK(!frame->IsConstructor());
- generator = isolate->factory()->NewJSGeneratorObject(function);
+ Handle<JSGeneratorObject> generator =
+ isolate->factory()->NewJSGeneratorObject(function);
generator->set_function(*function);
- generator->set_context(Context::cast(frame->context()));
- generator->set_receiver(frame->receiver());
- generator->set_continuation(0);
+ generator->set_context(isolate->context());
+ generator->set_receiver(*receiver);
generator->set_operand_stack(isolate->heap()->empty_fixed_array());
-
+ generator->set_continuation(JSGeneratorObject::kGeneratorExecuting);
return *generator;
}
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/test-ast-expression-visitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698