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

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

Issue 2198043002: Add a mode to completely deserialize scope chains (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 4 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
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/base/hashmap.h" 10 #include "src/base/hashmap.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 ALLOW_ACCESSORS(harmony_trailing_commas); 247 ALLOW_ACCESSORS(harmony_trailing_commas);
248 SCANNER_ACCESSORS(harmony_exponentiation_operator); 248 SCANNER_ACCESSORS(harmony_exponentiation_operator);
249 249
250 #undef SCANNER_ACCESSORS 250 #undef SCANNER_ACCESSORS
251 #undef ALLOW_ACCESSORS 251 #undef ALLOW_ACCESSORS
252 252
253 uintptr_t stack_limit() const { return stack_limit_; } 253 uintptr_t stack_limit() const { return stack_limit_; }
254 254
255 void set_stack_limit(uintptr_t stack_limit) { stack_limit_ = stack_limit; } 255 void set_stack_limit(uintptr_t stack_limit) { stack_limit_ = stack_limit; }
256 256
257 Scope* NewScriptScope() {
258 return new (zone()) Scope(zone(), nullptr, SCRIPT_SCOPE, kNormalFunction);
259 }
260
257 protected: 261 protected:
258 enum AllowRestrictedIdentifiers { 262 enum AllowRestrictedIdentifiers {
259 kAllowRestrictedIdentifiers, 263 kAllowRestrictedIdentifiers,
260 kDontAllowRestrictedIdentifiers 264 kDontAllowRestrictedIdentifiers
261 }; 265 };
262 266
263 enum Mode { 267 enum Mode {
264 PARSE_LAZILY, 268 PARSE_LAZILY,
265 PARSE_EAGERLY 269 PARSE_EAGERLY
266 }; 270 };
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 } 612 }
609 ~ParsingModeScope() { 613 ~ParsingModeScope() {
610 parser_->mode_ = old_mode_; 614 parser_->mode_ = old_mode_;
611 } 615 }
612 616
613 private: 617 private:
614 ParserBase* parser_; 618 ParserBase* parser_;
615 Mode old_mode_; 619 Mode old_mode_;
616 }; 620 };
617 621
618 Scope* NewScriptScope() {
619 return new (zone()) Scope(zone(), nullptr, SCRIPT_SCOPE, kNormalFunction);
620 }
621
622 Scope* NewScope(ScopeType scope_type) { 622 Scope* NewScope(ScopeType scope_type) {
623 return NewScopeWithParent(scope(), scope_type); 623 return NewScopeWithParent(scope(), scope_type);
624 } 624 }
625 625
626 // This constructor should only be used when absolutely necessary. Most scopes 626 // This constructor should only be used when absolutely necessary. Most scopes
627 // should automatically use scope() as parent, and be fine with 627 // should automatically use scope() as parent, and be fine with
628 // NewScope(ScopeType) above. 628 // NewScope(ScopeType) above.
629 Scope* NewScopeWithParent(Scope* parent, ScopeType scope_type) { 629 Scope* NewScopeWithParent(Scope* parent, ScopeType scope_type) {
630 // Must always use the specific constructors for the blacklisted scope 630 // Must always use the specific constructors for the blacklisted scope
631 // types. 631 // types.
(...skipping 3045 matching lines...) Expand 10 before | Expand all | Expand 10 after
3677 has_seen_constructor_ = true; 3677 has_seen_constructor_ = true;
3678 return; 3678 return;
3679 } 3679 }
3680 } 3680 }
3681 3681
3682 3682
3683 } // namespace internal 3683 } // namespace internal
3684 } // namespace v8 3684 } // namespace v8
3685 3685
3686 #endif // V8_PARSING_PARSER_BASE_H 3686 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« src/parsing/parser.cc ('K') | « src/parsing/parser.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698