| 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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 function_info->set_allows_lazy_compilation_without_context( | 620 function_info->set_allows_lazy_compilation_without_context( |
| 621 lit->AllowsLazyCompilationWithoutContext()); | 621 lit->AllowsLazyCompilationWithoutContext()); |
| 622 function_info->set_strict_mode(lit->strict_mode()); | 622 function_info->set_strict_mode(lit->strict_mode()); |
| 623 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); | 623 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); |
| 624 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); | 624 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); |
| 625 function_info->set_ast_node_count(lit->ast_node_count()); | 625 function_info->set_ast_node_count(lit->ast_node_count()); |
| 626 function_info->set_is_function(lit->is_function()); | 626 function_info->set_is_function(lit->is_function()); |
| 627 function_info->set_bailout_reason(lit->dont_optimize_reason()); | 627 function_info->set_bailout_reason(lit->dont_optimize_reason()); |
| 628 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); | 628 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); |
| 629 function_info->set_is_generator(lit->is_generator()); | 629 function_info->set_is_generator(lit->is_generator()); |
| 630 function_info->set_is_arrow(lit->is_arrow()); |
| 630 } | 631 } |
| 631 | 632 |
| 632 | 633 |
| 633 static bool CompileUnoptimizedCode(CompilationInfo* info) { | 634 static bool CompileUnoptimizedCode(CompilationInfo* info) { |
| 634 ASSERT(AllowCompilation::IsAllowed(info->isolate())); | 635 ASSERT(AllowCompilation::IsAllowed(info->isolate())); |
| 635 ASSERT(info->function() != NULL); | 636 ASSERT(info->function() != NULL); |
| 636 if (!Rewriter::Rewrite(info)) return false; | 637 if (!Rewriter::Rewrite(info)) return false; |
| 637 if (!Scope::Analyze(info)) return false; | 638 if (!Scope::Analyze(info)) return false; |
| 638 ASSERT(info->scope() != NULL); | 639 ASSERT(info->scope() != NULL); |
| 639 | 640 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 HistogramTimerScope timer(rate); | 836 HistogramTimerScope timer(rate); |
| 836 | 837 |
| 837 // Compile the code. | 838 // Compile the code. |
| 838 if (!CompileUnoptimizedCode(info)) { | 839 if (!CompileUnoptimizedCode(info)) { |
| 839 return Handle<SharedFunctionInfo>::null(); | 840 return Handle<SharedFunctionInfo>::null(); |
| 840 } | 841 } |
| 841 | 842 |
| 842 // Allocate function. | 843 // Allocate function. |
| 843 ASSERT(!info->code().is_null()); | 844 ASSERT(!info->code().is_null()); |
| 844 result = isolate->factory()->NewSharedFunctionInfo( | 845 result = isolate->factory()->NewSharedFunctionInfo( |
| 845 lit->name(), | 846 lit->name(), lit->materialized_literal_count(), lit->is_generator(), |
| 846 lit->materialized_literal_count(), | 847 lit->is_arrow(), info->code(), |
| 847 lit->is_generator(), | |
| 848 info->code(), | |
| 849 ScopeInfo::Create(info->scope(), info->zone()), | 848 ScopeInfo::Create(info->scope(), info->zone()), |
| 850 info->feedback_vector()); | 849 info->feedback_vector()); |
| 851 | 850 |
| 852 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); | 851 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); |
| 853 SetFunctionInfo(result, lit, true, script); | 852 SetFunctionInfo(result, lit, true, script); |
| 854 | 853 |
| 855 Handle<String> script_name = script->name()->IsString() | 854 Handle<String> script_name = script->name()->IsString() |
| 856 ? Handle<String>(String::cast(script->name())) | 855 ? Handle<String>(String::cast(script->name())) |
| 857 : isolate->factory()->empty_string(); | 856 : isolate->factory()->empty_string(); |
| 858 Logger::LogEventsAndTags log_tag = info->is_eval() | 857 Logger::LogEventsAndTags log_tag = info->is_eval() |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 info.SetCode(code); | 1044 info.SetCode(code); |
| 1046 scope_info = Handle<ScopeInfo>(ScopeInfo::Empty(isolate)); | 1045 scope_info = Handle<ScopeInfo>(ScopeInfo::Empty(isolate)); |
| 1047 } else if (FullCodeGenerator::MakeCode(&info)) { | 1046 } else if (FullCodeGenerator::MakeCode(&info)) { |
| 1048 ASSERT(!info.code().is_null()); | 1047 ASSERT(!info.code().is_null()); |
| 1049 scope_info = ScopeInfo::Create(info.scope(), info.zone()); | 1048 scope_info = ScopeInfo::Create(info.scope(), info.zone()); |
| 1050 } else { | 1049 } else { |
| 1051 return Handle<SharedFunctionInfo>::null(); | 1050 return Handle<SharedFunctionInfo>::null(); |
| 1052 } | 1051 } |
| 1053 | 1052 |
| 1054 // Create a shared function info object. | 1053 // Create a shared function info object. |
| 1055 Handle<SharedFunctionInfo> result = | 1054 Handle<SharedFunctionInfo> result = factory->NewSharedFunctionInfo( |
| 1056 factory->NewSharedFunctionInfo(literal->name(), | 1055 literal->name(), literal->materialized_literal_count(), |
| 1057 literal->materialized_literal_count(), | 1056 literal->is_generator(), literal->is_arrow(), info.code(), scope_info, |
| 1058 literal->is_generator(), | 1057 info.feedback_vector()); |
| 1059 info.code(), | |
| 1060 scope_info, | |
| 1061 info.feedback_vector()); | |
| 1062 SetFunctionInfo(result, literal, false, script); | 1058 SetFunctionInfo(result, literal, false, script); |
| 1063 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); | 1059 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); |
| 1064 result->set_allows_lazy_compilation(allow_lazy); | 1060 result->set_allows_lazy_compilation(allow_lazy); |
| 1065 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); | 1061 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); |
| 1066 | 1062 |
| 1067 // Set the expected number of properties for instances and return | 1063 // Set the expected number of properties for instances and return |
| 1068 // the resulting function. | 1064 // the resulting function. |
| 1069 SetExpectedNofPropertiesFromEstimate(result, | 1065 SetExpectedNofPropertiesFromEstimate(result, |
| 1070 literal->expected_property_count()); | 1066 literal->expected_property_count()); |
| 1071 live_edit_tracker.RecordFunctionInfo(result, literal, info.zone()); | 1067 live_edit_tracker.RecordFunctionInfo(result, literal, info.zone()); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 AllowHandleDereference allow_deref; | 1331 AllowHandleDereference allow_deref; |
| 1336 bool tracing_on = info()->IsStub() | 1332 bool tracing_on = info()->IsStub() |
| 1337 ? FLAG_trace_hydrogen_stubs | 1333 ? FLAG_trace_hydrogen_stubs |
| 1338 : (FLAG_trace_hydrogen && | 1334 : (FLAG_trace_hydrogen && |
| 1339 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1335 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1340 return (tracing_on && | 1336 return (tracing_on && |
| 1341 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1337 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1342 } | 1338 } |
| 1343 | 1339 |
| 1344 } } // namespace v8::internal | 1340 } } // namespace v8::internal |
| OLD | NEW |