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

Side by Side Diff: src/parser.cc

Issue 668143003: Move BailoutReason and flags computation to post-pass (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased on top of lgtm'd predecessor Created 6 years, 2 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 | Annotate | Revision Log
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 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 if (ok) { 910 if (ok) {
911 result = factory()->NewFunctionLiteral( 911 result = factory()->NewFunctionLiteral(
912 ast_value_factory()->empty_string(), ast_value_factory(), scope_, 912 ast_value_factory()->empty_string(), ast_value_factory(), scope_,
913 body, function_state.materialized_literal_count(), 913 body, function_state.materialized_literal_count(),
914 function_state.expected_property_count(), 914 function_state.expected_property_count(),
915 function_state.handler_count(), 0, 915 function_state.handler_count(), 0,
916 FunctionLiteral::kNoDuplicateParameters, 916 FunctionLiteral::kNoDuplicateParameters,
917 FunctionLiteral::ANONYMOUS_EXPRESSION, FunctionLiteral::kGlobalOrEval, 917 FunctionLiteral::ANONYMOUS_EXPRESSION, FunctionLiteral::kGlobalOrEval,
918 FunctionLiteral::kNotParenthesized, FunctionKind::kNormalFunction, 0); 918 FunctionLiteral::kNotParenthesized, FunctionKind::kNormalFunction, 0);
919 result->set_ast_properties(factory()->visitor()->ast_properties()); 919 result->set_ast_properties(factory()->visitor()->ast_properties());
920 result->set_dont_optimize_reason(
921 factory()->visitor()->dont_optimize_reason());
922 } 920 }
923 } 921 }
924 922
925 // Make sure the target stack is empty. 923 // Make sure the target stack is empty.
926 DCHECK(target_stack_ == NULL); 924 DCHECK(target_stack_ == NULL);
927 925
928 return result; 926 return result;
929 } 927 }
930 928
931 929
(...skipping 2563 matching lines...) Expand 10 before | Expand all | Expand 10 after
3495 ZoneList<Statement*>* body = NULL; 3493 ZoneList<Statement*>* body = NULL;
3496 int materialized_literal_count = -1; 3494 int materialized_literal_count = -1;
3497 int expected_property_count = -1; 3495 int expected_property_count = -1;
3498 int handler_count = 0; 3496 int handler_count = 0;
3499 FunctionLiteral::ParameterFlag duplicate_parameters = 3497 FunctionLiteral::ParameterFlag duplicate_parameters =
3500 FunctionLiteral::kNoDuplicateParameters; 3498 FunctionLiteral::kNoDuplicateParameters;
3501 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_ 3499 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_
3502 ? FunctionLiteral::kIsParenthesized 3500 ? FunctionLiteral::kIsParenthesized
3503 : FunctionLiteral::kNotParenthesized; 3501 : FunctionLiteral::kNotParenthesized;
3504 AstProperties ast_properties; 3502 AstProperties ast_properties;
3505 BailoutReason dont_optimize_reason = kNoReason;
3506 // Parse function body. 3503 // Parse function body.
3507 { 3504 {
3508 AstNodeFactory<AstConstructionVisitor> function_factory( 3505 AstNodeFactory<AstConstructionVisitor> function_factory(
3509 ast_value_factory()); 3506 ast_value_factory());
3510 FunctionState function_state(&function_state_, &scope_, scope, 3507 FunctionState function_state(&function_state_, &scope_, scope,
3511 &function_factory); 3508 &function_factory);
3512 scope_->SetScopeName(function_name); 3509 scope_->SetScopeName(function_name);
3513 3510
3514 if (is_generator) { 3511 if (is_generator) {
3515 // For generators, allocating variables in contexts is currently a win 3512 // For generators, allocating variables in contexts is currently a win
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
3664 dupe_error_loc, 3661 dupe_error_loc,
3665 reserved_loc, 3662 reserved_loc,
3666 CHECK_OK); 3663 CHECK_OK);
3667 } 3664 }
3668 if (strict_mode() == STRICT) { 3665 if (strict_mode() == STRICT) {
3669 CheckOctalLiteral(scope->start_position(), 3666 CheckOctalLiteral(scope->start_position(),
3670 scope->end_position(), 3667 scope->end_position(),
3671 CHECK_OK); 3668 CHECK_OK);
3672 } 3669 }
3673 ast_properties = *factory()->visitor()->ast_properties(); 3670 ast_properties = *factory()->visitor()->ast_properties();
3674 dont_optimize_reason = factory()->visitor()->dont_optimize_reason();
3675 3671
3676 if (allow_harmony_scoping() && strict_mode() == STRICT) { 3672 if (allow_harmony_scoping() && strict_mode() == STRICT) {
3677 CheckConflictingVarDeclarations(scope, CHECK_OK); 3673 CheckConflictingVarDeclarations(scope, CHECK_OK);
3678 } 3674 }
3679 } 3675 }
3680 3676
3681 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( 3677 FunctionLiteral* function_literal = factory()->NewFunctionLiteral(
3682 function_name, ast_value_factory(), scope, body, 3678 function_name, ast_value_factory(), scope, body,
3683 materialized_literal_count, expected_property_count, handler_count, 3679 materialized_literal_count, expected_property_count, handler_count,
3684 num_parameters, duplicate_parameters, function_type, 3680 num_parameters, duplicate_parameters, function_type,
3685 FunctionLiteral::kIsFunction, parenthesized, kind, pos); 3681 FunctionLiteral::kIsFunction, parenthesized, kind, pos);
3686 function_literal->set_function_token_position(function_token_pos); 3682 function_literal->set_function_token_position(function_token_pos);
3687 function_literal->set_ast_properties(&ast_properties); 3683 function_literal->set_ast_properties(&ast_properties);
3688 function_literal->set_dont_optimize_reason(dont_optimize_reason);
3689 3684
3690 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal); 3685 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal);
3691 return function_literal; 3686 return function_literal;
3692 } 3687 }
3693 3688
3694 3689
3695 void Parser::SkipLazyFunctionBody(const AstRawString* function_name, 3690 void Parser::SkipLazyFunctionBody(const AstRawString* function_name,
3696 int* materialized_literal_count, 3691 int* materialized_literal_count,
3697 int* expected_property_count, 3692 int* expected_property_count,
3698 bool* ok) { 3693 bool* ok) {
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
4961 4956
4962 // We cannot internalize on a background thread; a foreground task will take 4957 // We cannot internalize on a background thread; a foreground task will take
4963 // care of calling Parser::Internalize just before compilation. 4958 // care of calling Parser::Internalize just before compilation.
4964 4959
4965 if (compile_options() == ScriptCompiler::kProduceParserCache) { 4960 if (compile_options() == ScriptCompiler::kProduceParserCache) {
4966 if (result != NULL) *info_->cached_data() = recorder.GetScriptData(); 4961 if (result != NULL) *info_->cached_data() = recorder.GetScriptData();
4967 log_ = NULL; 4962 log_ = NULL;
4968 } 4963 }
4969 } 4964 }
4970 } } // namespace v8::internal 4965 } } // namespace v8::internal
OLDNEW
« src/compiler.cc ('K') | « src/compiler.cc ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698