OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 | 1772 |
1773 // Copy the content. | 1773 // Copy the content. |
1774 CopyBlock(reinterpret_cast<Object**>(HeapObject::cast(clone)->address()), | 1774 CopyBlock(reinterpret_cast<Object**>(HeapObject::cast(clone)->address()), |
1775 reinterpret_cast<Object**>(source->address()), | 1775 reinterpret_cast<Object**>(source->address()), |
1776 object_size); | 1776 object_size); |
1777 | 1777 |
1778 FixedArray* elements = FixedArray::cast(source->elements()); | 1778 FixedArray* elements = FixedArray::cast(source->elements()); |
1779 FixedArray* properties = FixedArray::cast(source->properties()); | 1779 FixedArray* properties = FixedArray::cast(source->properties()); |
1780 // Update elements if necessary. | 1780 // Update elements if necessary. |
1781 if (elements->length()> 0) { | 1781 if (elements->length()> 0) { |
1782 Object* elem = Heap::CopyFixedArray(elements); | 1782 Object* elem = CopyFixedArray(elements); |
1783 if (elem->IsFailure()) return elem; | 1783 if (elem->IsFailure()) return elem; |
1784 JSObject::cast(clone)->set_elements(FixedArray::cast(elem)); | 1784 JSObject::cast(clone)->set_elements(FixedArray::cast(elem)); |
1785 } | 1785 } |
1786 // Update properties if necessary. | 1786 // Update properties if necessary. |
1787 if (properties->length() > 0) { | 1787 if (properties->length() > 0) { |
1788 Object* prop = Heap::CopyFixedArray(properties); | 1788 Object* prop = CopyFixedArray(properties); |
1789 if (prop->IsFailure()) return prop; | 1789 if (prop->IsFailure()) return prop; |
1790 JSObject::cast(clone)->set_properties(FixedArray::cast(prop)); | 1790 JSObject::cast(clone)->set_properties(FixedArray::cast(prop)); |
1791 } | 1791 } |
1792 // Return the new clone. | 1792 // Return the new clone. |
1793 return clone; | 1793 return clone; |
1794 } | 1794 } |
1795 | 1795 |
1796 | 1796 |
1797 Object* Heap::ReinitializeJSGlobalProxy(JSFunction* constructor, | 1797 Object* Heap::ReinitializeJSGlobalProxy(JSFunction* constructor, |
1798 JSGlobalProxy* object) { | 1798 JSGlobalProxy* object) { |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2100 HeapObject* dst = HeapObject::cast(obj); | 2100 HeapObject* dst = HeapObject::cast(obj); |
2101 CopyBlock(reinterpret_cast<Object**>(dst->address()), | 2101 CopyBlock(reinterpret_cast<Object**>(dst->address()), |
2102 reinterpret_cast<Object**>(src->address()), | 2102 reinterpret_cast<Object**>(src->address()), |
2103 FixedArray::SizeFor(len)); | 2103 FixedArray::SizeFor(len)); |
2104 return obj; | 2104 return obj; |
2105 } | 2105 } |
2106 HeapObject::cast(obj)->set_map(src->map()); | 2106 HeapObject::cast(obj)->set_map(src->map()); |
2107 FixedArray* result = FixedArray::cast(obj); | 2107 FixedArray* result = FixedArray::cast(obj); |
2108 result->set_length(len); | 2108 result->set_length(len); |
2109 // Copy the content | 2109 // Copy the content |
2110 for (int i = 0; i < len; i++) result->set(i, src->get(i)); | 2110 FixedArray::WriteBarrierMode mode = result->GetWriteBarrierMode(); |
| 2111 for (int i = 0; i < len; i++) result->set(i, src->get(i), mode); |
2111 return result; | 2112 return result; |
2112 } | 2113 } |
2113 | 2114 |
2114 | 2115 |
2115 Object* Heap::AllocateFixedArray(int length) { | 2116 Object* Heap::AllocateFixedArray(int length) { |
2116 Object* result = AllocateRawFixedArray(length); | 2117 Object* result = AllocateRawFixedArray(length); |
2117 if (!result->IsFailure()) { | 2118 if (!result->IsFailure()) { |
2118 // Initialize header. | 2119 // Initialize header. |
2119 reinterpret_cast<Array*>(result)->set_map(fixed_array_map()); | 2120 reinterpret_cast<Array*>(result)->set_map(fixed_array_map()); |
2120 FixedArray* array = FixedArray::cast(result); | 2121 FixedArray* array = FixedArray::cast(result); |
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3164 #ifdef DEBUG | 3165 #ifdef DEBUG |
3165 bool Heap::GarbageCollectionGreedyCheck() { | 3166 bool Heap::GarbageCollectionGreedyCheck() { |
3166 ASSERT(FLAG_gc_greedy); | 3167 ASSERT(FLAG_gc_greedy); |
3167 if (Bootstrapper::IsActive()) return true; | 3168 if (Bootstrapper::IsActive()) return true; |
3168 if (disallow_allocation_failure()) return true; | 3169 if (disallow_allocation_failure()) return true; |
3169 return CollectGarbage(0, NEW_SPACE); | 3170 return CollectGarbage(0, NEW_SPACE); |
3170 } | 3171 } |
3171 #endif | 3172 #endif |
3172 | 3173 |
3173 } } // namespace v8::internal | 3174 } } // namespace v8::internal |
OLD | NEW |