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

Side by Side Diff: src/preparser.cc

Issue 13450007: Refactor parser mode configuration for correctness (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 7 years, 8 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/preparser.h ('k') | src/preparser-api.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 PreParser::SourceElements PreParser::ParseSourceElements(int end_token, 172 PreParser::SourceElements PreParser::ParseSourceElements(int end_token,
173 bool* ok) { 173 bool* ok) {
174 // SourceElements :: 174 // SourceElements ::
175 // (Statement)* <end_token> 175 // (Statement)* <end_token>
176 176
177 bool allow_directive_prologue = true; 177 bool allow_directive_prologue = true;
178 while (peek() != end_token) { 178 while (peek() != end_token) {
179 Statement statement = ParseSourceElement(CHECK_OK); 179 Statement statement = ParseSourceElement(CHECK_OK);
180 if (allow_directive_prologue) { 180 if (allow_directive_prologue) {
181 if (statement.IsUseStrictLiteral()) { 181 if (statement.IsUseStrictLiteral()) {
182 set_language_mode(harmony_scoping_ ? 182 set_language_mode(allow_harmony_scoping() ?
183 i::EXTENDED_MODE : i::STRICT_MODE); 183 i::EXTENDED_MODE : i::STRICT_MODE);
184 } else if (!statement.IsStringLiteral()) { 184 } else if (!statement.IsStringLiteral()) {
185 allow_directive_prologue = false; 185 allow_directive_prologue = false;
186 } 186 }
187 } 187 }
188 } 188 }
189 return kUnknownSourceElements; 189 return kUnknownSourceElements;
190 } 190 }
191 191
192 192
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1806 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u)); 1806 backing_store_.Add(static_cast<byte>((ascii_length >> 14) | 0x80u));
1807 } 1807 }
1808 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u)); 1808 backing_store_.Add(static_cast<byte>((ascii_length >> 7) | 0x80u));
1809 } 1809 }
1810 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f)); 1810 backing_store_.Add(static_cast<byte>(ascii_length & 0x7f));
1811 1811
1812 backing_store_.AddBlock(bytes); 1812 backing_store_.AddBlock(bytes);
1813 return backing_store_.EndSequence().start(); 1813 return backing_store_.EndSequence().start();
1814 } 1814 }
1815 } } // v8::preparser 1815 } } // v8::preparser
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | src/preparser-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698