| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 11732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11743 GroupStartIndexes starts(this); | 11743 GroupStartIndexes starts(this); |
| 11744 int start = starts.at(group); | 11744 int start = starts.at(group); |
| 11745 int end = starts.at(group + 1); | 11745 int end = starts.at(group + 1); |
| 11746 for (int i = start; i < end; i++) { | 11746 for (int i = start; i < end; i++) { |
| 11747 if (object_at(i) == code) return true; | 11747 if (object_at(i) == code) return true; |
| 11748 } | 11748 } |
| 11749 return false; | 11749 return false; |
| 11750 } | 11750 } |
| 11751 | 11751 |
| 11752 | 11752 |
| 11753 void DependentCode::DeoptimizeDependentCodeGroup( | 11753 bool DependentCode::MarkCodeForDeoptimization( |
| 11754 Isolate* isolate, | 11754 Isolate* isolate, |
| 11755 DependentCode::DependencyGroup group) { | 11755 DependentCode::DependencyGroup group) { |
| 11756 ASSERT(AllowCodeDependencyChange::IsAllowed()); | 11756 ASSERT(AllowCodeDependencyChange::IsAllowed()); |
| 11757 DisallowHeapAllocation no_allocation_scope; | 11757 DisallowHeapAllocation no_allocation_scope; |
| 11758 DependentCode::GroupStartIndexes starts(this); | 11758 DependentCode::GroupStartIndexes starts(this); |
| 11759 int start = starts.at(group); | 11759 int start = starts.at(group); |
| 11760 int end = starts.at(group + 1); | 11760 int end = starts.at(group + 1); |
| 11761 int code_entries = starts.number_of_entries(); | 11761 int code_entries = starts.number_of_entries(); |
| 11762 if (start == end) return; | 11762 if (start == end) return false; |
| 11763 | 11763 |
| 11764 // Mark all the code that needs to be deoptimized. | 11764 // Mark all the code that needs to be deoptimized. |
| 11765 bool marked = false; | 11765 bool marked = false; |
| 11766 for (int i = start; i < end; i++) { | 11766 for (int i = start; i < end; i++) { |
| 11767 if (is_code_at(i)) { | 11767 if (is_code_at(i)) { |
| 11768 Code* code = code_at(i); | 11768 Code* code = code_at(i); |
| 11769 if (!code->marked_for_deoptimization()) { | 11769 if (!code->marked_for_deoptimization()) { |
| 11770 code->set_marked_for_deoptimization(true); | 11770 code->set_marked_for_deoptimization(true); |
| 11771 marked = true; | 11771 marked = true; |
| 11772 } | 11772 } |
| 11773 } else { | 11773 } else { |
| 11774 CompilationInfo* info = compilation_info_at(i); | 11774 CompilationInfo* info = compilation_info_at(i); |
| 11775 info->AbortDueToDependencyChange(); | 11775 info->AbortDueToDependencyChange(); |
| 11776 } | 11776 } |
| 11777 } | 11777 } |
| 11778 // Compact the array by moving all subsequent groups to fill in the new holes. | 11778 // Compact the array by moving all subsequent groups to fill in the new holes. |
| 11779 for (int src = end, dst = start; src < code_entries; src++, dst++) { | 11779 for (int src = end, dst = start; src < code_entries; src++, dst++) { |
| 11780 copy(src, dst); | 11780 copy(src, dst); |
| 11781 } | 11781 } |
| 11782 // Now the holes are at the end of the array, zap them for heap-verifier. | 11782 // Now the holes are at the end of the array, zap them for heap-verifier. |
| 11783 int removed = end - start; | 11783 int removed = end - start; |
| 11784 for (int i = code_entries - removed; i < code_entries; i++) { | 11784 for (int i = code_entries - removed; i < code_entries; i++) { |
| 11785 clear_at(i); | 11785 clear_at(i); |
| 11786 } | 11786 } |
| 11787 set_number_of_entries(group, 0); | 11787 set_number_of_entries(group, 0); |
| 11788 return marked; |
| 11789 } |
| 11790 |
| 11791 |
| 11792 void DependentCode::DeoptimizeDependentCodeGroup( |
| 11793 Isolate* isolate, |
| 11794 DependentCode::DependencyGroup group) { |
| 11795 ASSERT(AllowCodeDependencyChange::IsAllowed()); |
| 11796 DisallowHeapAllocation no_allocation_scope; |
| 11797 bool marked = MarkCodeForDeoptimization(isolate, group); |
| 11788 | 11798 |
| 11789 if (marked) Deoptimizer::DeoptimizeMarkedCode(isolate); | 11799 if (marked) Deoptimizer::DeoptimizeMarkedCode(isolate); |
| 11790 } | 11800 } |
| 11791 | 11801 |
| 11792 | 11802 |
| 11793 Handle<Object> JSObject::SetPrototype(Handle<JSObject> object, | 11803 Handle<Object> JSObject::SetPrototype(Handle<JSObject> object, |
| 11794 Handle<Object> value, | 11804 Handle<Object> value, |
| 11795 bool skip_hidden_prototypes) { | 11805 bool skip_hidden_prototypes) { |
| 11796 #ifdef DEBUG | 11806 #ifdef DEBUG |
| 11797 int size = object->Size(); | 11807 int size = object->Size(); |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12753 ElementsKind to_kind) { | 12763 ElementsKind to_kind) { |
| 12754 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), | 12764 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), |
| 12755 object->TransitionElementsKind(to_kind)); | 12765 object->TransitionElementsKind(to_kind)); |
| 12756 } | 12766 } |
| 12757 | 12767 |
| 12758 | 12768 |
| 12759 const double AllocationSite::kPretenureRatio = 0.60; | 12769 const double AllocationSite::kPretenureRatio = 0.60; |
| 12760 | 12770 |
| 12761 | 12771 |
| 12762 void AllocationSite::ResetPretenureDecision() { | 12772 void AllocationSite::ResetPretenureDecision() { |
| 12763 dependent_code()->DeoptimizeDependentCodeGroup( | |
| 12764 GetIsolate(), | |
| 12765 DependentCode::kAllocationSiteTenuringChangedGroup); | |
| 12766 set_pretenure_decision(kUndecided); | 12773 set_pretenure_decision(kUndecided); |
| 12767 set_memento_found_count(0); | 12774 set_memento_found_count(0); |
| 12768 set_memento_create_count(0); | 12775 set_memento_create_count(0); |
| 12769 } | 12776 } |
| 12770 | 12777 |
| 12771 | 12778 |
| 12772 PretenureFlag AllocationSite::GetPretenureMode() { | 12779 PretenureFlag AllocationSite::GetPretenureMode() { |
| 12773 PretenureDecision mode = pretenure_decision(); | 12780 PretenureDecision mode = pretenure_decision(); |
| 12774 // Zombie objects "decide" to be untenured. | 12781 // Zombie objects "decide" to be untenured. |
| 12775 return (mode == kTenure && GetHeap()->GetPretenureMode() == TENURED) | 12782 return (mode == kTenure && GetHeap()->GetPretenureMode() == TENURED) |
| (...skipping 3859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16635 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16642 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16636 static const char* error_messages_[] = { | 16643 static const char* error_messages_[] = { |
| 16637 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16644 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16638 }; | 16645 }; |
| 16639 #undef ERROR_MESSAGES_TEXTS | 16646 #undef ERROR_MESSAGES_TEXTS |
| 16640 return error_messages_[reason]; | 16647 return error_messages_[reason]; |
| 16641 } | 16648 } |
| 16642 | 16649 |
| 16643 | 16650 |
| 16644 } } // namespace v8::internal | 16651 } } // namespace v8::internal |
| OLD | NEW |