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

Side by Side Diff: src/liveedit.cc

Issue 3432022: Clean up some messiness in Scopes. (Closed)
Patch Set: Created 10 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
« no previous file with comments | « src/ia32/virtual-frame-ia32.cc ('k') | src/rewriter.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 Scope* outer_scope = scope->outer_scope(); 657 Scope* outer_scope = scope->outer_scope();
658 if (outer_scope == NULL) { 658 if (outer_scope == NULL) {
659 return Heap::undefined_value(); 659 return Heap::undefined_value();
660 } 660 }
661 do { 661 do {
662 ZoneList<Variable*> list(10); 662 ZoneList<Variable*> list(10);
663 outer_scope->CollectUsedVariables(&list); 663 outer_scope->CollectUsedVariables(&list);
664 int j = 0; 664 int j = 0;
665 for (int i = 0; i < list.length(); i++) { 665 for (int i = 0; i < list.length(); i++) {
666 Variable* var1 = list[i]; 666 Variable* var1 = list[i];
667 Slot* slot = var1->slot(); 667 Slot* slot = var1->AsSlot();
668 if (slot != NULL && slot->type() == Slot::CONTEXT) { 668 if (slot != NULL && slot->type() == Slot::CONTEXT) {
669 if (j != i) { 669 if (j != i) {
670 list[j] = var1; 670 list[j] = var1;
671 } 671 }
672 j++; 672 j++;
673 } 673 }
674 } 674 }
675 675
676 // Sort it. 676 // Sort it.
677 for (int k = 1; k < j; k++) { 677 for (int k = 1; k < j; k++) {
678 int l = k; 678 int l = k;
679 for (int m = k + 1; m < j; m++) { 679 for (int m = k + 1; m < j; m++) {
680 if (list[l]->slot()->index() > list[m]->slot()->index()) { 680 if (list[l]->AsSlot()->index() > list[m]->AsSlot()->index()) {
681 l = m; 681 l = m;
682 } 682 }
683 } 683 }
684 list[k] = list[l]; 684 list[k] = list[l];
685 } 685 }
686 for (int i = 0; i < j; i++) { 686 for (int i = 0; i < j; i++) {
687 SetElement(scope_info_list, scope_info_length, list[i]->name()); 687 SetElement(scope_info_list, scope_info_length, list[i]->name());
688 scope_info_length++; 688 scope_info_length++;
689 SetElement(scope_info_list, scope_info_length, 689 SetElement(scope_info_list, scope_info_length,
690 Handle<Smi>(Smi::FromInt(list[i]->slot()->index()))); 690 Handle<Smi>(Smi::FromInt(list[i]->AsSlot()->index())));
691 scope_info_length++; 691 scope_info_length++;
692 } 692 }
693 SetElement(scope_info_list, scope_info_length, 693 SetElement(scope_info_list, scope_info_length,
694 Handle<Object>(Heap::null_value())); 694 Handle<Object>(Heap::null_value()));
695 scope_info_length++; 695 scope_info_length++;
696 696
697 outer_scope = outer_scope->outer_scope(); 697 outer_scope = outer_scope->outer_scope();
698 } while (outer_scope != NULL); 698 } while (outer_scope != NULL);
699 699
700 return *scope_info_list; 700 return *scope_info_list;
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 1476
1477 bool LiveEditFunctionTracker::IsActive() { 1477 bool LiveEditFunctionTracker::IsActive() {
1478 return false; 1478 return false;
1479 } 1479 }
1480 1480
1481 #endif // ENABLE_DEBUGGER_SUPPORT 1481 #endif // ENABLE_DEBUGGER_SUPPORT
1482 1482
1483 1483
1484 1484
1485 } } // namespace v8::internal 1485 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/virtual-frame-ia32.cc ('k') | src/rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698