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

Unified Diff: src/parser.h

Issue 733023003: Reland "Soft fail for invalid cache data." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix leak 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/compiler.cc ('k') | src/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.h
diff --git a/src/parser.h b/src/parser.h
index 820e1494e5711d0914d6acdefbe96168821c82ea..b362951af9bcc32d5e93123b12ebb3f530634c58 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -62,10 +62,14 @@ class FunctionEntry BASE_EMBEDDED {
// Wrapper around ScriptData to provide parser-specific functionality.
class ParseData {
public:
- explicit ParseData(ScriptData* script_data) : script_data_(script_data) {
- CHECK(IsAligned(script_data->length(), sizeof(unsigned)));
- CHECK(IsSane());
+ static ParseData* FromCachedData(ScriptData* cached_data) {
+ ParseData* pd = new ParseData(cached_data);
+ if (pd->IsSane()) return pd;
+ cached_data->Reject();
+ delete pd;
+ return NULL;
}
+
void Initialize();
FunctionEntry GetFunctionEntry(int start);
int FunctionCount();
@@ -77,6 +81,8 @@ class ParseData {
}
private:
+ explicit ParseData(ScriptData* script_data) : script_data_(script_data) {}
+
bool IsSane();
unsigned Magic();
unsigned Version();
@@ -722,6 +728,13 @@ class Parser : public ParserBase<ParserTraits> {
ScriptCompiler::CompileOptions compile_options() const {
return info_->compile_options();
}
+ bool consume_cached_parse_data() const {
+ return compile_options() == ScriptCompiler::kConsumeParserCache &&
+ cached_parse_data_ != NULL;
+ }
+ bool produce_cached_parse_data() const {
+ return compile_options() == ScriptCompiler::kProduceParserCache;
+ }
Scope* DeclarationScope(VariableMode mode) {
return IsLexicalVariableMode(mode)
? scope_ : scope_->DeclarationScope();
« no previous file with comments | « src/compiler.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698