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

Side by Side Diff: src/serialize.h

Issue 909473002: Add hash fields to code cache header. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix test case Created 5 years, 10 months 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/flags.cc ('k') | src/serialize.cc » ('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 #ifndef V8_SERIALIZE_H_ 5 #ifndef V8_SERIALIZE_H_
6 #define V8_SERIALIZE_H_ 6 #define V8_SERIALIZE_H_
7 7
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/hashmap.h" 9 #include "src/hashmap.h"
10 #include "src/heap-profiler.h" 10 #include "src/heap-profiler.h"
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 SerializedData() : data_(NULL), size_(0), owns_data_(false) {} 487 SerializedData() : data_(NULL), size_(0), owns_data_(false) {}
488 488
489 ~SerializedData() { 489 ~SerializedData() {
490 if (owns_data_) DeleteArray<byte>(data_); 490 if (owns_data_) DeleteArray<byte>(data_);
491 } 491 }
492 492
493 class ChunkSizeBits : public BitField<uint32_t, 0, 31> {}; 493 class ChunkSizeBits : public BitField<uint32_t, 0, 31> {};
494 class IsLastChunkBits : public BitField<bool, 31, 1> {}; 494 class IsLastChunkBits : public BitField<bool, 31, 1> {};
495 495
496 protected: 496 protected:
497 void SetHeaderValue(int offset, int value) { 497 void SetHeaderValue(int offset, uint32_t value) {
498 memcpy(reinterpret_cast<int*>(data_) + offset, &value, sizeof(value)); 498 memcpy(reinterpret_cast<uint32_t*>(data_) + offset, &value, sizeof(value));
499 } 499 }
500 500
501 int GetHeaderValue(int offset) const { 501 uint32_t GetHeaderValue(int offset) const {
502 int value; 502 uint32_t value;
503 memcpy(&value, reinterpret_cast<int*>(data_) + offset, sizeof(value)); 503 memcpy(&value, reinterpret_cast<int*>(data_) + offset, sizeof(value));
504 return value; 504 return value;
505 } 505 }
506 506
507 void AllocateData(int size); 507 void AllocateData(int size);
508 508
509 byte* data_; 509 byte* data_;
510 int size_; 510 int size_;
511 bool owns_data_; 511 bool owns_data_;
512 }; 512 };
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 941
942 int NumInternalizedStrings() const; 942 int NumInternalizedStrings() const;
943 Vector<const uint32_t> CodeStubKeys() const; 943 Vector<const uint32_t> CodeStubKeys() const;
944 944
945 private: 945 private:
946 explicit SerializedCodeData(ScriptData* data) 946 explicit SerializedCodeData(ScriptData* data)
947 : SerializedData(const_cast<byte*>(data->data()), data->length()) {} 947 : SerializedData(const_cast<byte*>(data->data()), data->length()) {}
948 948
949 bool IsSane(String* source); 949 bool IsSane(String* source);
950 950
951 int CheckSum(String* source); 951 uint32_t SourceHash(String* source) { return source->length(); }
952 952
953 // The data header consists of int-sized entries: 953 // The data header consists of int-sized entries:
954 // [0] version hash 954 // [0] version hash
955 // [1] number of internalized strings 955 // [1] source hash
956 // [2] number of code stub keys 956 // [2] cpu features
957 // [3] number of reservation size entries 957 // [3] flag hash
958 // [4] payload length 958 // [4] number of internalized strings
959 static const int kCheckSumOffset = 0; 959 // [5] number of code stub keys
960 static const int kNumInternalizedStringsOffset = 1; 960 // [6] number of reservation size entries
961 static const int kReservationsOffset = 2; 961 // [7] payload length
962 static const int kNumCodeStubKeysOffset = 3; 962 static const int kVersionHashOffset = 0;
963 static const int kPayloadLengthOffset = 4; 963 static const int kSourceHashOffset = 1;
964 static const int kCpuFeaturesOffset = 2;
965 static const int kFlagHashOffset = 3;
966 static const int kNumInternalizedStringsOffset = 4;
967 static const int kReservationsOffset = 5;
968 static const int kNumCodeStubKeysOffset = 6;
969 static const int kPayloadLengthOffset = 7;
964 static const int kHeaderSize = (kPayloadLengthOffset + 1) * kIntSize; 970 static const int kHeaderSize = (kPayloadLengthOffset + 1) * kIntSize;
965 }; 971 };
966 } } // namespace v8::internal 972 } } // namespace v8::internal
967 973
968 #endif // V8_SERIALIZE_H_ 974 #endif // V8_SERIALIZE_H_
OLDNEW
« no previous file with comments | « src/flags.cc ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698