| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #include <cmath> | 5 #include <cmath> |
| 6 | 6 |
| 7 #include "src/allocation.h" | 7 #include "src/allocation.h" |
| 8 #include "src/base/logging.h" | 8 #include "src/base/logging.h" |
| 9 #include "src/conversions-inl.h" | 9 #include "src/conversions-inl.h" |
| 10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 if (directive_prologue) { | 247 if (directive_prologue) { |
| 248 if (statement.IsUseStrictLiteral()) { | 248 if (statement.IsUseStrictLiteral()) { |
| 249 scope_->SetLanguageMode( | 249 scope_->SetLanguageMode( |
| 250 static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); | 250 static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); |
| 251 } else if (statement.IsUseStrongLiteral() && allow_strong_mode()) { | 251 } else if (statement.IsUseStrongLiteral() && allow_strong_mode()) { |
| 252 scope_->SetLanguageMode(static_cast<LanguageMode>( | 252 scope_->SetLanguageMode(static_cast<LanguageMode>( |
| 253 scope_->language_mode() | STRICT_BIT | STRONG_BIT)); | 253 scope_->language_mode() | STRICT_BIT | STRONG_BIT)); |
| 254 } else if (statement.IsUseAsmLiteral()) { |
| 255 scope_->SetAsmMode(ASM_MODULE); |
| 254 } else if (!statement.IsStringLiteral()) { | 256 } else if (!statement.IsStringLiteral()) { |
| 255 directive_prologue = false; | 257 directive_prologue = false; |
| 256 } | 258 } |
| 257 } | 259 } |
| 258 | 260 |
| 259 // If we're allowed to reset to a bookmark, we will do so when we see a long | 261 // If we're allowed to reset to a bookmark, we will do so when we see a long |
| 260 // and trivial function. | 262 // and trivial function. |
| 261 // Our current definition of 'long and trivial' is: | 263 // Our current definition of 'long and trivial' is: |
| 262 // - over 200 statements | 264 // - over 200 statements |
| 263 // - all starting with an identifier (i.e., no if, for, while, etc.) | 265 // - all starting with an identifier (i.e., no if, for, while, etc.) |
| (...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 ParseStatementList(Token::RBRACE, ok, bookmark); | 1101 ParseStatementList(Token::RBRACE, ok, bookmark); |
| 1100 if (!*ok) return; | 1102 if (!*ok) return; |
| 1101 if (bookmark && bookmark->HasBeenReset()) return; | 1103 if (bookmark && bookmark->HasBeenReset()) return; |
| 1102 | 1104 |
| 1103 // Position right after terminal '}'. | 1105 // Position right after terminal '}'. |
| 1104 DCHECK_EQ(Token::RBRACE, scanner()->peek()); | 1106 DCHECK_EQ(Token::RBRACE, scanner()->peek()); |
| 1105 int body_end = scanner()->peek_location().end_pos; | 1107 int body_end = scanner()->peek_location().end_pos; |
| 1106 log_->LogFunction(body_start, body_end, | 1108 log_->LogFunction(body_start, body_end, |
| 1107 function_state_->materialized_literal_count(), | 1109 function_state_->materialized_literal_count(), |
| 1108 function_state_->expected_property_count(), language_mode(), | 1110 function_state_->expected_property_count(), language_mode(), |
| 1109 scope_->uses_super_property(), scope_->calls_eval()); | 1111 asm_mode(), scope_->uses_super_property(), |
| 1112 scope_->calls_eval()); |
| 1110 } | 1113 } |
| 1111 | 1114 |
| 1112 | 1115 |
| 1113 PreParserExpression PreParser::ParseClassLiteral( | 1116 PreParserExpression PreParser::ParseClassLiteral( |
| 1114 PreParserIdentifier name, Scanner::Location class_name_location, | 1117 PreParserIdentifier name, Scanner::Location class_name_location, |
| 1115 bool name_is_strict_reserved, int pos, bool* ok) { | 1118 bool name_is_strict_reserved, int pos, bool* ok) { |
| 1116 // All parts of a ClassDeclaration and ClassExpression are strict code. | 1119 // All parts of a ClassDeclaration and ClassExpression are strict code. |
| 1117 if (name_is_strict_reserved) { | 1120 if (name_is_strict_reserved) { |
| 1118 ReportMessageAt(class_name_location, | 1121 ReportMessageAt(class_name_location, |
| 1119 MessageTemplate::kUnexpectedStrictReserved); | 1122 MessageTemplate::kUnexpectedStrictReserved); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 | 1189 |
| 1187 DCHECK(!spread_pos.IsValid()); | 1190 DCHECK(!spread_pos.IsValid()); |
| 1188 | 1191 |
| 1189 return Expression::Default(); | 1192 return Expression::Default(); |
| 1190 } | 1193 } |
| 1191 | 1194 |
| 1192 #undef CHECK_OK | 1195 #undef CHECK_OK |
| 1193 | 1196 |
| 1194 | 1197 |
| 1195 } } // v8::internal | 1198 } } // v8::internal |
| OLD | NEW |