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

Unified Diff: src/serialize.h

Issue 394793002: Verify that source string matches serialized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: src/serialize.h
diff --git a/src/serialize.h b/src/serialize.h
index e6547b842dfbeb5ff9346206972e17334219163d..0676c39ed139ded0ff490378c584a35404341356 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -590,6 +590,11 @@ class CodeSerializer : public Serializer {
static const int kSourceObjectIndex = 0;
+ String* source() {
+ ASSERT(!AllowHeapAllocation::IsAllowed());
+ return source_;
+ }
+
private:
void SerializeBuiltin(Code* builtin, HowToCode how_to_code,
WhereToPoint where_to_point, int skip);
@@ -606,9 +611,10 @@ class CodeSerializer : public Serializer {
class SerializedCodeData {
public:
// Used by when consuming.
- explicit SerializedCodeData(ScriptData* data)
+ explicit SerializedCodeData(ScriptData* data, String* source)
: script_data_(data), owns_script_data_(false) {
- CHECK(IsSane());
+ DisallowHeapAllocation no_gc;
+ CHECK(IsSane(source));
}
// Used when producing.
@@ -649,12 +655,14 @@ class SerializedCodeData {
return reinterpret_cast<const int*>(script_data_->data())[offset];
}
- bool IsSane();
+ bool IsSane(String* source);
+
+ int CheckSum(String* source);
// The data header consists of int-sized entries:
// [0] version hash
// [1..7] reservation sizes for spaces from NEW_SPACE to PROPERTY_CELL_SPACE.
- static const int kVersionHashOffset = 0;
+ static const int kCheckSumOffset = 0;
static const int kReservationsOffset = 1;
static const int kHeaderEntries = 8;
« no previous file with comments | « src/objects-inl.h ('k') | src/serialize.cc » ('j') | test/cctest/test-serialize.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698