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

Unified Diff: runtime/vm/code_generator.cc

Issue 10885039: Deoptimization can occur at Dart calls (includes native calls to C) but not at runtime calls. This … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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
Index: runtime/vm/code_generator.cc
===================================================================
--- runtime/vm/code_generator.cc (revision 11533)
+++ runtime/vm/code_generator.cc (working copy)
@@ -26,6 +26,8 @@
namespace dart {
+DEFINE_FLAG(bool, deoptimize_alot, false,
+ "Deoptimizes all live frames at runtime and native entries.");
siva 2012/08/30 01:37:30 Deoptimizes all live frames when we are about to r
srdjan 2012/08/30 17:16:16 Done, removed reference to runtime.
DEFINE_FLAG(bool, inline_cache, true, "Enable inline caches");
DEFINE_FLAG(bool, trace_deopt, false, "Trace deoptimization");
DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling");
@@ -1395,7 +1397,30 @@
}
+// Currently checks only that all optimized frames have kDeoptIndex
+// and unoptimized code has the kDeoptAfter.
+void DeoptimizeAll() {
+ DartFrameIterator iterator;
+ StackFrame* frame = iterator.NextFrame();
siva 2012/08/30 01:37:30 Code& optimized_code = Code::Handle(); Function& f
srdjan 2012/08/30 17:16:16 Done.
+ while (frame != NULL) {
+ const Code& optimized_code = Code::Handle(frame->LookupDartCode());
siva 2012/08/30 01:37:30 optimized_code = frame->LookupDartCode();
srdjan 2012/08/30 17:16:16 Done.
+ if (optimized_code.is_optimized()) {
+ intptr_t deopt_id, deopt_reason, deopt_index;
+ GetDeoptIxDescrAtPc(optimized_code, frame->pc(),
+ &deopt_id, &deopt_reason, &deopt_index);
+ ASSERT(deopt_id != Isolate::kNoDeoptId);
+ const Function& function = Function::Handle(optimized_code.function());
siva 2012/08/30 01:37:30 function = optimized_code.function(); unoptimized_
srdjan 2012/08/30 17:16:16 Done.
+ const Code& unoptimized_code = Code::Handle(function.unoptimized_code());
+ ASSERT(!unoptimized_code.IsNull());
+ uword continue_at_pc =
+ unoptimized_code.GetDeoptAfterPcAtDeoptId(deopt_id);
+ ASSERT(continue_at_pc != 0);
siva 2012/08/30 01:37:30 Maybe also assert that continue_at_pc > unoptimize
srdjan 2012/08/30 17:16:16 This check belongs in GetDeoptAfterPcAtDeoptId. Ad
+ }
+ frame = iterator.NextFrame();
+ }
+}
+
// Copy saved registers into the isolate buffer.
static void CopySavedRegisters(intptr_t* saved_registers_address) {
intptr_t* registers_copy = new intptr_t[kNumberOfCpuRegisters];
@@ -1563,7 +1588,7 @@
GetDeoptIxDescrAtPc(optimized_code, caller_frame->pc(),
&deopt_id, &deopt_reason, &deopt_index);
ASSERT(deopt_id != Isolate::kNoDeoptId);
- uword continue_at_pc = unoptimized_code.GetDeoptPcAtDeoptId(deopt_id);
+ uword continue_at_pc = unoptimized_code.GetDeoptBeforePcAtDeoptId(deopt_id);
siva 2012/08/30 01:37:30 I am a little confused I thought unoptimized_code
srdjan 2012/08/30 17:16:16 DeoptBefore an DeoptAfter are continuation points
if (FLAG_trace_deopt) {
OS::Print(" -> continue at 0x%x\n", continue_at_pc);
// TODO(srdjan): If we could allow GC, we could print the line where

Powered by Google App Engine
This is Rietveld 408576698