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

Side by Side Diff: src/parsing/parser-base.h

Issue 1573363002: [parser cleanup] Unify implementation of CheckPossibleEvalCall (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_PARSING_PARSER_BASE_H 5 #ifndef V8_PARSING_PARSER_BASE_H
6 #define V8_PARSING_PARSER_BASE_H 6 #define V8_PARSING_PARSER_BASE_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/hashmap.h" 10 #include "src/hashmap.h"
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 Traits::IsEvalOrArguments(Traits::AsIdentifier(expression))) { 823 Traits::IsEvalOrArguments(Traits::AsIdentifier(expression))) {
824 return false; 824 return false;
825 } 825 }
826 if (is_strong(language_mode()) && 826 if (is_strong(language_mode()) &&
827 Traits::IsUndefined(Traits::AsIdentifier(expression))) { 827 Traits::IsUndefined(Traits::AsIdentifier(expression))) {
828 return false; 828 return false;
829 } 829 }
830 return true; 830 return true;
831 } 831 }
832 832
833 // Keep track of eval() calls since they disable all local variable
834 // optimizations. This checks if expression is an eval call, and if yes,
835 // forwards the information to scope.
836 void CheckPossibleEvalCall(ExpressionT expression, Scope* scope) {
837 if (Traits::IsIdentifier(expression) &&
838 Traits::IsEval(Traits::AsIdentifier(expression))) {
839 scope->DeclarationScope()->RecordEvalCall();
840 scope->RecordEvalCall();
841 }
842 }
843
833 // Used to validate property names in object literals and class literals 844 // Used to validate property names in object literals and class literals
834 enum PropertyKind { 845 enum PropertyKind {
835 kAccessorProperty, 846 kAccessorProperty,
836 kValueProperty, 847 kValueProperty,
837 kMethodProperty 848 kMethodProperty
838 }; 849 };
839 850
840 class ObjectLiteralCheckerBase { 851 class ObjectLiteralCheckerBase {
841 public: 852 public:
842 explicit ObjectLiteralCheckerBase(ParserBase* parser) : parser_(parser) {} 853 explicit ObjectLiteralCheckerBase(ParserBase* parser) : parser_(parser) {}
(...skipping 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after
3330 return; 3341 return;
3331 } 3342 }
3332 has_seen_constructor_ = true; 3343 has_seen_constructor_ = true;
3333 return; 3344 return;
3334 } 3345 }
3335 } 3346 }
3336 } // namespace internal 3347 } // namespace internal
3337 } // namespace v8 3348 } // namespace v8
3338 3349
3339 #endif // V8_PARSING_PARSER_BASE_H 3350 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698