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

Side by Side Diff: src/parser.h

Issue 181543002: Eliminate extended mode, and other modes clean-up (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/objects-inl.h ('k') | src/parser.cc » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 template <typename T> class ZoneListWrapper; 47 template <typename T> class ZoneListWrapper;
48 48
49 49
50 class FunctionEntry BASE_EMBEDDED { 50 class FunctionEntry BASE_EMBEDDED {
51 public: 51 public:
52 enum { 52 enum {
53 kStartPositionIndex, 53 kStartPositionIndex,
54 kEndPositionIndex, 54 kEndPositionIndex,
55 kLiteralCountIndex, 55 kLiteralCountIndex,
56 kPropertyCountIndex, 56 kPropertyCountIndex,
57 kLanguageModeIndex, 57 kStrictModeIndex,
58 kSize 58 kSize
59 }; 59 };
60 60
61 explicit FunctionEntry(Vector<unsigned> backing) 61 explicit FunctionEntry(Vector<unsigned> backing)
62 : backing_(backing) { } 62 : backing_(backing) { }
63 63
64 FunctionEntry() : backing_() { } 64 FunctionEntry() : backing_() { }
65 65
66 int start_pos() { return backing_[kStartPositionIndex]; } 66 int start_pos() { return backing_[kStartPositionIndex]; }
67 int end_pos() { return backing_[kEndPositionIndex]; } 67 int end_pos() { return backing_[kEndPositionIndex]; }
68 int literal_count() { return backing_[kLiteralCountIndex]; } 68 int literal_count() { return backing_[kLiteralCountIndex]; }
69 int property_count() { return backing_[kPropertyCountIndex]; } 69 int property_count() { return backing_[kPropertyCountIndex]; }
70 LanguageMode language_mode() { 70 StrictMode strict_mode() {
71 ASSERT(backing_[kLanguageModeIndex] == SLOPPY_MODE || 71 ASSERT(backing_[kStrictModeIndex] == SLOPPY ||
72 backing_[kLanguageModeIndex] == STRICT_MODE || 72 backing_[kStrictModeIndex] == STRICT);
73 backing_[kLanguageModeIndex] == EXTENDED_MODE); 73 return static_cast<StrictMode>(backing_[kStrictModeIndex]);
74 return static_cast<LanguageMode>(backing_[kLanguageModeIndex]);
75 } 74 }
76 75
77 bool is_valid() { return !backing_.is_empty(); } 76 bool is_valid() { return !backing_.is_empty(); }
78 77
79 private: 78 private:
80 Vector<unsigned> backing_; 79 Vector<unsigned> backing_;
81 }; 80 };
82 81
83 82
84 class ScriptDataImpl : public ScriptData { 83 class ScriptDataImpl : public ScriptData {
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 void ReportInvalidPreparseData(Handle<String> name, bool* ok); 570 void ReportInvalidPreparseData(Handle<String> name, bool* ok);
572 571
573 void set_pre_parse_data(ScriptDataImpl *data) { 572 void set_pre_parse_data(ScriptDataImpl *data) {
574 pre_parse_data_ = data; 573 pre_parse_data_ = data;
575 symbol_cache_.Initialize(data ? data->symbol_count() : 0, zone()); 574 symbol_cache_.Initialize(data ? data->symbol_count() : 0, zone());
576 } 575 }
577 576
578 bool inside_with() const { return scope_->inside_with(); } 577 bool inside_with() const { return scope_->inside_with(); }
579 Mode mode() const { return mode_; } 578 Mode mode() const { return mode_; }
580 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; } 579 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; }
581 bool is_extended_mode() {
582 ASSERT(scope_ != NULL);
583 return scope_->is_extended_mode();
584 }
585 Scope* DeclarationScope(VariableMode mode) { 580 Scope* DeclarationScope(VariableMode mode) {
586 return IsLexicalVariableMode(mode) 581 return IsLexicalVariableMode(mode)
587 ? scope_ : scope_->DeclarationScope(); 582 ? scope_ : scope_->DeclarationScope();
588 } 583 }
589 584
590 // All ParseXXX functions take as the last argument an *ok parameter 585 // All ParseXXX functions take as the last argument an *ok parameter
591 // which is set to false if parsing failed; it is unchanged otherwise. 586 // which is set to false if parsing failed; it is unchanged otherwise.
592 // By making the 'exception handling' explicit, we are forced to check 587 // By making the 'exception handling' explicit, we are forced to check
593 // for failure at the call sites. 588 // for failure at the call sites.
594 void* ParseSourceElements(ZoneList<Statement*>* processor, int end_token, 589 void* ParseSourceElements(ZoneList<Statement*>* processor, int end_token,
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 private: 781 private:
787 static const int kLiteralTypeSlot = 0; 782 static const int kLiteralTypeSlot = 0;
788 static const int kElementsSlot = 1; 783 static const int kElementsSlot = 1;
789 784
790 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); 785 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue);
791 }; 786 };
792 787
793 } } // namespace v8::internal 788 } } // namespace v8::internal
794 789
795 #endif // V8_PARSER_H_ 790 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698