OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/api.h" | 8 #include "src/api.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1847 | 1847 |
1848 // We cannot serialize typed array objects correctly. | 1848 // We cannot serialize typed array objects correctly. |
1849 DCHECK(!object_->IsJSTypedArray()); | 1849 DCHECK(!object_->IsJSTypedArray()); |
1850 | 1850 |
1851 // We don't expect fillers. | 1851 // We don't expect fillers. |
1852 DCHECK(!object_->IsFiller()); | 1852 DCHECK(!object_->IsFiller()); |
1853 | 1853 |
1854 if (object_->IsPrototypeInfo()) { | 1854 if (object_->IsPrototypeInfo()) { |
1855 Object* prototype_users = PrototypeInfo::cast(object_)->prototype_users(); | 1855 Object* prototype_users = PrototypeInfo::cast(object_)->prototype_users(); |
1856 if (prototype_users->IsWeakFixedArray()) { | 1856 if (prototype_users->IsWeakFixedArray()) { |
1857 WeakFixedArray::cast(prototype_users)->Compact(); | 1857 WeakFixedArray* array = WeakFixedArray::cast(prototype_users); |
| 1858 array->Compact<JSObject::PrototypeRegistryCompactionCallback>(); |
| 1859 } |
| 1860 } |
| 1861 // Compaction of a prototype users list can require the registered users |
| 1862 // to update their remembered slots. That doesn't work if those users |
| 1863 // have already been serialized themselves. So if this object is a |
| 1864 // registered user, compact its prototype's user list now. |
| 1865 if (object_->IsMap()) { |
| 1866 Map* map = Map::cast(object_); |
| 1867 if (map->is_prototype_map() && map->prototype_info()->IsPrototypeInfo() && |
| 1868 PrototypeInfo::cast(map->prototype_info())->registry_slot() != |
| 1869 PrototypeInfo::UNREGISTERED) { |
| 1870 JSObject* proto = JSObject::cast(map->prototype()); |
| 1871 PrototypeInfo* info = PrototypeInfo::cast(proto->map()->prototype_info()); |
| 1872 WeakFixedArray* array = WeakFixedArray::cast(info->prototype_users()); |
| 1873 array->Compact<JSObject::PrototypeRegistryCompactionCallback>(); |
1858 } | 1874 } |
1859 } | 1875 } |
1860 | 1876 |
1861 if (object_->IsScript()) { | 1877 if (object_->IsScript()) { |
1862 // Clear cached line ends. | 1878 // Clear cached line ends. |
1863 Object* undefined = serializer_->isolate()->heap()->undefined_value(); | 1879 Object* undefined = serializer_->isolate()->heap()->undefined_value(); |
1864 Script::cast(object_)->set_line_ends(undefined); | 1880 Script::cast(object_)->set_line_ends(undefined); |
1865 } | 1881 } |
1866 | 1882 |
1867 if (object_->IsExternalString()) { | 1883 if (object_->IsExternalString()) { |
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2693 DisallowHeapAllocation no_gc; | 2709 DisallowHeapAllocation no_gc; |
2694 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2710 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2695 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2711 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2696 if (r == CHECK_SUCCESS) return scd; | 2712 if (r == CHECK_SUCCESS) return scd; |
2697 cached_data->Reject(); | 2713 cached_data->Reject(); |
2698 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2714 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2699 delete scd; | 2715 delete scd; |
2700 return NULL; | 2716 return NULL; |
2701 } | 2717 } |
2702 } } // namespace v8::internal | 2718 } } // namespace v8::internal |
OLD | NEW |