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/code-serializer.h" | 5 #include "src/snapshot/code-serializer.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/counters.h" | 10 #include "src/counters.h" |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const { | 478 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const { |
479 int reservations_size = GetHeaderValue(kNumReservationsOffset) * kInt32Size; | 479 int reservations_size = GetHeaderValue(kNumReservationsOffset) * kInt32Size; |
480 const byte* start = data_ + kHeaderSize + reservations_size; | 480 const byte* start = data_ + kHeaderSize + reservations_size; |
481 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start), | 481 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start), |
482 GetHeaderValue(kNumCodeStubKeysOffset)); | 482 GetHeaderValue(kNumCodeStubKeysOffset)); |
483 } | 483 } |
484 | 484 |
485 SerializedCodeData::SerializedCodeData(ScriptData* data) | 485 SerializedCodeData::SerializedCodeData(ScriptData* data) |
486 : SerializedData(const_cast<byte*>(data->data()), data->length()) {} | 486 : SerializedData(const_cast<byte*>(data->data()), data->length()) {} |
487 | 487 |
488 const SerializedCodeData SerializedCodeData::FromCachedData( | 488 SerializedCodeData SerializedCodeData::FromCachedData( |
489 Isolate* isolate, ScriptData* cached_data, uint32_t expected_source_hash, | 489 Isolate* isolate, ScriptData* cached_data, uint32_t expected_source_hash, |
490 SanityCheckResult* rejection_result) { | 490 SanityCheckResult* rejection_result) { |
491 DisallowHeapAllocation no_gc; | 491 DisallowHeapAllocation no_gc; |
492 SerializedCodeData scd(cached_data); | 492 SerializedCodeData scd(cached_data); |
493 *rejection_result = scd.SanityCheck(isolate, expected_source_hash); | 493 *rejection_result = scd.SanityCheck(isolate, expected_source_hash); |
494 if (*rejection_result != CHECK_SUCCESS) { | 494 if (*rejection_result != CHECK_SUCCESS) { |
495 cached_data->Reject(); | 495 cached_data->Reject(); |
496 return SerializedCodeData(nullptr, 0); | 496 return SerializedCodeData(nullptr, 0); |
497 } | 497 } |
498 return scd; | 498 return scd; |
499 } | 499 } |
500 | 500 |
501 } // namespace internal | 501 } // namespace internal |
502 } // namespace v8 | 502 } // namespace v8 |
OLD | NEW |