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

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

Issue 286363006: Add flag —enable-debugger (default true) in order to disable debugger single stepping code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/stub_code_ia32.cc » ('j') | runtime/vm/stub_code_ia32.cc » ('J')
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/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 24 matching lines...) Expand all
35 "Eliminate type checks when allowed by static type analysis."); 35 "Eliminate type checks when allowed by static type analysis.");
36 DEFINE_FLAG(bool, print_ast, false, "Print abstract syntax tree."); 36 DEFINE_FLAG(bool, print_ast, false, "Print abstract syntax tree.");
37 DEFINE_FLAG(bool, print_scopes, false, "Print scopes of local variables."); 37 DEFINE_FLAG(bool, print_scopes, false, "Print scopes of local variables.");
38 DEFINE_FLAG(bool, trace_type_check_elimination, false, 38 DEFINE_FLAG(bool, trace_type_check_elimination, false,
39 "Trace type check elimination at compile time."); 39 "Trace type check elimination at compile time.");
40 DEFINE_FLAG(bool, warn_on_javascript_compatibility, false, 40 DEFINE_FLAG(bool, warn_on_javascript_compatibility, false,
41 "Warn on incompatibilities between vm and dart2js."); 41 "Warn on incompatibilities between vm and dart2js.");
42 DECLARE_FLAG(bool, enable_type_checks); 42 DECLARE_FLAG(bool, enable_type_checks);
43 DECLARE_FLAG(bool, warning_as_error); 43 DECLARE_FLAG(bool, warning_as_error);
44 DECLARE_FLAG(bool, silent_warnings); 44 DECLARE_FLAG(bool, silent_warnings);
45 DECLARE_FLAG(int, optimization_counter_threshold);
45 46
47 DECLARE_FLAG(bool, enable_debugger);
46 48
47 // TODO(srdjan): Allow compiler to add constants as they are encountered in 49 // TODO(srdjan): Allow compiler to add constants as they are encountered in
48 // the compilation. 50 // the compilation.
49 const double kCommonDoubleConstants[] = 51 const double kCommonDoubleConstants[] =
50 {-1.0, -0.5, -0.1, 0.0, 0.1, 0.5, 1.0, 2.0, 4.0, 5.0, 52 {-1.0, -0.5, -0.1, 0.0, 0.1, 0.5, 1.0, 2.0, 4.0, 5.0,
51 10.0, 20.0, 30.0, 64.0, 255.0, NAN, 53 10.0, 20.0, 30.0, 64.0, 255.0, NAN,
52 // From dart:math 54 // From dart:math
53 2.718281828459045, 2.302585092994046, 0.6931471805599453, 55 2.718281828459045, 2.302585092994046, 0.6931471805599453,
54 1.4426950408889634, 0.4342944819032518, 3.1415926535897932, 56 1.4426950408889634, 0.4342944819032518, 3.1415926535897932,
55 0.7071067811865476, 1.4142135623730951}; 57 0.7071067811865476, 1.4142135623730951};
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 return_value = Bind(BuildLoadLocal(*temp)); 994 return_value = Bind(BuildLoadLocal(*temp));
993 } 995 }
994 996
995 // Call to stub that checks whether the debugger is in single 997 // Call to stub that checks whether the debugger is in single
996 // step mode. This call must happen before the contexts are 998 // step mode. This call must happen before the contexts are
997 // unchained so that captured variables can be inspected. 999 // unchained so that captured variables can be inspected.
998 // No debugger check is done in native functions or for return 1000 // No debugger check is done in native functions or for return
999 // statements for which there is no associated source position. 1001 // statements for which there is no associated source position.
1000 const Function& function = owner()->parsed_function()->function(); 1002 const Function& function = owner()->parsed_function()->function();
1001 if ((node->token_pos() != Scanner::kNoSourcePos) && 1003 if ((node->token_pos() != Scanner::kNoSourcePos) &&
1002 !function.is_native()) { 1004 !function.is_native() && FLAG_enable_debugger) {
1003 AddInstruction(new DebugStepCheckInstr(node->token_pos(), 1005 AddInstruction(new DebugStepCheckInstr(node->token_pos(),
1004 PcDescriptors::kReturn)); 1006 PcDescriptors::kReturn));
1005 } 1007 }
1006 1008
1007 if (FLAG_enable_type_checks) { 1009 if (FLAG_enable_type_checks) {
1008 const bool is_implicit_dynamic_getter = 1010 const bool is_implicit_dynamic_getter =
1009 (!function.is_static() && 1011 (!function.is_static() &&
1010 ((function.kind() == RawFunction::kImplicitGetter) || 1012 ((function.kind() == RawFunction::kImplicitGetter) ||
1011 (function.kind() == RawFunction::kImplicitStaticFinalGetter))); 1013 (function.kind() == RawFunction::kImplicitStaticFinalGetter)));
1012 // Implicit getters do not need a type check at return, unless they compute 1014 // Implicit getters do not need a type check at return, unless they compute
(...skipping 2088 matching lines...) Expand 10 before | Expand all | Expand 10 after
3101 3103
3102 3104
3103 // <Expression> ::= StoreLocal { local: LocalVariable 3105 // <Expression> ::= StoreLocal { local: LocalVariable
3104 // value: <Expression> } 3106 // value: <Expression> }
3105 void EffectGraphVisitor::VisitStoreLocalNode(StoreLocalNode* node) { 3107 void EffectGraphVisitor::VisitStoreLocalNode(StoreLocalNode* node) {
3106 // If the right hand side is an expression that does not contain 3108 // If the right hand side is an expression that does not contain
3107 // a safe point for the debugger to stop, add an explicit stub 3109 // a safe point for the debugger to stop, add an explicit stub
3108 // call. 3110 // call.
3109 if (node->value()->IsLiteralNode() || 3111 if (node->value()->IsLiteralNode() ||
3110 node->value()->IsLoadLocalNode()) { 3112 node->value()->IsLoadLocalNode()) {
3111 AddInstruction(new DebugStepCheckInstr(node->token_pos(), 3113 if (FLAG_enable_debugger) {
3112 PcDescriptors::kRuntimeCall)); 3114 AddInstruction(new DebugStepCheckInstr(node->token_pos(),
3115 PcDescriptors::kRuntimeCall));
3116 }
3113 } 3117 }
3114 3118
3115 ValueGraphVisitor for_value(owner()); 3119 ValueGraphVisitor for_value(owner());
3116 node->value()->Visit(&for_value); 3120 node->value()->Visit(&for_value);
3117 Append(for_value); 3121 Append(for_value);
3118 Value* store_value = for_value.value(); 3122 Value* store_value = for_value.value();
3119 if (FLAG_enable_type_checks) { 3123 if (FLAG_enable_type_checks) {
3120 store_value = BuildAssignableValue(node->value()->token_pos(), 3124 store_value = BuildAssignableValue(node->value()->token_pos(),
3121 store_value, 3125 store_value,
3122 node->local().type(), 3126 node->local().type(),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3159 Value* store_value = for_value.value(); 3163 Value* store_value = for_value.value();
3160 if (FLAG_enable_type_checks) { 3164 if (FLAG_enable_type_checks) {
3161 const AbstractType& type = AbstractType::ZoneHandle(node->field().type()); 3165 const AbstractType& type = AbstractType::ZoneHandle(node->field().type());
3162 const String& dst_name = String::ZoneHandle(node->field().name()); 3166 const String& dst_name = String::ZoneHandle(node->field().name());
3163 store_value = BuildAssignableValue(node->value()->token_pos(), 3167 store_value = BuildAssignableValue(node->value()->token_pos(),
3164 store_value, 3168 store_value,
3165 type, 3169 type,
3166 dst_name); 3170 dst_name);
3167 } 3171 }
3168 3172
3169 store_value = Bind(BuildStoreExprTemp(store_value)); 3173 if (FLAG_optimization_counter_threshold >= 0) {
3170 GuardFieldInstr* guard = 3174 store_value = Bind(BuildStoreExprTemp(store_value));
3171 new GuardFieldInstr(store_value, 3175 GuardFieldInstr* guard =
3172 node->field(), 3176 new GuardFieldInstr(store_value,
3173 Isolate::Current()->GetNextDeoptId()); 3177 node->field(),
3174 AddInstruction(guard); 3178 Isolate::Current()->GetNextDeoptId());
3179 AddInstruction(guard);
3180 store_value = Bind(BuildLoadExprTemp());
3181 }
3175 3182
3176 store_value = Bind(BuildLoadExprTemp());
3177 StoreInstanceFieldInstr* store = 3183 StoreInstanceFieldInstr* store =
3178 new StoreInstanceFieldInstr(node->field(), 3184 new StoreInstanceFieldInstr(node->field(),
3179 for_instance.value(), 3185 for_instance.value(),
3180 store_value, 3186 store_value,
3181 kEmitStoreBarrier, 3187 kEmitStoreBarrier,
3182 node->token_pos()); 3188 node->token_pos());
3183 store->set_is_initialization(true); // Maybe initializing store. 3189 store->set_is_initialization(true); // Maybe initializing store.
3184 ReturnDefinition(store); 3190 ReturnDefinition(store);
3185 } 3191 }
3186 3192
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
3512 Isolate::Current()->object_store()->empty_context()))))); 3518 Isolate::Current()->object_store()->empty_context())))));
3513 } 3519 }
3514 3520
3515 // This check may be deleted if the generated code is leaf. 3521 // This check may be deleted if the generated code is leaf.
3516 // Native functions don't need a stack check at entry. 3522 // Native functions don't need a stack check at entry.
3517 const Function& function = owner()->parsed_function()->function(); 3523 const Function& function = owner()->parsed_function()->function();
3518 if ((node == owner()->parsed_function()->node_sequence()) && 3524 if ((node == owner()->parsed_function()->node_sequence()) &&
3519 !function.is_native()) { 3525 !function.is_native()) {
3520 // Always allocate CheckOverflowInstr so that deopt-ids match regardless 3526 // Always allocate CheckOverflowInstr so that deopt-ids match regardless
3521 // if we inline or not. 3527 // if we inline or not.
3522 CheckStackOverflowInstr* check = 3528 if (!function.IsImplicitGetterFunction() &&
3523 new CheckStackOverflowInstr(function.token_pos(), 0); 3529 !function.IsImplicitSetterFunction()) {
3524 // If we are inlining don't actually attach the stack check. We must still 3530 CheckStackOverflowInstr* check =
3525 // create the stack check in order to allocate a deopt id. 3531 new CheckStackOverflowInstr(function.token_pos(), 0);
3526 if (!owner()->IsInlining()) { 3532 // If we are inlining don't actually attach the stack check. We must still
3527 AddInstruction(check); 3533 // create the stack check in order to allocate a deopt id.
3534 if (!owner()->IsInlining()) {
3535 AddInstruction(check);
3536 }
3528 } 3537 }
3529 } 3538 }
3530 3539
3531 if (FLAG_enable_type_checks && 3540 if (FLAG_enable_type_checks &&
3532 (node == owner()->parsed_function()->node_sequence())) { 3541 (node == owner()->parsed_function()->node_sequence())) {
3533 const Function& function = owner()->parsed_function()->function(); 3542 const Function& function = owner()->parsed_function()->function();
3534 const int num_params = function.NumParameters(); 3543 const int num_params = function.NumParameters();
3535 int pos = 0; 3544 int pos = 0;
3536 if (function.IsConstructor()) { 3545 if (function.IsConstructor()) {
3537 // Skip type checking of receiver and phase for constructor functions. 3546 // Skip type checking of receiver and phase for constructor functions.
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
3966 LanguageError::kBailout, 3975 LanguageError::kBailout,
3967 Heap::kNew, 3976 Heap::kNew,
3968 "FlowGraphBuilder Bailout: %s %s", 3977 "FlowGraphBuilder Bailout: %s %s",
3969 String::Handle(function.name()).ToCString(), 3978 String::Handle(function.name()).ToCString(),
3970 reason)); 3979 reason));
3971 Isolate::Current()->long_jump_base()->Jump(1, error); 3980 Isolate::Current()->long_jump_base()->Jump(1, error);
3972 UNREACHABLE(); 3981 UNREACHABLE();
3973 } 3982 }
3974 3983
3975 } // namespace dart 3984 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/stub_code_ia32.cc » ('j') | runtime/vm/stub_code_ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698