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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 PROFILE(info->isolate(), | 761 PROFILE(info->isolate(), |
762 CodeCreateEvent(log_tag, *abstract_code, *shared, info, script_name, | 762 CodeCreateEvent(log_tag, *abstract_code, *shared, info, script_name, |
763 line_num, column_num)); | 763 line_num, column_num)); |
764 } | 764 } |
765 } | 765 } |
766 | 766 |
767 void EnsureFeedbackVector(CompilationInfo* info) { | 767 void EnsureFeedbackVector(CompilationInfo* info) { |
768 if (!info->has_shared_info()) return; | 768 if (!info->has_shared_info()) return; |
769 | 769 |
770 // If no type feedback vector exists, we create one now. At this point the | 770 // If no type feedback vector exists, we create one now. At this point the |
771 // AstNumbering pass has already run. Note that we should reuse any existing | 771 // AstNumbering pass has already run. Note the snapshot can contain outdated |
772 // feedback vector rather than creating a new one. | 772 // vectors for a different configuration, hence we also recreate a new vector |
773 if (info->shared_info()->feedback_vector()->is_empty()) { | 773 // when the function is not compiled (i.e. no code was serialized). |
| 774 if (info->shared_info()->feedback_vector()->is_empty() || |
| 775 !info->shared_info()->is_compiled()) { |
774 Handle<TypeFeedbackMetadata> feedback_metadata = TypeFeedbackMetadata::New( | 776 Handle<TypeFeedbackMetadata> feedback_metadata = TypeFeedbackMetadata::New( |
775 info->isolate(), info->literal()->feedback_vector_spec()); | 777 info->isolate(), info->literal()->feedback_vector_spec()); |
776 Handle<TypeFeedbackVector> feedback_vector = | 778 Handle<TypeFeedbackVector> feedback_vector = |
777 TypeFeedbackVector::New(info->isolate(), feedback_metadata); | 779 TypeFeedbackVector::New(info->isolate(), feedback_metadata); |
778 info->shared_info()->set_feedback_vector(*feedback_vector); | 780 info->shared_info()->set_feedback_vector(*feedback_vector); |
779 } | 781 } |
780 | 782 |
781 // It's very important that recompiles do not alter the structure of the type | 783 // It's very important that recompiles do not alter the structure of the type |
782 // feedback vector. Verify that the structure fits the function literal. | 784 // feedback vector. Verify that the structure fits the function literal. |
783 CHECK(!info->shared_info()->feedback_vector()->metadata()->SpecDiffersFrom( | 785 CHECK(!info->shared_info()->feedback_vector()->metadata()->SpecDiffersFrom( |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1951 MaybeHandle<Code> code; | 1953 MaybeHandle<Code> code; |
1952 if (cached.code != nullptr) code = handle(cached.code); | 1954 if (cached.code != nullptr) code = handle(cached.code); |
1953 Handle<Context> native_context(function->context()->native_context()); | 1955 Handle<Context> native_context(function->context()->native_context()); |
1954 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 1956 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
1955 literals, BailoutId::None()); | 1957 literals, BailoutId::None()); |
1956 } | 1958 } |
1957 } | 1959 } |
1958 | 1960 |
1959 } // namespace internal | 1961 } // namespace internal |
1960 } // namespace v8 | 1962 } // namespace v8 |
OLD | NEW |