Commit 644b26e6 authored by Adam Klein's avatar Adam Klein Committed by Commit Bot

[parser] Remove dead BuildIteratorClose() method

Presumably this was obsoleted when this functionality moved to
the BytecodeGenerator.

Change-Id: I691fdaa01610ea050511825b5ad1f3ba4963421c
Reviewed-on: https://chromium-review.googlesource.com/c/1387991Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58453}
parent a70e5372
......@@ -3632,105 +3632,6 @@ Statement* Parser::CheckCallable(Variable* var, Expression* error, int pos) {
return validate_var;
}
void Parser::BuildIteratorClose(ZonePtrList<Statement>* statements,
Variable* iterator, Variable* input,
Variable* var_output, IteratorType type) {
//
// This function adds four statements to [statements], corresponding to the
// following code:
//
// let iteratorReturn = iterator.return;
// if (IS_NULL_OR_UNDEFINED(iteratorReturn) {
// return {value: input, done: true};
// }
// output = %_Call(iteratorReturn, iterator, input);
// if (!IS_RECEIVER(output)) %ThrowIterResultNotAnObject(output);
//
const int nopos = kNoSourcePosition;
// let iteratorReturn = iterator.return;
Variable* var_return = var_output; // Reusing the output variable.
Statement* get_return;
{
Expression* iterator_proxy = factory()->NewVariableProxy(iterator);
Expression* literal = factory()->NewStringLiteral(
ast_value_factory()->return_string(), nopos);
Expression* property =
factory()->NewProperty(iterator_proxy, literal, nopos);
Expression* return_proxy = factory()->NewVariableProxy(var_return);
Expression* assignment =
factory()->NewAssignment(Token::ASSIGN, return_proxy, property, nopos);
get_return = factory()->NewExpressionStatement(assignment, nopos);
}
// if (IS_NULL_OR_UNDEFINED(iteratorReturn) {
// return {value: input, done: true};
// }
Statement* check_return;
{
Expression* condition = factory()->NewCompareOperation(
Token::EQ, factory()->NewVariableProxy(var_return),
factory()->NewNullLiteral(nopos), nopos);
Expression* value = factory()->NewVariableProxy(input);
Statement* return_input = BuildReturnStatement(value, nopos);
check_return = factory()->NewIfStatement(
condition, return_input, factory()->EmptyStatement(), nopos);
}
// output = %_Call(iteratorReturn, iterator, input);
Statement* call_return;
{
ScopedPtrList<Expression> args(pointer_buffer());
args.Add(factory()->NewVariableProxy(var_return));
args.Add(factory()->NewVariableProxy(iterator));
args.Add(factory()->NewVariableProxy(input));
Expression* call =
factory()->NewCallRuntime(Runtime::kInlineCall, args, nopos);
if (type == IteratorType::kAsync) {
function_state_->AddSuspend();
call = factory()->NewAwait(call, nopos);
}
Expression* output_proxy = factory()->NewVariableProxy(var_output);
Expression* assignment =
factory()->NewAssignment(Token::ASSIGN, output_proxy, call, nopos);
call_return = factory()->NewExpressionStatement(assignment, nopos);
}
// if (!IS_RECEIVER(output)) %ThrowIteratorResultNotAnObject(output);
Statement* validate_output;
{
Expression* is_receiver_call;
{
ScopedPtrList<Expression> args(pointer_buffer());
args.Add(factory()->NewVariableProxy(var_output));
is_receiver_call =
factory()->NewCallRuntime(Runtime::kInlineIsJSReceiver, args, nopos);
}
Statement* throw_call;
{
ScopedPtrList<Expression> args(pointer_buffer());
args.Add(factory()->NewVariableProxy(var_output));
Expression* call = factory()->NewCallRuntime(
Runtime::kThrowIteratorResultNotAnObject, args, nopos);
throw_call = factory()->NewExpressionStatement(call, nopos);
}
validate_output = factory()->NewIfStatement(
is_receiver_call, factory()->EmptyStatement(), throw_call, nopos);
}
statements->Add(get_return, zone());
statements->Add(check_return, zone());
statements->Add(call_return, zone());
statements->Add(validate_output, zone());
}
void Parser::FinalizeIteratorUse(Variable* completion, Expression* condition,
Variable* iter, Block* iterator_use,
Block* target, IteratorType type) {
......
......@@ -576,9 +576,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion,
IteratorType type, int pos);
void BuildIteratorClose(ZonePtrList<Statement>* statements,
Variable* iterator, Variable* input, Variable* output,
IteratorType type);
void BuildIteratorCloseForCompletion(ZonePtrList<Statement>* statements,
Variable* iterator,
Expression* completion,
......
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