Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Unified Diff: src/type-feedback-vector.cc

Issue 2627783008: [ignition] Create the type feedback vector after bytecode generation (Closed)
Patch Set: Extract common functionality to static method on TypeFeedbackMetadata Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/interpreter/bytecode-generator.cc ('K') | « src/type-feedback-vector.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/type-feedback-vector.cc
diff --git a/src/type-feedback-vector.cc b/src/type-feedback-vector.cc
index c5908c717b40f7964381fab7579947d00ece39fa..b72f2278ffb59f0ecc94e6bc64fba4c1050e3a4f 100644
--- a/src/type-feedback-vector.cc
+++ b/src/type-feedback-vector.cc
@@ -118,6 +118,26 @@ Handle<TypeFeedbackMetadata> TypeFeedbackMetadata::New(Isolate* isolate,
return metadata;
}
+// static
+void TypeFeedbackMetadata::EnsureAllocated(Isolate* isolate,
+ Handle<SharedFunctionInfo> sfi,
+ const FeedbackVectorSpec* spec) {
+ // If no type feedback metadata exists, create it. At this point the
+ // AstNumbering pass has already run. Note the snapshot can contain outdated
+ // vectors for a different configuration, hence we also recreate a new vector
+ // when the function is not compiled (i.e. no code was serialized).
+
+ // TODO(mvstanton): reintroduce is_empty() predicate to feedback_metadata().
+ if (sfi->feedback_metadata()->length() == 0 || !sfi->is_compiled()) {
+ Handle<TypeFeedbackMetadata> feedback_metadata =
+ TypeFeedbackMetadata::New(isolate, spec);
+ sfi->set_feedback_metadata(*feedback_metadata);
+ }
+
+ // It's very important that recompiles do not alter the structure of the type
+ // feedback vector. Verify that the structure fits the function literal.
+ CHECK(!sfi->feedback_metadata()->SpecDiffersFrom(spec));
+}
bool TypeFeedbackMetadata::SpecDiffersFrom(
const FeedbackVectorSpec* other_spec) const {
« src/interpreter/bytecode-generator.cc ('K') | « src/type-feedback-vector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698