| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 is_sloppy(function_scope->language_mode()) && formals.is_simple && | 144 is_sloppy(function_scope->language_mode()) && formals.is_simple && |
| 145 !IsConciseMethod(kind); | 145 !IsConciseMethod(kind); |
| 146 ValidateFormalParameters(function_scope->language_mode(), | 146 ValidateFormalParameters(function_scope->language_mode(), |
| 147 allow_duplicate_parameters, | 147 allow_duplicate_parameters, |
| 148 CHECK_OK_VALUE(kPreParseSuccess)); | 148 CHECK_OK_VALUE(kPreParseSuccess)); |
| 149 } | 149 } |
| 150 | 150 |
| 151 if (is_strict(function_scope->language_mode())) { | 151 if (is_strict(function_scope->language_mode())) { |
| 152 int end_pos = scanner()->location().end_pos; | 152 int end_pos = scanner()->location().end_pos; |
| 153 CheckStrictOctalLiteral(function_scope->start_position(), end_pos, ok); | 153 CheckStrictOctalLiteral(function_scope->start_position(), end_pos, ok); |
| 154 CheckDecimalLiteralWithLeadingZero(function_scope->start_position(), | |
| 155 end_pos); | |
| 156 } | 154 } |
| 157 } | 155 } |
| 158 return kPreParseSuccess; | 156 return kPreParseSuccess; |
| 159 } | 157 } |
| 160 | 158 |
| 161 | 159 |
| 162 // Preparsing checks a JavaScript program and emits preparse-data that helps | 160 // Preparsing checks a JavaScript program and emits preparse-data that helps |
| 163 // a later parsing to be faster. | 161 // a later parsing to be faster. |
| 164 // See preparser-data.h for the data. | 162 // See preparser-data.h for the data. |
| 165 | 163 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // function, since the function can declare itself strict. | 208 // function, since the function can declare itself strict. |
| 211 CheckFunctionName(language_mode, function_name, function_name_validity, | 209 CheckFunctionName(language_mode, function_name, function_name_validity, |
| 212 function_name_location, CHECK_OK); | 210 function_name_location, CHECK_OK); |
| 213 const bool allow_duplicate_parameters = | 211 const bool allow_duplicate_parameters = |
| 214 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); | 212 is_sloppy(language_mode) && formals.is_simple && !IsConciseMethod(kind); |
| 215 ValidateFormalParameters(language_mode, allow_duplicate_parameters, CHECK_OK); | 213 ValidateFormalParameters(language_mode, allow_duplicate_parameters, CHECK_OK); |
| 216 | 214 |
| 217 int end_position = scanner()->location().end_pos; | 215 int end_position = scanner()->location().end_pos; |
| 218 if (is_strict(language_mode)) { | 216 if (is_strict(language_mode)) { |
| 219 CheckStrictOctalLiteral(start_position, end_position, CHECK_OK); | 217 CheckStrictOctalLiteral(start_position, end_position, CHECK_OK); |
| 220 CheckDecimalLiteralWithLeadingZero(start_position, end_position); | |
| 221 } | 218 } |
| 222 function_scope->set_end_position(end_position); | 219 function_scope->set_end_position(end_position); |
| 223 | 220 |
| 224 if (FLAG_trace_preparse) { | 221 if (FLAG_trace_preparse) { |
| 225 PrintF(" [%s]: %i-%i\n", | 222 PrintF(" [%s]: %i-%i\n", |
| 226 track_unresolved_variables_ ? "Preparse resolution" | 223 track_unresolved_variables_ ? "Preparse resolution" |
| 227 : "Preparse no-resolution", | 224 : "Preparse no-resolution", |
| 228 function_scope->start_position(), function_scope->end_position()); | 225 function_scope->start_position(), function_scope->end_position()); |
| 229 } | 226 } |
| 230 | 227 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 } | 286 } |
| 290 } | 287 } |
| 291 } | 288 } |
| 292 | 289 |
| 293 #undef CHECK_OK | 290 #undef CHECK_OK |
| 294 #undef CHECK_OK_CUSTOM | 291 #undef CHECK_OK_CUSTOM |
| 295 | 292 |
| 296 | 293 |
| 297 } // namespace internal | 294 } // namespace internal |
| 298 } // namespace v8 | 295 } // namespace v8 |
| OLD | NEW |