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:
Jens Johansen
2017-01-03 10:23:31 +01:00
parent 760c048798
commit d591b59fcd
3 changed files with 14 additions and 6 deletions
+6 -2
View File
@@ -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());
+8 -1
View File
@@ -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);
}
}
}
}
-3
View File
@@ -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);
}