| 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(info->function() != NULL); | 635 ASSERT(info->function() != NULL); |
| 635 if (!Rewriter::Rewrite(info)) return false; | 636 if (!Rewriter::Rewrite(info)) return false; |
| 636 if (!Scope::Analyze(info)) return false; | 637 if (!Scope::Analyze(info)) return false; |
| 637 ASSERT(info->scope() != NULL); | 638 ASSERT(info->scope() != NULL); |
| 638 | 639 |
| 639 if (!FullCodeGenerator::MakeCode(info)) { | 640 if (!FullCodeGenerator::MakeCode(info)) { |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 HistogramTimerScope timer(rate); | 833 HistogramTimerScope timer(rate); |
| 833 | 834 |
| 834 // Compile the code. | 835 // Compile the code. |
| 835 if (!CompileUnoptimizedCode(info)) { | 836 if (!CompileUnoptimizedCode(info)) { |
| 836 return Handle<SharedFunctionInfo>::null(); | 837 return Handle<SharedFunctionInfo>::null(); |
| 837 } | 838 } |
| 838 | 839 |
| 839 // Allocate function. | 840 // Allocate function. |
| 840 ASSERT(!info->code().is_null()); | 841 ASSERT(!info->code().is_null()); |
| 841 result = isolate->factory()->NewSharedFunctionInfo( | 842 result = isolate->factory()->NewSharedFunctionInfo( |
| 842 lit->name(), | 843 lit->name(), lit->materialized_literal_count(), lit->is_generator(), |
| 843 lit->materialized_literal_count(), | 844 lit->is_arrow(), info->code(), |
| 844 lit->is_generator(), | |
| 845 info->code(), | |
| 846 ScopeInfo::Create(info->scope(), info->zone()), | 845 ScopeInfo::Create(info->scope(), info->zone()), |
| 847 info->feedback_vector()); | 846 info->feedback_vector()); |
| 848 | 847 |
| 849 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); | 848 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); |
| 850 SetFunctionInfo(result, lit, true, script); | 849 SetFunctionInfo(result, lit, true, script); |
| 851 | 850 |
| 852 Handle<String> script_name = script->name()->IsString() | 851 Handle<String> script_name = script->name()->IsString() |
| 853 ? Handle<String>(String::cast(script->name())) | 852 ? Handle<String>(String::cast(script->name())) |
| 854 : isolate->factory()->empty_string(); | 853 : isolate->factory()->empty_string(); |
| 855 Logger::LogEventsAndTags log_tag = info->is_eval() | 854 Logger::LogEventsAndTags log_tag = info->is_eval() |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 info.SetCode(code); | 1043 info.SetCode(code); |
| 1045 scope_info = Handle<ScopeInfo>(ScopeInfo::Empty(isolate)); | 1044 scope_info = Handle<ScopeInfo>(ScopeInfo::Empty(isolate)); |
| 1046 } else if (FullCodeGenerator::MakeCode(&info)) { | 1045 } else if (FullCodeGenerator::MakeCode(&info)) { |
| 1047 ASSERT(!info.code().is_null()); | 1046 ASSERT(!info.code().is_null()); |
| 1048 scope_info = ScopeInfo::Create(info.scope(), info.zone()); | 1047 scope_info = ScopeInfo::Create(info.scope(), info.zone()); |
| 1049 } else { | 1048 } else { |
| 1050 return Handle<SharedFunctionInfo>::null(); | 1049 return Handle<SharedFunctionInfo>::null(); |
| 1051 } | 1050 } |
| 1052 | 1051 |
| 1053 // Create a shared function info object. | 1052 // Create a shared function info object. |
| 1054 Handle<SharedFunctionInfo> result = | 1053 Handle<SharedFunctionInfo> result = factory->NewSharedFunctionInfo( |
| 1055 factory->NewSharedFunctionInfo(literal->name(), | 1054 literal->name(), literal->materialized_literal_count(), |
| 1056 literal->materialized_literal_count(), | 1055 literal->is_generator(), literal->is_arrow(), info.code(), scope_info, |
| 1057 literal->is_generator(), | 1056 info.feedback_vector()); |
| 1058 info.code(), | |
| 1059 scope_info, | |
| 1060 info.feedback_vector()); | |
| 1061 SetFunctionInfo(result, literal, false, script); | 1057 SetFunctionInfo(result, literal, false, script); |
| 1062 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); | 1058 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); |
| 1063 result->set_allows_lazy_compilation(allow_lazy); | 1059 result->set_allows_lazy_compilation(allow_lazy); |
| 1064 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); | 1060 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); |
| 1065 | 1061 |
| 1066 // Set the expected number of properties for instances and return | 1062 // Set the expected number of properties for instances and return |
| 1067 // the resulting function. | 1063 // the resulting function. |
| 1068 SetExpectedNofPropertiesFromEstimate(result, | 1064 SetExpectedNofPropertiesFromEstimate(result, |
| 1069 literal->expected_property_count()); | 1065 literal->expected_property_count()); |
| 1070 live_edit_tracker.RecordFunctionInfo(result, literal, info.zone()); | 1066 live_edit_tracker.RecordFunctionInfo(result, literal, info.zone()); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 AllowHandleDereference allow_deref; | 1332 AllowHandleDereference allow_deref; |
| 1337 bool tracing_on = info()->IsStub() | 1333 bool tracing_on = info()->IsStub() |
| 1338 ? FLAG_trace_hydrogen_stubs | 1334 ? FLAG_trace_hydrogen_stubs |
| 1339 : (FLAG_trace_hydrogen && | 1335 : (FLAG_trace_hydrogen && |
| 1340 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1336 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1341 return (tracing_on && | 1337 return (tracing_on && |
| 1342 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1338 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1343 } | 1339 } |
| 1344 | 1340 |
| 1345 } } // namespace v8::internal | 1341 } } // namespace v8::internal |
| OLD | NEW |