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

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

Issue 1170483002: Fixed breakpoint handling at return statement with inlined finally clauses. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
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/flow_graph_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 1074
1075 1075
1076 // <Statement> ::= Return { value: <Expression> 1076 // <Statement> ::= Return { value: <Expression>
1077 // inlined_finally_list: <InlinedFinally>* } 1077 // inlined_finally_list: <InlinedFinally>* }
1078 void EffectGraphVisitor::VisitReturnNode(ReturnNode* node) { 1078 void EffectGraphVisitor::VisitReturnNode(ReturnNode* node) {
1079 ValueGraphVisitor for_value(owner()); 1079 ValueGraphVisitor for_value(owner());
1080 node->value()->Visit(&for_value); 1080 node->value()->Visit(&for_value);
1081 Append(for_value); 1081 Append(for_value);
1082 Value* return_value = for_value.value(); 1082 Value* return_value = for_value.value();
1083 1083
1084 // Call to stub that checks whether the debugger is in single
1085 // step mode. This call must happen before the contexts are
1086 // unchained so that captured variables can be inspected.
1087 // No debugger check is done in native functions or for return
1088 // statements for which there is no associated source position.
1089 const Function& function = owner()->function();
1090 if (FLAG_support_debugger &&
1091 (node->token_pos() != Scanner::kNoSourcePos) && !function.is_native()) {
1092 AddInstruction(new(Z) DebugStepCheckInstr(node->token_pos(),
1093 RawPcDescriptors::kRuntimeCall));
1094 }
1095
1084 NestedContextAdjustment context_adjustment(owner(), owner()->context_level()); 1096 NestedContextAdjustment context_adjustment(owner(), owner()->context_level());
1085 1097
1086 if (node->inlined_finally_list_length() > 0) { 1098 if (node->inlined_finally_list_length() > 0) {
1087 LocalVariable* temp = owner()->parsed_function().finally_return_temp_var(); 1099 LocalVariable* temp = owner()->parsed_function().finally_return_temp_var();
1088 ASSERT(temp != NULL); 1100 ASSERT(temp != NULL);
1089 Do(BuildStoreLocal(*temp, return_value)); 1101 Do(BuildStoreLocal(*temp, return_value));
1090 for (intptr_t i = 0; i < node->inlined_finally_list_length(); i++) { 1102 for (intptr_t i = 0; i < node->inlined_finally_list_length(); i++) {
1091 InlineBailout("EffectGraphVisitor::VisitReturnNode (exception)"); 1103 InlineBailout("EffectGraphVisitor::VisitReturnNode (exception)");
1092 EffectGraphVisitor for_effect(owner()); 1104 EffectGraphVisitor for_effect(owner());
1093 node->InlinedFinallyNodeAt(i)->Visit(&for_effect); 1105 node->InlinedFinallyNodeAt(i)->Visit(&for_effect);
1094 Append(for_effect); 1106 Append(for_effect);
1095 if (!is_open()) { 1107 if (!is_open()) {
1096 return; 1108 return;
1097 } 1109 }
1098 } 1110 }
1099 return_value = Bind(BuildLoadLocal(*temp)); 1111 return_value = Bind(BuildLoadLocal(*temp));
1100 } 1112 }
1101 1113
1102 // Call to stub that checks whether the debugger is in single
1103 // step mode. This call must happen before the contexts are
1104 // unchained so that captured variables can be inspected.
1105 // No debugger check is done in native functions or for return
1106 // statements for which there is no associated source position.
1107 const Function& function = owner()->function();
1108 if (FLAG_support_debugger &&
1109 (node->token_pos() != Scanner::kNoSourcePos) && !function.is_native()) {
1110 AddInstruction(new(Z) DebugStepCheckInstr(node->token_pos(),
1111 RawPcDescriptors::kRuntimeCall));
1112 }
1113
1114 if (Isolate::Current()->TypeChecksEnabled()) { 1114 if (Isolate::Current()->TypeChecksEnabled()) {
1115 const bool is_implicit_dynamic_getter = 1115 const bool is_implicit_dynamic_getter =
1116 (!function.is_static() && 1116 (!function.is_static() &&
1117 ((function.kind() == RawFunction::kImplicitGetter) || 1117 ((function.kind() == RawFunction::kImplicitGetter) ||
1118 (function.kind() == RawFunction::kImplicitStaticFinalGetter))); 1118 (function.kind() == RawFunction::kImplicitStaticFinalGetter)));
1119 // Implicit getters do not need a type check at return, unless they compute 1119 // Implicit getters do not need a type check at return, unless they compute
1120 // the initial value of a static field. 1120 // the initial value of a static field.
1121 // The body of a constructor cannot modify the type of the 1121 // The body of a constructor cannot modify the type of the
1122 // constructed instance, which is passed in as an implicit parameter. 1122 // constructed instance, which is passed in as an implicit parameter.
1123 // However, factories may create an instance of the wrong type. 1123 // However, factories may create an instance of the wrong type.
(...skipping 3398 matching lines...) Expand 10 before | Expand all | Expand 10 after
4522 Report::MessageF(Report::kBailout, 4522 Report::MessageF(Report::kBailout,
4523 Script::Handle(function.script()), 4523 Script::Handle(function.script()),
4524 function.token_pos(), 4524 function.token_pos(),
4525 "FlowGraphBuilder Bailout: %s %s", 4525 "FlowGraphBuilder Bailout: %s %s",
4526 String::Handle(function.name()).ToCString(), 4526 String::Handle(function.name()).ToCString(),
4527 reason); 4527 reason);
4528 UNREACHABLE(); 4528 UNREACHABLE();
4529 } 4529 }
4530 4530
4531 } // namespace dart 4531 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698