Commit 8b5783dc authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[cleanup] TNodify builtins-generator-gen.cc

Bug: v8:9810, v8:6949
Change-Id: If40852159e67b9bd0d6e5c7c6259fadf8b8ec3bc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1893345
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64696}
parent 82144cf3
...@@ -26,21 +26,23 @@ class GeneratorBuiltinsAssembler : public CodeStubAssembler { ...@@ -26,21 +26,23 @@ class GeneratorBuiltinsAssembler : public CodeStubAssembler {
// prototype methods as well as AsyncModuleEvaluate. The only difference // prototype methods as well as AsyncModuleEvaluate. The only difference
// between AsyncModuleEvaluate and JSGeneratorObject::PrototypeNext is // between AsyncModuleEvaluate and JSGeneratorObject::PrototypeNext is
// the expected reciever. // the expected reciever.
void InnerResume(CodeStubArguments* args, Node* receiver, Node* value, void InnerResume(CodeStubArguments* args, TNode<JSGeneratorObject> receiver,
Node* context, JSGeneratorObject::ResumeMode resume_mode, TNode<Object> value, TNode<Context> context,
JSGeneratorObject::ResumeMode resume_mode,
char const* const method_name); char const* const method_name);
void GeneratorPrototypeResume(CodeStubArguments* args, Node* receiver, void GeneratorPrototypeResume(CodeStubArguments* args, TNode<Object> receiver,
Node* value, Node* context, TNode<Object> value, TNode<Context> context,
JSGeneratorObject::ResumeMode resume_mode, JSGeneratorObject::ResumeMode resume_mode,
char const* const method_name); char const* const method_name);
}; };
void GeneratorBuiltinsAssembler::InnerResume( void GeneratorBuiltinsAssembler::InnerResume(
CodeStubArguments* args, Node* receiver, Node* value, Node* context, CodeStubArguments* args, TNode<JSGeneratorObject> receiver,
TNode<Object> value, TNode<Context> context,
JSGeneratorObject::ResumeMode resume_mode, char const* const method_name) { JSGeneratorObject::ResumeMode resume_mode, char const* const method_name) {
// Check if the {receiver} is running or already closed. // Check if the {receiver} is running or already closed.
TNode<Smi> receiver_continuation = TNode<Smi> receiver_continuation =
CAST(LoadObjectField(receiver, JSGeneratorObject::kContinuationOffset)); LoadObjectField<Smi>(receiver, JSGeneratorObject::kContinuationOffset);
Label if_receiverisclosed(this, Label::kDeferred), Label if_receiverisclosed(this, Label::kDeferred),
if_receiverisrunning(this, Label::kDeferred); if_receiverisrunning(this, Label::kDeferred);
TNode<Smi> closed = SmiConstant(JSGeneratorObject::kGeneratorClosed); TNode<Smi> closed = SmiConstant(JSGeneratorObject::kGeneratorClosed);
...@@ -64,7 +66,7 @@ void GeneratorBuiltinsAssembler::InnerResume( ...@@ -64,7 +66,7 @@ void GeneratorBuiltinsAssembler::InnerResume(
// If the generator is not suspended (i.e., its state is 'executing'), // If the generator is not suspended (i.e., its state is 'executing'),
// close it and wrap the return value in IteratorResult. // close it and wrap the return value in IteratorResult.
TNode<Smi> result_continuation = TNode<Smi> result_continuation =
CAST(LoadObjectField(receiver, JSGeneratorObject::kContinuationOffset)); LoadObjectField<Smi>(receiver, JSGeneratorObject::kContinuationOffset);
// The generator function should not close the generator by itself, let's // The generator function should not close the generator by itself, let's
// check it is indeed not closed yet. // check it is indeed not closed yet.
...@@ -88,7 +90,7 @@ void GeneratorBuiltinsAssembler::InnerResume( ...@@ -88,7 +90,7 @@ void GeneratorBuiltinsAssembler::InnerResume(
BIND(&if_receiverisclosed); BIND(&if_receiverisclosed);
{ {
// The {receiver} is closed already. // The {receiver} is closed already.
Node* result = nullptr; TNode<Object> result;
switch (resume_mode) { switch (resume_mode) {
case JSGeneratorObject::kNext: case JSGeneratorObject::kNext:
result = CallBuiltin(Builtins::kCreateIterResultObject, context, result = CallBuiltin(Builtins::kCreateIterResultObject, context,
...@@ -118,12 +120,14 @@ void GeneratorBuiltinsAssembler::InnerResume( ...@@ -118,12 +120,14 @@ void GeneratorBuiltinsAssembler::InnerResume(
} }
void GeneratorBuiltinsAssembler::GeneratorPrototypeResume( void GeneratorBuiltinsAssembler::GeneratorPrototypeResume(
CodeStubArguments* args, Node* receiver, Node* value, Node* context, CodeStubArguments* args, TNode<Object> receiver, TNode<Object> value,
JSGeneratorObject::ResumeMode resume_mode, char const* const method_name) { TNode<Context> context, JSGeneratorObject::ResumeMode resume_mode,
char const* const method_name) {
// Check if the {receiver} is actually a JSGeneratorObject. // Check if the {receiver} is actually a JSGeneratorObject.
ThrowIfNotInstanceType(context, receiver, JS_GENERATOR_OBJECT_TYPE, ThrowIfNotInstanceType(context, receiver, JS_GENERATOR_OBJECT_TYPE,
method_name); method_name);
InnerResume(args, receiver, value, context, resume_mode, method_name); TNode<JSGeneratorObject> generator = CAST(receiver);
InnerResume(args, generator, value, context, resume_mode, method_name);
} }
TF_BUILTIN(AsyncModuleEvaluate, GeneratorBuiltinsAssembler) { TF_BUILTIN(AsyncModuleEvaluate, GeneratorBuiltinsAssembler) {
...@@ -142,7 +146,8 @@ TF_BUILTIN(AsyncModuleEvaluate, GeneratorBuiltinsAssembler) { ...@@ -142,7 +146,8 @@ TF_BUILTIN(AsyncModuleEvaluate, GeneratorBuiltinsAssembler) {
char const* const method_name = "[AsyncModule].evaluate"; char const* const method_name = "[AsyncModule].evaluate";
ThrowIfNotInstanceType(context, receiver, JS_ASYNC_FUNCTION_OBJECT_TYPE, ThrowIfNotInstanceType(context, receiver, JS_ASYNC_FUNCTION_OBJECT_TYPE,
method_name); method_name);
InnerResume(&args, receiver, value, context, JSGeneratorObject::kNext, TNode<JSAsyncFunctionObject> async_function = CAST(receiver);
InnerResume(&args, async_function, value, context, JSGeneratorObject::kNext,
method_name); method_name);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment