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 3626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4326 int handler_count = 0; | 4328 int handler_count = 0; |
4327 FunctionLiteral::ParameterFlag duplicate_parameters = | 4329 FunctionLiteral::ParameterFlag duplicate_parameters = |
4328 FunctionLiteral::kNoDuplicateParameters; | 4330 FunctionLiteral::kNoDuplicateParameters; |
4329 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_ | 4331 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_ |
4330 ? FunctionLiteral::kIsParenthesized | 4332 ? FunctionLiteral::kIsParenthesized |
4331 : FunctionLiteral::kNotParenthesized; | 4333 : FunctionLiteral::kNotParenthesized; |
4332 FunctionLiteral::IsGeneratorFlag generator = is_generator | 4334 FunctionLiteral::IsGeneratorFlag generator = is_generator |
4333 ? FunctionLiteral::kIsGenerator | 4335 ? FunctionLiteral::kIsGenerator |
4334 : FunctionLiteral::kNotGenerator; | 4336 : FunctionLiteral::kNotGenerator; |
4335 AstProperties ast_properties; | 4337 AstProperties ast_properties; |
| 4338 BailoutReason dont_optimize_reason = kNoReason; |
4336 // Parse function body. | 4339 // Parse function body. |
4337 { FunctionState function_state(this, scope, isolate()); | 4340 { FunctionState function_state(this, scope, isolate()); |
4338 top_scope_->SetScopeName(function_name); | 4341 top_scope_->SetScopeName(function_name); |
4339 | 4342 |
4340 if (is_generator) { | 4343 if (is_generator) { |
4341 // For generators, allocating variables in contexts is currently a win | 4344 // For generators, allocating variables in contexts is currently a win |
4342 // because it minimizes the work needed to suspend and resume an | 4345 // because it minimizes the work needed to suspend and resume an |
4343 // activation. | 4346 // activation. |
4344 top_scope_->ForceContextAllocation(); | 4347 top_scope_->ForceContextAllocation(); |
4345 | 4348 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4585 ReportMessageAt(reserved_loc, "strict_reserved_word", | 4588 ReportMessageAt(reserved_loc, "strict_reserved_word", |
4586 Vector<const char*>::empty()); | 4589 Vector<const char*>::empty()); |
4587 *ok = false; | 4590 *ok = false; |
4588 return NULL; | 4591 return NULL; |
4589 } | 4592 } |
4590 CheckOctalLiteral(scope->start_position(), | 4593 CheckOctalLiteral(scope->start_position(), |
4591 scope->end_position(), | 4594 scope->end_position(), |
4592 CHECK_OK); | 4595 CHECK_OK); |
4593 } | 4596 } |
4594 ast_properties = *factory()->visitor()->ast_properties(); | 4597 ast_properties = *factory()->visitor()->ast_properties(); |
| 4598 dont_optimize_reason = factory()->visitor()->dont_optimize_reason(); |
4595 } | 4599 } |
4596 | 4600 |
4597 if (is_extended_mode()) { | 4601 if (is_extended_mode()) { |
4598 CheckConflictingVarDeclarations(scope, CHECK_OK); | 4602 CheckConflictingVarDeclarations(scope, CHECK_OK); |
4599 } | 4603 } |
4600 | 4604 |
4601 FunctionLiteral* function_literal = | 4605 FunctionLiteral* function_literal = |
4602 factory()->NewFunctionLiteral(function_name, | 4606 factory()->NewFunctionLiteral(function_name, |
4603 scope, | 4607 scope, |
4604 body, | 4608 body, |
4605 materialized_literal_count, | 4609 materialized_literal_count, |
4606 expected_property_count, | 4610 expected_property_count, |
4607 handler_count, | 4611 handler_count, |
4608 num_parameters, | 4612 num_parameters, |
4609 duplicate_parameters, | 4613 duplicate_parameters, |
4610 function_type, | 4614 function_type, |
4611 FunctionLiteral::kIsFunction, | 4615 FunctionLiteral::kIsFunction, |
4612 parenthesized, | 4616 parenthesized, |
4613 generator); | 4617 generator); |
4614 function_literal->set_function_token_position(function_token_position); | 4618 function_literal->set_function_token_position(function_token_position); |
4615 function_literal->set_ast_properties(&ast_properties); | 4619 function_literal->set_ast_properties(&ast_properties); |
| 4620 function_literal->set_dont_optimize_reason(dont_optimize_reason); |
4616 | 4621 |
4617 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal); | 4622 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal); |
4618 return function_literal; | 4623 return function_literal; |
4619 } | 4624 } |
4620 | 4625 |
4621 | 4626 |
4622 preparser::PreParser::PreParseResult Parser::LazyParseFunctionLiteral( | 4627 preparser::PreParser::PreParseResult Parser::LazyParseFunctionLiteral( |
4623 SingletonLogger* logger) { | 4628 SingletonLogger* logger) { |
4624 HistogramTimerScope preparse_scope(isolate()->counters()->pre_parse()); | 4629 HistogramTimerScope preparse_scope(isolate()->counters()->pre_parse()); |
4625 ASSERT_EQ(Token::LBRACE, scanner().current_token()); | 4630 ASSERT_EQ(Token::LBRACE, scanner().current_token()); |
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5970 ASSERT(info()->isolate()->has_pending_exception()); | 5975 ASSERT(info()->isolate()->has_pending_exception()); |
5971 } else { | 5976 } else { |
5972 result = ParseProgram(); | 5977 result = ParseProgram(); |
5973 } | 5978 } |
5974 } | 5979 } |
5975 info()->SetFunction(result); | 5980 info()->SetFunction(result); |
5976 return (result != NULL); | 5981 return (result != NULL); |
5977 } | 5982 } |
5978 | 5983 |
5979 } } // namespace v8::internal | 5984 } } // namespace v8::internal |
OLD | NEW |