Index: src/runtime/runtime-generator.cc |
diff --git a/src/runtime/runtime-generator.cc b/src/runtime/runtime-generator.cc |
index 71d7059bf8bccf790fcdf346a7f4c8bea729cbef..91766394522412a25939b16d4221287e22f52e73 100644 |
--- a/src/runtime/runtime-generator.cc |
+++ b/src/runtime/runtime-generator.cc |
@@ -129,7 +129,16 @@ RUNTIME_FUNCTION(Runtime_GeneratorGetResumeMode) { |
} |
-// Returns generator continuation as a PC offset, or the magic -1 or 0 values. |
+RUNTIME_FUNCTION(Runtime_GeneratorSetContext) { |
+ HandleScope scope(isolate); |
+ DCHECK(args.length() == 1); |
+ CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); |
+ |
+ generator->set_context(isolate->context()); |
+ return isolate->heap()->undefined_value(); |
+} |
+ |
+ |
RUNTIME_FUNCTION(Runtime_GeneratorGetContinuation) { |
HandleScope scope(isolate); |
DCHECK(args.length() == 1); |
@@ -139,6 +148,45 @@ RUNTIME_FUNCTION(Runtime_GeneratorGetContinuation) { |
} |
+RUNTIME_FUNCTION(Runtime_GeneratorSetContinuation) { |
+ HandleScope scope(isolate); |
+ DCHECK(args.length() == 2); |
+ CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); |
+ CONVERT_SMI_ARG_CHECKED(continuation, 1); |
+ |
+ generator->set_continuation(continuation); |
+ return isolate->heap()->undefined_value(); |
+} |
+ |
+ |
+RUNTIME_FUNCTION(Runtime_GeneratorLoadRegister) { |
+ HandleScope scope(isolate); |
+ DCHECK(args.length() == 2); |
+ CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); |
+ CONVERT_SMI_ARG_CHECKED(index, 1); |
+ |
+ DCHECK(FLAG_ignition && FLAG_ignition_generators); |
+ DCHECK(generator->function()->shared()->HasBytecodeArray()); |
+ |
+ return generator->operand_stack()->get(index); |
+} |
+ |
+ |
+RUNTIME_FUNCTION(Runtime_GeneratorStoreRegister) { |
+ HandleScope scope(isolate); |
+ DCHECK(args.length() == 3); |
+ CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0); |
+ CONVERT_SMI_ARG_CHECKED(index, 1); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
+ |
+ DCHECK(FLAG_ignition && FLAG_ignition_generators); |
+ DCHECK(generator->function()->shared()->HasBytecodeArray()); |
+ |
+ generator->operand_stack()->set(index, *value); |
+ return isolate->heap()->undefined_value(); |
+} |
+ |
+ |
RUNTIME_FUNCTION(Runtime_GeneratorGetSourcePosition) { |
HandleScope scope(isolate); |
DCHECK(args.length() == 1); |