OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/debugger.h" | 5 #include "vm/debugger.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 | 8 |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 if (bpt_location_->IsResolved()) { | 213 if (bpt_location_->IsResolved()) { |
214 jsobj.AddLocation(bpt_location_); | 214 jsobj.AddLocation(bpt_location_); |
215 } else { | 215 } else { |
216 jsobj.AddUnresolvedLocation(bpt_location_); | 216 jsobj.AddUnresolvedLocation(bpt_location_); |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 | 220 |
221 void CodeBreakpoint::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 221 void CodeBreakpoint::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
222 visitor->VisitPointer(reinterpret_cast<RawObject**>(&code_)); | 222 visitor->VisitPointer(reinterpret_cast<RawObject**>(&code_)); |
| 223 visitor->VisitPointer(reinterpret_cast<RawObject**>(&saved_value_)); |
223 } | 224 } |
224 | 225 |
225 | 226 |
226 ActivationFrame::ActivationFrame( | 227 ActivationFrame::ActivationFrame( |
227 uword pc, | 228 uword pc, |
228 uword fp, | 229 uword fp, |
229 uword sp, | 230 uword sp, |
230 const Code& code, | 231 const Code& code, |
231 const Array& deopt_frame, | 232 const Array& deopt_frame, |
232 intptr_t deopt_frame_offset) | 233 intptr_t deopt_frame_offset) |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 uword pc, | 1108 uword pc, |
1108 RawPcDescriptors::Kind kind) | 1109 RawPcDescriptors::Kind kind) |
1109 : code_(code.raw()), | 1110 : code_(code.raw()), |
1110 token_pos_(token_pos), | 1111 token_pos_(token_pos), |
1111 pc_(pc), | 1112 pc_(pc), |
1112 line_number_(-1), | 1113 line_number_(-1), |
1113 is_enabled_(false), | 1114 is_enabled_(false), |
1114 bpt_location_(NULL), | 1115 bpt_location_(NULL), |
1115 next_(NULL), | 1116 next_(NULL), |
1116 breakpoint_kind_(kind), | 1117 breakpoint_kind_(kind), |
1117 saved_value_(0) { | 1118 saved_value_(Code::null()) { |
1118 ASSERT(!code.IsNull()); | 1119 ASSERT(!code.IsNull()); |
1119 ASSERT(token_pos_ > 0); | 1120 ASSERT(token_pos_ > 0); |
1120 ASSERT(pc_ != 0); | 1121 ASSERT(pc_ != 0); |
1121 ASSERT((breakpoint_kind_ & kSafepointKind) != 0); | 1122 ASSERT((breakpoint_kind_ & kSafepointKind) != 0); |
1122 } | 1123 } |
1123 | 1124 |
1124 | 1125 |
1125 CodeBreakpoint::~CodeBreakpoint() { | 1126 CodeBreakpoint::~CodeBreakpoint() { |
1126 // Make sure we don't leave patched code behind. | 1127 // Make sure we don't leave patched code behind. |
1127 ASSERT(!IsEnabled()); | 1128 ASSERT(!IsEnabled()); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 | 1392 |
1392 RawArray* Debugger::DeoptimizeToArray(Isolate* isolate, | 1393 RawArray* Debugger::DeoptimizeToArray(Isolate* isolate, |
1393 StackFrame* frame, | 1394 StackFrame* frame, |
1394 const Code& code) { | 1395 const Code& code) { |
1395 ASSERT(code.is_optimized()); | 1396 ASSERT(code.is_optimized()); |
1396 | 1397 |
1397 // Create the DeoptContext for this deoptimization. | 1398 // Create the DeoptContext for this deoptimization. |
1398 DeoptContext* deopt_context = | 1399 DeoptContext* deopt_context = |
1399 new DeoptContext(frame, code, | 1400 new DeoptContext(frame, code, |
1400 DeoptContext::kDestIsAllocated, | 1401 DeoptContext::kDestIsAllocated, |
1401 NULL, NULL); | 1402 NULL, |
| 1403 NULL, |
| 1404 true); |
1402 isolate->set_deopt_context(deopt_context); | 1405 isolate->set_deopt_context(deopt_context); |
1403 | 1406 |
1404 deopt_context->FillDestFrame(); | 1407 deopt_context->FillDestFrame(); |
1405 deopt_context->MaterializeDeferredObjects(); | 1408 deopt_context->MaterializeDeferredObjects(); |
1406 const Array& dest_frame = Array::Handle(isolate, | 1409 const Array& dest_frame = Array::Handle(isolate, |
1407 deopt_context->DestFrameAsArray()); | 1410 deopt_context->DestFrameAsArray()); |
1408 | 1411 |
1409 isolate->set_deopt_context(NULL); | 1412 isolate->set_deopt_context(NULL); |
1410 delete deopt_context; | 1413 delete deopt_context; |
1411 | 1414 |
(...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3000 while (bpt != NULL) { | 3003 while (bpt != NULL) { |
3001 if (bpt->pc() == breakpoint_address) { | 3004 if (bpt->pc() == breakpoint_address) { |
3002 return bpt; | 3005 return bpt; |
3003 } | 3006 } |
3004 bpt = bpt->next(); | 3007 bpt = bpt->next(); |
3005 } | 3008 } |
3006 return NULL; | 3009 return NULL; |
3007 } | 3010 } |
3008 | 3011 |
3009 | 3012 |
3010 uword Debugger::GetPatchedStubAddress(uword breakpoint_address) { | 3013 RawCode* Debugger::GetPatchedStubAddress(uword breakpoint_address) { |
3011 CodeBreakpoint* bpt = GetCodeBreakpoint(breakpoint_address); | 3014 CodeBreakpoint* bpt = GetCodeBreakpoint(breakpoint_address); |
3012 if (bpt != NULL) { | 3015 if (bpt != NULL) { |
3013 return bpt->OrigStubAddress(); | 3016 return bpt->OrigStubAddress(); |
3014 } | 3017 } |
3015 UNREACHABLE(); | 3018 UNREACHABLE(); |
3016 return 0L; | 3019 return Code::null(); |
3017 } | 3020 } |
3018 | 3021 |
3019 | 3022 |
3020 // Remove and delete the source breakpoint bpt and its associated | 3023 // Remove and delete the source breakpoint bpt and its associated |
3021 // code breakpoints. | 3024 // code breakpoints. |
3022 void Debugger::RemoveBreakpoint(intptr_t bp_id) { | 3025 void Debugger::RemoveBreakpoint(intptr_t bp_id) { |
3023 BreakpointLocation* prev_loc = NULL; | 3026 BreakpointLocation* prev_loc = NULL; |
3024 BreakpointLocation* curr_loc = breakpoint_locations_; | 3027 BreakpointLocation* curr_loc = breakpoint_locations_; |
3025 while (curr_loc != NULL) { | 3028 while (curr_loc != NULL) { |
3026 Breakpoint* prev_bpt = NULL; | 3029 Breakpoint* prev_bpt = NULL; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3173 } | 3176 } |
3174 | 3177 |
3175 | 3178 |
3176 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { | 3179 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { |
3177 ASSERT(bpt->next() == NULL); | 3180 ASSERT(bpt->next() == NULL); |
3178 bpt->set_next(code_breakpoints_); | 3181 bpt->set_next(code_breakpoints_); |
3179 code_breakpoints_ = bpt; | 3182 code_breakpoints_ = bpt; |
3180 } | 3183 } |
3181 | 3184 |
3182 } // namespace dart | 3185 } // namespace dart |
OLD | NEW |