| OLD | NEW |
| 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/compiler.h" | 7 #include "src/compiler.h" |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 lit->AllowsLazyCompilationWithoutContext()); | 653 lit->AllowsLazyCompilationWithoutContext()); |
| 654 function_info->set_strict_mode(lit->strict_mode()); | 654 function_info->set_strict_mode(lit->strict_mode()); |
| 655 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); | 655 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); |
| 656 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); | 656 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); |
| 657 function_info->set_ast_node_count(lit->ast_node_count()); | 657 function_info->set_ast_node_count(lit->ast_node_count()); |
| 658 function_info->set_is_function(lit->is_function()); | 658 function_info->set_is_function(lit->is_function()); |
| 659 function_info->set_bailout_reason(lit->dont_optimize_reason()); | 659 function_info->set_bailout_reason(lit->dont_optimize_reason()); |
| 660 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); | 660 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); |
| 661 function_info->set_is_generator(lit->is_generator()); | 661 function_info->set_is_generator(lit->is_generator()); |
| 662 function_info->set_is_arrow(lit->is_arrow()); | 662 function_info->set_is_arrow(lit->is_arrow()); |
| 663 function_info->set_is_concise_method(lit->is_concise_method()); |
| 663 } | 664 } |
| 664 | 665 |
| 665 | 666 |
| 666 static bool CompileUnoptimizedCode(CompilationInfo* info) { | 667 static bool CompileUnoptimizedCode(CompilationInfo* info) { |
| 667 DCHECK(AllowCompilation::IsAllowed(info->isolate())); | 668 DCHECK(AllowCompilation::IsAllowed(info->isolate())); |
| 668 DCHECK(info->function() != NULL); | 669 DCHECK(info->function() != NULL); |
| 669 if (!Rewriter::Rewrite(info)) return false; | 670 if (!Rewriter::Rewrite(info)) return false; |
| 670 if (!Scope::Analyze(info)) return false; | 671 if (!Scope::Analyze(info)) return false; |
| 671 DCHECK(info->scope() != NULL); | 672 DCHECK(info->scope() != NULL); |
| 672 | 673 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 | 870 |
| 870 // Compile the code. | 871 // Compile the code. |
| 871 if (!CompileUnoptimizedCode(info)) { | 872 if (!CompileUnoptimizedCode(info)) { |
| 872 return Handle<SharedFunctionInfo>::null(); | 873 return Handle<SharedFunctionInfo>::null(); |
| 873 } | 874 } |
| 874 | 875 |
| 875 // Allocate function. | 876 // Allocate function. |
| 876 DCHECK(!info->code().is_null()); | 877 DCHECK(!info->code().is_null()); |
| 877 result = isolate->factory()->NewSharedFunctionInfo( | 878 result = isolate->factory()->NewSharedFunctionInfo( |
| 878 lit->name(), lit->materialized_literal_count(), lit->is_generator(), | 879 lit->name(), lit->materialized_literal_count(), lit->is_generator(), |
| 879 lit->is_arrow(), info->code(), | 880 lit->is_arrow(), lit->is_concise_method(), info->code(), |
| 880 ScopeInfo::Create(info->scope(), info->zone()), | 881 ScopeInfo::Create(info->scope(), info->zone()), |
| 881 info->feedback_vector()); | 882 info->feedback_vector()); |
| 882 | 883 |
| 883 DCHECK_EQ(RelocInfo::kNoPosition, lit->function_token_position()); | 884 DCHECK_EQ(RelocInfo::kNoPosition, lit->function_token_position()); |
| 884 SetFunctionInfo(result, lit, true, script); | 885 SetFunctionInfo(result, lit, true, script); |
| 885 | 886 |
| 886 Handle<String> script_name = script->name()->IsString() | 887 Handle<String> script_name = script->name()->IsString() |
| 887 ? Handle<String>(String::cast(script->name())) | 888 ? Handle<String>(String::cast(script->name())) |
| 888 : isolate->factory()->empty_string(); | 889 : isolate->factory()->empty_string(); |
| 889 Logger::LogEventsAndTags log_tag = info->is_eval() | 890 Logger::LogEventsAndTags log_tag = info->is_eval() |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 } else if (FullCodeGenerator::MakeCode(&info)) { | 1093 } else if (FullCodeGenerator::MakeCode(&info)) { |
| 1093 DCHECK(!info.code().is_null()); | 1094 DCHECK(!info.code().is_null()); |
| 1094 scope_info = ScopeInfo::Create(info.scope(), info.zone()); | 1095 scope_info = ScopeInfo::Create(info.scope(), info.zone()); |
| 1095 } else { | 1096 } else { |
| 1096 return Handle<SharedFunctionInfo>::null(); | 1097 return Handle<SharedFunctionInfo>::null(); |
| 1097 } | 1098 } |
| 1098 | 1099 |
| 1099 // Create a shared function info object. | 1100 // Create a shared function info object. |
| 1100 Handle<SharedFunctionInfo> result = factory->NewSharedFunctionInfo( | 1101 Handle<SharedFunctionInfo> result = factory->NewSharedFunctionInfo( |
| 1101 literal->name(), literal->materialized_literal_count(), | 1102 literal->name(), literal->materialized_literal_count(), |
| 1102 literal->is_generator(), literal->is_arrow(), info.code(), scope_info, | 1103 literal->is_generator(), literal->is_arrow(), |
| 1104 literal->is_concise_method(), info.code(), scope_info, |
| 1103 info.feedback_vector()); | 1105 info.feedback_vector()); |
| 1104 SetFunctionInfo(result, literal, false, script); | 1106 SetFunctionInfo(result, literal, false, script); |
| 1105 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); | 1107 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); |
| 1106 result->set_allows_lazy_compilation(allow_lazy); | 1108 result->set_allows_lazy_compilation(allow_lazy); |
| 1107 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); | 1109 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); |
| 1108 | 1110 |
| 1109 // Set the expected number of properties for instances and return | 1111 // Set the expected number of properties for instances and return |
| 1110 // the resulting function. | 1112 // the resulting function. |
| 1111 SetExpectedNofPropertiesFromEstimate(result, | 1113 SetExpectedNofPropertiesFromEstimate(result, |
| 1112 literal->expected_property_count()); | 1114 literal->expected_property_count()); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 AllowHandleDereference allow_deref; | 1382 AllowHandleDereference allow_deref; |
| 1381 bool tracing_on = info()->IsStub() | 1383 bool tracing_on = info()->IsStub() |
| 1382 ? FLAG_trace_hydrogen_stubs | 1384 ? FLAG_trace_hydrogen_stubs |
| 1383 : (FLAG_trace_hydrogen && | 1385 : (FLAG_trace_hydrogen && |
| 1384 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1386 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1385 return (tracing_on && | 1387 return (tracing_on && |
| 1386 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1388 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1387 } | 1389 } |
| 1388 | 1390 |
| 1389 } } // namespace v8::internal | 1391 } } // namespace v8::internal |
| OLD | NEW |