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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 lit->AllowsLazyCompilationWithoutContext()); | 608 lit->AllowsLazyCompilationWithoutContext()); |
609 function_info->set_strict_mode(lit->strict_mode()); | 609 function_info->set_strict_mode(lit->strict_mode()); |
610 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); | 610 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); |
611 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); | 611 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); |
612 function_info->set_ast_node_count(lit->ast_node_count()); | 612 function_info->set_ast_node_count(lit->ast_node_count()); |
613 function_info->set_is_function(lit->is_function()); | 613 function_info->set_is_function(lit->is_function()); |
614 function_info->set_dont_optimize_reason(lit->dont_optimize_reason()); | 614 function_info->set_dont_optimize_reason(lit->dont_optimize_reason()); |
615 function_info->set_dont_inline(lit->flags()->Contains(kDontInline)); | 615 function_info->set_dont_inline(lit->flags()->Contains(kDontInline)); |
616 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); | 616 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); |
617 function_info->set_is_generator(lit->is_generator()); | 617 function_info->set_is_generator(lit->is_generator()); |
| 618 function_info->set_is_arrow(lit->is_arrow()); |
618 } | 619 } |
619 | 620 |
620 | 621 |
621 static bool CompileUnoptimizedCode(CompilationInfo* info) { | 622 static bool CompileUnoptimizedCode(CompilationInfo* info) { |
622 ASSERT(info->function() != NULL); | 623 ASSERT(info->function() != NULL); |
623 if (!Rewriter::Rewrite(info)) return false; | 624 if (!Rewriter::Rewrite(info)) return false; |
624 if (!Scope::Analyze(info)) return false; | 625 if (!Scope::Analyze(info)) return false; |
625 ASSERT(info->scope() != NULL); | 626 ASSERT(info->scope() != NULL); |
626 | 627 |
627 if (!FullCodeGenerator::MakeCode(info)) { | 628 if (!FullCodeGenerator::MakeCode(info)) { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 if (!CompileUnoptimizedCode(info)) { | 820 if (!CompileUnoptimizedCode(info)) { |
820 return Handle<SharedFunctionInfo>::null(); | 821 return Handle<SharedFunctionInfo>::null(); |
821 } | 822 } |
822 | 823 |
823 // Allocate function. | 824 // Allocate function. |
824 ASSERT(!info->code().is_null()); | 825 ASSERT(!info->code().is_null()); |
825 result = isolate->factory()->NewSharedFunctionInfo( | 826 result = isolate->factory()->NewSharedFunctionInfo( |
826 lit->name(), | 827 lit->name(), |
827 lit->materialized_literal_count(), | 828 lit->materialized_literal_count(), |
828 lit->is_generator(), | 829 lit->is_generator(), |
| 830 lit->is_arrow(), |
829 info->code(), | 831 info->code(), |
830 ScopeInfo::Create(info->scope(), info->zone())); | 832 ScopeInfo::Create(info->scope(), info->zone())); |
831 | 833 |
832 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); | 834 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); |
833 SetFunctionInfo(result, lit, true, script); | 835 SetFunctionInfo(result, lit, true, script); |
834 | 836 |
835 Handle<String> script_name = script->name()->IsString() | 837 Handle<String> script_name = script->name()->IsString() |
836 ? Handle<String>(String::cast(script->name())) | 838 ? Handle<String>(String::cast(script->name())) |
837 : isolate->factory()->empty_string(); | 839 : isolate->factory()->empty_string(); |
838 Logger::LogEventsAndTags log_tag = info->is_eval() | 840 Logger::LogEventsAndTags log_tag = info->is_eval() |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 scope_info = ScopeInfo::Create(info.scope(), info.zone()); | 1030 scope_info = ScopeInfo::Create(info.scope(), info.zone()); |
1029 } else { | 1031 } else { |
1030 return Handle<SharedFunctionInfo>::null(); | 1032 return Handle<SharedFunctionInfo>::null(); |
1031 } | 1033 } |
1032 | 1034 |
1033 // Create a shared function info object. | 1035 // Create a shared function info object. |
1034 Handle<SharedFunctionInfo> result = | 1036 Handle<SharedFunctionInfo> result = |
1035 factory->NewSharedFunctionInfo(literal->name(), | 1037 factory->NewSharedFunctionInfo(literal->name(), |
1036 literal->materialized_literal_count(), | 1038 literal->materialized_literal_count(), |
1037 literal->is_generator(), | 1039 literal->is_generator(), |
| 1040 literal->is_arrow(), |
1038 info.code(), | 1041 info.code(), |
1039 scope_info); | 1042 scope_info); |
1040 SetFunctionInfo(result, literal, false, script); | 1043 SetFunctionInfo(result, literal, false, script); |
1041 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); | 1044 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); |
1042 result->set_allows_lazy_compilation(allow_lazy); | 1045 result->set_allows_lazy_compilation(allow_lazy); |
1043 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); | 1046 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); |
1044 | 1047 |
1045 // Set the expected number of properties for instances and return | 1048 // Set the expected number of properties for instances and return |
1046 // the resulting function. | 1049 // the resulting function. |
1047 SetExpectedNofPropertiesFromEstimate(result, | 1050 SetExpectedNofPropertiesFromEstimate(result, |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 AllowHandleDereference allow_deref; | 1309 AllowHandleDereference allow_deref; |
1307 bool tracing_on = info()->IsStub() | 1310 bool tracing_on = info()->IsStub() |
1308 ? FLAG_trace_hydrogen_stubs | 1311 ? FLAG_trace_hydrogen_stubs |
1309 : (FLAG_trace_hydrogen && | 1312 : (FLAG_trace_hydrogen && |
1310 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1313 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1311 return (tracing_on && | 1314 return (tracing_on && |
1312 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1315 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1313 } | 1316 } |
1314 | 1317 |
1315 } } // namespace v8::internal | 1318 } } // namespace v8::internal |
OLD | NEW |