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

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

Issue 343803002: Finishes removing intptr_t from raw object fields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | runtime/vm/object.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) 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 } 432 }
433 ASSERT(!pc_desc_.IsNull()); 433 ASSERT(!pc_desc_.IsNull());
434 intptr_t innermost_begin_pos = 0; 434 intptr_t innermost_begin_pos = 0;
435 intptr_t activation_token_pos = TokenPos(); 435 intptr_t activation_token_pos = TokenPos();
436 ASSERT(activation_token_pos >= 0); 436 ASSERT(activation_token_pos >= 0);
437 GetVarDescriptors(); 437 GetVarDescriptors();
438 intptr_t var_desc_len = var_descriptors_.Length(); 438 intptr_t var_desc_len = var_descriptors_.Length();
439 for (intptr_t cur_idx = 0; cur_idx < var_desc_len; cur_idx++) { 439 for (intptr_t cur_idx = 0; cur_idx < var_desc_len; cur_idx++) {
440 RawLocalVarDescriptors::VarInfo var_info; 440 RawLocalVarDescriptors::VarInfo var_info;
441 var_descriptors_.GetInfo(cur_idx, &var_info); 441 var_descriptors_.GetInfo(cur_idx, &var_info);
442 if ((var_info.kind == RawLocalVarDescriptors::kContextLevel) && 442 const int8_t kind = var_info.kind();
443 if ((kind == RawLocalVarDescriptors::kContextLevel) &&
443 (var_info.begin_pos <= activation_token_pos) && 444 (var_info.begin_pos <= activation_token_pos) &&
444 (activation_token_pos < var_info.end_pos)) { 445 (activation_token_pos < var_info.end_pos)) {
445 // This var_descriptors_ entry is a context scope which is in scope 446 // This var_descriptors_ entry is a context scope which is in scope
446 // of the current token position. Now check whether it is shadowing 447 // of the current token position. Now check whether it is shadowing
447 // the previous context scope. 448 // the previous context scope.
448 if (innermost_begin_pos < var_info.begin_pos) { 449 if (innermost_begin_pos < var_info.begin_pos) {
449 innermost_begin_pos = var_info.begin_pos; 450 innermost_begin_pos = var_info.begin_pos;
450 context_level_ = var_info.index; 451 context_level_ = var_info.index();
451 } 452 }
452 } 453 }
453 } 454 }
454 ASSERT(context_level_ >= 0); 455 ASSERT(context_level_ >= 0);
455 } 456 }
456 return context_level_; 457 return context_level_;
457 } 458 }
458 459
459 460
460 RawContext* ActivationFrame::GetSavedEntryContext() { 461 RawContext* ActivationFrame::GetSavedEntryContext() {
461 // Attempt to find a saved context. 462 // Attempt to find a saved context.
462 GetVarDescriptors(); 463 GetVarDescriptors();
463 intptr_t var_desc_len = var_descriptors_.Length(); 464 intptr_t var_desc_len = var_descriptors_.Length();
464 for (intptr_t i = 0; i < var_desc_len; i++) { 465 for (intptr_t i = 0; i < var_desc_len; i++) {
465 RawLocalVarDescriptors::VarInfo var_info; 466 RawLocalVarDescriptors::VarInfo var_info;
466 var_descriptors_.GetInfo(i, &var_info); 467 var_descriptors_.GetInfo(i, &var_info);
467 if (var_info.kind == RawLocalVarDescriptors::kSavedEntryContext) { 468 const int8_t kind = var_info.kind();
469 if (kind == RawLocalVarDescriptors::kSavedEntryContext) {
468 if (FLAG_trace_debugger_stacktrace) { 470 if (FLAG_trace_debugger_stacktrace) {
469 OS::PrintErr("\tFound saved entry ctx at index %" Pd "\n", 471 OS::PrintErr("\tFound saved entry ctx at index %d\n", var_info.index());
470 var_info.index);
471 } 472 }
472 return GetLocalContextVar(var_info.index); 473 return GetLocalContextVar(var_info.index());
473 } 474 }
474 } 475 }
475 476
476 // No saved context. Return the current context. 477 // No saved context. Return the current context.
477 return ctx_.raw(); 478 return ctx_.raw();
478 } 479 }
479 480
480 481
481 // Get the saved context if the callee of this activation frame is a 482 // Get the saved context if the callee of this activation frame is a
482 // closure function. 483 // closure function.
483 RawContext* ActivationFrame::GetSavedCurrentContext() { 484 RawContext* ActivationFrame::GetSavedCurrentContext() {
484 GetVarDescriptors(); 485 GetVarDescriptors();
485 intptr_t var_desc_len = var_descriptors_.Length(); 486 intptr_t var_desc_len = var_descriptors_.Length();
486 for (intptr_t i = 0; i < var_desc_len; i++) { 487 for (intptr_t i = 0; i < var_desc_len; i++) {
487 RawLocalVarDescriptors::VarInfo var_info; 488 RawLocalVarDescriptors::VarInfo var_info;
488 var_descriptors_.GetInfo(i, &var_info); 489 var_descriptors_.GetInfo(i, &var_info);
489 if (var_info.kind == RawLocalVarDescriptors::kSavedCurrentContext) { 490 const int8_t kind = var_info.kind();
491 if (kind == RawLocalVarDescriptors::kSavedCurrentContext) {
490 if (FLAG_trace_debugger_stacktrace) { 492 if (FLAG_trace_debugger_stacktrace) {
491 OS::PrintErr("\tFound saved current ctx at index %" Pd "\n", 493 OS::PrintErr("\tFound saved current ctx at index %d\n",
492 var_info.index); 494 var_info.index());
493 } 495 }
494 return GetLocalContextVar(var_info.index); 496 return GetLocalContextVar(var_info.index());
495 } 497 }
496 } 498 }
497 UNREACHABLE(); 499 UNREACHABLE();
498 return Context::null(); 500 return Context::null();
499 } 501 }
500 502
501 503
502 const char* DebuggerEvent::EventTypeToCString(EventType type) { 504 const char* DebuggerEvent::EventTypeToCString(EventType type) {
503 switch (type) { 505 switch (type) {
504 case kBreakpointReached: 506 case kBreakpointReached:
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 vars_initialized_ = true; 591 vars_initialized_ = true;
590 return; 592 return;
591 } 593 }
592 594
593 GrowableArray<String*> var_names(8); 595 GrowableArray<String*> var_names(8);
594 intptr_t var_desc_len = var_descriptors_.Length(); 596 intptr_t var_desc_len = var_descriptors_.Length();
595 for (intptr_t cur_idx = 0; cur_idx < var_desc_len; cur_idx++) { 597 for (intptr_t cur_idx = 0; cur_idx < var_desc_len; cur_idx++) {
596 ASSERT(var_names.length() == desc_indices_.length()); 598 ASSERT(var_names.length() == desc_indices_.length());
597 RawLocalVarDescriptors::VarInfo var_info; 599 RawLocalVarDescriptors::VarInfo var_info;
598 var_descriptors_.GetInfo(cur_idx, &var_info); 600 var_descriptors_.GetInfo(cur_idx, &var_info);
599 if ((var_info.kind != RawLocalVarDescriptors::kStackVar) && 601 const int8_t kind = var_info.kind();
600 (var_info.kind != RawLocalVarDescriptors::kContextVar)) { 602 if ((kind != RawLocalVarDescriptors::kStackVar) &&
603 (kind != RawLocalVarDescriptors::kContextVar)) {
601 continue; 604 continue;
602 } 605 }
603 if ((var_info.begin_pos <= activation_token_pos) && 606 if ((var_info.begin_pos <= activation_token_pos) &&
604 (activation_token_pos <= var_info.end_pos)) { 607 (activation_token_pos <= var_info.end_pos)) {
605 if ((var_info.kind == RawLocalVarDescriptors::kContextVar) && 608 if ((kind == RawLocalVarDescriptors::kContextVar) &&
606 (ContextLevel() < var_info.scope_id)) { 609 (ContextLevel() < var_info.scope_id)) {
607 // The variable is textually in scope but the context level 610 // The variable is textually in scope but the context level
608 // at the activation frame's PC is lower than the context 611 // at the activation frame's PC is lower than the context
609 // level of the variable. The context containing the variable 612 // level of the variable. The context containing the variable
610 // has already been removed from the chain. This can happen when we 613 // has already been removed from the chain. This can happen when we
611 // break at a return statement, since the contexts get discarded 614 // break at a return statement, since the contexts get discarded
612 // before the debugger gets called. 615 // before the debugger gets called.
613 continue; 616 continue;
614 } 617 }
615 // The current variable is textually in scope. Now check whether 618 // The current variable is textually in scope. Now check whether
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 intptr_t desc_index = desc_indices_[i]; 749 intptr_t desc_index = desc_indices_[i];
747 ASSERT(name != NULL); 750 ASSERT(name != NULL);
748 *name ^= var_descriptors_.GetName(desc_index); 751 *name ^= var_descriptors_.GetName(desc_index);
749 RawLocalVarDescriptors::VarInfo var_info; 752 RawLocalVarDescriptors::VarInfo var_info;
750 var_descriptors_.GetInfo(desc_index, &var_info); 753 var_descriptors_.GetInfo(desc_index, &var_info);
751 ASSERT(token_pos != NULL); 754 ASSERT(token_pos != NULL);
752 *token_pos = var_info.begin_pos; 755 *token_pos = var_info.begin_pos;
753 ASSERT(end_pos != NULL); 756 ASSERT(end_pos != NULL);
754 *end_pos = var_info.end_pos; 757 *end_pos = var_info.end_pos;
755 ASSERT(value != NULL); 758 ASSERT(value != NULL);
756 if (var_info.kind == RawLocalVarDescriptors::kStackVar) { 759 const int8_t kind = var_info.kind();
757 *value = GetLocalInstanceVar(var_info.index); 760 if (kind == RawLocalVarDescriptors::kStackVar) {
761 *value = GetLocalInstanceVar(var_info.index());
758 } else { 762 } else {
759 ASSERT(var_info.kind == RawLocalVarDescriptors::kContextVar); 763 ASSERT(kind == RawLocalVarDescriptors::kContextVar);
760 if (ctx_.IsNull()) { 764 if (ctx_.IsNull()) {
761 // The context has been removed by the optimizing compiler. 765 // The context has been removed by the optimizing compiler.
762 // 766 //
763 // TODO(turnidge): This may be erroneous. Revisit. 767 // TODO(turnidge): This may be erroneous. Revisit.
764 *value = Symbols::OptimizedOut().raw(); 768 *value = Symbols::OptimizedOut().raw();
765 return; 769 return;
766 } 770 }
767 771
768 // The context level at the PC/token index of this activation frame. 772 // The context level at the PC/token index of this activation frame.
769 intptr_t frame_ctx_level = ContextLevel(); 773 intptr_t frame_ctx_level = ContextLevel();
770 774
771 // The context level of the variable. 775 // The context level of the variable.
772 intptr_t var_ctx_level = var_info.scope_id; 776 intptr_t var_ctx_level = var_info.scope_id;
773 intptr_t level_diff = frame_ctx_level - var_ctx_level; 777 intptr_t level_diff = frame_ctx_level - var_ctx_level;
774 intptr_t ctx_slot = var_info.index; 778 intptr_t ctx_slot = var_info.index();
775 if (level_diff == 0) { 779 if (level_diff == 0) {
776 if ((ctx_slot < 0) || 780 if ((ctx_slot < 0) ||
777 (ctx_slot >= ctx_.num_variables())) { 781 (ctx_slot >= ctx_.num_variables())) {
778 PrintContextMismatchError(*name, ctx_slot, 782 PrintContextMismatchError(*name, ctx_slot,
779 frame_ctx_level, var_ctx_level); 783 frame_ctx_level, var_ctx_level);
780 } 784 }
781 ASSERT((ctx_slot >= 0) && (ctx_slot < ctx_.num_variables())); 785 ASSERT((ctx_slot >= 0) && (ctx_slot < ctx_.num_variables()));
782 *value = ctx_.At(ctx_slot); 786 *value = ctx_.At(ctx_slot);
783 } else { 787 } else {
784 ASSERT(level_diff > 0); 788 ASSERT(level_diff > 0);
(...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after
2579 } 2583 }
2580 2584
2581 2585
2582 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) { 2586 void Debugger::RegisterCodeBreakpoint(CodeBreakpoint* bpt) {
2583 ASSERT(bpt->next() == NULL); 2587 ASSERT(bpt->next() == NULL);
2584 bpt->set_next(code_breakpoints_); 2588 bpt->set_next(code_breakpoints_);
2585 code_breakpoints_ = bpt; 2589 code_breakpoints_ = bpt;
2586 } 2590 }
2587 2591
2588 } // namespace dart 2592 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698