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

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

Issue 1858283002: Initial SIMDBC interpreter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: commend ifdef's Created 4 years, 8 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
OLDNEW
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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 if (bpt_location_->IsResolved()) { 224 if (bpt_location_->IsResolved()) {
225 jsobj.AddLocation(bpt_location_); 225 jsobj.AddLocation(bpt_location_);
226 } else { 226 } else {
227 jsobj.AddUnresolvedLocation(bpt_location_); 227 jsobj.AddUnresolvedLocation(bpt_location_);
228 } 228 }
229 } 229 }
230 230
231 231
232 void CodeBreakpoint::VisitObjectPointers(ObjectPointerVisitor* visitor) { 232 void CodeBreakpoint::VisitObjectPointers(ObjectPointerVisitor* visitor) {
233 visitor->VisitPointer(reinterpret_cast<RawObject**>(&code_)); 233 visitor->VisitPointer(reinterpret_cast<RawObject**>(&code_));
234 #if !defined(TARGET_ARCH_DBC)
234 visitor->VisitPointer(reinterpret_cast<RawObject**>(&saved_value_)); 235 visitor->VisitPointer(reinterpret_cast<RawObject**>(&saved_value_));
236 #endif
235 } 237 }
236 238
237 239
238 ActivationFrame::ActivationFrame( 240 ActivationFrame::ActivationFrame(
239 uword pc, 241 uword pc,
240 uword fp, 242 uword fp,
241 uword sp, 243 uword sp,
242 const Code& code, 244 const Code& code,
243 const Array& deopt_frame, 245 const Array& deopt_frame,
244 intptr_t deopt_frame_offset) 246 intptr_t deopt_frame_offset)
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 vars_initialized_ = true; 854 vars_initialized_ = true;
853 } 855 }
854 856
855 857
856 intptr_t ActivationFrame::NumLocalVariables() { 858 intptr_t ActivationFrame::NumLocalVariables() {
857 GetDescIndices(); 859 GetDescIndices();
858 return desc_indices_.length(); 860 return desc_indices_.length();
859 } 861 }
860 862
861 863
864 DART_FORCE_INLINE static RawObject* GetVariableValue(uword addr) {
865 return *reinterpret_cast<RawObject**>(addr);
866 }
867
868
862 RawObject* ActivationFrame::GetParameter(intptr_t index) { 869 RawObject* ActivationFrame::GetParameter(intptr_t index) {
863 intptr_t num_parameters = function().num_fixed_parameters(); 870 intptr_t num_parameters = function().num_fixed_parameters();
864 ASSERT(0 <= index && index < num_parameters); 871 ASSERT(0 <= index && index < num_parameters);
865 intptr_t reverse_index = num_parameters - index;
866 872
867 if (function().NumOptionalParameters() > 0) { 873 if (function().NumOptionalParameters() > 0) {
868 // If the function has optional parameters, the first positional parameter 874 // If the function has optional parameters, the first positional parameter
869 // can be in a number of places in the caller's frame depending on how many 875 // can be in a number of places in the caller's frame depending on how many
870 // were actually supplied at the call site, but they are copied to a fixed 876 // were actually supplied at the call site, but they are copied to a fixed
871 // place in the callee's frame. 877 // place in the callee's frame.
872 uword var_address = fp() + ((kFirstLocalSlotFromFp - index) * kWordSize); 878 return GetVariableValue(LocalVarAddress(fp(), -(index + 1)));
873 return reinterpret_cast<RawObject*>(
874 *reinterpret_cast<uword*>(var_address));
875 } else { 879 } else {
876 uword var_address = fp() + (kParamEndSlotFromFp * kWordSize) 880 intptr_t reverse_index = num_parameters - index;
877 + (reverse_index * kWordSize); 881 return GetVariableValue(ParamAddress(fp(), reverse_index));
878 return reinterpret_cast<RawObject*>(
879 *reinterpret_cast<uword*>(var_address));
880 } 882 }
881 } 883 }
882 884
883 885
884 RawObject* ActivationFrame::GetClosure() { 886 RawObject* ActivationFrame::GetClosure() {
885 ASSERT(function().IsClosureFunction()); 887 ASSERT(function().IsClosureFunction());
886 return GetParameter(0); 888 return GetParameter(0);
887 } 889 }
888 890
889 891
890 RawObject* ActivationFrame::GetStackVar(intptr_t slot_index) { 892 RawObject* ActivationFrame::GetStackVar(intptr_t slot_index) {
891 if (deopt_frame_.IsNull()) { 893 if (deopt_frame_.IsNull()) {
892 uword var_address = fp() + slot_index * kWordSize; 894 return GetVariableValue(LocalVarAddress(fp(), slot_index));
893 return reinterpret_cast<RawObject*>(
894 *reinterpret_cast<uword*>(var_address));
895 } else { 895 } else {
896 return deopt_frame_.At(deopt_frame_offset_ + slot_index); 896 return deopt_frame_.At(deopt_frame_offset_ + slot_index);
897 } 897 }
898 } 898 }
899 899
900 900
901 void ActivationFrame::PrintContextMismatchError( 901 void ActivationFrame::PrintContextMismatchError(
902 intptr_t ctx_slot, 902 intptr_t ctx_slot,
903 intptr_t frame_ctx_level, 903 intptr_t frame_ctx_level,
904 intptr_t var_ctx_level) { 904 intptr_t var_ctx_level) {
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 uword pc, 1162 uword pc,
1163 RawPcDescriptors::Kind kind) 1163 RawPcDescriptors::Kind kind)
1164 : code_(code.raw()), 1164 : code_(code.raw()),
1165 token_pos_(token_pos), 1165 token_pos_(token_pos),
1166 pc_(pc), 1166 pc_(pc),
1167 line_number_(-1), 1167 line_number_(-1),
1168 is_enabled_(false), 1168 is_enabled_(false),
1169 bpt_location_(NULL), 1169 bpt_location_(NULL),
1170 next_(NULL), 1170 next_(NULL),
1171 breakpoint_kind_(kind), 1171 breakpoint_kind_(kind),
1172 saved_value_(Code::null()) { 1172 #if !defined(TARGET_ARCH_DBC)
1173 saved_value_(Code::null())
1174 #else
1175 saved_value_(Bytecode::kTrap)
1176 #endif
1177 {
1173 ASSERT(!code.IsNull()); 1178 ASSERT(!code.IsNull());
1174 ASSERT(token_pos_.IsReal()); 1179 ASSERT(token_pos_.IsReal());
1175 ASSERT(pc_ != 0); 1180 ASSERT(pc_ != 0);
1176 ASSERT((breakpoint_kind_ & kSafepointKind) != 0); 1181 ASSERT((breakpoint_kind_ & kSafepointKind) != 0);
1177 } 1182 }
1178 1183
1179 1184
1180 CodeBreakpoint::~CodeBreakpoint() { 1185 CodeBreakpoint::~CodeBreakpoint() {
1181 // Make sure we don't leave patched code behind. 1186 // Make sure we don't leave patched code behind.
1182 ASSERT(!IsEnabled()); 1187 ASSERT(!IsEnabled());
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
2683 // interested in. If we saved the frame pointer of a stack frame 2688 // interested in. If we saved the frame pointer of a stack frame
2684 // the user is interested in, we ignore the single step if we are 2689 // the user is interested in, we ignore the single step if we are
2685 // in a callee of that frame. Note that we assume that the stack 2690 // in a callee of that frame. Note that we assume that the stack
2686 // grows towards lower addresses. 2691 // grows towards lower addresses.
2687 ActivationFrame* frame = TopDartFrame(); 2692 ActivationFrame* frame = TopDartFrame();
2688 ASSERT(frame != NULL); 2693 ASSERT(frame != NULL);
2689 2694
2690 if (stepping_fp_ != 0) { 2695 if (stepping_fp_ != 0) {
2691 // There is an "interesting frame" set. Only pause at appropriate 2696 // There is an "interesting frame" set. Only pause at appropriate
2692 // locations in this frame. 2697 // locations in this frame.
2693 if (stepping_fp_ > frame->fp()) { 2698 if (IsCalleeFrameOf(stepping_fp_, frame->fp())) {
2694 // We are i n a callee of the frame we're interested in. 2699 // We are i n a callee of the frame we're interested in.
2695 // Ignore this stepping break. 2700 // Ignore this stepping break.
2696 return Error::null(); 2701 return Error::null();
2697 } else if (frame->fp() > stepping_fp_) { 2702 } else if (IsCalleeFrameOf(frame->fp(), stepping_fp_)) {
2698 // We returned from the "interesting frame", there can be no more 2703 // We returned from the "interesting frame", there can be no more
2699 // stepping breaks for it. Pause at the next appropriate location 2704 // stepping breaks for it. Pause at the next appropriate location
2700 // and let the user set the "interesting" frame again. 2705 // and let the user set the "interesting" frame again.
2701 stepping_fp_ = 0; 2706 stepping_fp_ = 0;
2702 } 2707 }
2703 } 2708 }
2704 2709
2705 if (!frame->IsDebuggable()) { 2710 if (!frame->IsDebuggable()) {
2706 return Error::null(); 2711 return Error::null();
2707 } 2712 }
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
3344 3349
3345 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 3350 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
3346 ASSERT(bpt->next() == NULL); 3351 ASSERT(bpt->next() == NULL);
3347 bpt->set_next(code_breakpoints_); 3352 bpt->set_next(code_breakpoints_);
3348 code_breakpoints_ = bpt; 3353 code_breakpoints_ = bpt;
3349 } 3354 }
3350 3355
3351 #endif // !PRODUCT 3356 #endif // !PRODUCT
3352 3357
3353 } // namespace dart 3358 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698