Index: src/serialize.cc |
diff --git a/src/serialize.cc b/src/serialize.cc |
index b7277b5da563927fcd755ab97f7104feca1106e0..93882cbf0a9ba24b740eae0d87a9e7447d768658 100644 |
--- a/src/serialize.cc |
+++ b/src/serialize.cc |
@@ -9,6 +9,7 @@ |
#include "src/base/platform/platform.h" |
#include "src/bootstrapper.h" |
#include "src/code-stubs.h" |
+#include "src/compiler.h" |
#include "src/deoptimizer.h" |
#include "src/execution.h" |
#include "src/global-handles.h" |
@@ -2651,4 +2652,19 @@ Vector<const uint32_t> SerializedCodeData::CodeStubKeys() const { |
return Vector<const uint32_t>(reinterpret_cast<const uint32_t*>(start), |
GetHeaderValue(kNumCodeStubKeysOffset)); |
} |
+ |
+ |
+SerializedCodeData::SerializedCodeData(ScriptData* data) |
+ : SerializedData(const_cast<byte*>(data->data()), data->length()) {} |
+ |
+ |
+SerializedCodeData* SerializedCodeData::FromCachedData(ScriptData* cached_data, |
+ String* source) { |
+ DisallowHeapAllocation no_gc; |
+ SerializedCodeData* scd = new SerializedCodeData(cached_data); |
+ if (scd->IsSane(source)) return scd; |
+ cached_data->Reject(); |
+ delete scd; |
+ return NULL; |
+} |
} } // namespace v8::internal |