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

Unified Diff: src/parsing/parser-base.h

Issue 2509143003: Treat a '!' preceding a function literal as eager-compile hint. (Closed)
Patch Set: Created 4 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/parsing/parser.cc ('k') | test/cctest/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index 4fe27e2e5a364a79c103051da3159938b991e21a..59e6afdd220b385645b3e751a2961ca275334ad8 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -460,12 +460,24 @@ class ParserBase {
return next_function_is_parenthesized_;
}
+ bool this_function_is_parenthesized() const {
+ return this_function_is_parenthesized_;
+ }
+
void set_next_function_is_parenthesized(bool parenthesized) {
next_function_is_parenthesized_ = parenthesized;
}
- bool this_function_is_parenthesized() const {
- return this_function_is_parenthesized_;
+ bool next_function_is_exclaimed() const {
+ return next_function_is_exclaimed_;
+ }
+
+ bool this_function_is_exclaimed() const {
+ return this_function_is_exclaimed_;
+ }
+
+ void set_next_function_is_exclaimed(bool exclaimed) {
+ next_function_is_exclaimed_ = exclaimed;
}
private:
@@ -507,12 +519,14 @@ class ParserBase {
ZoneList<typename ExpressionClassifier::Error> reported_errors_;
// If true, the next (and immediately following) function literal is
- // preceded by a parenthesis.
+ // preceded by a parenthesis / exclamation mark.
bool next_function_is_parenthesized_;
+ bool next_function_is_exclaimed_;
- // The value of the parents' next_function_is_parenthesized_, as it applies
+ // The value of the parents' next_function_is_*_, as it applies
// to this function. Filled in by constructor.
bool this_function_is_parenthesized_;
+ bool this_function_is_exclaimed_;
friend Impl;
friend class Checkpoint;
@@ -1464,12 +1478,17 @@ ParserBase<Impl>::FunctionState::FunctionState(
non_patterns_to_rewrite_(0, scope->zone()),
reported_errors_(16, scope->zone()),
next_function_is_parenthesized_(false),
- this_function_is_parenthesized_(false) {
+ next_function_is_exclaimed_(false),
+ this_function_is_parenthesized_(false),
+ this_function_is_exclaimed_(false) {
*function_state_stack = this;
if (outer_function_state_) {
this_function_is_parenthesized_ =
outer_function_state_->next_function_is_parenthesized_;
outer_function_state_->next_function_is_parenthesized_ = false;
+ this_function_is_exclaimed_ =
+ outer_function_state_->next_function_is_exclaimed_;
+ outer_function_state_->next_function_is_exclaimed_ = false;
vogelheim 2016/11/17 12:09:48 self-nitpick: :) All this flag handling is rather
}
}
@@ -2941,6 +2960,11 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseUnaryExpression(
op = Next();
int pos = position();
+
+ // Record occurrence of "! function ..."
+ function_state_->set_next_function_is_exclaimed(op == Token::NOT &&
+ peek() == Token::FUNCTION);
+
ExpressionT expression = ParseUnaryExpression(CHECK_OK);
impl()->RewriteNonPattern(CHECK_OK);
« no previous file with comments | « src/parsing/parser.cc ('k') | test/cctest/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698