| 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 10293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10304 } | 10304 } |
| 10305 | 10305 |
| 10306 | 10306 |
| 10307 void Code::InvalidateRelocation() { | 10307 void Code::InvalidateRelocation() { |
| 10308 set_relocation_info(GetHeap()->empty_byte_array()); | 10308 set_relocation_info(GetHeap()->empty_byte_array()); |
| 10309 } | 10309 } |
| 10310 | 10310 |
| 10311 | 10311 |
| 10312 void Code::InvalidateEmbeddedObjects() { | 10312 void Code::InvalidateEmbeddedObjects() { |
| 10313 Object* undefined = GetHeap()->undefined_value(); | 10313 Object* undefined = GetHeap()->undefined_value(); |
| 10314 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); | 10314 Cell* undefined_cell = GetHeap()->undefined_cell(); |
| 10315 int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 10316 RelocInfo::ModeMask(RelocInfo::CELL); |
| 10315 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { | 10317 for (RelocIterator it(this, mode_mask); !it.done(); it.next()) { |
| 10316 RelocInfo::Mode mode = it.rinfo()->rmode(); | 10318 RelocInfo::Mode mode = it.rinfo()->rmode(); |
| 10317 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 10319 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
| 10318 it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER); | 10320 it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER); |
| 10321 } else if (mode == RelocInfo::CELL) { |
| 10322 it.rinfo()->set_target_cell(undefined_cell, SKIP_WRITE_BARRIER); |
| 10319 } | 10323 } |
| 10320 } | 10324 } |
| 10321 } | 10325 } |
| 10322 | 10326 |
| 10323 | 10327 |
| 10324 void Code::Relocate(intptr_t delta) { | 10328 void Code::Relocate(intptr_t delta) { |
| 10325 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { | 10329 for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) { |
| 10326 it.rinfo()->apply(delta); | 10330 it.rinfo()->apply(delta); |
| 10327 } | 10331 } |
| 10328 CPU::FlushICache(instruction_start(), instruction_size()); | 10332 CPU::FlushICache(instruction_start(), instruction_size()); |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11270 | 11274 |
| 11271 bool Code::IsWeakEmbeddedObject(Kind kind, Object* object) { | 11275 bool Code::IsWeakEmbeddedObject(Kind kind, Object* object) { |
| 11272 if (kind != Code::OPTIMIZED_FUNCTION) return false; | 11276 if (kind != Code::OPTIMIZED_FUNCTION) return false; |
| 11273 | 11277 |
| 11274 if (object->IsMap()) { | 11278 if (object->IsMap()) { |
| 11275 return Map::cast(object)->CanTransition() && | 11279 return Map::cast(object)->CanTransition() && |
| 11276 FLAG_collect_maps && | 11280 FLAG_collect_maps && |
| 11277 FLAG_weak_embedded_maps_in_optimized_code; | 11281 FLAG_weak_embedded_maps_in_optimized_code; |
| 11278 } | 11282 } |
| 11279 | 11283 |
| 11280 if (object->IsJSObject()) { | 11284 if (object->IsJSObject() || |
| 11285 (object->IsCell() && Cell::cast(object)->value()->IsJSObject())) { |
| 11281 return FLAG_weak_embedded_objects_in_optimized_code; | 11286 return FLAG_weak_embedded_objects_in_optimized_code; |
| 11282 } | 11287 } |
| 11283 | 11288 |
| 11284 return false; | 11289 return false; |
| 11285 } | 11290 } |
| 11286 | 11291 |
| 11287 | 11292 |
| 11288 void JSObject::SetFastDoubleElementsCapacityAndLength(Handle<JSObject> object, | 11293 void JSObject::SetFastDoubleElementsCapacityAndLength(Handle<JSObject> object, |
| 11289 int capacity, | 11294 int capacity, |
| 11290 int length) { | 11295 int length) { |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11743 GroupStartIndexes starts(this); | 11748 GroupStartIndexes starts(this); |
| 11744 int start = starts.at(group); | 11749 int start = starts.at(group); |
| 11745 int end = starts.at(group + 1); | 11750 int end = starts.at(group + 1); |
| 11746 for (int i = start; i < end; i++) { | 11751 for (int i = start; i < end; i++) { |
| 11747 if (object_at(i) == code) return true; | 11752 if (object_at(i) == code) return true; |
| 11748 } | 11753 } |
| 11749 return false; | 11754 return false; |
| 11750 } | 11755 } |
| 11751 | 11756 |
| 11752 | 11757 |
| 11753 void DependentCode::DeoptimizeDependentCodeGroup( | 11758 bool DependentCode::MarkCodeForDeoptimization( |
| 11754 Isolate* isolate, | 11759 Isolate* isolate, |
| 11755 DependentCode::DependencyGroup group) { | 11760 DependentCode::DependencyGroup group) { |
| 11756 ASSERT(AllowCodeDependencyChange::IsAllowed()); | 11761 ASSERT(AllowCodeDependencyChange::IsAllowed()); |
| 11757 DisallowHeapAllocation no_allocation_scope; | 11762 DisallowHeapAllocation no_allocation_scope; |
| 11758 DependentCode::GroupStartIndexes starts(this); | 11763 DependentCode::GroupStartIndexes starts(this); |
| 11759 int start = starts.at(group); | 11764 int start = starts.at(group); |
| 11760 int end = starts.at(group + 1); | 11765 int end = starts.at(group + 1); |
| 11761 int code_entries = starts.number_of_entries(); | 11766 int code_entries = starts.number_of_entries(); |
| 11762 if (start == end) return; | 11767 if (start == end) return false; |
| 11763 | 11768 |
| 11764 // Mark all the code that needs to be deoptimized. | 11769 // Mark all the code that needs to be deoptimized. |
| 11765 bool marked = false; | 11770 bool marked = false; |
| 11766 for (int i = start; i < end; i++) { | 11771 for (int i = start; i < end; i++) { |
| 11767 if (is_code_at(i)) { | 11772 if (is_code_at(i)) { |
| 11768 Code* code = code_at(i); | 11773 Code* code = code_at(i); |
| 11769 if (!code->marked_for_deoptimization()) { | 11774 if (!code->marked_for_deoptimization()) { |
| 11770 code->set_marked_for_deoptimization(true); | 11775 code->set_marked_for_deoptimization(true); |
| 11771 marked = true; | 11776 marked = true; |
| 11772 } | 11777 } |
| 11773 } else { | 11778 } else { |
| 11774 CompilationInfo* info = compilation_info_at(i); | 11779 CompilationInfo* info = compilation_info_at(i); |
| 11775 info->AbortDueToDependencyChange(); | 11780 info->AbortDueToDependencyChange(); |
| 11776 } | 11781 } |
| 11777 } | 11782 } |
| 11778 // Compact the array by moving all subsequent groups to fill in the new holes. | 11783 // 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++) { | 11784 for (int src = end, dst = start; src < code_entries; src++, dst++) { |
| 11780 copy(src, dst); | 11785 copy(src, dst); |
| 11781 } | 11786 } |
| 11782 // Now the holes are at the end of the array, zap them for heap-verifier. | 11787 // Now the holes are at the end of the array, zap them for heap-verifier. |
| 11783 int removed = end - start; | 11788 int removed = end - start; |
| 11784 for (int i = code_entries - removed; i < code_entries; i++) { | 11789 for (int i = code_entries - removed; i < code_entries; i++) { |
| 11785 clear_at(i); | 11790 clear_at(i); |
| 11786 } | 11791 } |
| 11787 set_number_of_entries(group, 0); | 11792 set_number_of_entries(group, 0); |
| 11793 return marked; |
| 11794 } |
| 11795 |
| 11796 |
| 11797 void DependentCode::DeoptimizeDependentCodeGroup( |
| 11798 Isolate* isolate, |
| 11799 DependentCode::DependencyGroup group) { |
| 11800 ASSERT(AllowCodeDependencyChange::IsAllowed()); |
| 11801 DisallowHeapAllocation no_allocation_scope; |
| 11802 bool marked = MarkCodeForDeoptimization(isolate, group); |
| 11788 | 11803 |
| 11789 if (marked) Deoptimizer::DeoptimizeMarkedCode(isolate); | 11804 if (marked) Deoptimizer::DeoptimizeMarkedCode(isolate); |
| 11790 } | 11805 } |
| 11791 | 11806 |
| 11792 | 11807 |
| 11793 Handle<Object> JSObject::SetPrototype(Handle<JSObject> object, | 11808 Handle<Object> JSObject::SetPrototype(Handle<JSObject> object, |
| 11794 Handle<Object> value, | 11809 Handle<Object> value, |
| 11795 bool skip_hidden_prototypes) { | 11810 bool skip_hidden_prototypes) { |
| 11796 #ifdef DEBUG | 11811 #ifdef DEBUG |
| 11797 int size = object->Size(); | 11812 int size = object->Size(); |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12753 ElementsKind to_kind) { | 12768 ElementsKind to_kind) { |
| 12754 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), | 12769 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), |
| 12755 object->TransitionElementsKind(to_kind)); | 12770 object->TransitionElementsKind(to_kind)); |
| 12756 } | 12771 } |
| 12757 | 12772 |
| 12758 | 12773 |
| 12759 const double AllocationSite::kPretenureRatio = 0.60; | 12774 const double AllocationSite::kPretenureRatio = 0.60; |
| 12760 | 12775 |
| 12761 | 12776 |
| 12762 void AllocationSite::ResetPretenureDecision() { | 12777 void AllocationSite::ResetPretenureDecision() { |
| 12763 dependent_code()->DeoptimizeDependentCodeGroup( | |
| 12764 GetIsolate(), | |
| 12765 DependentCode::kAllocationSiteTenuringChangedGroup); | |
| 12766 set_pretenure_decision(kUndecided); | 12778 set_pretenure_decision(kUndecided); |
| 12767 set_memento_found_count(0); | 12779 set_memento_found_count(0); |
| 12768 set_memento_create_count(0); | 12780 set_memento_create_count(0); |
| 12769 } | 12781 } |
| 12770 | 12782 |
| 12771 | 12783 |
| 12772 PretenureFlag AllocationSite::GetPretenureMode() { | 12784 PretenureFlag AllocationSite::GetPretenureMode() { |
| 12773 PretenureDecision mode = pretenure_decision(); | 12785 PretenureDecision mode = pretenure_decision(); |
| 12774 // Zombie objects "decide" to be untenured. | 12786 // Zombie objects "decide" to be untenured. |
| 12775 return (mode == kTenure && GetHeap()->GetPretenureMode() == TENURED) | 12787 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, | 16647 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16636 static const char* error_messages_[] = { | 16648 static const char* error_messages_[] = { |
| 16637 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16649 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16638 }; | 16650 }; |
| 16639 #undef ERROR_MESSAGES_TEXTS | 16651 #undef ERROR_MESSAGES_TEXTS |
| 16640 return error_messages_[reason]; | 16652 return error_messages_[reason]; |
| 16641 } | 16653 } |
| 16642 | 16654 |
| 16643 | 16655 |
| 16644 } } // namespace v8::internal | 16656 } } // namespace v8::internal |
| OLD | NEW |