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/flow_graph_builder.cc

Issue 1564493002: Make Scanner::kNoSourcePos be a true sentinel value (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_arm.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 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after
2277 2277
2278 LocalVariable* EffectGraphVisitor::EnterTempLocalScope(Value* value) { 2278 LocalVariable* EffectGraphVisitor::EnterTempLocalScope(Value* value) {
2279 Do(new(Z) PushTempInstr(value)); 2279 Do(new(Z) PushTempInstr(value));
2280 owner()->AllocateTemp(); 2280 owner()->AllocateTemp();
2281 2281
2282 ASSERT(value->definition()->temp_index() == (owner()->temp_count() - 1)); 2282 ASSERT(value->definition()->temp_index() == (owner()->temp_count() - 1));
2283 intptr_t index = GetCurrentTempLocalIndex(); 2283 intptr_t index = GetCurrentTempLocalIndex();
2284 char name[64]; 2284 char name[64];
2285 OS::SNPrint(name, 64, ":tmp_local%" Pd, index); 2285 OS::SNPrint(name, 64, ":tmp_local%" Pd, index);
2286 LocalVariable* var = 2286 LocalVariable* var =
2287 new(Z) LocalVariable(0, 2287 new(Z) LocalVariable(Scanner::kNoSourcePos,
2288 String::ZoneHandle(Z, Symbols::New(name)), 2288 String::ZoneHandle(Z, Symbols::New(name)),
2289 *value->Type()->ToAbstractType()); 2289 *value->Type()->ToAbstractType());
2290 var->set_index(index); 2290 var->set_index(index);
2291 return var; 2291 return var;
2292 } 2292 }
2293 2293
2294 2294
2295 Definition* EffectGraphVisitor::ExitTempLocalScope(LocalVariable* var) { 2295 Definition* EffectGraphVisitor::ExitTempLocalScope(LocalVariable* var) {
2296 Value* tmp = Bind(new(Z) LoadLocalInstr(*var)); 2296 Value* tmp = Bind(new(Z) LoadLocalInstr(*var));
2297 owner()->DeallocateTemps(1); 2297 owner()->DeallocateTemps(1);
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after
3995 const int num_params = function.NumParameters(); 3995 const int num_params = function.NumParameters();
3996 int param_frame_index = (num_params == function.num_fixed_parameters()) ? 3996 int param_frame_index = (num_params == function.num_fixed_parameters()) ?
3997 (kParamEndSlotFromFp + num_params) : kFirstLocalSlotFromFp; 3997 (kParamEndSlotFromFp + num_params) : kFirstLocalSlotFromFp;
3998 for (int pos = 0; pos < num_params; param_frame_index--, pos++) { 3998 for (int pos = 0; pos < num_params; param_frame_index--, pos++) {
3999 const LocalVariable& parameter = *scope->VariableAt(pos); 3999 const LocalVariable& parameter = *scope->VariableAt(pos);
4000 ASSERT(parameter.owner() == scope); 4000 ASSERT(parameter.owner() == scope);
4001 if (parameter.is_captured()) { 4001 if (parameter.is_captured()) {
4002 // Create a temporary local describing the original position. 4002 // Create a temporary local describing the original position.
4003 const String& temp_name = Symbols::TempParam(); 4003 const String& temp_name = Symbols::TempParam();
4004 LocalVariable* temp_local = new(Z) LocalVariable( 4004 LocalVariable* temp_local = new(Z) LocalVariable(
4005 0, // Token index. 4005 Scanner::kNoSourcePos, // Token index.
4006 temp_name, 4006 temp_name,
4007 Object::dynamic_type()); // Type. 4007 Object::dynamic_type()); // Type.
4008 temp_local->set_index(param_frame_index); 4008 temp_local->set_index(param_frame_index);
4009 4009
4010 // Mark this local as captured parameter so that the optimizer 4010 // Mark this local as captured parameter so that the optimizer
4011 // correctly handles these when compiling try-catch: Captured 4011 // correctly handles these when compiling try-catch: Captured
4012 // parameters are not in the stack environment, therefore they 4012 // parameters are not in the stack environment, therefore they
4013 // must be skipped when emitting sync-code in try-blocks. 4013 // must be skipped when emitting sync-code in try-blocks.
4014 temp_local->set_is_captured_parameter(true); 4014 temp_local->set_is_captured_parameter(true);
4015 4015
(...skipping 20 matching lines...) Expand all
4036 // are in scope in the debugger at method entry. 4036 // are in scope in the debugger at method entry.
4037 const int num_params = function.NumParameters(); 4037 const int num_params = function.NumParameters();
4038 intptr_t check_pos = Scanner::kNoSourcePos; 4038 intptr_t check_pos = Scanner::kNoSourcePos;
4039 if (num_params > 0) { 4039 if (num_params > 0) {
4040 const LocalVariable& parameter = *scope->VariableAt(num_params - 1); 4040 const LocalVariable& parameter = *scope->VariableAt(num_params - 1);
4041 check_pos = parameter.token_pos(); 4041 check_pos = parameter.token_pos();
4042 } 4042 }
4043 if (check_pos == Scanner::kNoSourcePos) { 4043 if (check_pos == Scanner::kNoSourcePos) {
4044 // No parameters or synthetic parameters. 4044 // No parameters or synthetic parameters.
4045 check_pos = node->token_pos(); 4045 check_pos = node->token_pos();
4046 ASSERT(check_pos != Scanner::kNoSourcePos);
4046 } 4047 }
4047 AddInstruction(new(Z) DebugStepCheckInstr(check_pos, 4048 AddInstruction(new(Z) DebugStepCheckInstr(check_pos,
4048 RawPcDescriptors::kRuntimeCall)); 4049 RawPcDescriptors::kRuntimeCall));
4049 } 4050 }
4050 4051
4051 // This check may be deleted if the generated code is leaf. 4052 // This check may be deleted if the generated code is leaf.
4052 // Native functions don't need a stack check at entry. 4053 // Native functions don't need a stack check at entry.
4053 if (is_top_level_sequence && !function.is_native()) { 4054 if (is_top_level_sequence && !function.is_native()) {
4054 // Always allocate CheckOverflowInstr so that deopt-ids match regardless 4055 // Always allocate CheckOverflowInstr so that deopt-ids match regardless
4055 // if we inline or not. 4056 // if we inline or not.
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
4580 Report::MessageF(Report::kBailout, 4581 Report::MessageF(Report::kBailout,
4581 Script::Handle(function.script()), 4582 Script::Handle(function.script()),
4582 function.token_pos(), 4583 function.token_pos(),
4583 "FlowGraphBuilder Bailout: %s %s", 4584 "FlowGraphBuilder Bailout: %s %s",
4584 String::Handle(function.name()).ToCString(), 4585 String::Handle(function.name()).ToCString(),
4585 reason); 4586 reason);
4586 UNREACHABLE(); 4587 UNREACHABLE();
4587 } 4588 }
4588 4589
4589 } // namespace dart 4590 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/flow_graph_compiler_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698