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

Side by Side Diff: src/parser.cc

Issue 663373003: Assign bailout and type feedback IDs in a post-pass (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
« no previous file with comments | « src/hydrogen.cc ('k') | src/preparser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 int function_token_position, FunctionLiteral::FunctionType type, 729 int function_token_position, FunctionLiteral::FunctionType type,
730 FunctionLiteral::ArityRestriction arity_restriction, bool* ok) { 730 FunctionLiteral::ArityRestriction arity_restriction, bool* ok) {
731 return parser_->ParseFunctionLiteral( 731 return parser_->ParseFunctionLiteral(
732 name, function_name_location, name_is_strict_reserved, kind, 732 name, function_name_location, name_is_strict_reserved, kind,
733 function_token_position, type, arity_restriction, ok); 733 function_token_position, type, arity_restriction, ok);
734 } 734 }
735 735
736 736
737 Parser::Parser(CompilationInfo* info, ParseInfo* parse_info) 737 Parser::Parser(CompilationInfo* info, ParseInfo* parse_info)
738 : ParserBase<ParserTraits>(&scanner_, parse_info->stack_limit, 738 : ParserBase<ParserTraits>(&scanner_, parse_info->stack_limit,
739 info->extension(), NULL, info->zone(), 739 info->extension(), NULL, info->zone(), this),
740 info->ast_node_id_gen(), this),
741 scanner_(parse_info->unicode_cache), 740 scanner_(parse_info->unicode_cache),
742 reusable_preparser_(NULL), 741 reusable_preparser_(NULL),
743 original_scope_(NULL), 742 original_scope_(NULL),
744 target_stack_(NULL), 743 target_stack_(NULL),
745 cached_parse_data_(NULL), 744 cached_parse_data_(NULL),
746 info_(info), 745 info_(info),
747 has_pending_error_(false), 746 has_pending_error_(false),
748 pending_error_message_(NULL), 747 pending_error_message_(NULL),
749 pending_error_arg_(NULL), 748 pending_error_arg_(NULL),
750 pending_error_char_arg_(NULL), 749 pending_error_char_arg_(NULL),
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 // Compute the parsing mode. 871 // Compute the parsing mode.
873 Mode mode = (FLAG_lazy && allow_lazy()) ? PARSE_LAZILY : PARSE_EAGERLY; 872 Mode mode = (FLAG_lazy && allow_lazy()) ? PARSE_LAZILY : PARSE_EAGERLY;
874 if (allow_natives_syntax() || extension_ != NULL || 873 if (allow_natives_syntax() || extension_ != NULL ||
875 (*scope)->is_eval_scope()) { 874 (*scope)->is_eval_scope()) {
876 mode = PARSE_EAGERLY; 875 mode = PARSE_EAGERLY;
877 } 876 }
878 ParsingModeScope parsing_mode(this, mode); 877 ParsingModeScope parsing_mode(this, mode);
879 878
880 // Enters 'scope'. 879 // Enters 'scope'.
881 AstNodeFactory<AstConstructionVisitor> function_factory( 880 AstNodeFactory<AstConstructionVisitor> function_factory(
882 zone(), ast_value_factory(), info->ast_node_id_gen()); 881 ast_value_factory());
883 FunctionState function_state(&function_state_, &scope_, *scope, 882 FunctionState function_state(&function_state_, &scope_, *scope,
884 &function_factory); 883 &function_factory);
885 884
886 scope_->SetStrictMode(info->strict_mode()); 885 scope_->SetStrictMode(info->strict_mode());
887 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16, zone()); 886 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16, zone());
888 bool ok = true; 887 bool ok = true;
889 int beg_pos = scanner()->location().beg_pos; 888 int beg_pos = scanner()->location().beg_pos;
890 ParseSourceElements(body, Token::EOS, info->is_eval(), true, eval_scope, 889 ParseSourceElements(body, Token::EOS, info->is_eval(), true, eval_scope,
891 &ok); 890 &ok);
892 891
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 { 986 {
988 // Parse the function literal. 987 // Parse the function literal.
989 Scope* scope = NewScope(scope_, GLOBAL_SCOPE); 988 Scope* scope = NewScope(scope_, GLOBAL_SCOPE);
990 info()->SetGlobalScope(scope); 989 info()->SetGlobalScope(scope);
991 if (!info()->closure().is_null()) { 990 if (!info()->closure().is_null()) {
992 scope = Scope::DeserializeScopeChain(info()->closure()->context(), scope, 991 scope = Scope::DeserializeScopeChain(info()->closure()->context(), scope,
993 zone()); 992 zone());
994 } 993 }
995 original_scope_ = scope; 994 original_scope_ = scope;
996 AstNodeFactory<AstConstructionVisitor> function_factory( 995 AstNodeFactory<AstConstructionVisitor> function_factory(
997 zone(), ast_value_factory(), info()->ast_node_id_gen()); 996 ast_value_factory());
998 FunctionState function_state(&function_state_, &scope_, scope, 997 FunctionState function_state(&function_state_, &scope_, scope,
999 &function_factory); 998 &function_factory);
1000 DCHECK(scope->strict_mode() == SLOPPY || info()->strict_mode() == STRICT); 999 DCHECK(scope->strict_mode() == SLOPPY || info()->strict_mode() == STRICT);
1001 DCHECK(info()->strict_mode() == shared_info->strict_mode()); 1000 DCHECK(info()->strict_mode() == shared_info->strict_mode());
1002 scope->SetStrictMode(shared_info->strict_mode()); 1001 scope->SetStrictMode(shared_info->strict_mode());
1003 FunctionLiteral::FunctionType function_type = shared_info->is_expression() 1002 FunctionLiteral::FunctionType function_type = shared_info->is_expression()
1004 ? (shared_info->is_anonymous() 1003 ? (shared_info->is_anonymous()
1005 ? FunctionLiteral::ANONYMOUS_EXPRESSION 1004 ? FunctionLiteral::ANONYMOUS_EXPRESSION
1006 : FunctionLiteral::NAMED_EXPRESSION) 1005 : FunctionLiteral::NAMED_EXPRESSION)
1007 : FunctionLiteral::DECLARATION; 1006 : FunctionLiteral::DECLARATION;
(...skipping 2481 matching lines...) Expand 10 before | Expand all | Expand 10 after
3489 FunctionLiteral::ParameterFlag duplicate_parameters = 3488 FunctionLiteral::ParameterFlag duplicate_parameters =
3490 FunctionLiteral::kNoDuplicateParameters; 3489 FunctionLiteral::kNoDuplicateParameters;
3491 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_ 3490 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_
3492 ? FunctionLiteral::kIsParenthesized 3491 ? FunctionLiteral::kIsParenthesized
3493 : FunctionLiteral::kNotParenthesized; 3492 : FunctionLiteral::kNotParenthesized;
3494 AstProperties ast_properties; 3493 AstProperties ast_properties;
3495 BailoutReason dont_optimize_reason = kNoReason; 3494 BailoutReason dont_optimize_reason = kNoReason;
3496 // Parse function body. 3495 // Parse function body.
3497 { 3496 {
3498 AstNodeFactory<AstConstructionVisitor> function_factory( 3497 AstNodeFactory<AstConstructionVisitor> function_factory(
3499 zone(), ast_value_factory(), info()->ast_node_id_gen()); 3498 ast_value_factory());
3500 FunctionState function_state(&function_state_, &scope_, scope, 3499 FunctionState function_state(&function_state_, &scope_, scope,
3501 &function_factory); 3500 &function_factory);
3502 scope_->SetScopeName(function_name); 3501 scope_->SetScopeName(function_name);
3503 3502
3504 if (is_generator) { 3503 if (is_generator) {
3505 // For generators, allocating variables in contexts is currently a win 3504 // For generators, allocating variables in contexts is currently a win
3506 // because it minimizes the work needed to suspend and resume an 3505 // because it minimizes the work needed to suspend and resume an
3507 // activation. 3506 // activation.
3508 scope_->ForceContextAllocation(); 3507 scope_->ForceContextAllocation();
3509 3508
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after
4951 4950
4952 // We cannot internalize on a background thread; a foreground task will take 4951 // We cannot internalize on a background thread; a foreground task will take
4953 // care of calling Parser::Internalize just before compilation. 4952 // care of calling Parser::Internalize just before compilation.
4954 4953
4955 if (compile_options() == ScriptCompiler::kProduceParserCache) { 4954 if (compile_options() == ScriptCompiler::kProduceParserCache) {
4956 if (result != NULL) *info_->cached_data() = recorder.GetScriptData(); 4955 if (result != NULL) *info_->cached_data() = recorder.GetScriptData();
4957 log_ = NULL; 4956 log_ = NULL;
4958 } 4957 }
4959 } 4958 }
4960 } } // namespace v8::internal 4959 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698