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

Unified Diff: src/parsing/preparser.h

Issue 1702063002: Non-pattern rewriting revisited (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
Index: src/parsing/preparser.h
diff --git a/src/parsing/preparser.h b/src/parsing/preparser.h
index fc187c4c101f4b094fd95a42829a03e10825ba41..22432baca920084ca74038bfb24c1bdef7834c21 100644
--- a/src/parsing/preparser.h
+++ b/src/parsing/preparser.h
@@ -197,8 +197,6 @@ class PreParserExpression {
ExpressionTypeField::decode(code_) == kAssignment;
}
- bool IsRewritableAssignmentExpression() const { return IsAssignment(); }
-
bool IsObjectLiteral() const {
return TypeField::decode(code_) == kObjectLiteralExpression;
}
@@ -487,8 +485,7 @@ class PreParserFactory {
PreParserExpression right, int pos) {
return PreParserExpression::Default();
}
- PreParserExpression NewRewritableAssignmentExpression(
- PreParserExpression expression) {
+ PreParserExpression NewRewritableExpression(PreParserExpression expression) {
return expression;
}
PreParserExpression NewAssignment(Token::Value op,
@@ -589,6 +586,9 @@ class PreParserTraits {
typedef int AstProperties;
+ typedef v8::internal::ExpressionClassifier<PreParserTraits>
+ ExpressionClassifier;
+
// Return types for traversing functions.
typedef PreParserIdentifier Identifier;
typedef PreParserExpression Expression;
@@ -885,7 +885,7 @@ class PreParserTraits {
++parameters->arity;
}
void DeclareFormalParameter(Scope* scope, PreParserIdentifier parameter,
- ExpressionClassifier* classifier) {
+ Type::ExpressionClassifier* classifier) {
if (!classifier->is_simple_parameter_list()) {
scope->SetHasNonSimpleParameters();
}
@@ -924,18 +924,18 @@ class PreParserTraits {
inline void RewriteDestructuringAssignments() {}
inline void QueueDestructuringAssignmentForRewriting(PreParserExpression) {}
+ inline void QueueNonPatternForRewriting(PreParserExpression) {}
void SetFunctionNameFromPropertyName(PreParserExpression,
PreParserIdentifier) {}
void SetFunctionNameFromIdentifierRef(PreParserExpression,
PreParserExpression) {}
- inline PreParserExpression RewriteNonPattern(
- PreParserExpression expr, const ExpressionClassifier* classifier,
- bool* ok);
- inline PreParserExpression RewriteNonPatternObjectLiteralProperty(
- PreParserExpression property, const ExpressionClassifier* classifier,
- bool* ok);
+ inline void RewriteNonPattern(Type::ExpressionClassifier* classifier,
+ bool* ok);
+
+ V8_INLINE Zone* zone() const;
+ V8_INLINE ZoneList<PreParserExpression>* GetNonPatternList() const;
inline PreParserExpression RewriteYieldStar(
PreParserExpression generator, PreParserExpression expr, int pos);
@@ -1121,19 +1121,19 @@ PreParserExpression PreParserTraits::ParseDoExpression(bool* ok) {
}
-PreParserExpression PreParserTraits::RewriteNonPattern(
- PreParserExpression expr, const ExpressionClassifier* classifier,
- bool* ok) {
+void PreParserTraits::RewriteNonPattern(Type::ExpressionClassifier* classifier,
+ bool* ok) {
pre_parser_->ValidateExpression(classifier, ok);
- return expr;
}
-PreParserExpression PreParserTraits::RewriteNonPatternObjectLiteralProperty(
- PreParserExpression property, const ExpressionClassifier* classifier,
- bool* ok) {
- pre_parser_->ValidateExpression(classifier, ok);
- return property;
+Zone* PreParserTraits::zone() const {
+ return pre_parser_->function_state_->scope()->zone();
+}
+
+
+ZoneList<PreParserExpression>* PreParserTraits::GetNonPatternList() const {
+ return pre_parser_->function_state_->non_patterns_to_rewrite();
}

Powered by Google App Engine
This is Rietveld 408576698