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

Side by Side Diff: src/liveedit.cc

Issue 3295023: Landing 3338012: Move a function below to private section. (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 | « no previous file | no next file » | 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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 len_++; 610 len_++;
611 } 611 }
612 612
613 void FunctionDone() { 613 void FunctionDone() {
614 HandleScope scope; 614 HandleScope scope;
615 FunctionInfoWrapper info = 615 FunctionInfoWrapper info =
616 FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_)); 616 FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_));
617 current_parent_index_ = info.GetParentIndex(); 617 current_parent_index_ = info.GetParentIndex();
618 } 618 }
619 619
620 // TODO(LiveEdit): Move private method below. 620 public:
621 // This private section was created here to avoid moving the function 621 // Saves only function code, because for a script function we
622 // to keep already complex diff simpler. 622 // may never create a SharedFunctionInfo object.
623 void FunctionCode(Handle<Code> function_code) {
624 FunctionInfoWrapper info =
625 FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_));
626 info.SetFunctionCode(function_code, Handle<Object>(Heap::null_value()));
627 }
628
629 // Saves full information about a function: its code, its scope info
630 // and a SharedFunctionInfo object.
631 void FunctionInfo(Handle<SharedFunctionInfo> shared, Scope* scope) {
632 if (!shared->IsSharedFunctionInfo()) {
633 return;
634 }
635 FunctionInfoWrapper info =
636 FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_));
637 info.SetFunctionCode(Handle<Code>(shared->code()),
638 Handle<Object>(shared->scope_info()));
639 info.SetSharedFunctionInfo(shared);
640
641 Handle<Object> scope_info_list(SerializeFunctionScope(scope));
642 info.SetOuterScopeInfo(scope_info_list);
643 }
644
645 Handle<JSArray> GetResult() { return result_; }
646
623 private: 647 private:
624 Object* SerializeFunctionScope(Scope* scope) { 648 Object* SerializeFunctionScope(Scope* scope) {
625 HandleScope handle_scope; 649 HandleScope handle_scope;
626 650
627 Handle<JSArray> scope_info_list = Factory::NewJSArray(10); 651 Handle<JSArray> scope_info_list = Factory::NewJSArray(10);
628 int scope_info_length = 0; 652 int scope_info_length = 0;
629 653
630 // Saves some description of scope. It stores name and indexes of 654 // Saves some description of scope. It stores name and indexes of
631 // variables in the whole scope chain. Null-named slots delimit 655 // variables in the whole scope chain. Null-named slots delimit
632 // scopes of this chain. 656 // scopes of this chain.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 SetElement(scope_info_list, scope_info_length, 693 SetElement(scope_info_list, scope_info_length,
670 Handle<Object>(Heap::null_value())); 694 Handle<Object>(Heap::null_value()));
671 scope_info_length++; 695 scope_info_length++;
672 696
673 outer_scope = outer_scope->outer_scope(); 697 outer_scope = outer_scope->outer_scope();
674 } while (outer_scope != NULL); 698 } while (outer_scope != NULL);
675 699
676 return *scope_info_list; 700 return *scope_info_list;
677 } 701 }
678 702
679 public:
680 // Saves only function code, because for a script function we
681 // may never create a SharedFunctionInfo object.
682 void FunctionCode(Handle<Code> function_code) {
683 FunctionInfoWrapper info =
684 FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_));
685 info.SetFunctionCode(function_code, Handle<Object>(Heap::null_value()));
686 }
687
688 // Saves full information about a function: its code, its scope info
689 // and a SharedFunctionInfo object.
690 void FunctionInfo(Handle<SharedFunctionInfo> shared, Scope* scope) {
691 if (!shared->IsSharedFunctionInfo()) {
692 return;
693 }
694 FunctionInfoWrapper info =
695 FunctionInfoWrapper::cast(result_->GetElement(current_parent_index_));
696 info.SetFunctionCode(Handle<Code>(shared->code()),
697 Handle<Object>(shared->scope_info()));
698 info.SetSharedFunctionInfo(shared);
699
700 Handle<Object> scope_info_list(SerializeFunctionScope(scope));
701 info.SetOuterScopeInfo(scope_info_list);
702 }
703
704 Handle<JSArray> GetResult() {
705 return result_;
706 }
707
708 private:
709 Handle<JSArray> result_; 703 Handle<JSArray> result_;
710 int len_; 704 int len_;
711 int current_parent_index_; 705 int current_parent_index_;
712 }; 706 };
713 707
714 static FunctionInfoListener* active_function_info_listener = NULL; 708 static FunctionInfoListener* active_function_info_listener = NULL;
715 709
716 JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script, 710 JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script,
717 Handle<String> source) { 711 Handle<String> source) {
718 CompilationZoneScope zone_scope(DELETE_ON_EXIT); 712 CompilationZoneScope zone_scope(DELETE_ON_EXIT);
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 1476
1483 bool LiveEditFunctionTracker::IsActive() { 1477 bool LiveEditFunctionTracker::IsActive() {
1484 return false; 1478 return false;
1485 } 1479 }
1486 1480
1487 #endif // ENABLE_DEBUGGER_SUPPORT 1481 #endif // ENABLE_DEBUGGER_SUPPORT
1488 1482
1489 1483
1490 1484
1491 } } // namespace v8::internal 1485 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698