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