Setup local var descriptors in kernel mode.
Closes https://github.com/dart-lang/sdk/issues/28054 R=kmillikin@google.com Review-Url: https://codereview.chromium.org/2589733002 .
This commit is contained in:
@@ -1593,8 +1593,12 @@ void Compiler::ComputeLocalVarDescriptors(const Code& code) {
|
||||
// if state changed while compiling in background.
|
||||
LongJumpScope jump;
|
||||
if (setjmp(*jump.Set()) == 0) {
|
||||
Parser::ParseFunction(parsed_function);
|
||||
parsed_function->AllocateVariables();
|
||||
if (function.kernel_function() == NULL) {
|
||||
Parser::ParseFunction(parsed_function);
|
||||
parsed_function->AllocateVariables();
|
||||
} else {
|
||||
parsed_function->EnsureKernelScopes();
|
||||
}
|
||||
const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle(
|
||||
parsed_function->node_sequence()->scope()->GetVarDescriptors(function));
|
||||
ASSERT(!var_descs.IsNull());
|
||||
|
||||
@@ -662,7 +662,7 @@ void ScopeBuilder::VisitFunctionNode(FunctionNode* node) {
|
||||
node->body()->AcceptStatementVisitor(this);
|
||||
}
|
||||
|
||||
// Ensure that :await_jump_var and :await_ctx_var are captured.
|
||||
// Ensure that :await_jump_var, :await_ctx_var and :async_op are captured.
|
||||
if (node->async_marker() == FunctionNode::kSyncYielding) {
|
||||
{
|
||||
LocalVariable* temp = NULL;
|
||||
@@ -676,6 +676,13 @@ void ScopeBuilder::VisitFunctionNode(FunctionNode* node) {
|
||||
(depth_.function_ == 0) ? &result_->yield_context_variable : &temp,
|
||||
Symbols::AwaitContextVar());
|
||||
}
|
||||
{
|
||||
LocalVariable* temp =
|
||||
scope_->LookupVariable(Symbols::AsyncOperation(), true);
|
||||
if (temp != NULL) {
|
||||
scope_->CaptureVariable(temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13822,9 +13822,6 @@ RawLocalVarDescriptors* Code::GetLocalVarDescriptors() const {
|
||||
if (v.IsNull()) {
|
||||
ASSERT(!is_optimized());
|
||||
const Function& f = Function::Handle(function());
|
||||
if (f.kernel_function() != NULL) {
|
||||
return v.raw();
|
||||
}
|
||||
ASSERT(!f.IsIrregexpFunction()); // Not yet implemented.
|
||||
Compiler::ComputeLocalVarDescriptors(*this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user