OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 11768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11779 int end = starts.at(group + 1); | 11779 int end = starts.at(group + 1); |
11780 int code_entries = starts.number_of_entries(); | 11780 int code_entries = starts.number_of_entries(); |
11781 if (start == end) return false; | 11781 if (start == end) return false; |
11782 | 11782 |
11783 // Mark all the code that needs to be deoptimized. | 11783 // Mark all the code that needs to be deoptimized. |
11784 bool marked = false; | 11784 bool marked = false; |
11785 for (int i = start; i < end; i++) { | 11785 for (int i = start; i < end; i++) { |
11786 if (is_code_at(i)) { | 11786 if (is_code_at(i)) { |
11787 Code* code = code_at(i); | 11787 Code* code = code_at(i); |
11788 if (!code->marked_for_deoptimization()) { | 11788 if (!code->marked_for_deoptimization()) { |
11789 code->set_marked_for_deoptimization(true); | 11789 SetMarkedForDeoptimization(code, group); |
11790 marked = true; | 11790 marked = true; |
11791 } | 11791 } |
11792 } else { | 11792 } else { |
11793 CompilationInfo* info = compilation_info_at(i); | 11793 CompilationInfo* info = compilation_info_at(i); |
11794 info->AbortDueToDependencyChange(); | 11794 info->AbortDueToDependencyChange(); |
11795 } | 11795 } |
11796 } | 11796 } |
11797 // Compact the array by moving all subsequent groups to fill in the new holes. | 11797 // Compact the array by moving all subsequent groups to fill in the new holes. |
11798 for (int src = end, dst = start; src < code_entries; src++, dst++) { | 11798 for (int src = end, dst = start; src < code_entries; src++, dst++) { |
11799 copy(src, dst); | 11799 copy(src, dst); |
(...skipping 30 matching lines...) Expand all Loading... | |
11830 if (head->IsCode()) { | 11830 if (head->IsCode()) { |
11831 stub->set_next_code_link(Code::cast(head)->next_code_link()); | 11831 stub->set_next_code_link(Code::cast(head)->next_code_link()); |
11832 Code::cast(head)->set_next_code_link(*stub); | 11832 Code::cast(head)->set_next_code_link(*stub); |
11833 } else { | 11833 } else { |
11834 stub->set_next_code_link(head); | 11834 stub->set_next_code_link(head); |
11835 set_object_at(i, *stub); | 11835 set_object_at(i, *stub); |
11836 } | 11836 } |
11837 } | 11837 } |
11838 | 11838 |
11839 | 11839 |
11840 void DependentCode::SetMarkedForDeoptimization(Code* code, | |
11841 DependencyGroup group) { | |
11842 code->set_marked_for_deoptimization(true); | |
11843 if (FLAG_trace_deopt && | |
11844 (code->deoptimization_data() != code->GetHeap()->empty_fixed_array())) { | |
11845 DeoptimizationInputData* deopt_data = | |
11846 DeoptimizationInputData::cast(code->deoptimization_data()); | |
11847 CodeTracer::Scope scope(code->GetHeap()->isolate()->GetCodeTracer()); | |
11848 PrintF(scope.file(), "[marking dependent code 0x%08" V8PRIxPTR | |
11849 " (opt #%d) for deoptimization, reason: %s]\n", | |
11850 reinterpret_cast<intptr_t>(code), | |
11851 deopt_data->OptimizationId()->value(), DependencyGroupName(group)); | |
11852 } | |
11853 } | |
11854 | |
11855 | |
11856 const char* DependentCode::DependencyGroupName(DependencyGroup group) { | |
11857 switch (group) { | |
11858 case kWeakICGroup: | |
11859 return "weak-ic"; | |
11860 case kWeakCodeGroup: | |
11861 return "weak-code"; | |
11862 case kTransitionGroup: | |
11863 return "transition"; | |
11864 case kPrototypeCheckGroup: | |
11865 return "prototype-check"; | |
11866 case kElementsCantBeAddedGroup: | |
11867 return "elements-cant-be-added"; | |
11868 case kPropertyCellChangedGroup: | |
11869 return "property-cell-changed"; | |
11870 case kFieldTypeGroup: | |
11871 return "field-type"; | |
11872 case kInitialMapChangedGroup: | |
11873 return "initial-map-changed"; | |
11874 case kAllocationSiteTenuringChangedGroup: | |
11875 return "allocation-site-tenuring-changed"; | |
11876 case kAllocationSiteTransitionChangedGroup: | |
11877 return "allocation-site-transition-changed"; | |
11878 default: | |
Toon Verwaest
2014/08/19 11:08:04
Any reason why you added a default case? That kind
Vyacheslav Egorov (Google)
2014/08/19 11:14:41
Well, main reason is that enumeration has parasiti
| |
11879 UNREACHABLE(); | |
11880 return "?"; | |
11881 } | |
11882 } | |
11883 | |
11884 | |
11840 Handle<Map> Map::TransitionToPrototype(Handle<Map> map, | 11885 Handle<Map> Map::TransitionToPrototype(Handle<Map> map, |
11841 Handle<Object> prototype) { | 11886 Handle<Object> prototype) { |
11842 Handle<Map> new_map = GetPrototypeTransition(map, prototype); | 11887 Handle<Map> new_map = GetPrototypeTransition(map, prototype); |
11843 if (new_map.is_null()) { | 11888 if (new_map.is_null()) { |
11844 new_map = Copy(map); | 11889 new_map = Copy(map); |
11845 PutPrototypeTransition(map, prototype, new_map); | 11890 PutPrototypeTransition(map, prototype, new_map); |
11846 new_map->set_prototype(*prototype); | 11891 new_map->set_prototype(*prototype); |
11847 } | 11892 } |
11848 return new_map; | 11893 return new_map; |
11849 } | 11894 } |
(...skipping 4764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
16614 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16659 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16615 static const char* error_messages_[] = { | 16660 static const char* error_messages_[] = { |
16616 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16661 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16617 }; | 16662 }; |
16618 #undef ERROR_MESSAGES_TEXTS | 16663 #undef ERROR_MESSAGES_TEXTS |
16619 return error_messages_[reason]; | 16664 return error_messages_[reason]; |
16620 } | 16665 } |
16621 | 16666 |
16622 | 16667 |
16623 } } // namespace v8::internal | 16668 } } // namespace v8::internal |
OLD | NEW |