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/compiler.h" | 5 #include "src/compiler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/ast/ast-numbering.h" | 9 #include "src/ast/ast-numbering.h" |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 PROFILE(info->isolate(), | 737 PROFILE(info->isolate(), |
738 CodeCreateEvent(log_tag, *abstract_code, *shared, info, script_name, | 738 CodeCreateEvent(log_tag, *abstract_code, *shared, info, script_name, |
739 line_num, column_num)); | 739 line_num, column_num)); |
740 } | 740 } |
741 } | 741 } |
742 | 742 |
743 void EnsureFeedbackVector(CompilationInfo* info) { | 743 void EnsureFeedbackVector(CompilationInfo* info) { |
744 if (!info->has_shared_info()) return; | 744 if (!info->has_shared_info()) return; |
745 | 745 |
746 // If no type feedback vector exists, we create one now. At this point the | 746 // If no type feedback vector exists, we create one now. At this point the |
747 // AstNumbering pass has already run. Note the snapshot can contain outdated | 747 // AstNumbering pass has already run. Note that we should reuse any existing |
748 // vectors for a different configuration, hence we also recreate a new vector | 748 // feedback vector rather than creating a new one. |
749 // when the function is not compiled (i.e. no code was serialized). | 749 if (info->shared_info()->feedback_vector()->is_empty()) { |
750 if (info->shared_info()->feedback_vector()->is_empty() || | |
751 !info->shared_info()->is_compiled()) { | |
752 Handle<TypeFeedbackMetadata> feedback_metadata = TypeFeedbackMetadata::New( | 750 Handle<TypeFeedbackMetadata> feedback_metadata = TypeFeedbackMetadata::New( |
753 info->isolate(), info->literal()->feedback_vector_spec()); | 751 info->isolate(), info->literal()->feedback_vector_spec()); |
754 Handle<TypeFeedbackVector> feedback_vector = | 752 Handle<TypeFeedbackVector> feedback_vector = |
755 TypeFeedbackVector::New(info->isolate(), feedback_metadata); | 753 TypeFeedbackVector::New(info->isolate(), feedback_metadata); |
756 info->shared_info()->set_feedback_vector(*feedback_vector); | 754 info->shared_info()->set_feedback_vector(*feedback_vector); |
757 } | 755 } |
758 | 756 |
759 // It's very important that recompiles do not alter the structure of the type | 757 // It's very important that recompiles do not alter the structure of the type |
760 // feedback vector. Verify that the structure fits the function literal. | 758 // feedback vector. Verify that the structure fits the function literal. |
761 CHECK(!info->shared_info()->feedback_vector()->metadata()->SpecDiffersFrom( | 759 CHECK(!info->shared_info()->feedback_vector()->metadata()->SpecDiffersFrom( |
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1900 MaybeHandle<Code> code; | 1898 MaybeHandle<Code> code; |
1901 if (cached.code != nullptr) code = handle(cached.code); | 1899 if (cached.code != nullptr) code = handle(cached.code); |
1902 Handle<Context> native_context(function->context()->native_context()); | 1900 Handle<Context> native_context(function->context()->native_context()); |
1903 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 1901 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
1904 literals, BailoutId::None()); | 1902 literals, BailoutId::None()); |
1905 } | 1903 } |
1906 } | 1904 } |
1907 | 1905 |
1908 } // namespace internal | 1906 } // namespace internal |
1909 } // namespace v8 | 1907 } // namespace v8 |
OLD | NEW |