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

Side by Side Diff: src/liveedit.cc

Issue 23783007: LiveEdit to mark more closure functions for re-instantiation when scope layout changes (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 7 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 | « no previous file | src/liveedit-debugger.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 this->SetSmiValueField(kParentIndexOffset_, parent_index); 724 this->SetSmiValueField(kParentIndexOffset_, parent_index);
725 } 725 }
726 void SetFunctionCode(Handle<Code> function_code, 726 void SetFunctionCode(Handle<Code> function_code,
727 Handle<HeapObject> code_scope_info) { 727 Handle<HeapObject> code_scope_info) {
728 Handle<JSValue> code_wrapper = WrapInJSValue(function_code); 728 Handle<JSValue> code_wrapper = WrapInJSValue(function_code);
729 this->SetField(kCodeOffset_, code_wrapper); 729 this->SetField(kCodeOffset_, code_wrapper);
730 730
731 Handle<JSValue> scope_wrapper = WrapInJSValue(code_scope_info); 731 Handle<JSValue> scope_wrapper = WrapInJSValue(code_scope_info);
732 this->SetField(kCodeScopeInfoOffset_, scope_wrapper); 732 this->SetField(kCodeScopeInfoOffset_, scope_wrapper);
733 } 733 }
734 void SetOuterScopeInfo(Handle<Object> scope_info_array) { 734 void SetFunctionScopeInfo(Handle<Object> scope_info_array) {
735 this->SetField(kOuterScopeInfoOffset_, scope_info_array); 735 this->SetField(kFunctionScopeInfoOffset_, scope_info_array);
736 } 736 }
737 void SetSharedFunctionInfo(Handle<SharedFunctionInfo> info) { 737 void SetSharedFunctionInfo(Handle<SharedFunctionInfo> info) {
738 Handle<JSValue> info_holder = WrapInJSValue(info); 738 Handle<JSValue> info_holder = WrapInJSValue(info);
739 this->SetField(kSharedFunctionInfoOffset_, info_holder); 739 this->SetField(kSharedFunctionInfoOffset_, info_holder);
740 } 740 }
741 int GetLiteralCount() { 741 int GetLiteralCount() {
742 return this->GetSmiValueField(kLiteralNumOffset_); 742 return this->GetSmiValueField(kLiteralNumOffset_);
743 } 743 }
744 int GetParentIndex() { 744 int GetParentIndex() {
745 return this->GetSmiValueField(kParentIndexOffset_); 745 return this->GetSmiValueField(kParentIndexOffset_);
(...skipping 18 matching lines...) Expand all
764 return this->GetSmiValueField(kEndPositionOffset_); 764 return this->GetSmiValueField(kEndPositionOffset_);
765 } 765 }
766 766
767 private: 767 private:
768 static const int kFunctionNameOffset_ = 0; 768 static const int kFunctionNameOffset_ = 0;
769 static const int kStartPositionOffset_ = 1; 769 static const int kStartPositionOffset_ = 1;
770 static const int kEndPositionOffset_ = 2; 770 static const int kEndPositionOffset_ = 2;
771 static const int kParamNumOffset_ = 3; 771 static const int kParamNumOffset_ = 3;
772 static const int kCodeOffset_ = 4; 772 static const int kCodeOffset_ = 4;
773 static const int kCodeScopeInfoOffset_ = 5; 773 static const int kCodeScopeInfoOffset_ = 5;
774 static const int kOuterScopeInfoOffset_ = 6; 774 static const int kFunctionScopeInfoOffset_ = 6;
775 static const int kParentIndexOffset_ = 7; 775 static const int kParentIndexOffset_ = 7;
776 static const int kSharedFunctionInfoOffset_ = 8; 776 static const int kSharedFunctionInfoOffset_ = 8;
777 static const int kLiteralNumOffset_ = 9; 777 static const int kLiteralNumOffset_ = 9;
778 static const int kSize_ = 10; 778 static const int kSize_ = 10;
779 779
780 friend class JSArrayBasedStruct<FunctionInfoWrapper>; 780 friend class JSArrayBasedStruct<FunctionInfoWrapper>;
781 }; 781 };
782 782
783 783
784 // Wraps SharedFunctionInfo along with some of its fields for passing it 784 // Wraps SharedFunctionInfo along with some of its fields for passing it
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 FunctionInfoWrapper info = 873 FunctionInfoWrapper info =
874 FunctionInfoWrapper::cast( 874 FunctionInfoWrapper::cast(
875 result_->GetElementNoExceptionThrown( 875 result_->GetElementNoExceptionThrown(
876 isolate(), current_parent_index_)); 876 isolate(), current_parent_index_));
877 info.SetFunctionCode(Handle<Code>(shared->code()), 877 info.SetFunctionCode(Handle<Code>(shared->code()),
878 Handle<HeapObject>(shared->scope_info())); 878 Handle<HeapObject>(shared->scope_info()));
879 info.SetSharedFunctionInfo(shared); 879 info.SetSharedFunctionInfo(shared);
880 880
881 Handle<Object> scope_info_list(SerializeFunctionScope(scope, zone), 881 Handle<Object> scope_info_list(SerializeFunctionScope(scope, zone),
882 isolate()); 882 isolate());
883 info.SetOuterScopeInfo(scope_info_list); 883 info.SetFunctionScopeInfo(scope_info_list);
884 } 884 }
885 885
886 Handle<JSArray> GetResult() { return result_; } 886 Handle<JSArray> GetResult() { return result_; }
887 887
888 private: 888 private:
889 Isolate* isolate() const { return result_->GetIsolate(); } 889 Isolate* isolate() const { return result_->GetIsolate(); }
890 890
891 Object* SerializeFunctionScope(Scope* scope, Zone* zone) { 891 Object* SerializeFunctionScope(Scope* scope, Zone* zone) {
892 HandleScope handle_scope(isolate()); 892 HandleScope handle_scope(isolate());
893 893
894 Handle<JSArray> scope_info_list = isolate()->factory()->NewJSArray(10); 894 Handle<JSArray> scope_info_list = isolate()->factory()->NewJSArray(10);
895 int scope_info_length = 0; 895 int scope_info_length = 0;
896 896
897 // Saves some description of scope. It stores name and indexes of 897 // Saves some description of scope. It stores name and indexes of
898 // variables in the whole scope chain. Null-named slots delimit 898 // variables in the whole scope chain. Null-named slots delimit
899 // scopes of this chain. 899 // scopes of this chain.
900 Scope* outer_scope = scope->outer_scope(); 900 Scope* current_scope = scope;
901 if (outer_scope == NULL) { 901 while (current_scope != NULL) {
902 return isolate()->heap()->undefined_value(); 902 ZoneList<Variable*> stack_list(current_scope->StackLocalCount(), zone);
903 } 903 ZoneList<Variable*> context_list(
904 do { 904 current_scope->ContextLocalCount(), zone);
905 ZoneList<Variable*> stack_list(outer_scope->StackLocalCount(), zone); 905 current_scope->CollectStackAndContextLocals(&stack_list, &context_list);
906 ZoneList<Variable*> context_list(outer_scope->ContextLocalCount(), zone);
907 outer_scope->CollectStackAndContextLocals(&stack_list, &context_list);
908 context_list.Sort(&Variable::CompareIndex); 906 context_list.Sort(&Variable::CompareIndex);
909 907
910 for (int i = 0; i < context_list.length(); i++) { 908 for (int i = 0; i < context_list.length(); i++) {
911 SetElementNonStrict(scope_info_list, 909 SetElementNonStrict(scope_info_list,
912 scope_info_length, 910 scope_info_length,
913 context_list[i]->name()); 911 context_list[i]->name());
914 scope_info_length++; 912 scope_info_length++;
915 SetElementNonStrict( 913 SetElementNonStrict(
916 scope_info_list, 914 scope_info_list,
917 scope_info_length, 915 scope_info_length,
918 Handle<Smi>(Smi::FromInt(context_list[i]->index()), isolate())); 916 Handle<Smi>(Smi::FromInt(context_list[i]->index()), isolate()));
919 scope_info_length++; 917 scope_info_length++;
920 } 918 }
921 SetElementNonStrict(scope_info_list, 919 SetElementNonStrict(scope_info_list,
922 scope_info_length, 920 scope_info_length,
923 Handle<Object>(isolate()->heap()->null_value(), 921 Handle<Object>(isolate()->heap()->null_value(),
924 isolate())); 922 isolate()));
925 scope_info_length++; 923 scope_info_length++;
926 924
927 outer_scope = outer_scope->outer_scope(); 925 current_scope = current_scope->outer_scope();
928 } while (outer_scope != NULL); 926 }
929 927
930 return *scope_info_list; 928 return *scope_info_list;
931 } 929 }
932 930
933 Handle<JSArray> result_; 931 Handle<JSArray> result_;
934 int len_; 932 int len_;
935 int current_parent_index_; 933 int current_parent_index_;
936 }; 934 };
937 935
938 936
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2154 2152
2155 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { 2153 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) {
2156 return false; 2154 return false;
2157 } 2155 }
2158 2156
2159 #endif // ENABLE_DEBUGGER_SUPPORT 2157 #endif // ENABLE_DEBUGGER_SUPPORT
2160 2158
2161 2159
2162 2160
2163 } } // namespace v8::internal 2161 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/liveedit-debugger.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698