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

Side by Side Diff: runtime/vm/scopes.cc

Issue 2030763002: Fix finally clause inlining for forward jumps (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/scopes.h ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/scopes.h" 5 #include "vm/scopes.h"
6 6
7 #include "vm/object.h" 7 #include "vm/object.h"
8 #include "vm/stack_frame.h" 8 #include "vm/stack_frame.h"
9 #include "vm/symbols.h" 9 #include "vm/symbols.h"
10 10
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 labels_.Add(label); 91 labels_.Add(label);
92 if (label->owner() == NULL) { 92 if (label->owner() == NULL) {
93 // Labels must be added to their owner scope first. Subsequent calls 93 // Labels must be added to their owner scope first. Subsequent calls
94 // to 'add' treat the label as an alias. 94 // to 'add' treat the label as an alias.
95 label->set_owner(this); 95 label->set_owner(this);
96 } 96 }
97 return true; 97 return true;
98 } 98 }
99 99
100 100
101 void LocalScope::MoveLabel(SourceLabel* label) {
102 ASSERT(LocalLookupLabel(label->name()) == NULL);
103 ASSERT(label->kind() == SourceLabel::kForward);
104 labels_.Add(label);
105 label->set_owner(this);
106 }
107
108
101 NameReference* LocalScope::FindReference(const String& name) const { 109 NameReference* LocalScope::FindReference(const String& name) const {
102 ASSERT(name.IsSymbol()); 110 ASSERT(name.IsSymbol());
103 intptr_t num_references = referenced_.length(); 111 intptr_t num_references = referenced_.length();
104 for (intptr_t i = 0; i < num_references; i++) { 112 for (intptr_t i = 0; i < num_references; i++) {
105 if (name.raw() == referenced_[i]->name().raw()) { 113 if (name.raw() == referenced_[i]->name().raw()) {
106 return referenced_[i]; 114 return referenced_[i];
107 } 115 }
108 } 116 }
109 return NULL; 117 return NULL;
110 } 118 }
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 490
483 491
484 SourceLabel* LocalScope::CheckUnresolvedLabels() { 492 SourceLabel* LocalScope::CheckUnresolvedLabels() {
485 for (int i = 0; i < this->labels_.length(); i++) { 493 for (int i = 0; i < this->labels_.length(); i++) {
486 SourceLabel* label = this->labels_[i]; 494 SourceLabel* label = this->labels_[i];
487 if (label->kind() == SourceLabel::kForward) { 495 if (label->kind() == SourceLabel::kForward) {
488 LocalScope* outer_switch = LookupSwitchScope(); 496 LocalScope* outer_switch = LookupSwitchScope();
489 if (outer_switch == NULL) { 497 if (outer_switch == NULL) {
490 return label; 498 return label;
491 } else { 499 } else {
492 outer_switch->AddLabel(label); 500 outer_switch->MoveLabel(label);
493 } 501 }
494 } 502 }
495 } 503 }
496 return NULL; 504 return NULL;
497 } 505 }
498 506
499 507
500 int LocalScope::NumCapturedVariables() const { 508 int LocalScope::NumCapturedVariables() const {
501 // It is not necessary to traverse parent scopes, since we are only interested 509 // It is not necessary to traverse parent scopes, since we are only interested
502 // in the captured variables referenced in this scope. If this scope is the 510 // in the captured variables referenced in this scope. If this scope is the
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 return fixed_parameter_count - (index() - kParamEndSlotFromFp); 676 return fixed_parameter_count - (index() - kParamEndSlotFromFp);
669 } else { 677 } else {
670 // Shift negative indexes so that the lowest one is 0 (they are still 678 // Shift negative indexes so that the lowest one is 0 (they are still
671 // non-positive). 679 // non-positive).
672 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp); 680 return fixed_parameter_count - (index() - kFirstLocalSlotFromFp);
673 } 681 }
674 } 682 }
675 683
676 684
677 } // namespace dart 685 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/scopes.h ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698