| 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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 function_state.expected_property_count(), | 677 function_state.expected_property_count(), |
| 678 function_state.handler_count(), | 678 function_state.handler_count(), |
| 679 0, | 679 0, |
| 680 FunctionLiteral::kNoDuplicateParameters, | 680 FunctionLiteral::kNoDuplicateParameters, |
| 681 FunctionLiteral::ANONYMOUS_EXPRESSION, | 681 FunctionLiteral::ANONYMOUS_EXPRESSION, |
| 682 FunctionLiteral::kGlobalOrEval, | 682 FunctionLiteral::kGlobalOrEval, |
| 683 FunctionLiteral::kNotParenthesized, | 683 FunctionLiteral::kNotParenthesized, |
| 684 FunctionLiteral::kNotGenerator, | 684 FunctionLiteral::kNotGenerator, |
| 685 0); | 685 0); |
| 686 result->set_ast_properties(factory()->visitor()->ast_properties()); | 686 result->set_ast_properties(factory()->visitor()->ast_properties()); |
| 687 result->set_slot_processor(factory()->visitor()->slot_processor()); |
| 687 result->set_dont_optimize_reason( | 688 result->set_dont_optimize_reason( |
| 688 factory()->visitor()->dont_optimize_reason()); | 689 factory()->visitor()->dont_optimize_reason()); |
| 689 } else if (stack_overflow()) { | 690 } else if (stack_overflow()) { |
| 690 isolate()->StackOverflow(); | 691 isolate()->StackOverflow(); |
| 691 } | 692 } |
| 692 } | 693 } |
| 693 | 694 |
| 694 // Make sure the target stack is empty. | 695 // Make sure the target stack is empty. |
| 695 ASSERT(target_stack_ == NULL); | 696 ASSERT(target_stack_ == NULL); |
| 696 | 697 |
| (...skipping 3375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4072 int expected_property_count = -1; | 4073 int expected_property_count = -1; |
| 4073 int handler_count = 0; | 4074 int handler_count = 0; |
| 4074 FunctionLiteral::ParameterFlag duplicate_parameters = | 4075 FunctionLiteral::ParameterFlag duplicate_parameters = |
| 4075 FunctionLiteral::kNoDuplicateParameters; | 4076 FunctionLiteral::kNoDuplicateParameters; |
| 4076 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_ | 4077 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_ |
| 4077 ? FunctionLiteral::kIsParenthesized | 4078 ? FunctionLiteral::kIsParenthesized |
| 4078 : FunctionLiteral::kNotParenthesized; | 4079 : FunctionLiteral::kNotParenthesized; |
| 4079 FunctionLiteral::IsGeneratorFlag generator = is_generator | 4080 FunctionLiteral::IsGeneratorFlag generator = is_generator |
| 4080 ? FunctionLiteral::kIsGenerator | 4081 ? FunctionLiteral::kIsGenerator |
| 4081 : FunctionLiteral::kNotGenerator; | 4082 : FunctionLiteral::kNotGenerator; |
| 4083 DeferredFeedbackSlotProcessor* slot_processor; |
| 4082 AstProperties ast_properties; | 4084 AstProperties ast_properties; |
| 4083 BailoutReason dont_optimize_reason = kNoReason; | 4085 BailoutReason dont_optimize_reason = kNoReason; |
| 4084 // Parse function body. | 4086 // Parse function body. |
| 4085 { FunctionState function_state(this, scope); | 4087 { FunctionState function_state(this, scope); |
| 4086 top_scope_->SetScopeName(function_name); | 4088 top_scope_->SetScopeName(function_name); |
| 4087 | 4089 |
| 4088 if (is_generator) { | 4090 if (is_generator) { |
| 4089 // For generators, allocating variables in contexts is currently a win | 4091 // For generators, allocating variables in contexts is currently a win |
| 4090 // because it minimizes the work needed to suspend and resume an | 4092 // because it minimizes the work needed to suspend and resume an |
| 4091 // activation. | 4093 // activation. |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4330 ReportMessageAt(reserved_loc, "strict_reserved_word", | 4332 ReportMessageAt(reserved_loc, "strict_reserved_word", |
| 4331 Vector<const char*>::empty()); | 4333 Vector<const char*>::empty()); |
| 4332 *ok = false; | 4334 *ok = false; |
| 4333 return NULL; | 4335 return NULL; |
| 4334 } | 4336 } |
| 4335 CheckOctalLiteral(scope->start_position(), | 4337 CheckOctalLiteral(scope->start_position(), |
| 4336 scope->end_position(), | 4338 scope->end_position(), |
| 4337 CHECK_OK); | 4339 CHECK_OK); |
| 4338 } | 4340 } |
| 4339 ast_properties = *factory()->visitor()->ast_properties(); | 4341 ast_properties = *factory()->visitor()->ast_properties(); |
| 4342 slot_processor = factory()->visitor()->slot_processor(); |
| 4340 dont_optimize_reason = factory()->visitor()->dont_optimize_reason(); | 4343 dont_optimize_reason = factory()->visitor()->dont_optimize_reason(); |
| 4341 } | 4344 } |
| 4342 | 4345 |
| 4343 if (is_extended_mode()) { | 4346 if (is_extended_mode()) { |
| 4344 CheckConflictingVarDeclarations(scope, CHECK_OK); | 4347 CheckConflictingVarDeclarations(scope, CHECK_OK); |
| 4345 } | 4348 } |
| 4346 | 4349 |
| 4347 FunctionLiteral* function_literal = | 4350 FunctionLiteral* function_literal = |
| 4348 factory()->NewFunctionLiteral(function_name, | 4351 factory()->NewFunctionLiteral(function_name, |
| 4349 scope, | 4352 scope, |
| 4350 body, | 4353 body, |
| 4351 materialized_literal_count, | 4354 materialized_literal_count, |
| 4352 expected_property_count, | 4355 expected_property_count, |
| 4353 handler_count, | 4356 handler_count, |
| 4354 num_parameters, | 4357 num_parameters, |
| 4355 duplicate_parameters, | 4358 duplicate_parameters, |
| 4356 function_type, | 4359 function_type, |
| 4357 FunctionLiteral::kIsFunction, | 4360 FunctionLiteral::kIsFunction, |
| 4358 parenthesized, | 4361 parenthesized, |
| 4359 generator, | 4362 generator, |
| 4360 pos); | 4363 pos); |
| 4361 function_literal->set_function_token_position(function_token_pos); | 4364 function_literal->set_function_token_position(function_token_pos); |
| 4362 function_literal->set_ast_properties(&ast_properties); | 4365 function_literal->set_ast_properties(&ast_properties); |
| 4366 function_literal->set_slot_processor(slot_processor); |
| 4363 function_literal->set_dont_optimize_reason(dont_optimize_reason); | 4367 function_literal->set_dont_optimize_reason(dont_optimize_reason); |
| 4364 | 4368 |
| 4365 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal); | 4369 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal); |
| 4366 return function_literal; | 4370 return function_literal; |
| 4367 } | 4371 } |
| 4368 | 4372 |
| 4369 | 4373 |
| 4370 PreParser::PreParseResult Parser::LazyParseFunctionLiteral( | 4374 PreParser::PreParseResult Parser::LazyParseFunctionLiteral( |
| 4371 SingletonLogger* logger) { | 4375 SingletonLogger* logger) { |
| 4372 HistogramTimerScope preparse_scope(isolate()->counters()->pre_parse()); | 4376 HistogramTimerScope preparse_scope(isolate()->counters()->pre_parse()); |
| (...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5684 ASSERT(info()->isolate()->has_pending_exception()); | 5688 ASSERT(info()->isolate()->has_pending_exception()); |
| 5685 } else { | 5689 } else { |
| 5686 result = ParseProgram(); | 5690 result = ParseProgram(); |
| 5687 } | 5691 } |
| 5688 } | 5692 } |
| 5689 info()->SetFunction(result); | 5693 info()->SetFunction(result); |
| 5690 return (result != NULL); | 5694 return (result != NULL); |
| 5691 } | 5695 } |
| 5692 | 5696 |
| 5693 } } // namespace v8::internal | 5697 } } // namespace v8::internal |
| OLD | NEW |