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

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

Issue 1904933002: Introduce bytecodes for assisting generator suspend and resume. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Nix 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/interpreter/bytecode_expectations/Generators.golden » ('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 9c875300c6ba1aaf3d2fc90564f32d65bffaf2ef..602b2c66cccbc0e21972a31baa09d8b482b2dc61 100644
--- a/src/runtime/runtime-generator.cc
+++ b/src/runtime/runtime-generator.cc
@@ -145,60 +145,5 @@ RUNTIME_FUNCTION(Runtime_GeneratorGetSourcePosition) {
return isolate->heap()->undefined_value();
}
-
-RUNTIME_FUNCTION(Runtime_SuspendIgnitionGenerator) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
- CONVERT_ARG_HANDLE_CHECKED(Smi, state, 1);
-
- JavaScriptFrameIterator it(isolate);
- JavaScriptFrame* frame = it.frame();
- Handle<JSFunction> function(frame->function());
- CHECK(function->shared()->is_generator());
- CHECK_EQ(frame->type(), StackFrame::INTERPRETED);
-
- // Save register file.
- int size = function->shared()->bytecode_array()->register_count();
- Handle<FixedArray> register_file = isolate->factory()->NewFixedArray(size);
- for (int i = 0; i < size; ++i) {
- Object* value =
- static_cast<InterpretedFrame*>(frame)->ReadInterpreterRegister(i);
- register_file->set(i, value);
- }
-
- generator->set_operand_stack(*register_file);
- generator->set_context(Context::cast(frame->context()));
- generator->set_continuation(state->value());
-
- return isolate->heap()->undefined_value();
-}
-
-
-RUNTIME_FUNCTION(Runtime_ResumeIgnitionGenerator) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
-
- JavaScriptFrameIterator it(isolate);
- JavaScriptFrame* frame = it.frame();
- Handle<JSFunction> function(frame->function());
- CHECK(function->shared()->is_generator());
- CHECK_EQ(frame->type(), StackFrame::INTERPRETED);
-
- // Restore register file.
- int size = function->shared()->bytecode_array()->register_count();
- DCHECK_EQ(size, generator->operand_stack()->length());
- for (int i = 0; i < size; ++i) {
- Object* value = generator->operand_stack()->get(i);
- static_cast<InterpretedFrame*>(frame)->WriteInterpreterRegister(i, value);
- }
- generator->set_operand_stack(isolate->heap()->empty_fixed_array());
-
- int state = generator->continuation();
- generator->set_continuation(JSGeneratorObject::kGeneratorExecuting);
- return Smi::FromInt(state);
-}
-
} // namespace internal
} // namespace v8
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/interpreter/bytecode_expectations/Generators.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698