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

Unified Diff: runtime/vm/code_generator.cc

Issue 292173005: Fix issue 18834. Collect stack trace before the frame is prepared for OSR. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/debugger.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator.cc
===================================================================
--- runtime/vm/code_generator.cc (revision 36356)
+++ runtime/vm/code_generator.cc (working copy)
@@ -1066,6 +1066,69 @@
UNREACHABLE();
}
+ // The following code is used to stress test deoptimization and
+ // debugger stack tracing.
+ bool do_deopt = false;
+ bool do_stacktrace = false;
+ if (FLAG_deoptimize_every > 0 ||
+ FLAG_stacktrace_every > 0) {
srdjan 2014/05/20 18:13:32 This fits in one line, and add parentheses please.
Florian Schneider 2014/05/21 09:28:59 Done.
+ // TODO(turnidge): To make --deoptimize_every and
+ // --stacktrace-every faster we could move this increment/test to
+ // the generated code.
+ int32_t count = isolate->IncrementAndGetStackOverflowCount();
+ if (FLAG_deoptimize_every > 0 &&
+ (count % FLAG_deoptimize_every) == 0) {
srdjan 2014/05/20 18:13:32 Add parantheses
+ do_deopt = true;
+ }
+ if (FLAG_stacktrace_every > 0 &&
+ (count % FLAG_stacktrace_every) == 0) {
srdjan 2014/05/20 18:13:32 ditto
+ do_stacktrace = true;
+ }
+ }
+ if (FLAG_deoptimize_filter != NULL ||
+ FLAG_stacktrace_filter != NULL) {
srdjan 2014/05/20 18:13:32 ditto
+ DartFrameIterator iterator;
+ StackFrame* frame = iterator.NextFrame();
+ ASSERT(frame != NULL);
+ const Code& code = Code::Handle(frame->LookupDartCode());
+ ASSERT(!code.IsNull());
+ const Function& function = Function::Handle(code.function());
+ ASSERT(!function.IsNull());
+ const char* function_name = function.ToFullyQualifiedCString();
+ ASSERT(function_name != NULL);
+ if (code.is_optimized() &&
+ FLAG_deoptimize_filter != NULL &&
+ strstr(function_name, FLAG_deoptimize_filter) != NULL) {
srdjan 2014/05/20 18:13:32 ditto
+ OS::PrintErr("*** Forcing deoptimization (%s)\n",
+ function.ToFullyQualifiedCString());
+ do_deopt = true;
+ }
+ if (FLAG_stacktrace_filter != NULL &&
+ strstr(function_name, FLAG_stacktrace_filter) != NULL) {
srdjan 2014/05/20 18:13:32 ditto
+ OS::PrintErr("*** Computing stacktrace (%s)\n",
+ function.ToFullyQualifiedCString());
+ do_stacktrace = true;
+ }
+ }
+ if (do_deopt) {
+ // TODO(turnidge): Consider using DeoptimizeAt instead.
+ DeoptimizeAll();
turnidge 2014/05/20 16:52:25 If I deoptimize here and then attempt to osr below
Florian Schneider 2014/05/21 09:28:59 Yes, I think so. The function triggering OSR is un
+ }
+ if (do_stacktrace) {
+ String& var_name = String::Handle();
+ Instance& var_value = Instance::Handle();
+ DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
+ intptr_t num_frames = stack->Length();
+ for (intptr_t i = 0; i < num_frames; i++) {
+ ActivationFrame* frame = stack->FrameAt(i);
+ const int num_vars = frame->NumLocalVariables();
+ intptr_t unused;
+ for (intptr_t v = 0; v < num_vars; v++) {
+ frame->VariableAt(v, &var_name, &unused, &unused, &var_value);
+ }
+ }
+ }
+
uword interrupt_bits = isolate->GetAndClearInterrupts();
if ((interrupt_bits & Isolate::kStoreBufferInterrupt) != 0) {
if (FLAG_verbose_gc) {
@@ -1144,69 +1207,6 @@
frame->set_pc(optimized_entry);
}
}
-
- // The following code is used to stress test deoptimization and
- // debugger stack tracing.
- bool do_deopt = false;
- bool do_stacktrace = false;
- if (FLAG_deoptimize_every > 0 ||
- FLAG_stacktrace_every > 0) {
- // TODO(turnidge): To make --deoptimize_every and
- // --stacktrace-every faster we could move this increment/test to
- // the generated code.
- int32_t count = isolate->IncrementAndGetStackOverflowCount();
- if (FLAG_deoptimize_every > 0 &&
- (count % FLAG_deoptimize_every) == 0) {
- do_deopt = true;
- }
- if (FLAG_stacktrace_every > 0 &&
- (count % FLAG_stacktrace_every) == 0) {
- do_stacktrace = true;
- }
- }
- if (FLAG_deoptimize_filter != NULL ||
- FLAG_stacktrace_filter != NULL) {
- DartFrameIterator iterator;
- StackFrame* frame = iterator.NextFrame();
- ASSERT(frame != NULL);
- const Code& code = Code::Handle(frame->LookupDartCode());
- ASSERT(!code.IsNull());
- const Function& function = Function::Handle(code.function());
- ASSERT(!function.IsNull());
- const char* function_name = function.ToFullyQualifiedCString();
- ASSERT(function_name != NULL);
- if (code.is_optimized() &&
- FLAG_deoptimize_filter != NULL &&
- strstr(function_name, FLAG_deoptimize_filter) != NULL) {
- OS::PrintErr("*** Forcing deoptimization (%s)\n",
- function.ToFullyQualifiedCString());
- do_deopt = true;
- }
- if (FLAG_stacktrace_filter != NULL &&
- strstr(function_name, FLAG_stacktrace_filter) != NULL) {
- OS::PrintErr("*** Computing stacktrace (%s)\n",
- function.ToFullyQualifiedCString());
- do_stacktrace = true;
- }
- }
- if (do_deopt) {
- // TODO(turnidge): Consider using DeoptimizeAt instead.
- DeoptimizeAll();
- }
- if (do_stacktrace) {
- String& var_name = String::Handle();
- Instance& var_value = Instance::Handle();
- DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
- intptr_t num_frames = stack->Length();
- for (intptr_t i = 0; i < num_frames; i++) {
- ActivationFrame* frame = stack->FrameAt(i);
- const int num_vars = frame->NumLocalVariables();
- intptr_t unused;
- for (intptr_t v = 0; v < num_vars; v++) {
- frame->VariableAt(v, &var_name, &unused, &unused, &var_value);
- }
- }
- }
}
« no previous file with comments | « no previous file | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698