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

Unified Diff: runtime/vm/exceptions.cc

Issue 2392613002: Reapply "Lazy deopt without code patching." (Closed)
Patch Set: . Created 4 years, 2 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/deopt_instructions.cc ('k') | runtime/vm/flow_graph_compiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/exceptions.cc
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index 7c9d71dccbb5327f3db5be3086ee36e0ccd85f13..f5f66aee6c59fff91e118b2307996e7cda5ca393 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -21,6 +21,7 @@
namespace dart {
+DECLARE_FLAG(bool, trace_deoptimization);
DEFINE_FLAG(bool, print_stacktrace_at_throw, false,
"Prints a stack trace everytime a throw occurs.");
@@ -128,6 +129,7 @@ static void BuildStackTrace(StacktraceBuilder* builder) {
while (frame != NULL) {
if (frame->IsDartFrame()) {
code = frame->LookupDartCode();
+ ASSERT(code.ContainsInstructionAt(frame->pc()));
offset = Smi::New(frame->pc() - code.PayloadStart());
builder->AddFrame(code, offset);
}
@@ -214,6 +216,35 @@ static void JumpToExceptionHandler(Thread* thread,
RawObject* raw_exception = exception_object.raw();
RawObject* raw_stacktrace = stacktrace_object.raw();
+#if !defined(TARGET_ARCH_DBC)
+ MallocGrowableArray<PendingLazyDeopt>* pending_deopts =
+ thread->isolate()->pending_deopts();
+ for (intptr_t i = pending_deopts->length() - 1; i >= 0; i--) {
+ if ((*pending_deopts)[i].fp() == frame_pointer) {
+ // Frame is scheduled for lazy deopt.
+
+ // Deopt should now resume in the catch handler instead of after the call.
+ (*pending_deopts)[i].set_pc(program_counter);
+
+ // Jump to the deopt stub instead of the catch handler.
+ program_counter =
+ StubCode::DeoptimizeLazyFromThrow_entry()->EntryPoint();
+ if (FLAG_trace_deoptimization) {
+ THR_Print("Throwing to frame scheduled for lazy deopt fp=%" Pp "\n",
+ frame_pointer);
+ }
+ break;
+ }
+ }
+ for (intptr_t i = pending_deopts->length() - 1; i >= 0; i--) {
+ // Leave the mapping at fp itself for use in DeoptimizeCopyFrame.
+ if ((*pending_deopts)[i].fp() < frame_pointer) {
+ pending_deopts->RemoveAt(i);
+ }
+ }
+#endif // !DBC
+
+
#if defined(USING_SIMULATOR)
// Unwinding of the C++ frames and destroying of their stack resources is done
// by the simulator, because the target stack_pointer is a simulated stack
« no previous file with comments | « runtime/vm/deopt_instructions.cc ('k') | runtime/vm/flow_graph_compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698