| 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 lit->AllowsLazyCompilationWithoutContext()); | 612 lit->AllowsLazyCompilationWithoutContext()); |
| 613 function_info->set_strict_mode(lit->strict_mode()); | 613 function_info->set_strict_mode(lit->strict_mode()); |
| 614 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); | 614 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); |
| 615 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); | 615 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); |
| 616 function_info->set_ast_node_count(lit->ast_node_count()); | 616 function_info->set_ast_node_count(lit->ast_node_count()); |
| 617 function_info->set_is_function(lit->is_function()); | 617 function_info->set_is_function(lit->is_function()); |
| 618 function_info->set_dont_optimize_reason(lit->dont_optimize_reason()); | 618 function_info->set_dont_optimize_reason(lit->dont_optimize_reason()); |
| 619 function_info->set_dont_inline(lit->flags()->Contains(kDontInline)); | 619 function_info->set_dont_inline(lit->flags()->Contains(kDontInline)); |
| 620 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); | 620 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); |
| 621 function_info->set_is_generator(lit->is_generator()); | 621 function_info->set_is_generator(lit->is_generator()); |
| 622 function_info->set_is_arrow(lit->is_arrow()); |
| 622 } | 623 } |
| 623 | 624 |
| 624 | 625 |
| 625 static bool CompileUnoptimizedCode(CompilationInfo* info) { | 626 static bool CompileUnoptimizedCode(CompilationInfo* info) { |
| 626 ASSERT(info->function() != NULL); | 627 ASSERT(info->function() != NULL); |
| 627 if (!Rewriter::Rewrite(info)) return false; | 628 if (!Rewriter::Rewrite(info)) return false; |
| 628 if (!Scope::Analyze(info)) return false; | 629 if (!Scope::Analyze(info)) return false; |
| 629 ASSERT(info->scope() != NULL); | 630 ASSERT(info->scope() != NULL); |
| 630 | 631 |
| 631 if (!FullCodeGenerator::MakeCode(info)) { | 632 if (!FullCodeGenerator::MakeCode(info)) { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 if (!CompileUnoptimizedCode(info)) { | 830 if (!CompileUnoptimizedCode(info)) { |
| 830 return Handle<SharedFunctionInfo>::null(); | 831 return Handle<SharedFunctionInfo>::null(); |
| 831 } | 832 } |
| 832 | 833 |
| 833 // Allocate function. | 834 // Allocate function. |
| 834 ASSERT(!info->code().is_null()); | 835 ASSERT(!info->code().is_null()); |
| 835 result = isolate->factory()->NewSharedFunctionInfo( | 836 result = isolate->factory()->NewSharedFunctionInfo( |
| 836 lit->name(), | 837 lit->name(), |
| 837 lit->materialized_literal_count(), | 838 lit->materialized_literal_count(), |
| 838 lit->is_generator(), | 839 lit->is_generator(), |
| 840 lit->is_arrow(), |
| 839 info->code(), | 841 info->code(), |
| 840 ScopeInfo::Create(info->scope(), info->zone())); | 842 ScopeInfo::Create(info->scope(), info->zone())); |
| 841 | 843 |
| 842 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); | 844 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); |
| 843 SetFunctionInfo(result, lit, true, script); | 845 SetFunctionInfo(result, lit, true, script); |
| 844 | 846 |
| 845 Handle<String> script_name = script->name()->IsString() | 847 Handle<String> script_name = script->name()->IsString() |
| 846 ? Handle<String>(String::cast(script->name())) | 848 ? Handle<String>(String::cast(script->name())) |
| 847 : isolate->factory()->empty_string(); | 849 : isolate->factory()->empty_string(); |
| 848 Logger::LogEventsAndTags log_tag = info->is_eval() | 850 Logger::LogEventsAndTags log_tag = info->is_eval() |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 scope_info = ScopeInfo::Create(info.scope(), info.zone()); | 1033 scope_info = ScopeInfo::Create(info.scope(), info.zone()); |
| 1032 } else { | 1034 } else { |
| 1033 return Handle<SharedFunctionInfo>::null(); | 1035 return Handle<SharedFunctionInfo>::null(); |
| 1034 } | 1036 } |
| 1035 | 1037 |
| 1036 // Create a shared function info object. | 1038 // Create a shared function info object. |
| 1037 Handle<SharedFunctionInfo> result = | 1039 Handle<SharedFunctionInfo> result = |
| 1038 factory->NewSharedFunctionInfo(literal->name(), | 1040 factory->NewSharedFunctionInfo(literal->name(), |
| 1039 literal->materialized_literal_count(), | 1041 literal->materialized_literal_count(), |
| 1040 literal->is_generator(), | 1042 literal->is_generator(), |
| 1043 literal->is_arrow(), |
| 1041 info.code(), | 1044 info.code(), |
| 1042 scope_info); | 1045 scope_info); |
| 1043 SetFunctionInfo(result, literal, false, script); | 1046 SetFunctionInfo(result, literal, false, script); |
| 1044 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); | 1047 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); |
| 1045 result->set_allows_lazy_compilation(allow_lazy); | 1048 result->set_allows_lazy_compilation(allow_lazy); |
| 1046 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); | 1049 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); |
| 1047 | 1050 |
| 1048 // Set the expected number of properties for instances and return | 1051 // Set the expected number of properties for instances and return |
| 1049 // the resulting function. | 1052 // the resulting function. |
| 1050 SetExpectedNofPropertiesFromEstimate(result, | 1053 SetExpectedNofPropertiesFromEstimate(result, |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 AllowHandleDereference allow_deref; | 1317 AllowHandleDereference allow_deref; |
| 1315 bool tracing_on = info()->IsStub() | 1318 bool tracing_on = info()->IsStub() |
| 1316 ? FLAG_trace_hydrogen_stubs | 1319 ? FLAG_trace_hydrogen_stubs |
| 1317 : (FLAG_trace_hydrogen && | 1320 : (FLAG_trace_hydrogen && |
| 1318 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1321 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
| 1319 return (tracing_on && | 1322 return (tracing_on && |
| 1320 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1323 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
| 1321 } | 1324 } |
| 1322 | 1325 |
| 1323 } } // namespace v8::internal | 1326 } } // namespace v8::internal |
| OLD | NEW |