[serializer] remove some dead code.

credits to gcov.

R=vogelheim@chromium.org

Review URL: https://codereview.chromium.org/1529763002

Cr-Commit-Position: refs/heads/master@{#32859}
This commit is contained in:
yangguo 2015-12-15 03:01:11 -08:00 committed by Commit bot
parent e11bba3acd
commit 44e401f18c
5 changed files with 18 additions and 45 deletions

View File

@ -93,23 +93,17 @@ class NativesStore {
return Vector<const char>::cast(name);
}
bool ReadNameAndContentPair(SnapshotByteSource* bytes) {
void ReadNameAndContentPair(SnapshotByteSource* bytes) {
const byte* id;
int id_length;
const byte* source;
int source_length;
bool success = bytes->GetBlob(&id, &id_length) &&
bytes->GetBlob(&source, &source_length);
if (success) {
Vector<const char> id_vector(reinterpret_cast<const char*>(id),
id_length);
Vector<const char> source_vector(
reinterpret_cast<const char*>(source), source_length);
native_ids_.Add(id_vector);
native_source_.Add(source_vector);
native_names_.Add(NameFromId(id, id_length));
}
return success;
int id_length = bytes->GetBlob(&id);
int source_length = bytes->GetBlob(&source);
Vector<const char> id_vector(reinterpret_cast<const char*>(id), id_length);
Vector<const char> source_vector(reinterpret_cast<const char*>(source),
source_length);
native_ids_.Add(id_vector);
native_source_.Add(source_vector);
native_names_.Add(NameFromId(id, id_length));
}
List<Vector<const char> > native_ids_;

View File

@ -136,8 +136,6 @@ class SerializerDeserializer: public ObjectVisitor {
public:
static void Iterate(Isolate* isolate, ObjectVisitor* visitor);
static int nop() { return kNop; }
// No reservation for large object space necessary.
static const int kNumberOfPreallocatedSpaces = LAST_PAGED_SPACE + 1;
static const int kNumberOfSpaces = LAST_SPACE + 1;
@ -653,10 +651,6 @@ class StartupSerializer : public Serializer {
void SerializeObject(HeapObject* o, HowToCode how_to_code,
WhereToPoint where_to_point, int skip) override;
void SerializeWeakReferencesAndDeferred();
void Serialize() {
SerializeStrongReferences();
SerializeWeakReferencesAndDeferred();
}
private:
intptr_t root_index_wave_front_;

View File

@ -40,27 +40,12 @@ void SnapshotByteSink::PutRaw(const byte* data, int number_of_bytes,
}
bool SnapshotByteSource::AtEOF() {
if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false;
for (int x = position_; x < length_; x++) {
if (data_[x] != SerializerDeserializer::nop()) return false;
}
return true;
}
bool SnapshotByteSource::GetBlob(const byte** data, int* number_of_bytes) {
int SnapshotByteSource::GetBlob(const byte** data) {
int size = GetInt();
*number_of_bytes = size;
if (position_ + size <= length_) {
*data = &data_[position_];
Advance(size);
return true;
} else {
Advance(length_ - position_); // proceed until end.
return false;
}
CHECK(position_ + size <= length_);
*data = &data_[position_];
Advance(size);
return size;
}
} // namespace internal
} // namespace v8

View File

@ -57,9 +57,8 @@ class SnapshotByteSource final {
return answer;
}
bool GetBlob(const byte** data, int* number_of_bytes);
bool AtEOF();
// Returns length.
int GetBlob(const byte** data);
int position() { return position_; }

View File

@ -93,7 +93,8 @@ void WritePayload(const Vector<const byte>& payload, const char* file_name) {
static bool WriteToFile(Isolate* isolate, const char* snapshot_file) {
SnapshotByteSink sink;
StartupSerializer ser(isolate, &sink);
ser.Serialize();
ser.SerializeStrongReferences();
ser.SerializeWeakReferencesAndDeferred();
SnapshotData snapshot_data(ser);
WritePayload(snapshot_data.RawData(), snapshot_file);
return true;