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/snapshot/serialize.h" | 5 #include "src/snapshot/serialize.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 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 HowToCode how_to_code, WhereToPoint where_to_point) | 1360 HowToCode how_to_code, WhereToPoint where_to_point) |
1361 : serializer_(serializer), | 1361 : serializer_(serializer), |
1362 object_(HeapObject::cast(o)), | 1362 object_(HeapObject::cast(o)), |
1363 sink_(sink), | 1363 sink_(sink), |
1364 reference_representation_(how_to_code + where_to_point), | 1364 reference_representation_(how_to_code + where_to_point), |
1365 bytes_processed_so_far_(0), | 1365 bytes_processed_so_far_(0), |
1366 is_code_object_(o->IsCode()), | 1366 is_code_object_(o->IsCode()), |
1367 code_has_been_output_(false) {} | 1367 code_has_been_output_(false) {} |
1368 void Serialize(); | 1368 void Serialize(); |
1369 void SerializeDeferred(); | 1369 void SerializeDeferred(); |
1370 void VisitPointers(Object** start, Object** end); | 1370 void VisitPointers(Object** start, Object** end) override; |
1371 void VisitEmbeddedPointer(RelocInfo* target); | 1371 void VisitEmbeddedPointer(RelocInfo* target) override; |
1372 void VisitExternalReference(Address* p); | 1372 void VisitExternalReference(Address* p) override; |
1373 void VisitExternalReference(RelocInfo* rinfo); | 1373 void VisitExternalReference(RelocInfo* rinfo) override; |
1374 void VisitInternalReference(RelocInfo* rinfo); | 1374 void VisitInternalReference(RelocInfo* rinfo) override; |
1375 void VisitCodeTarget(RelocInfo* target); | 1375 void VisitCodeTarget(RelocInfo* target) override; |
1376 void VisitCodeEntry(Address entry_address); | 1376 void VisitCodeEntry(Address entry_address) override; |
1377 void VisitCell(RelocInfo* rinfo); | 1377 void VisitCell(RelocInfo* rinfo) override; |
1378 void VisitRuntimeEntry(RelocInfo* reloc); | 1378 void VisitRuntimeEntry(RelocInfo* reloc) override; |
1379 // Used for seralizing the external strings that hold the natives source. | 1379 // Used for seralizing the external strings that hold the natives source. |
1380 void VisitExternalOneByteString( | 1380 void VisitExternalOneByteString( |
1381 v8::String::ExternalOneByteStringResource** resource); | 1381 v8::String::ExternalOneByteStringResource** resource) override; |
1382 // We can't serialize a heap with external two byte strings. | 1382 // We can't serialize a heap with external two byte strings. |
1383 void VisitExternalTwoByteString( | 1383 void VisitExternalTwoByteString( |
1384 v8::String::ExternalStringResource** resource) { | 1384 v8::String::ExternalStringResource** resource) override { |
1385 UNREACHABLE(); | 1385 UNREACHABLE(); |
1386 } | 1386 } |
1387 | 1387 |
1388 private: | 1388 private: |
1389 void SerializePrologue(AllocationSpace space, int size, Map* map); | 1389 void SerializePrologue(AllocationSpace space, int size, Map* map); |
1390 | 1390 |
1391 bool SerializeExternalNativeSourceString( | 1391 bool SerializeExternalNativeSourceString( |
1392 int builtin_count, | 1392 int builtin_count, |
1393 v8::String::ExternalOneByteStringResource** resource_pointer, | 1393 v8::String::ExternalOneByteStringResource** resource_pointer, |
1394 FixedArray* source_cache, int resource_index); | 1394 FixedArray* source_cache, int resource_index); |
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2849 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2849 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2850 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2850 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2851 if (r == CHECK_SUCCESS) return scd; | 2851 if (r == CHECK_SUCCESS) return scd; |
2852 cached_data->Reject(); | 2852 cached_data->Reject(); |
2853 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2853 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2854 delete scd; | 2854 delete scd; |
2855 return NULL; | 2855 return NULL; |
2856 } | 2856 } |
2857 } // namespace internal | 2857 } // namespace internal |
2858 } // namespace v8 | 2858 } // namespace v8 |
OLD | NEW |