| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/snapshot/partial-serializer.h" | 5 #include "src/snapshot/partial-serializer.h" |
| 6 | 6 |
| 7 #include "src/objects-inl.h" | 7 #include "src/objects-inl.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // All the internalized strings that the partial snapshot needs should be | 76 // All the internalized strings that the partial snapshot needs should be |
| 77 // either in the root table or in the partial snapshot cache. | 77 // either in the root table or in the partial snapshot cache. |
| 78 DCHECK(!obj->IsInternalizedString()); | 78 DCHECK(!obj->IsInternalizedString()); |
| 79 | 79 |
| 80 if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return; | 80 if (SerializeKnownObject(obj, how_to_code, where_to_point, skip)) return; |
| 81 | 81 |
| 82 FlushSkip(skip); | 82 FlushSkip(skip); |
| 83 | 83 |
| 84 // Clear literal boilerplates. | 84 // Clear literal boilerplates. |
| 85 if (obj->IsJSFunction()) { | 85 if (obj->IsJSFunction()) { |
| 86 FixedArray* literals = JSFunction::cast(obj)->literals(); | 86 LiteralsArray* literals = JSFunction::cast(obj)->literals(); |
| 87 for (int i = 0; i < literals->length(); i++) literals->set_undefined(i); | 87 for (int i = 0; i < literals->literals_count(); i++) { |
| 88 literals->set_literal_undefined(i); |
| 89 } |
| 88 } | 90 } |
| 89 | 91 |
| 90 // Object has not yet been serialized. Serialize it here. | 92 // Object has not yet been serialized. Serialize it here. |
| 91 ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point); | 93 ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point); |
| 92 serializer.Serialize(); | 94 serializer.Serialize(); |
| 93 } | 95 } |
| 94 | 96 |
| 95 int PartialSerializer::PartialSnapshotCacheIndex(HeapObject* heap_object) { | 97 int PartialSerializer::PartialSnapshotCacheIndex(HeapObject* heap_object) { |
| 96 int index = partial_cache_index_map_.LookupOrInsert( | 98 int index = partial_cache_index_map_.LookupOrInsert( |
| 97 heap_object, next_partial_cache_index_); | 99 heap_object, next_partial_cache_index_); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 112 // would cause dupes. | 114 // would cause dupes. |
| 113 DCHECK(!o->IsScript()); | 115 DCHECK(!o->IsScript()); |
| 114 return o->IsName() || o->IsSharedFunctionInfo() || o->IsHeapNumber() || | 116 return o->IsName() || o->IsSharedFunctionInfo() || o->IsHeapNumber() || |
| 115 o->IsCode() || o->IsScopeInfo() || o->IsAccessorInfo() || | 117 o->IsCode() || o->IsScopeInfo() || o->IsAccessorInfo() || |
| 116 o->map() == | 118 o->map() == |
| 117 startup_serializer_->isolate()->heap()->fixed_cow_array_map(); | 119 startup_serializer_->isolate()->heap()->fixed_cow_array_map(); |
| 118 } | 120 } |
| 119 | 121 |
| 120 } // namespace internal | 122 } // namespace internal |
| 121 } // namespace v8 | 123 } // namespace v8 |
| OLD | NEW |