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

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

Issue 1127523004: Add flag --support_debugger, controls emitting single stepping checks. Disable in --noopt, 6% gain. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 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/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/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 17 matching lines...) Expand all
28 #include "vm/symbols.h" 28 #include "vm/symbols.h"
29 #include "vm/token.h" 29 #include "vm/token.h"
30 #include "vm/zone.h" 30 #include "vm/zone.h"
31 31
32 namespace dart { 32 namespace dart {
33 33
34 DEFINE_FLAG(bool, eliminate_type_checks, true, 34 DEFINE_FLAG(bool, eliminate_type_checks, true,
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, support_debugger, true, "Emit code needed for debugging");
hausner 2015/05/05 15:59:15 Would be nice to use the --debug command line opti
srdjan 2015/05/06 21:02:54 This flag should not be used by user, the flag wil
38 DEFINE_FLAG(bool, trace_type_check_elimination, false, 39 DEFINE_FLAG(bool, trace_type_check_elimination, false,
39 "Trace type check elimination at compile time."); 40 "Trace type check elimination at compile time.");
40 41
41 DECLARE_FLAG(bool, enable_asserts); 42 DECLARE_FLAG(bool, enable_asserts);
42 DECLARE_FLAG(bool, enable_type_checks); 43 DECLARE_FLAG(bool, enable_type_checks);
43 DECLARE_FLAG(int, optimization_counter_threshold); 44 DECLARE_FLAG(int, optimization_counter_threshold);
44 DECLARE_FLAG(bool, warn_on_javascript_compatibility); 45 DECLARE_FLAG(bool, warn_on_javascript_compatibility);
45 DECLARE_FLAG(bool, use_field_guards); 46 DECLARE_FLAG(bool, use_field_guards);
46 47
47 // Quick access to the locally defined zone() method. 48 // Quick access to the locally defined zone() method.
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 } 1036 }
1036 return_value = Bind(BuildLoadLocal(*temp)); 1037 return_value = Bind(BuildLoadLocal(*temp));
1037 } 1038 }
1038 1039
1039 // Call to stub that checks whether the debugger is in single 1040 // Call to stub that checks whether the debugger is in single
1040 // step mode. This call must happen before the contexts are 1041 // step mode. This call must happen before the contexts are
1041 // unchained so that captured variables can be inspected. 1042 // unchained so that captured variables can be inspected.
1042 // No debugger check is done in native functions or for return 1043 // No debugger check is done in native functions or for return
1043 // statements for which there is no associated source position. 1044 // statements for which there is no associated source position.
1044 const Function& function = owner()->function(); 1045 const Function& function = owner()->function();
1045 if ((node->token_pos() != Scanner::kNoSourcePos) && !function.is_native()) { 1046 if (FLAG_support_debugger &&
1047 (node->token_pos() != Scanner::kNoSourcePos) && !function.is_native()) {
1046 AddInstruction(new(Z) DebugStepCheckInstr(node->token_pos(), 1048 AddInstruction(new(Z) DebugStepCheckInstr(node->token_pos(),
1047 RawPcDescriptors::kRuntimeCall)); 1049 RawPcDescriptors::kRuntimeCall));
1048 } 1050 }
1049 1051
1050 if (Isolate::Current()->TypeChecksEnabled()) { 1052 if (Isolate::Current()->TypeChecksEnabled()) {
1051 const bool is_implicit_dynamic_getter = 1053 const bool is_implicit_dynamic_getter =
1052 (!function.is_static() && 1054 (!function.is_static() &&
1053 ((function.kind() == RawFunction::kImplicitGetter) || 1055 ((function.kind() == RawFunction::kImplicitGetter) ||
1054 (function.kind() == RawFunction::kImplicitStaticFinalGetter))); 1056 (function.kind() == RawFunction::kImplicitStaticFinalGetter)));
1055 // Implicit getters do not need a type check at return, unless they compute 1057 // Implicit getters do not need a type check at return, unless they compute
(...skipping 2375 matching lines...) Expand 10 before | Expand all | Expand 10 after
3431 } 3433 }
3432 3434
3433 3435
3434 // <Expression> ::= StoreLocal { local: LocalVariable 3436 // <Expression> ::= StoreLocal { local: LocalVariable
3435 // value: <Expression> } 3437 // value: <Expression> }
3436 void EffectGraphVisitor::VisitStoreLocalNode(StoreLocalNode* node) { 3438 void EffectGraphVisitor::VisitStoreLocalNode(StoreLocalNode* node) {
3437 // If the right hand side is an expression that does not contain 3439 // If the right hand side is an expression that does not contain
3438 // a safe point for the debugger to stop, add an explicit stub 3440 // a safe point for the debugger to stop, add an explicit stub
3439 // call. Exception: don't do this when assigning to or from internal 3441 // call. Exception: don't do this when assigning to or from internal
3440 // variables, or for generated code that has no source position. 3442 // variables, or for generated code that has no source position.
3441 if ((node->value()->IsLiteralNode() || 3443 if (FLAG_support_debugger) {
3442 (node->value()->IsLoadLocalNode() && 3444 if ((node->value()->IsLiteralNode() ||
3443 !node->value()->AsLoadLocalNode()->local().IsInternal()) || 3445 (node->value()->IsLoadLocalNode() &&
3444 node->value()->IsClosureNode()) && 3446 !node->value()->AsLoadLocalNode()->local().IsInternal()) ||
3445 !node->local().IsInternal() && 3447 node->value()->IsClosureNode()) &&
3446 (node->token_pos() != Scanner::kNoSourcePos)) { 3448 !node->local().IsInternal() &&
3447 AddInstruction(new(Z) DebugStepCheckInstr( 3449 (node->token_pos() != Scanner::kNoSourcePos)) {
3448 node->token_pos(), RawPcDescriptors::kRuntimeCall)); 3450 AddInstruction(new(Z) DebugStepCheckInstr(
3451 node->token_pos(), RawPcDescriptors::kRuntimeCall));
3452 }
3449 } 3453 }
3450 3454
3451 ValueGraphVisitor for_value(owner()); 3455 ValueGraphVisitor for_value(owner());
3452 node->value()->Visit(&for_value); 3456 node->value()->Visit(&for_value);
3453 Append(for_value); 3457 Append(for_value);
3454 Value* store_value = for_value.value(); 3458 Value* store_value = for_value.value();
3455 if (Isolate::Current()->TypeChecksEnabled()) { 3459 if (Isolate::Current()->TypeChecksEnabled()) {
3456 store_value = BuildAssignableValue(node->value()->token_pos(), 3460 store_value = BuildAssignableValue(node->value()->token_pos(),
3457 store_value, 3461 store_value,
3458 node->local().type(), 3462 node->local().type(),
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
4242 ASSERT(!func.IsNull()); 4246 ASSERT(!func.IsNull());
4243 return new(Z) StaticCallInstr(token_pos, 4247 return new(Z) StaticCallInstr(token_pos,
4244 func, 4248 func,
4245 Object::null_array(), // No names. 4249 Object::null_array(), // No names.
4246 arguments, 4250 arguments,
4247 owner()->ic_data_array()); 4251 owner()->ic_data_array());
4248 } 4252 }
4249 4253
4250 4254
4251 void EffectGraphVisitor::BuildThrowNode(ThrowNode* node) { 4255 void EffectGraphVisitor::BuildThrowNode(ThrowNode* node) {
4252 if (node->exception()->IsLiteralNode() || 4256 if (FLAG_support_debugger) {
4253 node->exception()->IsLoadLocalNode() || 4257 if (node->exception()->IsLiteralNode() ||
4254 node->exception()->IsClosureNode()) { 4258 node->exception()->IsLoadLocalNode() ||
4255 AddInstruction(new(Z) DebugStepCheckInstr( 4259 node->exception()->IsClosureNode()) {
4256 node->token_pos(), RawPcDescriptors::kRuntimeCall)); 4260 AddInstruction(new(Z) DebugStepCheckInstr(
4261 node->token_pos(), RawPcDescriptors::kRuntimeCall));
4262 }
4257 } 4263 }
4258 ValueGraphVisitor for_exception(owner()); 4264 ValueGraphVisitor for_exception(owner());
4259 node->exception()->Visit(&for_exception); 4265 node->exception()->Visit(&for_exception);
4260 Append(for_exception); 4266 Append(for_exception);
4261 PushArgument(for_exception.value()); 4267 PushArgument(for_exception.value());
4262 Instruction* instr = NULL; 4268 Instruction* instr = NULL;
4263 if (node->stacktrace() == NULL) { 4269 if (node->stacktrace() == NULL) {
4264 instr = new(Z) ThrowInstr(node->token_pos()); 4270 instr = new(Z) ThrowInstr(node->token_pos());
4265 } else { 4271 } else {
4266 ValueGraphVisitor for_stack_trace(owner()); 4272 ValueGraphVisitor for_stack_trace(owner());
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
4377 Report::MessageF(Report::kBailout, 4383 Report::MessageF(Report::kBailout,
4378 Script::Handle(function.script()), 4384 Script::Handle(function.script()),
4379 function.token_pos(), 4385 function.token_pos(),
4380 "FlowGraphBuilder Bailout: %s %s", 4386 "FlowGraphBuilder Bailout: %s %s",
4381 String::Handle(function.name()).ToCString(), 4387 String::Handle(function.name()).ToCString(),
4382 reason); 4388 reason);
4383 UNREACHABLE(); 4389 UNREACHABLE();
4384 } 4390 }
4385 4391
4386 } // namespace dart 4392 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698