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

Side by Side Diff: src/type-feedback-vector.cc

Issue 2631253002: [compiler] Unify EnsureFeedbackMetadata call sites. (Closed)
Patch Set: Remove helper method. 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 unified diff | Download patch
« no previous file with comments | « src/type-feedback-vector.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/type-feedback-vector.h" 5 #include "src/type-feedback-vector.h"
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/ic/ic-inl.h" 8 #include "src/ic/ic-inl.h"
9 #include "src/ic/ic-state.h" 9 #include "src/ic/ic-state.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // It's important that the TypeFeedbackMetadata have a COW map, since it's 111 // It's important that the TypeFeedbackMetadata have a COW map, since it's
112 // pointed to by both a SharedFunctionInfo and indirectly by closures through 112 // pointed to by both a SharedFunctionInfo and indirectly by closures through
113 // the TypeFeedbackVector. The serializer uses the COW map type to decide 113 // the TypeFeedbackVector. The serializer uses the COW map type to decide
114 // this object belongs in the startup snapshot and not the partial 114 // this object belongs in the startup snapshot and not the partial
115 // snapshot(s). 115 // snapshot(s).
116 metadata->set_map(isolate->heap()->fixed_cow_array_map()); 116 metadata->set_map(isolate->heap()->fixed_cow_array_map());
117 117
118 return metadata; 118 return metadata;
119 } 119 }
120 120
121 // static
122 void TypeFeedbackMetadata::EnsureAllocated(Isolate* isolate,
123 Handle<SharedFunctionInfo> sfi,
124 const FeedbackVectorSpec* spec) {
125 // If no type feedback metadata exists, create it. At this point the
126 // AstNumbering pass has already run. Note the snapshot can contain outdated
127 // vectors for a different configuration, hence we also recreate a new vector
128 // when the function is not compiled (i.e. no code was serialized).
129
130 // TODO(mvstanton): reintroduce is_empty() predicate to feedback_metadata().
131 if (sfi->feedback_metadata()->length() == 0 || !sfi->is_compiled()) {
132 Handle<TypeFeedbackMetadata> feedback_metadata =
133 TypeFeedbackMetadata::New(isolate, spec);
134 sfi->set_feedback_metadata(*feedback_metadata);
135 }
136
137 // It's very important that recompiles do not alter the structure of the type
138 // feedback vector. Verify that the structure fits the function literal.
139 CHECK(!sfi->feedback_metadata()->SpecDiffersFrom(spec));
140 }
141
142 bool TypeFeedbackMetadata::SpecDiffersFrom( 121 bool TypeFeedbackMetadata::SpecDiffersFrom(
143 const FeedbackVectorSpec* other_spec) const { 122 const FeedbackVectorSpec* other_spec) const {
144 if (other_spec->slots() != slot_count()) { 123 if (other_spec->slots() != slot_count()) {
145 return true; 124 return true;
146 } 125 }
147 126
148 int slots = slot_count(); 127 int slots = slot_count();
149 int parameter_index = 0; 128 int parameter_index = 0;
150 for (int i = 0; i < slots;) { 129 for (int i = 0; i < slots;) {
151 FeedbackVectorSlot slot(i); 130 FeedbackVectorSlot slot(i);
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 void StoreDataPropertyInLiteralICNexus::ConfigureMonomorphic( 1086 void StoreDataPropertyInLiteralICNexus::ConfigureMonomorphic(
1108 Handle<Name> name, Handle<Map> receiver_map) { 1087 Handle<Name> name, Handle<Map> receiver_map) {
1109 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); 1088 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map);
1110 1089
1111 SetFeedback(*cell); 1090 SetFeedback(*cell);
1112 SetFeedbackExtra(*name); 1091 SetFeedbackExtra(*name);
1113 } 1092 }
1114 1093
1115 } // namespace internal 1094 } // namespace internal
1116 } // namespace v8 1095 } // namespace v8
OLDNEW
« no previous file with comments | « src/type-feedback-vector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698