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

Unified Diff: src/parsing/parser.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 | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.h
diff --git a/src/parsing/parser.h b/src/parsing/parser.h
index 1762c97c548fb2325a0e40ef680db20e753416e5..1f66431bf637ea0685b8a2a55cdff0f9e8f804ba 100644
--- a/src/parsing/parser.h
+++ b/src/parsing/parser.h
@@ -29,8 +29,12 @@ class ParserTargetScope;
class FunctionEntry BASE_EMBEDDED {
public:
enum {
+ kKeyPositionIndex,
kStartPositionIndex,
kEndPositionIndex,
+ kNumParametersIndex,
+ kFunctionLengthIndex,
+ kHasDuplicateParametersIndex,
kLiteralCountIndex,
kPropertyCountIndex,
kLanguageModeIndex,
@@ -44,18 +48,23 @@ class FunctionEntry BASE_EMBEDDED {
FunctionEntry() : backing_() { }
- int start_pos() { return backing_[kStartPositionIndex]; }
- int end_pos() { return backing_[kEndPositionIndex]; }
- int literal_count() { return backing_[kLiteralCountIndex]; }
- int property_count() { return backing_[kPropertyCountIndex]; }
- LanguageMode language_mode() {
+ int start_pos() const { return backing_[kStartPositionIndex]; }
+ int end_pos() const { return backing_[kEndPositionIndex]; }
+ int num_parameters() const { return backing_[kNumParametersIndex]; }
+ int function_length() const { return backing_[kFunctionLengthIndex]; }
+ bool has_duplicate_parameters() const {
+ return backing_[kHasDuplicateParametersIndex];
+ }
+ int literal_count() const { return backing_[kLiteralCountIndex]; }
+ int property_count() const { return backing_[kPropertyCountIndex]; }
+ LanguageMode language_mode() const {
DCHECK(is_valid_language_mode(backing_[kLanguageModeIndex]));
return static_cast<LanguageMode>(backing_[kLanguageModeIndex]);
}
- bool uses_super_property() { return backing_[kUsesSuperPropertyIndex]; }
- bool calls_eval() { return backing_[kCallsEvalIndex]; }
+ bool uses_super_property() const { return backing_[kUsesSuperPropertyIndex]; }
+ bool calls_eval() const { return backing_[kCallsEvalIndex]; }
- bool is_valid() { return !backing_.is_empty(); }
+ bool is_valid() const { return !backing_.is_empty(); }
private:
Vector<unsigned> backing_;
@@ -491,13 +500,17 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
// by parsing the function with PreParser. Consumes the ending }.
// If may_abort == true, the (pre-)parser may decide to abort skipping
// in order to force the function to be eagerly parsed, after all.
- LazyParsingResult SkipLazyFunctionBody(int* materialized_literal_count,
- int* expected_property_count,
- bool is_inner_function, bool may_abort,
- bool* ok);
-
- PreParser::PreParseResult ParseFunctionBodyWithPreParser(
- SingletonLogger* logger, bool is_inner_function, bool may_abort);
+ LazyParsingResult SkipLazyFunction(
+ FunctionKind kind, DeclarationScope* function_scope, int* num_parameters,
+ int* function_length, bool* has_duplicate_parameters,
+ int* materialized_literal_count, int* expected_property_count,
+ bool is_inner_function, bool may_abort, bool* ok);
+
+ PreParser::PreParseResult ParseFunctionWithPreParser(FunctionKind kind,
+ DeclarationScope* scope,
+ SingletonLogger* logger,
+ bool is_inner_function,
+ bool may_abort);
Block* BuildParameterInitializationBlock(
const ParserFormalParameters& parameters, bool* ok);
@@ -509,6 +522,13 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
const ParserFormalParameters& parameters, FunctionKind kind,
FunctionLiteral::FunctionType function_type, bool* ok);
+ ZoneList<Statement*>* ParseFunctionParametersAndBodyEagerly(
+ const AstRawString* function_name, int pos, FunctionKind kind,
+ FunctionLiteral::FunctionType function_type,
+ DeclarationScope* function_scope, int* num_parameters,
+ int* function_length, bool* has_duplicate_parameters,
+ int* materialized_literal_count, int* expected_property_count, bool* ok);
+
void ThrowPendingError(Isolate* isolate, Handle<Script> script);
class TemplateLiteral : public ZoneObject {
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698