Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: runtime/vm/scopes.cc

Issue 1361423004: Don't use a special var descriptor for :async_op since it can now be either stack or context alloca… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: also assert async op is either closure or null Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« runtime/vm/object.cc ('K') | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scopes.cc
diff --git a/runtime/vm/scopes.cc b/runtime/vm/scopes.cc
index 139705a0079817463415683fd9f7b4dcf19c348e..0881b8725ec851b723d6724bf9e3824a51c00deb 100644
--- a/runtime/vm/scopes.cc
+++ b/runtime/vm/scopes.cc
@@ -250,8 +250,12 @@ int LocalScope::AllocateVariables(int first_parameter_index,
// The parser creates internal variables that start with ":"
-static bool IsInternalIdentifier(const String& str) {
+static bool IsFilteredIdentifier(const String& str) {
ASSERT(str.Length() > 0);
+ if (str.raw() == Symbols::AsyncOperation().raw()) {
+ // Keep :async_op for asynchronous debugging.
+ return false;
+ }
return str.CharAt(0) == ':';
}
@@ -266,10 +270,8 @@ RawLocalVarDescriptors* LocalScope::GetVarDescriptors(const Function& func) {
for (int i = 0; i < context_scope.num_variables(); i++) {
String& name = String::Handle(context_scope.NameAt(i));
RawLocalVarDescriptors::VarInfoKind kind;
- if (!IsInternalIdentifier(name)) {
+ if (!IsFilteredIdentifier(name)) {
kind = RawLocalVarDescriptors::kContextVar;
- } else if (name.raw() == Symbols::AsyncOperation().raw()) {
- kind = RawLocalVarDescriptors::kAsyncOperation;
} else {
continue;
}
@@ -319,24 +321,7 @@ void LocalScope::CollectLocalVariables(GrowableArray<VarDesc>* vars,
for (int i = 0; i < this->variables_.length(); i++) {
LocalVariable* var = variables_[i];
if ((var->owner() == this) && !var->is_invisible()) {
- if (!IsInternalIdentifier(var->name())) {
- // This is a regular Dart variable, either stack-based or captured.
- VarDesc desc;
- desc.name = &var->name();
- if (var->is_captured()) {
- desc.info.set_kind(RawLocalVarDescriptors::kContextVar);
- ASSERT(var->owner() != NULL);
- ASSERT(var->owner()->context_level() >= 0);
- desc.info.scope_id = var->owner()->context_level();
- } else {
- desc.info.set_kind(RawLocalVarDescriptors::kStackVar);
- desc.info.scope_id = *scope_id;
- }
- desc.info.begin_pos = var->token_pos();
- desc.info.end_pos = var->owner()->end_token_pos();
- desc.info.set_index(var->index());
- vars->Add(desc);
- } else if (var->name().raw() == Symbols::CurrentContextVar().raw()) {
+ if (var->name().raw() == Symbols::CurrentContextVar().raw()) {
// This is the local variable in which the function saves its
// own context before calling a closure function.
VarDesc desc;
@@ -347,21 +332,21 @@ void LocalScope::CollectLocalVariables(GrowableArray<VarDesc>* vars,
desc.info.end_pos = 0;
desc.info.set_index(var->index());
vars->Add(desc);
- } else if (var->name().raw() == Symbols::AsyncOperation().raw()) {
- // The async continuation.
- ASSERT(var->is_captured());
+ } else if (!IsFilteredIdentifier(var->name())) {
+ // This is a regular Dart variable, either stack-based or captured.
VarDesc desc;
desc.name = &var->name();
- desc.info.set_kind(RawLocalVarDescriptors::kAsyncOperation);
if (var->is_captured()) {
+ desc.info.set_kind(RawLocalVarDescriptors::kContextVar);
ASSERT(var->owner() != NULL);
ASSERT(var->owner()->context_level() >= 0);
desc.info.scope_id = var->owner()->context_level();
} else {
+ desc.info.set_kind(RawLocalVarDescriptors::kStackVar);
desc.info.scope_id = *scope_id;
}
- desc.info.begin_pos = 0;
- desc.info.end_pos = 0;
+ desc.info.begin_pos = var->token_pos();
+ desc.info.end_pos = var->owner()->end_token_pos();
desc.info.set_index(var->index());
vars->Add(desc);
}
« runtime/vm/object.cc ('K') | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698