| 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 3339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4036 int expected_property_count = -1; | 4037 int expected_property_count = -1; |
| 4037 int handler_count = 0; | 4038 int handler_count = 0; |
| 4038 FunctionLiteral::ParameterFlag duplicate_parameters = | 4039 FunctionLiteral::ParameterFlag duplicate_parameters = |
| 4039 FunctionLiteral::kNoDuplicateParameters; | 4040 FunctionLiteral::kNoDuplicateParameters; |
| 4040 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_ | 4041 FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_ |
| 4041 ? FunctionLiteral::kIsParenthesized | 4042 ? FunctionLiteral::kIsParenthesized |
| 4042 : FunctionLiteral::kNotParenthesized; | 4043 : FunctionLiteral::kNotParenthesized; |
| 4043 FunctionLiteral::IsGeneratorFlag generator = is_generator | 4044 FunctionLiteral::IsGeneratorFlag generator = is_generator |
| 4044 ? FunctionLiteral::kIsGenerator | 4045 ? FunctionLiteral::kIsGenerator |
| 4045 : FunctionLiteral::kNotGenerator; | 4046 : FunctionLiteral::kNotGenerator; |
| 4047 DeferredFeedbackSlotProcessor* slot_processor; |
| 4046 AstProperties ast_properties; | 4048 AstProperties ast_properties; |
| 4047 BailoutReason dont_optimize_reason = kNoReason; | 4049 BailoutReason dont_optimize_reason = kNoReason; |
| 4048 // Parse function body. | 4050 // Parse function body. |
| 4049 { FunctionState function_state(this, scope); | 4051 { FunctionState function_state(this, scope); |
| 4050 top_scope_->SetScopeName(function_name); | 4052 top_scope_->SetScopeName(function_name); |
| 4051 | 4053 |
| 4052 if (is_generator) { | 4054 if (is_generator) { |
| 4053 // For generators, allocating variables in contexts is currently a win | 4055 // For generators, allocating variables in contexts is currently a win |
| 4054 // because it minimizes the work needed to suspend and resume an | 4056 // because it minimizes the work needed to suspend and resume an |
| 4055 // activation. | 4057 // activation. |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4287 ReportMessageAt(reserved_loc, "unexpected_strict_reserved", | 4289 ReportMessageAt(reserved_loc, "unexpected_strict_reserved", |
| 4288 Vector<const char*>::empty()); | 4290 Vector<const char*>::empty()); |
| 4289 *ok = false; | 4291 *ok = false; |
| 4290 return NULL; | 4292 return NULL; |
| 4291 } | 4293 } |
| 4292 CheckOctalLiteral(scope->start_position(), | 4294 CheckOctalLiteral(scope->start_position(), |
| 4293 scope->end_position(), | 4295 scope->end_position(), |
| 4294 CHECK_OK); | 4296 CHECK_OK); |
| 4295 } | 4297 } |
| 4296 ast_properties = *factory()->visitor()->ast_properties(); | 4298 ast_properties = *factory()->visitor()->ast_properties(); |
| 4299 slot_processor = factory()->visitor()->slot_processor(); |
| 4297 dont_optimize_reason = factory()->visitor()->dont_optimize_reason(); | 4300 dont_optimize_reason = factory()->visitor()->dont_optimize_reason(); |
| 4298 } | 4301 } |
| 4299 | 4302 |
| 4300 if (is_extended_mode()) { | 4303 if (is_extended_mode()) { |
| 4301 CheckConflictingVarDeclarations(scope, CHECK_OK); | 4304 CheckConflictingVarDeclarations(scope, CHECK_OK); |
| 4302 } | 4305 } |
| 4303 | 4306 |
| 4304 FunctionLiteral* function_literal = | 4307 FunctionLiteral* function_literal = |
| 4305 factory()->NewFunctionLiteral(function_name, | 4308 factory()->NewFunctionLiteral(function_name, |
| 4306 scope, | 4309 scope, |
| 4307 body, | 4310 body, |
| 4308 materialized_literal_count, | 4311 materialized_literal_count, |
| 4309 expected_property_count, | 4312 expected_property_count, |
| 4310 handler_count, | 4313 handler_count, |
| 4311 num_parameters, | 4314 num_parameters, |
| 4312 duplicate_parameters, | 4315 duplicate_parameters, |
| 4313 function_type, | 4316 function_type, |
| 4314 FunctionLiteral::kIsFunction, | 4317 FunctionLiteral::kIsFunction, |
| 4315 parenthesized, | 4318 parenthesized, |
| 4316 generator, | 4319 generator, |
| 4317 pos); | 4320 pos); |
| 4318 function_literal->set_function_token_position(function_token_pos); | 4321 function_literal->set_function_token_position(function_token_pos); |
| 4319 function_literal->set_ast_properties(&ast_properties); | 4322 function_literal->set_ast_properties(&ast_properties); |
| 4323 function_literal->set_slot_processor(slot_processor); |
| 4320 function_literal->set_dont_optimize_reason(dont_optimize_reason); | 4324 function_literal->set_dont_optimize_reason(dont_optimize_reason); |
| 4321 | 4325 |
| 4322 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal); | 4326 if (fni_ != NULL && should_infer_name) fni_->AddFunction(function_literal); |
| 4323 return function_literal; | 4327 return function_literal; |
| 4324 } | 4328 } |
| 4325 | 4329 |
| 4326 | 4330 |
| 4327 PreParser::PreParseResult Parser::LazyParseFunctionLiteral( | 4331 PreParser::PreParseResult Parser::LazyParseFunctionLiteral( |
| 4328 SingletonLogger* logger) { | 4332 SingletonLogger* logger) { |
| 4329 HistogramTimerScope preparse_scope(isolate()->counters()->pre_parse()); | 4333 HistogramTimerScope preparse_scope(isolate()->counters()->pre_parse()); |
| (...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5689 ASSERT(info()->isolate()->has_pending_exception()); | 5693 ASSERT(info()->isolate()->has_pending_exception()); |
| 5690 } else { | 5694 } else { |
| 5691 result = ParseProgram(); | 5695 result = ParseProgram(); |
| 5692 } | 5696 } |
| 5693 } | 5697 } |
| 5694 info()->SetFunction(result); | 5698 info()->SetFunction(result); |
| 5695 return (result != NULL); | 5699 return (result != NULL); |
| 5696 } | 5700 } |
| 5697 | 5701 |
| 5698 } } // namespace v8::internal | 5702 } } // namespace v8::internal |
| OLD | NEW |