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

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
« no previous file with comments | « runtime/vm/code_generator.h ('k') | runtime/vm/deopt_instructions.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 11621)
+++ runtime/vm/code_generator.cc (working copy)
@@ -26,6 +26,9 @@
namespace dart {
+DEFINE_FLAG(bool, deoptimize_alot, false,
+ "Deoptimizes all live frames when we are about to return to Dart code from"
+ " native entries.");
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");
@@ -1376,6 +1379,7 @@
intptr_t* deopt_id,
intptr_t* deopt_reason,
intptr_t* deopt_index) {
+ ASSERT(code.is_optimized());
const PcDescriptors& descriptors =
PcDescriptors::Handle(code.pc_descriptors());
ASSERT(!descriptors.IsNull());
@@ -1395,7 +1399,33 @@
}
+// Currently checks only that all optimized frames have kDeoptIndex
+// and unoptimized code has the kDeoptAfter.
+void DeoptimizeAll() {
+ DartFrameIterator iterator;
+ StackFrame* frame = iterator.NextFrame();
+ Code& optimized_code = Code::Handle();
+ Function& function = Function::Handle();
+ Code& unoptimized_code = Code::Handle();
+ while (frame != NULL) {
+ optimized_code = frame->LookupDartCode();
+ 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);
+ function = optimized_code.function();
+ unoptimized_code = function.unoptimized_code();
+ ASSERT(!unoptimized_code.IsNull());
+ uword continue_at_pc =
+ unoptimized_code.GetDeoptAfterPcAtDeoptId(deopt_id);
+ ASSERT(continue_at_pc != 0);
+ }
+ 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 +1593,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);
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
« no previous file with comments | « runtime/vm/code_generator.h ('k') | runtime/vm/deopt_instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698