| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1561 } | 1561 } |
| 1562 // Retained object is new tail. | 1562 // Retained object is new tail. |
| 1563 ASSERT(!retained->IsUndefined()); | 1563 ASSERT(!retained->IsUndefined()); |
| 1564 candidate = reinterpret_cast<T*>(retained); | 1564 candidate = reinterpret_cast<T*>(retained); |
| 1565 tail = candidate; | 1565 tail = candidate; |
| 1566 | 1566 |
| 1567 | 1567 |
| 1568 // tail is a live object, visit it. | 1568 // tail is a live object, visit it. |
| 1569 WeakListVisitor<T>::VisitLiveObject( | 1569 WeakListVisitor<T>::VisitLiveObject( |
| 1570 heap, tail, retainer, record_slots); | 1570 heap, tail, retainer, record_slots); |
| 1571 } else { |
| 1572 WeakListVisitor<T>::VisitPhantomObject(heap, candidate); |
| 1571 } | 1573 } |
| 1572 | 1574 |
| 1573 // Move to next element in the list. | 1575 // Move to next element in the list. |
| 1574 list = WeakListVisitor<T>::WeakNext(candidate); | 1576 list = WeakListVisitor<T>::WeakNext(candidate); |
| 1575 } | 1577 } |
| 1576 | 1578 |
| 1577 // Terminate the list if there is one or more elements. | 1579 // Terminate the list if there is one or more elements. |
| 1578 if (tail != NULL) { | 1580 if (tail != NULL) { |
| 1579 WeakListVisitor<T>::SetWeakNext(tail, undefined); | 1581 WeakListVisitor<T>::SetWeakNext(tail, undefined); |
| 1580 } | 1582 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1592 return function->next_function_link(); | 1594 return function->next_function_link(); |
| 1593 } | 1595 } |
| 1594 | 1596 |
| 1595 static int WeakNextOffset() { | 1597 static int WeakNextOffset() { |
| 1596 return JSFunction::kNextFunctionLinkOffset; | 1598 return JSFunction::kNextFunctionLinkOffset; |
| 1597 } | 1599 } |
| 1598 | 1600 |
| 1599 static void VisitLiveObject(Heap*, JSFunction*, | 1601 static void VisitLiveObject(Heap*, JSFunction*, |
| 1600 WeakObjectRetainer*, bool) { | 1602 WeakObjectRetainer*, bool) { |
| 1601 } | 1603 } |
| 1604 |
| 1605 static void VisitPhantomObject(Heap*, JSFunction*) { |
| 1606 } |
| 1602 }; | 1607 }; |
| 1603 | 1608 |
| 1604 | 1609 |
| 1605 template<> | 1610 template<> |
| 1606 struct WeakListVisitor<Context> { | 1611 struct WeakListVisitor<Context> { |
| 1607 static void SetWeakNext(Context* context, Object* next) { | 1612 static void SetWeakNext(Context* context, Object* next) { |
| 1608 context->set(Context::NEXT_CONTEXT_LINK, | 1613 context->set(Context::NEXT_CONTEXT_LINK, |
| 1609 next, | 1614 next, |
| 1610 UPDATE_WRITE_BARRIER); | 1615 UPDATE_WRITE_BARRIER); |
| 1611 } | 1616 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1630 UPDATE_WRITE_BARRIER); | 1635 UPDATE_WRITE_BARRIER); |
| 1631 if (record_slots) { | 1636 if (record_slots) { |
| 1632 Object** optimized_functions = | 1637 Object** optimized_functions = |
| 1633 HeapObject::RawField( | 1638 HeapObject::RawField( |
| 1634 context, FixedArray::SizeFor(Context::OPTIMIZED_FUNCTIONS_LIST)); | 1639 context, FixedArray::SizeFor(Context::OPTIMIZED_FUNCTIONS_LIST)); |
| 1635 heap->mark_compact_collector()->RecordSlot( | 1640 heap->mark_compact_collector()->RecordSlot( |
| 1636 optimized_functions, optimized_functions, function_list_head); | 1641 optimized_functions, optimized_functions, function_list_head); |
| 1637 } | 1642 } |
| 1638 } | 1643 } |
| 1639 | 1644 |
| 1645 static void VisitPhantomObject(Heap*, Context*) { |
| 1646 } |
| 1647 |
| 1640 static int WeakNextOffset() { | 1648 static int WeakNextOffset() { |
| 1641 return FixedArray::SizeFor(Context::NEXT_CONTEXT_LINK); | 1649 return FixedArray::SizeFor(Context::NEXT_CONTEXT_LINK); |
| 1642 } | 1650 } |
| 1643 }; | 1651 }; |
| 1644 | 1652 |
| 1645 | 1653 |
| 1646 void Heap::ProcessWeakReferences(WeakObjectRetainer* retainer) { | 1654 void Heap::ProcessWeakReferences(WeakObjectRetainer* retainer) { |
| 1647 // We don't record weak slots during marking or scavenges. | 1655 // We don't record weak slots during marking or scavenges. |
| 1648 // Instead we do it once when we complete mark-compact cycle. | 1656 // Instead we do it once when we complete mark-compact cycle. |
| 1649 // Note that write barrier has no effect if we are already in the middle of | 1657 // Note that write barrier has no effect if we are already in the middle of |
| 1650 // compacting mark-sweep cycle and we have to record slots manually. | 1658 // compacting mark-sweep cycle and we have to record slots manually. |
| 1651 bool record_slots = | 1659 bool record_slots = |
| 1652 gc_state() == MARK_COMPACT && | 1660 gc_state() == MARK_COMPACT && |
| 1653 mark_compact_collector()->is_compacting(); | 1661 mark_compact_collector()->is_compacting(); |
| 1654 ProcessArrayBuffers(retainer, record_slots); | 1662 ProcessArrayBuffers(retainer, record_slots); |
| 1655 ProcessNativeContexts(retainer, record_slots); | 1663 ProcessNativeContexts(retainer, record_slots); |
| 1656 } | 1664 } |
| 1657 | 1665 |
| 1658 void Heap::ProcessNativeContexts(WeakObjectRetainer* retainer, | 1666 void Heap::ProcessNativeContexts(WeakObjectRetainer* retainer, |
| 1659 bool record_slots) { | 1667 bool record_slots) { |
| 1660 Object* head = | 1668 Object* head = |
| 1661 VisitWeakList<Context>( | 1669 VisitWeakList<Context>( |
| 1662 this, native_contexts_list(), retainer, record_slots); | 1670 this, native_contexts_list(), retainer, record_slots); |
| 1663 // Update the head of the list of contexts. | 1671 // Update the head of the list of contexts. |
| 1664 native_contexts_list_ = head; | 1672 native_contexts_list_ = head; |
| 1665 } | 1673 } |
| 1666 | 1674 |
| 1667 | 1675 |
| 1668 template<> | 1676 template<> |
| 1669 struct WeakListVisitor<JSTypedArray> { | 1677 struct WeakListVisitor<JSArrayBufferView> { |
| 1670 static void SetWeakNext(JSTypedArray* obj, Object* next) { | 1678 static void SetWeakNext(JSArrayBufferView* obj, Object* next) { |
| 1671 obj->set_weak_next(next); | 1679 obj->set_weak_next(next); |
| 1672 } | 1680 } |
| 1673 | 1681 |
| 1674 static Object* WeakNext(JSTypedArray* obj) { | 1682 static Object* WeakNext(JSArrayBufferView* obj) { |
| 1675 return obj->weak_next(); | 1683 return obj->weak_next(); |
| 1676 } | 1684 } |
| 1677 | 1685 |
| 1678 static void VisitLiveObject(Heap*, | 1686 static void VisitLiveObject(Heap*, |
| 1679 JSTypedArray* obj, | 1687 JSArrayBufferView* obj, |
| 1680 WeakObjectRetainer* retainer, | 1688 WeakObjectRetainer* retainer, |
| 1681 bool record_slots) {} | 1689 bool record_slots) {} |
| 1682 | 1690 |
| 1691 static void VisitPhantomObject(Heap*, JSArrayBufferView*) {} |
| 1692 |
| 1683 static int WeakNextOffset() { | 1693 static int WeakNextOffset() { |
| 1684 return JSTypedArray::kWeakNextOffset; | 1694 return JSArrayBufferView::kWeakNextOffset; |
| 1685 } | 1695 } |
| 1686 }; | 1696 }; |
| 1687 | 1697 |
| 1688 | 1698 |
| 1689 template<> | 1699 template<> |
| 1690 struct WeakListVisitor<JSArrayBuffer> { | 1700 struct WeakListVisitor<JSArrayBuffer> { |
| 1691 static void SetWeakNext(JSArrayBuffer* obj, Object* next) { | 1701 static void SetWeakNext(JSArrayBuffer* obj, Object* next) { |
| 1692 obj->set_weak_next(next); | 1702 obj->set_weak_next(next); |
| 1693 } | 1703 } |
| 1694 | 1704 |
| 1695 static Object* WeakNext(JSArrayBuffer* obj) { | 1705 static Object* WeakNext(JSArrayBuffer* obj) { |
| 1696 return obj->weak_next(); | 1706 return obj->weak_next(); |
| 1697 } | 1707 } |
| 1698 | 1708 |
| 1699 static void VisitLiveObject(Heap* heap, | 1709 static void VisitLiveObject(Heap* heap, |
| 1700 JSArrayBuffer* array_buffer, | 1710 JSArrayBuffer* array_buffer, |
| 1701 WeakObjectRetainer* retainer, | 1711 WeakObjectRetainer* retainer, |
| 1702 bool record_slots) { | 1712 bool record_slots) { |
| 1703 Object* typed_array_obj = | 1713 Object* typed_array_obj = |
| 1704 VisitWeakList<JSTypedArray>( | 1714 VisitWeakList<JSArrayBufferView>( |
| 1705 heap, | 1715 heap, |
| 1706 array_buffer->weak_first_array(), | 1716 array_buffer->weak_first_view(), |
| 1707 retainer, record_slots); | 1717 retainer, record_slots); |
| 1708 array_buffer->set_weak_first_array(typed_array_obj); | 1718 array_buffer->set_weak_first_view(typed_array_obj); |
| 1709 if (typed_array_obj != heap->undefined_value() && record_slots) { | 1719 if (typed_array_obj != heap->undefined_value() && record_slots) { |
| 1710 Object** slot = HeapObject::RawField( | 1720 Object** slot = HeapObject::RawField( |
| 1711 array_buffer, JSArrayBuffer::kWeakFirstArrayOffset); | 1721 array_buffer, JSArrayBuffer::kWeakFirstViewOffset); |
| 1712 heap->mark_compact_collector()->RecordSlot(slot, slot, typed_array_obj); | 1722 heap->mark_compact_collector()->RecordSlot(slot, slot, typed_array_obj); |
| 1713 } | 1723 } |
| 1714 } | 1724 } |
| 1715 | 1725 |
| 1726 static void VisitPhantomObject(Heap* heap, JSArrayBuffer* phantom) { |
| 1727 Runtime::FreeArrayBuffer(heap->isolate(), phantom); |
| 1728 } |
| 1729 |
| 1716 static int WeakNextOffset() { | 1730 static int WeakNextOffset() { |
| 1717 return JSArrayBuffer::kWeakNextOffset; | 1731 return JSArrayBuffer::kWeakNextOffset; |
| 1718 } | 1732 } |
| 1719 }; | 1733 }; |
| 1720 | 1734 |
| 1721 | 1735 |
| 1722 void Heap::ProcessArrayBuffers(WeakObjectRetainer* retainer, | 1736 void Heap::ProcessArrayBuffers(WeakObjectRetainer* retainer, |
| 1723 bool record_slots) { | 1737 bool record_slots) { |
| 1724 Object* array_buffer_obj = | 1738 Object* array_buffer_obj = |
| 1725 VisitWeakList<JSArrayBuffer>(this, | 1739 VisitWeakList<JSArrayBuffer>(this, |
| 1726 array_buffers_list(), | 1740 array_buffers_list(), |
| 1727 retainer, record_slots); | 1741 retainer, record_slots); |
| 1728 set_array_buffers_list(array_buffer_obj); | 1742 set_array_buffers_list(array_buffer_obj); |
| 1729 } | 1743 } |
| 1730 | 1744 |
| 1731 | 1745 |
| 1746 void Heap::TearDownArrayBuffers() { |
| 1747 Object* undefined = undefined_value(); |
| 1748 for (Object* o = array_buffers_list(); o != undefined;) { |
| 1749 JSArrayBuffer* buffer = JSArrayBuffer::cast(o); |
| 1750 Runtime::FreeArrayBuffer(isolate(), buffer); |
| 1751 o = buffer->weak_next(); |
| 1752 } |
| 1753 array_buffers_list_ = undefined; |
| 1754 } |
| 1755 |
| 1756 |
| 1732 void Heap::VisitExternalResources(v8::ExternalResourceVisitor* visitor) { | 1757 void Heap::VisitExternalResources(v8::ExternalResourceVisitor* visitor) { |
| 1733 DisallowHeapAllocation no_allocation; | 1758 DisallowHeapAllocation no_allocation; |
| 1734 | 1759 |
| 1735 // Both the external string table and the string table may contain | 1760 // Both the external string table and the string table may contain |
| 1736 // external strings, but neither lists them exhaustively, nor is the | 1761 // external strings, but neither lists them exhaustively, nor is the |
| 1737 // intersection set empty. Therefore we iterate over the external string | 1762 // intersection set empty. Therefore we iterate over the external string |
| 1738 // table first, ignoring internalized strings, and then over the | 1763 // table first, ignoring internalized strings, and then over the |
| 1739 // internalized string table. | 1764 // internalized string table. |
| 1740 | 1765 |
| 1741 class ExternalStringTableVisitorAdapter : public ObjectVisitor { | 1766 class ExternalStringTableVisitorAdapter : public ObjectVisitor { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1905 Visit); | 1930 Visit); |
| 1906 | 1931 |
| 1907 table_.Register(kVisitJSArrayBuffer, | 1932 table_.Register(kVisitJSArrayBuffer, |
| 1908 &ObjectEvacuationStrategy<POINTER_OBJECT>:: | 1933 &ObjectEvacuationStrategy<POINTER_OBJECT>:: |
| 1909 Visit); | 1934 Visit); |
| 1910 | 1935 |
| 1911 table_.Register(kVisitJSTypedArray, | 1936 table_.Register(kVisitJSTypedArray, |
| 1912 &ObjectEvacuationStrategy<POINTER_OBJECT>:: | 1937 &ObjectEvacuationStrategy<POINTER_OBJECT>:: |
| 1913 Visit); | 1938 Visit); |
| 1914 | 1939 |
| 1940 table_.Register(kVisitJSDataView, |
| 1941 &ObjectEvacuationStrategy<POINTER_OBJECT>:: |
| 1942 Visit); |
| 1943 |
| 1915 table_.Register(kVisitJSRegExp, | 1944 table_.Register(kVisitJSRegExp, |
| 1916 &ObjectEvacuationStrategy<POINTER_OBJECT>:: | 1945 &ObjectEvacuationStrategy<POINTER_OBJECT>:: |
| 1917 Visit); | 1946 Visit); |
| 1918 | 1947 |
| 1919 if (marks_handling == IGNORE_MARKS) { | 1948 if (marks_handling == IGNORE_MARKS) { |
| 1920 table_.Register(kVisitJSFunction, | 1949 table_.Register(kVisitJSFunction, |
| 1921 &ObjectEvacuationStrategy<POINTER_OBJECT>:: | 1950 &ObjectEvacuationStrategy<POINTER_OBJECT>:: |
| 1922 template VisitSpecialized<JSFunction::kSize>); | 1951 template VisitSpecialized<JSFunction::kSize>); |
| 1923 } else { | 1952 } else { |
| 1924 table_.Register(kVisitJSFunction, &EvacuateJSFunction); | 1953 table_.Register(kVisitJSFunction, &EvacuateJSFunction); |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2823 } | 2852 } |
| 2824 | 2853 |
| 2825 | 2854 |
| 2826 MaybeObject* Heap::AllocatePropertyCell(Object* value) { | 2855 MaybeObject* Heap::AllocatePropertyCell(Object* value) { |
| 2827 Object* result; | 2856 Object* result; |
| 2828 { MaybeObject* maybe_result = AllocateRawPropertyCell(); | 2857 { MaybeObject* maybe_result = AllocateRawPropertyCell(); |
| 2829 if (!maybe_result->ToObject(&result)) return maybe_result; | 2858 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 2830 } | 2859 } |
| 2831 HeapObject::cast(result)->set_map_no_write_barrier( | 2860 HeapObject::cast(result)->set_map_no_write_barrier( |
| 2832 global_property_cell_map()); | 2861 global_property_cell_map()); |
| 2833 PropertyCell::cast(result)->set_value(value); | 2862 PropertyCell* cell = PropertyCell::cast(result); |
| 2834 PropertyCell::cast(result)->set_type(Type::None()); | 2863 cell->set_dependent_code(DependentCode::cast(empty_fixed_array()), |
| 2864 SKIP_WRITE_BARRIER); |
| 2865 cell->set_value(value); |
| 2866 cell->set_type(Type::None()); |
| 2835 return result; | 2867 return result; |
| 2836 } | 2868 } |
| 2837 | 2869 |
| 2838 | 2870 |
| 2839 MaybeObject* Heap::AllocateBox(Object* value, PretenureFlag pretenure) { | 2871 MaybeObject* Heap::AllocateBox(Object* value, PretenureFlag pretenure) { |
| 2840 Box* result; | 2872 Box* result; |
| 2841 MaybeObject* maybe_result = AllocateStruct(BOX_TYPE); | 2873 MaybeObject* maybe_result = AllocateStruct(BOX_TYPE); |
| 2842 if (!maybe_result->To(&result)) return maybe_result; | 2874 if (!maybe_result->To(&result)) return maybe_result; |
| 2843 result->set_value(value); | 2875 result->set_value(value); |
| 2844 return result; | 2876 return result; |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3124 } | 3156 } |
| 3125 set_frozen_symbol(Symbol::cast(obj)); | 3157 set_frozen_symbol(Symbol::cast(obj)); |
| 3126 | 3158 |
| 3127 { MaybeObject* maybe_obj = SeededNumberDictionary::Allocate(this, 0, TENURED); | 3159 { MaybeObject* maybe_obj = SeededNumberDictionary::Allocate(this, 0, TENURED); |
| 3128 if (!maybe_obj->ToObject(&obj)) return false; | 3160 if (!maybe_obj->ToObject(&obj)) return false; |
| 3129 } | 3161 } |
| 3130 SeededNumberDictionary::cast(obj)->set_requires_slow_elements(); | 3162 SeededNumberDictionary::cast(obj)->set_requires_slow_elements(); |
| 3131 set_empty_slow_element_dictionary(SeededNumberDictionary::cast(obj)); | 3163 set_empty_slow_element_dictionary(SeededNumberDictionary::cast(obj)); |
| 3132 | 3164 |
| 3133 // Handling of script id generation is in Factory::NewScript. | 3165 // Handling of script id generation is in Factory::NewScript. |
| 3134 set_last_script_id(undefined_value()); | 3166 set_last_script_id(Smi::FromInt(v8::Script::kNoScriptId)); |
| 3135 | 3167 |
| 3136 // Initialize keyed lookup cache. | 3168 // Initialize keyed lookup cache. |
| 3137 isolate_->keyed_lookup_cache()->Clear(); | 3169 isolate_->keyed_lookup_cache()->Clear(); |
| 3138 | 3170 |
| 3139 // Initialize context slot cache. | 3171 // Initialize context slot cache. |
| 3140 isolate_->context_slot_cache()->Clear(); | 3172 isolate_->context_slot_cache()->Clear(); |
| 3141 | 3173 |
| 3142 // Initialize descriptor cache. | 3174 // Initialize descriptor cache. |
| 3143 isolate_->descriptor_lookup_cache()->Clear(); | 3175 isolate_->descriptor_lookup_cache()->Clear(); |
| 3144 | 3176 |
| (...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4394 // JSFunctions should be allocated using AllocateFunction to be | 4426 // JSFunctions should be allocated using AllocateFunction to be |
| 4395 // properly initialized. | 4427 // properly initialized. |
| 4396 ASSERT(map->instance_type() != JS_FUNCTION_TYPE); | 4428 ASSERT(map->instance_type() != JS_FUNCTION_TYPE); |
| 4397 | 4429 |
| 4398 // Both types of global objects should be allocated using | 4430 // Both types of global objects should be allocated using |
| 4399 // AllocateGlobalObject to be properly initialized. | 4431 // AllocateGlobalObject to be properly initialized. |
| 4400 ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); | 4432 ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); |
| 4401 ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); | 4433 ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); |
| 4402 | 4434 |
| 4403 // Allocate the backing storage for the properties. | 4435 // Allocate the backing storage for the properties. |
| 4404 int prop_size = map->InitialPropertiesLength(); | 4436 int prop_size = |
| 4437 map->pre_allocated_property_fields() + |
| 4438 map->unused_property_fields() - |
| 4439 map->inobject_properties(); |
| 4405 ASSERT(prop_size >= 0); | 4440 ASSERT(prop_size >= 0); |
| 4406 Object* properties; | 4441 Object* properties; |
| 4407 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size, pretenure); | 4442 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size, pretenure); |
| 4408 if (!maybe_properties->ToObject(&properties)) return maybe_properties; | 4443 if (!maybe_properties->ToObject(&properties)) return maybe_properties; |
| 4409 } | 4444 } |
| 4410 | 4445 |
| 4411 // Allocate the JSObject. | 4446 // Allocate the JSObject. |
| 4412 AllocationSpace space = | 4447 AllocationSpace space = |
| 4413 (pretenure == TENURED) ? OLD_POINTER_SPACE : NEW_SPACE; | 4448 (pretenure == TENURED) ? OLD_POINTER_SPACE : NEW_SPACE; |
| 4414 if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE; | 4449 if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 4431 // JSFunctions should be allocated using AllocateFunction to be | 4466 // JSFunctions should be allocated using AllocateFunction to be |
| 4432 // properly initialized. | 4467 // properly initialized. |
| 4433 ASSERT(map->instance_type() != JS_FUNCTION_TYPE); | 4468 ASSERT(map->instance_type() != JS_FUNCTION_TYPE); |
| 4434 | 4469 |
| 4435 // Both types of global objects should be allocated using | 4470 // Both types of global objects should be allocated using |
| 4436 // AllocateGlobalObject to be properly initialized. | 4471 // AllocateGlobalObject to be properly initialized. |
| 4437 ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); | 4472 ASSERT(map->instance_type() != JS_GLOBAL_OBJECT_TYPE); |
| 4438 ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); | 4473 ASSERT(map->instance_type() != JS_BUILTINS_OBJECT_TYPE); |
| 4439 | 4474 |
| 4440 // Allocate the backing storage for the properties. | 4475 // Allocate the backing storage for the properties. |
| 4441 int prop_size = map->InitialPropertiesLength(); | 4476 int prop_size = |
| 4477 map->pre_allocated_property_fields() + |
| 4478 map->unused_property_fields() - |
| 4479 map->inobject_properties(); |
| 4442 ASSERT(prop_size >= 0); | 4480 ASSERT(prop_size >= 0); |
| 4443 Object* properties; | 4481 Object* properties; |
| 4444 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size); | 4482 { MaybeObject* maybe_properties = AllocateFixedArray(prop_size); |
| 4445 if (!maybe_properties->ToObject(&properties)) return maybe_properties; | 4483 if (!maybe_properties->ToObject(&properties)) return maybe_properties; |
| 4446 } | 4484 } |
| 4447 | 4485 |
| 4448 // Allocate the JSObject. | 4486 // Allocate the JSObject. |
| 4449 AllocationSpace space = NEW_SPACE; | 4487 AllocationSpace space = NEW_SPACE; |
| 4450 if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE; | 4488 if (map->instance_size() > Page::kMaxNonCodeHeapObjectSize) space = LO_SPACE; |
| 4451 Object* obj; | 4489 Object* obj; |
| (...skipping 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6618 // generation size. | 6656 // generation size. |
| 6619 if (max_executable_size_ > max_old_generation_size_) { | 6657 if (max_executable_size_ > max_old_generation_size_) { |
| 6620 max_executable_size_ = max_old_generation_size_; | 6658 max_executable_size_ = max_old_generation_size_; |
| 6621 } | 6659 } |
| 6622 | 6660 |
| 6623 // The new space size must be a power of two to support single-bit testing | 6661 // The new space size must be a power of two to support single-bit testing |
| 6624 // for containment. | 6662 // for containment. |
| 6625 max_semispace_size_ = RoundUpToPowerOf2(max_semispace_size_); | 6663 max_semispace_size_ = RoundUpToPowerOf2(max_semispace_size_); |
| 6626 reserved_semispace_size_ = RoundUpToPowerOf2(reserved_semispace_size_); | 6664 reserved_semispace_size_ = RoundUpToPowerOf2(reserved_semispace_size_); |
| 6627 initial_semispace_size_ = Min(initial_semispace_size_, max_semispace_size_); | 6665 initial_semispace_size_ = Min(initial_semispace_size_, max_semispace_size_); |
| 6628 external_allocation_limit_ = 16 * max_semispace_size_; | 6666 |
| 6667 // The external allocation limit should be below 256 MB on all architectures |
| 6668 // to avoid unnecessary low memory notifications, as that is the threshold |
| 6669 // for some embedders. |
| 6670 external_allocation_limit_ = 12 * max_semispace_size_; |
| 6671 ASSERT(external_allocation_limit_ <= 256 * MB); |
| 6629 | 6672 |
| 6630 // The old generation is paged and needs at least one page for each space. | 6673 // The old generation is paged and needs at least one page for each space. |
| 6631 int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1; | 6674 int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1; |
| 6632 max_old_generation_size_ = Max(static_cast<intptr_t>(paged_space_count * | 6675 max_old_generation_size_ = Max(static_cast<intptr_t>(paged_space_count * |
| 6633 Page::kPageSize), | 6676 Page::kPageSize), |
| 6634 RoundUp(max_old_generation_size_, | 6677 RoundUp(max_old_generation_size_, |
| 6635 Page::kPageSize)); | 6678 Page::kPageSize)); |
| 6636 | 6679 |
| 6637 configured_ = true; | 6680 configured_ = true; |
| 6638 return true; | 6681 return true; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6867 PrintF("max_gc_pause=%.1f ", get_max_gc_pause()); | 6910 PrintF("max_gc_pause=%.1f ", get_max_gc_pause()); |
| 6868 PrintF("total_gc_time=%.1f ", total_gc_time_ms_); | 6911 PrintF("total_gc_time=%.1f ", total_gc_time_ms_); |
| 6869 PrintF("min_in_mutator=%.1f ", get_min_in_mutator()); | 6912 PrintF("min_in_mutator=%.1f ", get_min_in_mutator()); |
| 6870 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ", | 6913 PrintF("max_alive_after_gc=%" V8_PTR_PREFIX "d ", |
| 6871 get_max_alive_after_gc()); | 6914 get_max_alive_after_gc()); |
| 6872 PrintF("total_marking_time=%.1f ", marking_time()); | 6915 PrintF("total_marking_time=%.1f ", marking_time()); |
| 6873 PrintF("total_sweeping_time=%.1f ", sweeping_time()); | 6916 PrintF("total_sweeping_time=%.1f ", sweeping_time()); |
| 6874 PrintF("\n\n"); | 6917 PrintF("\n\n"); |
| 6875 } | 6918 } |
| 6876 | 6919 |
| 6920 TearDownArrayBuffers(); |
| 6921 |
| 6877 isolate_->global_handles()->TearDown(); | 6922 isolate_->global_handles()->TearDown(); |
| 6878 | 6923 |
| 6879 external_string_table_.TearDown(); | 6924 external_string_table_.TearDown(); |
| 6880 | 6925 |
| 6881 error_object_list_.TearDown(); | 6926 error_object_list_.TearDown(); |
| 6882 | 6927 |
| 6883 new_space_.TearDown(); | 6928 new_space_.TearDown(); |
| 6884 | 6929 |
| 6885 if (old_pointer_space_ != NULL) { | 6930 if (old_pointer_space_ != NULL) { |
| 6886 old_pointer_space_->TearDown(); | 6931 old_pointer_space_->TearDown(); |
| (...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8075 if (FLAG_parallel_recompilation) { | 8120 if (FLAG_parallel_recompilation) { |
| 8076 heap_->relocation_mutex_->Lock(); | 8121 heap_->relocation_mutex_->Lock(); |
| 8077 #ifdef DEBUG | 8122 #ifdef DEBUG |
| 8078 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 8123 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
| 8079 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 8124 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
| 8080 #endif // DEBUG | 8125 #endif // DEBUG |
| 8081 } | 8126 } |
| 8082 } | 8127 } |
| 8083 | 8128 |
| 8084 } } // namespace v8::internal | 8129 } } // namespace v8::internal |
| OLD | NEW |