Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: src/serialize.cc

Issue 803063002: Add a CHECK to make sure we don't accidentally serialize type feedback (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/serialize.h ('k') | src/type-feedback-vector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/v8.h" 5 #include "src/v8.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 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 } 1300 }
1301 1301
1302 default: 1302 default:
1303 UNREACHABLE(); 1303 UNREACHABLE();
1304 } 1304 }
1305 } 1305 }
1306 DCHECK_EQ(limit, current); 1306 DCHECK_EQ(limit, current);
1307 } 1307 }
1308 1308
1309 1309
1310 Serializer::Serializer(Isolate* isolate, SnapshotByteSink* sink) 1310 Serializer::Serializer(Isolate* isolate, SnapshotByteSink* sink,
1311 bool allow_type_feedback)
1311 : isolate_(isolate), 1312 : isolate_(isolate),
1312 sink_(sink), 1313 sink_(sink),
1313 external_reference_encoder_(new ExternalReferenceEncoder(isolate)), 1314 external_reference_encoder_(new ExternalReferenceEncoder(isolate)),
1314 root_index_map_(isolate), 1315 root_index_map_(isolate),
1315 code_address_map_(NULL), 1316 code_address_map_(NULL),
1316 large_objects_total_size_(0), 1317 large_objects_total_size_(0),
1317 seen_large_objects_index_(0) { 1318 seen_large_objects_index_(0),
1319 allow_type_feedback_(allow_type_feedback) {
1318 // The serializer is meant to be used only to generate initial heap images 1320 // The serializer is meant to be used only to generate initial heap images
1319 // from a context in which there is only one isolate. 1321 // from a context in which there is only one isolate.
1320 for (int i = 0; i < kNumberOfPreallocatedSpaces; i++) { 1322 for (int i = 0; i < kNumberOfPreallocatedSpaces; i++) {
1321 pending_chunk_[i] = 0; 1323 pending_chunk_[i] = 0;
1322 max_chunk_size_[i] = static_cast<uint32_t>( 1324 max_chunk_size_[i] = static_cast<uint32_t>(
1323 MemoryAllocator::PageAreaSize(static_cast<AllocationSpace>(i))); 1325 MemoryAllocator::PageAreaSize(static_cast<AllocationSpace>(i)));
1324 } 1326 }
1325 } 1327 }
1326 1328
1327 1329
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1761 // around this, external strings are serialized to look like ordinary 1763 // around this, external strings are serialized to look like ordinary
1762 // sequential strings. 1764 // sequential strings.
1763 // The exception are native source code strings, since we can recreate 1765 // The exception are native source code strings, since we can recreate
1764 // their resources. In that case we fall through and leave it to 1766 // their resources. In that case we fall through and leave it to
1765 // VisitExternalOneByteString further down. 1767 // VisitExternalOneByteString further down.
1766 SerializeExternalString(); 1768 SerializeExternalString();
1767 return; 1769 return;
1768 } 1770 }
1769 } 1771 }
1770 1772
1773 if (object_->IsSharedFunctionInfo() && !serializer_->allow_type_feedback_) {
1774 CHECK(SharedFunctionInfo::cast(object_)
1775 ->feedback_vector()
1776 ->CanBeSerialized());
1777 }
1778
1771 int size = object_->Size(); 1779 int size = object_->Size();
1772 Map* map = object_->map(); 1780 Map* map = object_->map();
1773 SerializePrologue(Serializer::SpaceOfObject(object_), size, map); 1781 SerializePrologue(Serializer::SpaceOfObject(object_), size, map);
1774 1782
1775 // Serialize the rest of the object. 1783 // Serialize the rest of the object.
1776 CHECK_EQ(0, bytes_processed_so_far_); 1784 CHECK_EQ(0, bytes_processed_so_far_);
1777 bytes_processed_so_far_ = kPointerSize; 1785 bytes_processed_so_far_ = kPointerSize;
1778 1786
1779 object_->IterateBody(map->instance_type(), size, this); 1787 object_->IterateBody(map->instance_type(), size, this);
1780 OutputRawData(object_->address() + size); 1788 OutputRawData(object_->address() + size);
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
2477 return GetHeaderValue(kNumInternalizedStringsOffset); 2485 return GetHeaderValue(kNumInternalizedStringsOffset);
2478 } 2486 }
2479 2487
2480 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const { 2488 Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const {
2481 int reservations_size = GetHeaderValue(kReservationsOffset) * kInt32Size; 2489 int reservations_size = GetHeaderValue(kReservationsOffset) * kInt32Size;
2482 const byte* start = data_ + kHeaderSize + reservations_size; 2490 const byte* start = data_ + kHeaderSize + reservations_size;
2483 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start), 2491 return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start),
2484 GetHeaderValue(kNumCodeStubKeysOffset)); 2492 GetHeaderValue(kNumCodeStubKeysOffset));
2485 } 2493 }
2486 } } // namespace v8::internal 2494 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/serialize.h ('k') | src/type-feedback-vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698