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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "compiler.h" | 7 #include "compiler.h" |
8 | 8 |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 lit->AllowsLazyCompilationWithoutContext()); | 598 lit->AllowsLazyCompilationWithoutContext()); |
599 function_info->set_strict_mode(lit->strict_mode()); | 599 function_info->set_strict_mode(lit->strict_mode()); |
600 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); | 600 function_info->set_uses_arguments(lit->scope()->arguments() != NULL); |
601 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); | 601 function_info->set_has_duplicate_parameters(lit->has_duplicate_parameters()); |
602 function_info->set_ast_node_count(lit->ast_node_count()); | 602 function_info->set_ast_node_count(lit->ast_node_count()); |
603 function_info->set_is_function(lit->is_function()); | 603 function_info->set_is_function(lit->is_function()); |
604 function_info->set_dont_optimize_reason(lit->dont_optimize_reason()); | 604 function_info->set_dont_optimize_reason(lit->dont_optimize_reason()); |
605 function_info->set_dont_inline(lit->flags()->Contains(kDontInline)); | 605 function_info->set_dont_inline(lit->flags()->Contains(kDontInline)); |
606 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); | 606 function_info->set_dont_cache(lit->flags()->Contains(kDontCache)); |
607 function_info->set_is_generator(lit->is_generator()); | 607 function_info->set_is_generator(lit->is_generator()); |
| 608 function_info->set_is_arrow(lit->is_arrow()); |
608 } | 609 } |
609 | 610 |
610 | 611 |
611 static bool CompileUnoptimizedCode(CompilationInfo* info) { | 612 static bool CompileUnoptimizedCode(CompilationInfo* info) { |
612 ASSERT(info->function() != NULL); | 613 ASSERT(info->function() != NULL); |
613 if (!Rewriter::Rewrite(info)) return false; | 614 if (!Rewriter::Rewrite(info)) return false; |
614 if (!Scope::Analyze(info)) return false; | 615 if (!Scope::Analyze(info)) return false; |
615 ASSERT(info->scope() != NULL); | 616 ASSERT(info->scope() != NULL); |
616 | 617 |
617 if (!FullCodeGenerator::MakeCode(info)) { | 618 if (!FullCodeGenerator::MakeCode(info)) { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 if (!CompileUnoptimizedCode(info)) { | 814 if (!CompileUnoptimizedCode(info)) { |
814 return Handle<SharedFunctionInfo>::null(); | 815 return Handle<SharedFunctionInfo>::null(); |
815 } | 816 } |
816 | 817 |
817 // Allocate function. | 818 // Allocate function. |
818 ASSERT(!info->code().is_null()); | 819 ASSERT(!info->code().is_null()); |
819 result = isolate->factory()->NewSharedFunctionInfo( | 820 result = isolate->factory()->NewSharedFunctionInfo( |
820 lit->name(), | 821 lit->name(), |
821 lit->materialized_literal_count(), | 822 lit->materialized_literal_count(), |
822 lit->is_generator(), | 823 lit->is_generator(), |
| 824 lit->is_arrow(), |
823 info->code(), | 825 info->code(), |
824 ScopeInfo::Create(info->scope(), info->zone()), | 826 ScopeInfo::Create(info->scope(), info->zone()), |
825 info->feedback_vector()); | 827 info->feedback_vector()); |
826 | 828 |
827 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); | 829 ASSERT_EQ(RelocInfo::kNoPosition, lit->function_token_position()); |
828 SetFunctionInfo(result, lit, true, script); | 830 SetFunctionInfo(result, lit, true, script); |
829 | 831 |
830 Handle<String> script_name = script->name()->IsString() | 832 Handle<String> script_name = script->name()->IsString() |
831 ? Handle<String>(String::cast(script->name())) | 833 ? Handle<String>(String::cast(script->name())) |
832 : isolate->factory()->empty_string(); | 834 : isolate->factory()->empty_string(); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 scope_info = ScopeInfo::Create(info.scope(), info.zone()); | 1014 scope_info = ScopeInfo::Create(info.scope(), info.zone()); |
1013 } else { | 1015 } else { |
1014 return Handle<SharedFunctionInfo>::null(); | 1016 return Handle<SharedFunctionInfo>::null(); |
1015 } | 1017 } |
1016 | 1018 |
1017 // Create a shared function info object. | 1019 // Create a shared function info object. |
1018 Handle<SharedFunctionInfo> result = | 1020 Handle<SharedFunctionInfo> result = |
1019 factory->NewSharedFunctionInfo(literal->name(), | 1021 factory->NewSharedFunctionInfo(literal->name(), |
1020 literal->materialized_literal_count(), | 1022 literal->materialized_literal_count(), |
1021 literal->is_generator(), | 1023 literal->is_generator(), |
| 1024 literal->is_arrow(), |
1022 info.code(), | 1025 info.code(), |
1023 scope_info, | 1026 scope_info, |
1024 info.feedback_vector()); | 1027 info.feedback_vector()); |
1025 SetFunctionInfo(result, literal, false, script); | 1028 SetFunctionInfo(result, literal, false, script); |
1026 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); | 1029 RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result); |
1027 result->set_allows_lazy_compilation(allow_lazy); | 1030 result->set_allows_lazy_compilation(allow_lazy); |
1028 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); | 1031 result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx); |
1029 | 1032 |
1030 // Set the expected number of properties for instances and return | 1033 // Set the expected number of properties for instances and return |
1031 // the resulting function. | 1034 // the resulting function. |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 AllowHandleDereference allow_deref; | 1299 AllowHandleDereference allow_deref; |
1297 bool tracing_on = info()->IsStub() | 1300 bool tracing_on = info()->IsStub() |
1298 ? FLAG_trace_hydrogen_stubs | 1301 ? FLAG_trace_hydrogen_stubs |
1299 : (FLAG_trace_hydrogen && | 1302 : (FLAG_trace_hydrogen && |
1300 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1303 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1301 return (tracing_on && | 1304 return (tracing_on && |
1302 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1305 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1303 } | 1306 } |
1304 | 1307 |
1305 } } // namespace v8::internal | 1308 } } // namespace v8::internal |
OLD | NEW |