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

Unified Diff: src/parsing/preparse-data.h

Issue 2411793003: Preparse lazy function parameters (Closed)
Patch Set: rebased Created 4 years, 2 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
« no previous file with comments | « src/parsing/parser-base.h ('k') | src/parsing/preparse-data-format.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/preparse-data.h
diff --git a/src/parsing/preparse-data.h b/src/parsing/preparse-data.h
index e8e909f855125e874d3e049be75fcb7d742b18fb..388ecff4ee0232c0d8ab404d4a72d311ee5ad443 100644
--- a/src/parsing/preparse-data.h
+++ b/src/parsing/preparse-data.h
@@ -53,7 +53,9 @@ class ParserRecorder {
virtual ~ParserRecorder() { }
// Logs the scope and some details of a function literal in the source.
- virtual void LogFunction(int start, int end, int literals, int properties,
+ virtual void LogFunction(int key, int start, int end, int num_parameters,
+ int function_length, bool has_duplicate_parameters,
+ int literals, int properties,
LanguageMode language_mode, bool uses_super_property,
bool calls_eval) = 0;
@@ -72,19 +74,32 @@ class ParserRecorder {
class SingletonLogger : public ParserRecorder {
public:
SingletonLogger()
- : has_error_(false), start_(-1), end_(-1), error_type_(kSyntaxError) {}
+ : has_error_(false),
+ key_(-1),
+ start_(-1),
+ end_(-1),
+ num_parameters_(-1),
+ function_length_(-1),
+ has_duplicate_parameters_(false),
+ error_type_(kSyntaxError) {}
virtual ~SingletonLogger() {}
void Reset() { has_error_ = false; }
- virtual void LogFunction(int start, int end, int literals, int properties,
+ virtual void LogFunction(int key, int start, int end, int num_parameters,
+ int function_length, bool has_duplicate_parameters,
+ int literals, int properties,
LanguageMode language_mode, bool uses_super_property,
bool calls_eval) {
DCHECK(!has_error_);
// Check that we only log at most one function.
DCHECK(start_ == -1 && end_ == -1);
+ key_ = key;
start_ = start;
end_ = end;
+ num_parameters_ = num_parameters;
+ function_length_ = function_length;
+ has_duplicate_parameters_ = has_duplicate_parameters;
literals_ = literals;
properties_ = properties;
language_mode_ = language_mode;
@@ -110,6 +125,18 @@ class SingletonLogger : public ParserRecorder {
int start() const { return start_; }
int end() const { return end_; }
+ int num_parameters() const {
+ DCHECK(!has_error_);
+ return num_parameters_;
+ }
+ int function_length() const {
+ DCHECK(!has_error_);
+ return function_length_;
+ }
+ bool has_duplicate_parameters() const {
+ DCHECK(!has_error_);
+ return has_duplicate_parameters_;
+ }
int literals() const {
DCHECK(!has_error_);
return literals_;
@@ -145,9 +172,13 @@ class SingletonLogger : public ParserRecorder {
private:
bool has_error_;
+ int key_;
int start_;
int end_;
// For function entries.
+ int num_parameters_;
+ int function_length_;
+ bool has_duplicate_parameters_;
int literals_;
int properties_;
LanguageMode language_mode_;
@@ -170,11 +201,17 @@ class CompleteParserRecorder : public ParserRecorder {
CompleteParserRecorder();
virtual ~CompleteParserRecorder() {}
- virtual void LogFunction(int start, int end, int literals, int properties,
+ virtual void LogFunction(int key, int start, int end, int num_parameters,
+ int function_length, bool has_duplicate_parameters,
+ int literals, int properties,
LanguageMode language_mode, bool uses_super_property,
bool calls_eval) {
+ function_store_.Add(key);
function_store_.Add(start);
function_store_.Add(end);
+ function_store_.Add(num_parameters);
+ function_store_.Add(function_length);
+ function_store_.Add(has_duplicate_parameters);
function_store_.Add(literals);
function_store_.Add(properties);
function_store_.Add(language_mode);
« no previous file with comments | « src/parsing/parser-base.h ('k') | src/parsing/preparse-data-format.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698