| 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 that we should reuse any existing | 747 // AstNumbering pass has already run. Note the snapshot can contain outdated |
| 748 // feedback vector rather than creating a new one. | 748 // vectors for a different configuration, hence we also recreate a new vector |
| 749 if (info->shared_info()->feedback_vector()->is_empty()) { | 749 // when the function is not compiled (i.e. no code was serialized). |
| 750 if (info->shared_info()->feedback_vector()->is_empty() || |
| 751 !info->shared_info()->is_compiled()) { |
| 750 Handle<TypeFeedbackMetadata> feedback_metadata = TypeFeedbackMetadata::New( | 752 Handle<TypeFeedbackMetadata> feedback_metadata = TypeFeedbackMetadata::New( |
| 751 info->isolate(), info->literal()->feedback_vector_spec()); | 753 info->isolate(), info->literal()->feedback_vector_spec()); |
| 752 Handle<TypeFeedbackVector> feedback_vector = | 754 Handle<TypeFeedbackVector> feedback_vector = |
| 753 TypeFeedbackVector::New(info->isolate(), feedback_metadata); | 755 TypeFeedbackVector::New(info->isolate(), feedback_metadata); |
| 754 info->shared_info()->set_feedback_vector(*feedback_vector); | 756 info->shared_info()->set_feedback_vector(*feedback_vector); |
| 755 } | 757 } |
| 756 | 758 |
| 757 // It's very important that recompiles do not alter the structure of the type | 759 // It's very important that recompiles do not alter the structure of the type |
| 758 // feedback vector. Verify that the structure fits the function literal. | 760 // feedback vector. Verify that the structure fits the function literal. |
| 759 CHECK(!info->shared_info()->feedback_vector()->metadata()->SpecDiffersFrom( | 761 CHECK(!info->shared_info()->feedback_vector()->metadata()->SpecDiffersFrom( |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1898 MaybeHandle<Code> code; | 1900 MaybeHandle<Code> code; |
| 1899 if (cached.code != nullptr) code = handle(cached.code); | 1901 if (cached.code != nullptr) code = handle(cached.code); |
| 1900 Handle<Context> native_context(function->context()->native_context()); | 1902 Handle<Context> native_context(function->context()->native_context()); |
| 1901 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 1903 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
| 1902 literals, BailoutId::None()); | 1904 literals, BailoutId::None()); |
| 1903 } | 1905 } |
| 1904 } | 1906 } |
| 1905 | 1907 |
| 1906 } // namespace internal | 1908 } // namespace internal |
| 1907 } // namespace v8 | 1909 } // namespace v8 |
| OLD | NEW |