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

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

Issue 2382953004: Revert "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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/exceptions.h" 5 #include "vm/exceptions.h"
6 6
7 #include "platform/address_sanitizer.h" 7 #include "platform/address_sanitizer.h"
8 8
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
11 #include "vm/debugger.h" 11 #include "vm/debugger.h"
12 #include "vm/flags.h" 12 #include "vm/flags.h"
13 #include "vm/log.h" 13 #include "vm/log.h"
14 #include "vm/longjump.h" 14 #include "vm/longjump.h"
15 #include "vm/object.h" 15 #include "vm/object.h"
16 #include "vm/object_store.h" 16 #include "vm/object_store.h"
17 #include "vm/stack_frame.h" 17 #include "vm/stack_frame.h"
18 #include "vm/stub_code.h" 18 #include "vm/stub_code.h"
19 #include "vm/symbols.h" 19 #include "vm/symbols.h"
20 #include "vm/tags.h" 20 #include "vm/tags.h"
21 21
22 namespace dart { 22 namespace dart {
23 23
24 DECLARE_FLAG(bool, trace_deoptimization);
25 DEFINE_FLAG(bool, print_stacktrace_at_throw, false, 24 DEFINE_FLAG(bool, print_stacktrace_at_throw, false,
26 "Prints a stack trace everytime a throw occurs."); 25 "Prints a stack trace everytime a throw occurs.");
27 26
28 27
29 class StacktraceBuilder : public ValueObject { 28 class StacktraceBuilder : public ValueObject {
30 public: 29 public:
31 StacktraceBuilder() { } 30 StacktraceBuilder() { }
32 virtual ~StacktraceBuilder() { } 31 virtual ~StacktraceBuilder() { }
33 32
34 virtual void AddFrame(const Code& code, const Smi& offset) = 0; 33 virtual void AddFrame(const Code& code, const Smi& offset) = 0;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 121
123 static void BuildStackTrace(StacktraceBuilder* builder) { 122 static void BuildStackTrace(StacktraceBuilder* builder) {
124 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); 123 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames);
125 StackFrame* frame = frames.NextFrame(); 124 StackFrame* frame = frames.NextFrame();
126 ASSERT(frame != NULL); // We expect to find a dart invocation frame. 125 ASSERT(frame != NULL); // We expect to find a dart invocation frame.
127 Code& code = Code::Handle(); 126 Code& code = Code::Handle();
128 Smi& offset = Smi::Handle(); 127 Smi& offset = Smi::Handle();
129 while (frame != NULL) { 128 while (frame != NULL) {
130 if (frame->IsDartFrame()) { 129 if (frame->IsDartFrame()) {
131 code = frame->LookupDartCode(); 130 code = frame->LookupDartCode();
132 ASSERT(code.ContainsInstructionAt(frame->pc()));
133 offset = Smi::New(frame->pc() - code.PayloadStart()); 131 offset = Smi::New(frame->pc() - code.PayloadStart());
134 builder->AddFrame(code, offset); 132 builder->AddFrame(code, offset);
135 } 133 }
136 frame = frames.NextFrame(); 134 frame = frames.NextFrame();
137 } 135 }
138 } 136 }
139 137
140 138
141 // Iterate through the stack frames and try to find a frame with an 139 // Iterate through the stack frames and try to find a frame with an
142 // exception handler. Once found, set the pc, sp and fp so that execution 140 // exception handler. Once found, set the pc, sp and fp so that execution
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 uword stack_pointer, 207 uword stack_pointer,
210 uword frame_pointer, 208 uword frame_pointer,
211 const Object& exception_object, 209 const Object& exception_object,
212 const Object& stacktrace_object) { 210 const Object& stacktrace_object) {
213 // The no_gc StackResource is unwound through the tear down of 211 // The no_gc StackResource is unwound through the tear down of
214 // stack resources below. 212 // stack resources below.
215 NoSafepointScope no_safepoint; 213 NoSafepointScope no_safepoint;
216 RawObject* raw_exception = exception_object.raw(); 214 RawObject* raw_exception = exception_object.raw();
217 RawObject* raw_stacktrace = stacktrace_object.raw(); 215 RawObject* raw_stacktrace = stacktrace_object.raw();
218 216
219 #if !defined(TARGET_ARCH_DBC)
220 MallocGrowableArray<PendingLazyDeopt>* pending_deopts =
221 thread->isolate()->pending_deopts();
222 for (intptr_t i = pending_deopts->length() - 1; i >= 0; i--) {
223 if ((*pending_deopts)[i].fp() == frame_pointer) {
224 // Frame is scheduled for lazy deopt.
225 program_counter =
226 StubCode::DeoptimizeLazyFromThrow_entry()->EntryPoint();
227 if (FLAG_trace_deoptimization) {
228 THR_Print("Throwing to frame scheduled for lazy deopt fp=%" Pp "\n",
229 frame_pointer);
230 }
231 break;
232 }
233 }
234 for (intptr_t i = pending_deopts->length() - 1; i >= 0; i--) {
235 // Leave the mapping at fp itself for use in DeoptimizeCopyFrame.
236 if ((*pending_deopts)[i].fp() < frame_pointer) {
237 pending_deopts->RemoveAt(i);
238 }
239 }
240 #endif // !DBC
241
242
243 #if defined(USING_SIMULATOR) 217 #if defined(USING_SIMULATOR)
244 // Unwinding of the C++ frames and destroying of their stack resources is done 218 // Unwinding of the C++ frames and destroying of their stack resources is done
245 // by the simulator, because the target stack_pointer is a simulated stack 219 // by the simulator, because the target stack_pointer is a simulated stack
246 // pointer and not the C++ stack pointer. 220 // pointer and not the C++ stack pointer.
247 221
248 // Continue simulating at the given pc in the given frame after setting up the 222 // Continue simulating at the given pc in the given frame after setting up the
249 // exception object in the kExceptionObjectReg register and the stacktrace 223 // exception object in the kExceptionObjectReg register and the stacktrace
250 // object (may be raw null) in the kStackTraceObjectReg register. 224 // object (may be raw null) in the kStackTraceObjectReg register.
251 225
252 Simulator::Current()->Longjmp(program_counter, stack_pointer, frame_pointer, 226 Simulator::Current()->Longjmp(program_counter, stack_pointer, frame_pointer,
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 } 738 }
765 739
766 return DartLibraryCalls::InstanceCreate(library, 740 return DartLibraryCalls::InstanceCreate(library,
767 *class_name, 741 *class_name,
768 *constructor_name, 742 *constructor_name,
769 arguments); 743 arguments);
770 } 744 }
771 745
772 746
773 } // namespace dart 747 } // namespace dart
OLDNEW
« 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