| 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/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 set_allow_harmony_modules(!info->is_native() && FLAG_harmony_modules); | 865 set_allow_harmony_modules(!info->is_native() && FLAG_harmony_modules); |
| 866 set_allow_harmony_arrow_functions(FLAG_harmony_arrow_functions); | 866 set_allow_harmony_arrow_functions(FLAG_harmony_arrow_functions); |
| 867 set_allow_harmony_classes(FLAG_harmony_classes); | 867 set_allow_harmony_classes(FLAG_harmony_classes); |
| 868 set_allow_harmony_object_literals(FLAG_harmony_object_literals); | 868 set_allow_harmony_object_literals(FLAG_harmony_object_literals); |
| 869 set_allow_harmony_sloppy(FLAG_harmony_sloppy); | 869 set_allow_harmony_sloppy(FLAG_harmony_sloppy); |
| 870 set_allow_harmony_unicode(FLAG_harmony_unicode); | 870 set_allow_harmony_unicode(FLAG_harmony_unicode); |
| 871 set_allow_harmony_computed_property_names( | 871 set_allow_harmony_computed_property_names( |
| 872 FLAG_harmony_computed_property_names); | 872 FLAG_harmony_computed_property_names); |
| 873 set_allow_harmony_rest_params(FLAG_harmony_rest_parameters); | 873 set_allow_harmony_rest_params(FLAG_harmony_rest_parameters); |
| 874 set_allow_harmony_spreadcalls(FLAG_harmony_spreadcalls); | 874 set_allow_harmony_spreadcalls(FLAG_harmony_spreadcalls); |
| 875 set_allow_harmony_destructuring(FLAG_harmony_destructuring); |
| 875 set_allow_strong_mode(FLAG_strong_mode); | 876 set_allow_strong_mode(FLAG_strong_mode); |
| 876 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; | 877 for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount; |
| 877 ++feature) { | 878 ++feature) { |
| 878 use_counts_[feature] = 0; | 879 use_counts_[feature] = 0; |
| 879 } | 880 } |
| 880 if (info->ast_value_factory() == NULL) { | 881 if (info->ast_value_factory() == NULL) { |
| 881 // info takes ownership of AstValueFactory. | 882 // info takes ownership of AstValueFactory. |
| 882 info->set_ast_value_factory(new AstValueFactory(zone(), info->hash_seed())); | 883 info->set_ast_value_factory(new AstValueFactory(zone(), info->hash_seed())); |
| 883 info->set_ast_value_factory_owned(); | 884 info->set_ast_value_factory_owned(); |
| 884 ast_value_factory_ = info->ast_value_factory(); | 885 ast_value_factory_ = info->ast_value_factory(); |
| (...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2380 { | 2381 { |
| 2381 ExpressionClassifier pattern_classifier; | 2382 ExpressionClassifier pattern_classifier; |
| 2382 Token::Value next = peek(); | 2383 Token::Value next = peek(); |
| 2383 Expression* pattern = | 2384 Expression* pattern = |
| 2384 ParsePrimaryExpression(&pattern_classifier, CHECK_OK); | 2385 ParsePrimaryExpression(&pattern_classifier, CHECK_OK); |
| 2385 ValidateBindingPattern(&pattern_classifier, CHECK_OK); | 2386 ValidateBindingPattern(&pattern_classifier, CHECK_OK); |
| 2386 if (pattern->IsVariableProxy() && | 2387 if (pattern->IsVariableProxy() && |
| 2387 pattern->AsVariableProxy()->IsValidReferenceExpression()) { | 2388 pattern->AsVariableProxy()->IsValidReferenceExpression()) { |
| 2388 scope_->RemoveUnresolved(pattern->AsVariableProxy()); | 2389 scope_->RemoveUnresolved(pattern->AsVariableProxy()); |
| 2389 name = pattern->AsVariableProxy()->raw_name(); | 2390 name = pattern->AsVariableProxy()->raw_name(); |
| 2391 } else if (allow_harmony_destructuring()) { |
| 2392 // TODO(dslomov): really destructure. |
| 2393 name = ast_value_factory()->GetOneByteString(".temp.variable"); |
| 2390 } else { | 2394 } else { |
| 2391 ReportUnexpectedToken(next); | 2395 ReportUnexpectedToken(next); |
| 2392 *ok = false; | 2396 *ok = false; |
| 2393 return nullptr; | 2397 return nullptr; |
| 2394 } | 2398 } |
| 2395 } | 2399 } |
| 2396 | 2400 |
| 2397 if (!first_name) first_name = name; | 2401 if (!first_name) first_name = name; |
| 2398 Scanner::Location variable_loc = scanner()->location(); | 2402 Scanner::Location variable_loc = scanner()->location(); |
| 2399 if (fni_ != NULL) fni_->PushVariableName(name); | 2403 if (fni_ != NULL) fni_->PushVariableName(name); |
| (...skipping 1928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4328 reusable_preparser_->set_allow_harmony_object_literals( | 4332 reusable_preparser_->set_allow_harmony_object_literals( |
| 4329 allow_harmony_object_literals()); | 4333 allow_harmony_object_literals()); |
| 4330 reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy()); | 4334 reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy()); |
| 4331 reusable_preparser_->set_allow_harmony_unicode(allow_harmony_unicode()); | 4335 reusable_preparser_->set_allow_harmony_unicode(allow_harmony_unicode()); |
| 4332 reusable_preparser_->set_allow_harmony_computed_property_names( | 4336 reusable_preparser_->set_allow_harmony_computed_property_names( |
| 4333 allow_harmony_computed_property_names()); | 4337 allow_harmony_computed_property_names()); |
| 4334 reusable_preparser_->set_allow_harmony_rest_params( | 4338 reusable_preparser_->set_allow_harmony_rest_params( |
| 4335 allow_harmony_rest_params()); | 4339 allow_harmony_rest_params()); |
| 4336 reusable_preparser_->set_allow_harmony_spreadcalls( | 4340 reusable_preparser_->set_allow_harmony_spreadcalls( |
| 4337 allow_harmony_spreadcalls()); | 4341 allow_harmony_spreadcalls()); |
| 4342 reusable_preparser_->set_allow_harmony_destructuring( |
| 4343 allow_harmony_destructuring()); |
| 4338 reusable_preparser_->set_allow_strong_mode(allow_strong_mode()); | 4344 reusable_preparser_->set_allow_strong_mode(allow_strong_mode()); |
| 4339 } | 4345 } |
| 4340 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( | 4346 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( |
| 4341 language_mode(), function_state_->kind(), logger); | 4347 language_mode(), function_state_->kind(), logger); |
| 4342 if (pre_parse_timer_ != NULL) { | 4348 if (pre_parse_timer_ != NULL) { |
| 4343 pre_parse_timer_->Stop(); | 4349 pre_parse_timer_->Stop(); |
| 4344 } | 4350 } |
| 4345 return result; | 4351 return result; |
| 4346 } | 4352 } |
| 4347 | 4353 |
| (...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5839 | 5845 |
| 5840 Expression* Parser::SpreadCallNew(Expression* function, | 5846 Expression* Parser::SpreadCallNew(Expression* function, |
| 5841 ZoneList<v8::internal::Expression*>* args, | 5847 ZoneList<v8::internal::Expression*>* args, |
| 5842 int pos) { | 5848 int pos) { |
| 5843 args->InsertAt(0, function, zone()); | 5849 args->InsertAt(0, function, zone()); |
| 5844 | 5850 |
| 5845 return factory()->NewCallRuntime( | 5851 return factory()->NewCallRuntime( |
| 5846 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5852 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
| 5847 } | 5853 } |
| 5848 } } // namespace v8::internal | 5854 } } // namespace v8::internal |
| OLD | NEW |