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/deserializer.h" | 5 #include "src/snapshot/deserializer.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/assembler-inl.h" | 8 #include "src/assembler-inl.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/external-reference-table.h" | 10 #include "src/external-reference-table.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 | 70 |
71 void Deserializer::Initialize(Isolate* isolate) { | 71 void Deserializer::Initialize(Isolate* isolate) { |
72 DCHECK_NULL(isolate_); | 72 DCHECK_NULL(isolate_); |
73 DCHECK_NOT_NULL(isolate); | 73 DCHECK_NOT_NULL(isolate); |
74 isolate_ = isolate; | 74 isolate_ = isolate; |
75 DCHECK_NULL(external_reference_table_); | 75 DCHECK_NULL(external_reference_table_); |
76 external_reference_table_ = ExternalReferenceTable::instance(isolate); | 76 external_reference_table_ = ExternalReferenceTable::instance(isolate); |
77 CHECK_EQ(magic_number_, | 77 CHECK_EQ(magic_number_, |
78 SerializedData::ComputeMagicNumber(external_reference_table_)); | 78 SerializedData::ComputeMagicNumber(external_reference_table_)); |
| 79 // The current isolate must have at least as many API-provided external |
| 80 // references as the to-be-deserialized snapshot expects and refers to. |
| 81 CHECK_LE(num_extra_references_, |
| 82 SerializedData::GetExtraReferences(external_reference_table_)); |
79 } | 83 } |
80 | 84 |
81 void Deserializer::Deserialize(Isolate* isolate) { | 85 void Deserializer::Deserialize(Isolate* isolate) { |
82 Initialize(isolate); | 86 Initialize(isolate); |
83 if (!ReserveSpace()) V8::FatalProcessOutOfMemory("deserializing context"); | 87 if (!ReserveSpace()) V8::FatalProcessOutOfMemory("deserializing context"); |
84 // No active threads. | 88 // No active threads. |
85 DCHECK_NULL(isolate_->thread_manager()->FirstThreadStateInUse()); | 89 DCHECK_NULL(isolate_->thread_manager()->FirstThreadStateInUse()); |
86 // No active handles. | 90 // No active handles. |
87 DCHECK(isolate_->handle_scope_implementer()->blocks()->is_empty()); | 91 DCHECK(isolate_->handle_scope_implementer()->blocks()->is_empty()); |
88 // Partial snapshot cache is not yet populated. | 92 // Partial snapshot cache is not yet populated. |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 | 865 |
862 default: | 866 default: |
863 CHECK(false); | 867 CHECK(false); |
864 } | 868 } |
865 } | 869 } |
866 CHECK_EQ(limit, current); | 870 CHECK_EQ(limit, current); |
867 return true; | 871 return true; |
868 } | 872 } |
869 } // namespace internal | 873 } // namespace internal |
870 } // namespace v8 | 874 } // namespace v8 |
OLD | NEW |