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

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

Issue 1568353002: Don't test directly against Scanner::kNoSourcePos instead use >= 0. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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/debugger.cc ('k') | runtime/vm/flow_graph_compiler.cc » ('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/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/compiler.h" 10 #include "vm/compiler.h"
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 Append(for_value); 1109 Append(for_value);
1110 Value* return_value = for_value.value(); 1110 Value* return_value = for_value.value();
1111 1111
1112 // Call to stub that checks whether the debugger is in single 1112 // Call to stub that checks whether the debugger is in single
1113 // step mode. This call must happen before the contexts are 1113 // step mode. This call must happen before the contexts are
1114 // unchained so that captured variables can be inspected. 1114 // unchained so that captured variables can be inspected.
1115 // No debugger check is done in native functions or for return 1115 // No debugger check is done in native functions or for return
1116 // statements for which there is no associated source position. 1116 // statements for which there is no associated source position.
1117 const Function& function = owner()->function(); 1117 const Function& function = owner()->function();
1118 if (FLAG_support_debugger && 1118 if (FLAG_support_debugger &&
1119 (node->token_pos() != Scanner::kNoSourcePos) && !function.is_native()) { 1119 (node->token_pos() >= 0) && !function.is_native()) {
1120 AddInstruction(new(Z) DebugStepCheckInstr(node->token_pos(), 1120 AddInstruction(new(Z) DebugStepCheckInstr(node->token_pos(),
1121 RawPcDescriptors::kRuntimeCall)); 1121 RawPcDescriptors::kRuntimeCall));
1122 } 1122 }
1123 1123
1124 NestedContextAdjustment context_adjustment(owner(), owner()->context_level()); 1124 NestedContextAdjustment context_adjustment(owner(), owner()->context_level());
1125 1125
1126 if (node->inlined_finally_list_length() > 0) { 1126 if (node->inlined_finally_list_length() > 0) {
1127 LocalVariable* temp = owner()->parsed_function().finally_return_temp_var(); 1127 LocalVariable* temp = owner()->parsed_function().finally_return_temp_var();
1128 ASSERT(temp != NULL); 1128 ASSERT(temp != NULL);
1129 Do(BuildStoreLocal(*temp, return_value)); 1129 Do(BuildStoreLocal(*temp, return_value));
(...skipping 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after
3617 // If the right hand side is an expression that does not contain 3617 // If the right hand side is an expression that does not contain
3618 // a safe point for the debugger to stop, add an explicit stub 3618 // a safe point for the debugger to stop, add an explicit stub
3619 // call. Exception: don't do this when assigning to or from internal 3619 // call. Exception: don't do this when assigning to or from internal
3620 // variables, or for generated code that has no source position. 3620 // variables, or for generated code that has no source position.
3621 if (FLAG_support_debugger) { 3621 if (FLAG_support_debugger) {
3622 if ((node->value()->IsLiteralNode() || 3622 if ((node->value()->IsLiteralNode() ||
3623 (node->value()->IsLoadLocalNode() && 3623 (node->value()->IsLoadLocalNode() &&
3624 !node->value()->AsLoadLocalNode()->local().IsInternal()) || 3624 !node->value()->AsLoadLocalNode()->local().IsInternal()) ||
3625 node->value()->IsClosureNode()) && 3625 node->value()->IsClosureNode()) &&
3626 !node->local().IsInternal() && 3626 !node->local().IsInternal() &&
3627 (node->token_pos() != Scanner::kNoSourcePos)) { 3627 (node->token_pos() >= 0)) {
3628 AddInstruction(new(Z) DebugStepCheckInstr( 3628 AddInstruction(new(Z) DebugStepCheckInstr(
3629 node->token_pos(), RawPcDescriptors::kRuntimeCall)); 3629 node->token_pos(), RawPcDescriptors::kRuntimeCall));
3630 } 3630 }
3631 } 3631 }
3632 3632
3633 ValueGraphVisitor for_value(owner()); 3633 ValueGraphVisitor for_value(owner());
3634 node->value()->Visit(&for_value); 3634 node->value()->Visit(&for_value);
3635 Append(for_value); 3635 Append(for_value);
3636 Value* store_value = for_value.value(); 3636 Value* store_value = for_value.value();
3637 if (Isolate::Current()->flags().type_checks()) { 3637 if (Isolate::Current()->flags().type_checks()) {
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
4064 // Place a debug check at method entry to ensure breaking on a method always 4064 // Place a debug check at method entry to ensure breaking on a method always
4065 // happens, even if there are no assignments/calls/runtimecalls in the first 4065 // happens, even if there are no assignments/calls/runtimecalls in the first
4066 // basic block. Place this check at the last parameter to ensure parameters 4066 // basic block. Place this check at the last parameter to ensure parameters
4067 // are in scope in the debugger at method entry. 4067 // are in scope in the debugger at method entry.
4068 const int num_params = function.NumParameters(); 4068 const int num_params = function.NumParameters();
4069 intptr_t check_pos = Scanner::kNoSourcePos; 4069 intptr_t check_pos = Scanner::kNoSourcePos;
4070 if (num_params > 0) { 4070 if (num_params > 0) {
4071 const LocalVariable& parameter = *scope->VariableAt(num_params - 1); 4071 const LocalVariable& parameter = *scope->VariableAt(num_params - 1);
4072 check_pos = parameter.token_pos(); 4072 check_pos = parameter.token_pos();
4073 } 4073 }
4074 if (check_pos == Scanner::kNoSourcePos) { 4074 if (check_pos < 0) {
4075 // No parameters or synthetic parameters. 4075 // No parameters or synthetic parameters.
4076 check_pos = node->token_pos(); 4076 check_pos = node->token_pos();
4077 ASSERT(check_pos != Scanner::kNoSourcePos); 4077 ASSERT(check_pos >= 0);
4078 } 4078 }
4079 AddInstruction(new(Z) DebugStepCheckInstr(check_pos, 4079 AddInstruction(new(Z) DebugStepCheckInstr(check_pos,
4080 RawPcDescriptors::kRuntimeCall)); 4080 RawPcDescriptors::kRuntimeCall));
4081 } 4081 }
4082 4082
4083 // This check may be deleted if the generated code is leaf. 4083 // This check may be deleted if the generated code is leaf.
4084 // Native functions don't need a stack check at entry. 4084 // Native functions don't need a stack check at entry.
4085 if (is_top_level_sequence && !function.is_native()) { 4085 if (is_top_level_sequence && !function.is_native()) {
4086 // Always allocate CheckOverflowInstr so that deopt-ids match regardless 4086 // Always allocate CheckOverflowInstr so that deopt-ids match regardless
4087 // if we inline or not. 4087 // if we inline or not.
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
4613 Report::MessageF(Report::kBailout, 4613 Report::MessageF(Report::kBailout,
4614 Script::Handle(function.script()), 4614 Script::Handle(function.script()),
4615 function.token_pos(), 4615 function.token_pos(),
4616 "FlowGraphBuilder Bailout: %s %s", 4616 "FlowGraphBuilder Bailout: %s %s",
4617 String::Handle(function.name()).ToCString(), 4617 String::Handle(function.name()).ToCString(),
4618 reason); 4618 reason);
4619 UNREACHABLE(); 4619 UNREACHABLE();
4620 } 4620 }
4621 4621
4622 } // namespace dart 4622 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698