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

Unified Diff: src/serialize.h

Issue 724023002: Soft fail for invalid cache data. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: use flag to indicate rejection Created 6 years, 1 month 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
« no previous file with comments | « src/parser.cc ('k') | src/serialize.cc » ('j') | test/cctest/test-api.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/serialize.h
diff --git a/src/serialize.h b/src/serialize.h
index d7a6c7fa30b6ea3b1ef01f5e7a9834d03acdff7c..1c781139b5a6a0cf1092261bcaff9ffc15247913 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -706,7 +706,7 @@ class CodeSerializer : public Serializer {
Handle<String> source);
MUST_USE_RESULT static MaybeHandle<SharedFunctionInfo> Deserialize(
- Isolate* isolate, ScriptData* data, Handle<String> source);
+ Isolate* isolate, ScriptData* cached_data, Handle<String> source);
static const int kSourceObjectIndex = 0;
static const int kCodeStubsBaseIndex = 1;
@@ -757,10 +757,14 @@ class CodeSerializer : public Serializer {
class SerializedCodeData {
public:
// Used by when consuming.
- explicit SerializedCodeData(ScriptData* data, String* source)
- : script_data_(data), owns_script_data_(false) {
+ static SerializedCodeData* FromCachedData(ScriptData* cached_data,
+ String* source) {
DisallowHeapAllocation no_gc;
- CHECK(IsSane(source));
+ SerializedCodeData* scd = new SerializedCodeData(cached_data);
+ if (scd->IsSane(source)) return scd;
+ cached_data->Reject();
+ delete scd;
+ return NULL;
}
// Used when producing.
@@ -822,6 +826,9 @@ class SerializedCodeData {
}
private:
+ explicit SerializedCodeData(ScriptData* data)
+ : script_data_(data), owns_script_data_(false) {}
+
void SetHeaderValue(int offset, int value) {
reinterpret_cast<int*>(const_cast<byte*>(script_data_->data()))[offset] =
value;
« no previous file with comments | « src/parser.cc ('k') | src/serialize.cc » ('j') | test/cctest/test-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698