| OLD | NEW |
| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/ast.h" | 8 #include "src/ast.h" |
| 9 #include "src/ast-literal-reindexer.h" | 9 #include "src/ast-literal-reindexer.h" |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 // previously. If not, parsing has been interrupted due to a stack | 1209 // previously. If not, parsing has been interrupted due to a stack |
| 1210 // overflow, at which point the partially parsed arrow function | 1210 // overflow, at which point the partially parsed arrow function |
| 1211 // concise body happens to be a valid expression. This is a problem | 1211 // concise body happens to be a valid expression. This is a problem |
| 1212 // only for arrow functions with single expression bodies, since there | 1212 // only for arrow functions with single expression bodies, since there |
| 1213 // is no end token such as "}" for normal functions. | 1213 // is no end token such as "}" for normal functions. |
| 1214 if (scanner()->location().end_pos == shared_info->end_position()) { | 1214 if (scanner()->location().end_pos == shared_info->end_position()) { |
| 1215 // The pre-parser saw an arrow function here, so the full parser | 1215 // The pre-parser saw an arrow function here, so the full parser |
| 1216 // must produce a FunctionLiteral. | 1216 // must produce a FunctionLiteral. |
| 1217 DCHECK(expression->IsFunctionLiteral()); | 1217 DCHECK(expression->IsFunctionLiteral()); |
| 1218 result = expression->AsFunctionLiteral(); | 1218 result = expression->AsFunctionLiteral(); |
| 1219 if (scope->has_rest_parameter()) { |
| 1220 // TODO(caitp): enable optimization of functions with rest params |
| 1221 result->set_dont_optimize_reason(kRestParameter); |
| 1222 } |
| 1219 } else { | 1223 } else { |
| 1220 ok = false; | 1224 ok = false; |
| 1221 } | 1225 } |
| 1222 } | 1226 } |
| 1223 } | 1227 } |
| 1224 } else if (shared_info->is_default_constructor()) { | 1228 } else if (shared_info->is_default_constructor()) { |
| 1225 result = DefaultConstructor(IsSubclassConstructor(shared_info->kind()), | 1229 result = DefaultConstructor(IsSubclassConstructor(shared_info->kind()), |
| 1226 scope, shared_info->start_position(), | 1230 scope, shared_info->start_position(), |
| 1227 shared_info->end_position()); | 1231 shared_info->end_position()); |
| 1228 } else { | 1232 } else { |
| (...skipping 4713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5942 Expression* Parser::SpreadCallNew(Expression* function, | 5946 Expression* Parser::SpreadCallNew(Expression* function, |
| 5943 ZoneList<v8::internal::Expression*>* args, | 5947 ZoneList<v8::internal::Expression*>* args, |
| 5944 int pos) { | 5948 int pos) { |
| 5945 args->InsertAt(0, function, zone()); | 5949 args->InsertAt(0, function, zone()); |
| 5946 | 5950 |
| 5947 return factory()->NewCallRuntime( | 5951 return factory()->NewCallRuntime( |
| 5948 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5952 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
| 5949 } | 5953 } |
| 5950 } // namespace internal | 5954 } // namespace internal |
| 5951 } // namespace v8 | 5955 } // namespace v8 |
| OLD | NEW |