OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 function_state.materialized_literal_count(), | 680 function_state.materialized_literal_count(), |
681 function_state.expected_property_count(), | 681 function_state.expected_property_count(), |
682 function_state.handler_count(), | 682 function_state.handler_count(), |
683 0, | 683 0, |
684 FunctionLiteral::kNoDuplicateParameters, | 684 FunctionLiteral::kNoDuplicateParameters, |
685 FunctionLiteral::ANONYMOUS_EXPRESSION, | 685 FunctionLiteral::ANONYMOUS_EXPRESSION, |
686 FunctionLiteral::kGlobalOrEval, | 686 FunctionLiteral::kGlobalOrEval, |
687 FunctionLiteral::kNotParenthesized, | 687 FunctionLiteral::kNotParenthesized, |
688 FunctionLiteral::kNotGenerator); | 688 FunctionLiteral::kNotGenerator); |
689 result->set_ast_properties(factory()->visitor()->ast_properties()); | 689 result->set_ast_properties(factory()->visitor()->ast_properties()); |
| 690 result->set_dont_optimize_reason( |
| 691 factory()->visitor()->dont_optimize_reason()); |
690 } else if (stack_overflow_) { | 692 } else if (stack_overflow_) { |
691 isolate()->StackOverflow(); | 693 isolate()->StackOverflow(); |
692 } | 694 } |
693 } | 695 } |
694 | 696 |
695 // Make sure the target stack is empty. | 697 // Make sure the target stack is empty. |
696 ASSERT(target_stack_ == NULL); | 698 ASSERT(target_stack_ == NULL); |
697 | 699 |
698 return result; | 700 return result; |
699 } | 701 } |
(...skipping 3627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4327 int handler_count = 0; | 4329 int handler_count = 0; |
4328 FunctionLiteral::ParameterFlag duplicate_parameters = | 4330 FunctionLiteral::ParameterFlag duplicate_parameters = |
4329 FunctionLiteral::kNoDuplicateParameters; | 4331 FunctionLiteral::kNoDuplicateParameters; |
4330 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_ | 4332 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_ |
4331 ? FunctionLiteral::kIsParenthesized | 4333 ? FunctionLiteral::kIsParenthesized |
4332 : FunctionLiteral::kNotParenthesized; | 4334 : FunctionLiteral::kNotParenthesized; |
4333 FunctionLiteral::IsGeneratorFlag generator = is_generator | 4335 FunctionLiteral::IsGeneratorFlag generator = is_generator |
4334 ? FunctionLiteral::kIsGenerator | 4336 ? FunctionLiteral::kIsGenerator |
4335 : FunctionLiteral::kNotGenerator; | 4337 : FunctionLiteral::kNotGenerator; |
4336 AstProperties ast_properties; | 4338 AstProperties ast_properties; |
| 4339 BailoutReason dont_optimize_reason = kNoReason; |
4337 // Parse function body. | 4340 // Parse function body. |
4338 { FunctionState function_state(this, scope, isolate()); | 4341 { FunctionState function_state(this, scope, isolate()); |
4339 top_scope_->SetScopeName(function_name); | 4342 top_scope_->SetScopeName(function_name); |
4340 | 4343 |
4341 if (is_generator) { | 4344 if (is_generator) { |
4342 // For generators, allocating variables in contexts is currently a win | 4345 // For generators, allocating variables in contexts is currently a win |
4343 // because it minimizes the work needed to suspend and resume an | 4346 // because it minimizes the work needed to suspend and resume an |
4344 // activation. | 4347 // activation. |
4345 top_scope_->ForceContextAllocation(); | 4348 top_scope_->ForceContextAllocation(); |
4346 | 4349 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4586 ReportMessageAt(reserved_loc, "strict_reserved_word", | 4589 ReportMessageAt(reserved_loc, "strict_reserved_word", |
4587 Vector<const char*>::empty()); | 4590 Vector<const char*>::empty()); |
4588 *ok = false; | 4591 *ok = false; |
4589 return NULL; | 4592 return NULL; |
4590 } | 4593 } |
4591 CheckOctalLiteral(scope->start_position(), | 4594 CheckOctalLiteral(scope->start_position(), |
4592 scope->end_position(), | 4595 scope->end_position(), |
4593 CHECK_OK); | 4596 CHECK_OK); |
4594 } | 4597 } |
4595 ast_properties = *factory()->visitor()->ast_properties(); | 4598 ast_properties = *factory()->visitor()->ast_properties(); |
| 4599 dont_optimize_reason = factory()->visitor()->dont_optimize_reason(); |
4596 } | 4600 } |
4597 | 4601 |
4598 if (is_extended_mode()) { | 4602 if (is_extended_mode()) { |
4599 CheckConflictingVarDeclarations(scope, CHECK_OK); | 4603 CheckConflictingVarDeclarations(scope, CHECK_OK); |
4600 } | 4604 } |
4601 | 4605 |
4602 FunctionLiteral* function_literal = | 4606 FunctionLiteral* function_literal = |
4603 factory()->NewFunctionLiteral(function_name, | 4607 factory()->NewFunctionLiteral(function_name, |
4604 scope, | 4608 scope, |
4605 body, | 4609 body, |
4606 materialized_literal_count, | 4610 materialized_literal_count, |
4607 expected_property_count, | 4611 expected_property_count, |
4608 handler_count, | 4612 handler_count, |
4609 num_parameters, | 4613 num_parameters, |
4610 duplicate_parameters, | 4614 duplicate_parameters, |
4611 function_type, | 4615 function_type, |
4612 FunctionLiteral::kIsFunction, | 4616 FunctionLiteral::kIsFunction, |
4613 parenthesized, | 4617 parenthesized, |
4614 generator); | 4618 generator); |
4615 function_literal->set_function_token_position(function_token_position); | 4619 function_literal->set_function_token_position(function_token_position); |
4616 function_literal->set_ast_properties(&ast_properties); | 4620 function_literal->set_ast_properties(&ast_properties); |
| 4621 function_literal->set_dont_optimize_reason(dont_optimize_reason); |
4617 | 4622 |
4618 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal); | 4623 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal); |
4619 return function_literal; | 4624 return function_literal; |
4620 } | 4625 } |
4621 | 4626 |
4622 | 4627 |
4623 preparser::PreParser::PreParseResult Parser::LazyParseFunctionLiteral( | 4628 preparser::PreParser::PreParseResult Parser::LazyParseFunctionLiteral( |
4624 SingletonLogger* logger) { | 4629 SingletonLogger* logger) { |
4625 HistogramTimerScope preparse_scope(isolate()->counters()->pre_parse()); | 4630 HistogramTimerScope preparse_scope(isolate()->counters()->pre_parse()); |
4626 ASSERT_EQ(Token::LBRACE, scanner().current_token()); | 4631 ASSERT_EQ(Token::LBRACE, scanner().current_token()); |
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5971 ASSERT(info()->isolate()->has_pending_exception()); | 5976 ASSERT(info()->isolate()->has_pending_exception()); |
5972 } else { | 5977 } else { |
5973 result = ParseProgram(); | 5978 result = ParseProgram(); |
5974 } | 5979 } |
5975 } | 5980 } |
5976 info()->SetFunction(result); | 5981 info()->SetFunction(result); |
5977 return (result != NULL); | 5982 return (result != NULL); |
5978 } | 5983 } |
5979 | 5984 |
5980 } } // namespace v8::internal | 5985 } } // namespace v8::internal |
OLD | NEW |