| OLD | NEW |
| 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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 // collect all functions and fix their literal arrays. | 767 // collect all functions and fix their literal arrays. |
| 768 Handle<FixedArray> function_instances = | 768 Handle<FixedArray> function_instances = |
| 769 CollectJSFunctions(shared_info, isolate); | 769 CollectJSFunctions(shared_info, isolate); |
| 770 Handle<TypeFeedbackMetadata> feedback_metadata( | 770 Handle<TypeFeedbackMetadata> feedback_metadata( |
| 771 shared_info->feedback_metadata()); | 771 shared_info->feedback_metadata()); |
| 772 | 772 |
| 773 for (int i = 0; i < function_instances->length(); i++) { | 773 for (int i = 0; i < function_instances->length(); i++) { |
| 774 Handle<JSFunction> fun(JSFunction::cast(function_instances->get(i))); | 774 Handle<JSFunction> fun(JSFunction::cast(function_instances->get(i))); |
| 775 Handle<TypeFeedbackVector> vector = | 775 Handle<TypeFeedbackVector> vector = |
| 776 TypeFeedbackVector::New(isolate, feedback_metadata); | 776 TypeFeedbackVector::New(isolate, feedback_metadata); |
| 777 Handle<LiteralsArray> new_literals = | 777 fun->set_feedback_vector(*vector); |
| 778 LiteralsArray::New(isolate, vector, new_literal_count); | |
| 779 fun->set_literals(*new_literals); | |
| 780 } | 778 } |
| 781 | 779 |
| 782 shared_info->set_num_literals(new_literal_count); | 780 shared_info->set_num_literals(new_literal_count); |
| 783 } | 781 } |
| 784 } | 782 } |
| 785 | 783 |
| 786 private: | 784 private: |
| 787 // Iterates all function instances in the HEAP that refers to the | 785 // Iterates all function instances in the HEAP that refers to the |
| 788 // provided shared_info. | 786 // provided shared_info. |
| 789 template<typename Visitor> | 787 template<typename Visitor> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 814 if (size > 0) { | 812 if (size > 0) { |
| 815 CollectVisitor collect_visitor(result); | 813 CollectVisitor collect_visitor(result); |
| 816 IterateJSFunctions(shared_info, &collect_visitor); | 814 IterateJSFunctions(shared_info, &collect_visitor); |
| 817 } | 815 } |
| 818 return result; | 816 return result; |
| 819 } | 817 } |
| 820 | 818 |
| 821 class ClearValuesVisitor { | 819 class ClearValuesVisitor { |
| 822 public: | 820 public: |
| 823 void visit(JSFunction* fun) { | 821 void visit(JSFunction* fun) { |
| 824 LiteralsArray* literals = fun->literals(); | 822 TypeFeedbackVector* vector = fun->feedback_vector(); |
| 825 int len = literals->literals_count(); | 823 vector->ClearSlots(fun->shared()); |
| 826 for (int j = 0; j < len; j++) { | |
| 827 literals->set_literal_undefined(j); | |
| 828 } | |
| 829 } | 824 } |
| 830 }; | 825 }; |
| 831 | 826 |
| 832 class CountVisitor { | 827 class CountVisitor { |
| 833 public: | 828 public: |
| 834 void visit(JSFunction* fun) { | 829 void visit(JSFunction* fun) { |
| 835 count++; | 830 count++; |
| 836 } | 831 } |
| 837 int count; | 832 int count; |
| 838 }; | 833 }; |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1671 scope_info_length++; | 1666 scope_info_length++; |
| 1672 | 1667 |
| 1673 current_scope = current_scope->outer_scope(); | 1668 current_scope = current_scope->outer_scope(); |
| 1674 } | 1669 } |
| 1675 | 1670 |
| 1676 return scope_info_list; | 1671 return scope_info_list; |
| 1677 } | 1672 } |
| 1678 | 1673 |
| 1679 } // namespace internal | 1674 } // namespace internal |
| 1680 } // namespace v8 | 1675 } // namespace v8 |
| OLD | NEW |