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

Side by Side Diff: src/parser.cc

Issue 816913003: Implement ES6 rest parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Disable optimization of functions with rest parameters in parser Created 5 years, 10 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
OLDNEW
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 3842 matching lines...) Expand 10 before | Expand all | Expand 10 after
3853 } 3853 }
3854 } 3854 }
3855 3855
3856 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( 3856 FunctionLiteral* function_literal = factory()->NewFunctionLiteral(
3857 function_name, ast_value_factory(), scope, body, 3857 function_name, ast_value_factory(), scope, body,
3858 materialized_literal_count, expected_property_count, handler_count, 3858 materialized_literal_count, expected_property_count, handler_count,
3859 num_parameters, duplicate_parameters, function_type, 3859 num_parameters, duplicate_parameters, function_type,
3860 FunctionLiteral::kIsFunction, parenthesized, kind, pos); 3860 FunctionLiteral::kIsFunction, parenthesized, kind, pos);
3861 function_literal->set_function_token_position(function_token_pos); 3861 function_literal->set_function_token_position(function_token_pos);
3862 3862
3863 if (scope->has_rest_parameter()) {
3864 // TODO(caitp): enable optimization of functions with rest params
3865 function_literal->set_dont_optimize_reason(kRestParameter);
3866 }
3867
3863 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal); 3868 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal);
3864 return function_literal; 3869 return function_literal;
3865 } 3870 }
3866 3871
3867 3872
3868 void Parser::SkipLazyFunctionBody(const AstRawString* function_name, 3873 void Parser::SkipLazyFunctionBody(const AstRawString* function_name,
3869 int* materialized_literal_count, 3874 int* materialized_literal_count,
3870 int* expected_property_count, 3875 int* expected_property_count,
3871 bool* ok) { 3876 bool* ok) {
3872 if (produce_cached_parse_data()) CHECK(log_); 3877 if (produce_cached_parse_data()) CHECK(log_);
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after
5429 } else { 5434 } else {
5430 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); 5435 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data());
5431 running_hash = StringHasher::ComputeRunningHash(running_hash, data, 5436 running_hash = StringHasher::ComputeRunningHash(running_hash, data,
5432 raw_string->length()); 5437 raw_string->length());
5433 } 5438 }
5434 } 5439 }
5435 5440
5436 return running_hash; 5441 return running_hash;
5437 } 5442 }
5438 } } // namespace v8::internal 5443 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698