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 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 void Serializer::ObjectSerializer::Serialize() { | 1772 void Serializer::ObjectSerializer::Serialize() { |
1773 if (FLAG_trace_serializer) { | 1773 if (FLAG_trace_serializer) { |
1774 PrintF(" Encoding heap object: "); | 1774 PrintF(" Encoding heap object: "); |
1775 object_->ShortPrint(); | 1775 object_->ShortPrint(); |
1776 PrintF("\n"); | 1776 PrintF("\n"); |
1777 } | 1777 } |
1778 | 1778 |
1779 // We cannot serialize typed array objects correctly. | 1779 // We cannot serialize typed array objects correctly. |
1780 DCHECK(!object_->IsJSTypedArray()); | 1780 DCHECK(!object_->IsJSTypedArray()); |
1781 | 1781 |
| 1782 if (object_->IsPrototypeInfo()) { |
| 1783 Object* prototype_users = PrototypeInfo::cast(object_)->prototype_users(); |
| 1784 if (prototype_users->IsWeakFixedArray()) { |
| 1785 WeakFixedArray::cast(prototype_users)->Compact(); |
| 1786 } |
| 1787 } |
| 1788 |
1782 if (object_->IsScript()) { | 1789 if (object_->IsScript()) { |
1783 // Clear cached line ends. | 1790 // Clear cached line ends. |
1784 Object* undefined = serializer_->isolate()->heap()->undefined_value(); | 1791 Object* undefined = serializer_->isolate()->heap()->undefined_value(); |
1785 Script::cast(object_)->set_line_ends(undefined); | 1792 Script::cast(object_)->set_line_ends(undefined); |
1786 } | 1793 } |
1787 | 1794 |
1788 if (object_->IsExternalString()) { | 1795 if (object_->IsExternalString()) { |
1789 Heap* heap = serializer_->isolate()->heap(); | 1796 Heap* heap = serializer_->isolate()->heap(); |
1790 if (object_->map() != heap->native_source_string_map()) { | 1797 if (object_->map() != heap->native_source_string_map()) { |
1791 // Usually we cannot recreate resources for external strings. To work | 1798 // Usually we cannot recreate resources for external strings. To work |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2591 DisallowHeapAllocation no_gc; | 2598 DisallowHeapAllocation no_gc; |
2592 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2599 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2593 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2600 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2594 if (r == CHECK_SUCCESS) return scd; | 2601 if (r == CHECK_SUCCESS) return scd; |
2595 cached_data->Reject(); | 2602 cached_data->Reject(); |
2596 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2603 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2597 delete scd; | 2604 delete scd; |
2598 return NULL; | 2605 return NULL; |
2599 } | 2606 } |
2600 } } // namespace v8::internal | 2607 } } // namespace v8::internal |
OLD | NEW |