Index: src/interpreter/interpreter-intrinsics.cc |
diff --git a/src/interpreter/interpreter-intrinsics.cc b/src/interpreter/interpreter-intrinsics.cc |
index a2820fb1286aeb49f52f0ced856fee705929e3af..d131f62e7769538557391d4eb1cede16492fc437 100644 |
--- a/src/interpreter/interpreter-intrinsics.cc |
+++ b/src/interpreter/interpreter-intrinsics.cc |
@@ -389,6 +389,42 @@ Node* IntrinsicsHelper::ClassOf(Node* args_reg, Node* arg_count, |
return return_value.value(); |
} |
+Node* IntrinsicsHelper::CreateAsyncFromSyncIterator(Node* args_reg, |
+ Node* arg_count, |
+ Node* context) { |
+ InterpreterAssembler::Label not_receiver( |
+ assembler_, InterpreterAssembler::Label::kDeferred); |
+ InterpreterAssembler::Label done(assembler_); |
+ InterpreterAssembler::Variable return_value(assembler_, |
+ MachineRepresentation::kTagged); |
+ |
+ Node* sync_iterator = __ LoadRegister(args_reg); |
+ |
+ __ GotoIf(__ TaggedIsSmi(sync_iterator), ¬_receiver); |
+ __ GotoUnless(__ IsJSReceiver(sync_iterator), ¬_receiver); |
+ |
+ Node* const native_context = __ LoadNativeContext(context); |
+ Node* const map = __ LoadContextElement( |
+ native_context, Context::INITIAL_ASYNC_FROM_SYNC_ITERATOR_MAP_INDEX); |
+ Node* const iterator = __ AllocateJSObjectFromMap(map); |
+ |
+ __ StoreObjectFieldNoWriteBarrier( |
+ iterator, JSAsyncFromSyncIterator::kSyncIteratorOffset, sync_iterator); |
+ |
+ return_value.Bind(iterator); |
+ __ Goto(&done); |
+ |
+ __ Bind(¬_receiver); |
+ { |
+ return_value.Bind( |
+ __ CallRuntime(Runtime::kThrowSymbolIteratorInvalid, context)); |
+ __ Goto(&done); |
+ } |
+ |
+ __ Bind(&done); |
+ return return_value.value(); |
+} |
+ |
void IntrinsicsHelper::AbortIfArgCountMismatch(int expected, Node* actual) { |
InterpreterAssembler::Label match(assembler_); |
Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); |