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

Side by Side Diff: src/debug/liveedit.cc

Issue 2672363002: Link type feedback vectors to the shared function info. (Closed)
Patch Set: rebase Created 3 years, 10 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/compiler.cc ('k') | src/feedback-vector.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/debug/liveedit.h" 5 #include "src/debug/liveedit.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compilation-cache.h" 9 #include "src/compilation-cache.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 static void PatchFeedbackVector(FunctionInfoWrapper* compile_info_wrapper, 751 static void PatchFeedbackVector(FunctionInfoWrapper* compile_info_wrapper,
752 Handle<SharedFunctionInfo> shared_info, 752 Handle<SharedFunctionInfo> shared_info,
753 Isolate* isolate) { 753 Isolate* isolate) {
754 int new_literal_count = compile_info_wrapper->GetLiteralCount(); 754 int new_literal_count = compile_info_wrapper->GetLiteralCount();
755 755
756 // When feedback metadata changes, we have to create new array instances. 756 // When feedback metadata changes, we have to create new array instances.
757 // Since we cannot create instances when iterating heap, we should first 757 // Since we cannot create instances when iterating heap, we should first
758 // collect all functions and fix their literal arrays. 758 // collect all functions and fix their literal arrays.
759 Handle<FixedArray> function_instances = 759 Handle<FixedArray> function_instances =
760 CollectJSFunctions(shared_info, isolate); 760 CollectJSFunctions(shared_info, isolate);
761 Handle<FeedbackMetadata> feedback_metadata(
762 shared_info->feedback_metadata());
763 761
764 for (int i = 0; i < function_instances->length(); i++) { 762 for (int i = 0; i < function_instances->length(); i++) {
765 Handle<JSFunction> fun(JSFunction::cast(function_instances->get(i))); 763 Handle<JSFunction> fun(JSFunction::cast(function_instances->get(i)));
766 Handle<FeedbackVector> vector = 764 fun->set_feedback_vector_cell(isolate->heap()->undefined_cell());
767 FeedbackVector::New(isolate, feedback_metadata); 765 // Only create feedback vectors if we already have the metadata.
768 fun->feedback_vector_cell()->set_value(*vector); 766 if (shared_info->is_compiled()) JSFunction::EnsureLiterals(fun);
769 } 767 }
770 768
771 shared_info->set_num_literals(new_literal_count); 769 shared_info->set_num_literals(new_literal_count);
772 } 770 }
773 771
774 private: 772 private:
775 // Iterates all function instances in the HEAP that refers to the 773 // Iterates all function instances in the HEAP that refers to the
776 // provided shared_info. 774 // provided shared_info.
777 template<typename Visitor> 775 template<typename Visitor>
778 static void IterateJSFunctions(Handle<SharedFunctionInfo> shared_info, 776 static void IterateJSFunctions(Handle<SharedFunctionInfo> shared_info,
779 Visitor* visitor) { 777 Visitor* visitor) {
780 HeapIterator iterator(shared_info->GetHeap()); 778 HeapIterator iterator(shared_info->GetHeap());
781 for (HeapObject* obj = iterator.next(); obj != NULL; 779 for (HeapObject* obj = iterator.next(); obj != NULL;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 isolate->debug()->RemoveDebugInfoAndClearFromShared( 916 isolate->debug()->RemoveDebugInfoAndClearFromShared(
919 handle(shared_info->GetDebugInfo())); 917 handle(shared_info->GetDebugInfo()));
920 } 918 }
921 shared_info->set_scope_info(new_shared_info->scope_info()); 919 shared_info->set_scope_info(new_shared_info->scope_info());
922 shared_info->set_outer_scope_info(new_shared_info->outer_scope_info()); 920 shared_info->set_outer_scope_info(new_shared_info->outer_scope_info());
923 shared_info->DisableOptimization(kLiveEdit); 921 shared_info->DisableOptimization(kLiveEdit);
924 // Update the type feedback vector, if needed. 922 // Update the type feedback vector, if needed.
925 Handle<FeedbackMetadata> new_feedback_metadata( 923 Handle<FeedbackMetadata> new_feedback_metadata(
926 new_shared_info->feedback_metadata()); 924 new_shared_info->feedback_metadata());
927 shared_info->set_feedback_metadata(*new_feedback_metadata); 925 shared_info->set_feedback_metadata(*new_feedback_metadata);
926 } else {
927 shared_info->set_feedback_metadata(
928 FeedbackMetadata::cast(isolate->heap()->empty_fixed_array()));
928 } 929 }
929 930
930 int start_position = compile_info_wrapper.GetStartPosition(); 931 int start_position = compile_info_wrapper.GetStartPosition();
931 int end_position = compile_info_wrapper.GetEndPosition(); 932 int end_position = compile_info_wrapper.GetEndPosition();
932 shared_info->set_start_position(start_position); 933 shared_info->set_start_position(start_position);
933 shared_info->set_end_position(end_position); 934 shared_info->set_end_position(end_position);
934 935
935 FeedbackVectorFixer::PatchFeedbackVector(&compile_info_wrapper, shared_info, 936 FeedbackVectorFixer::PatchFeedbackVector(&compile_info_wrapper, shared_info,
936 isolate); 937 isolate);
937 938
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 scope_info_length++; 1646 scope_info_length++;
1646 1647
1647 current_scope = current_scope->outer_scope(); 1648 current_scope = current_scope->outer_scope();
1648 } 1649 }
1649 1650
1650 return scope_info_list; 1651 return scope_info_list;
1651 } 1652 }
1652 1653
1653 } // namespace internal 1654 } // namespace internal
1654 } // namespace v8 1655 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/feedback-vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698