OLD | NEW |
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/feedback-vector.h" | 5 #include "src/feedback-vector.h" |
6 #include "src/code-stubs.h" | 6 #include "src/code-stubs.h" |
7 #include "src/feedback-vector-inl.h" | 7 #include "src/feedback-vector-inl.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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 170 } |
171 } | 171 } |
172 return false; | 172 return false; |
173 } | 173 } |
174 | 174 |
175 FeedbackSlotKind FeedbackVector::GetKind(FeedbackSlot slot) const { | 175 FeedbackSlotKind FeedbackVector::GetKind(FeedbackSlot slot) const { |
176 DCHECK(!is_empty()); | 176 DCHECK(!is_empty()); |
177 return metadata()->GetKind(slot); | 177 return metadata()->GetKind(slot); |
178 } | 178 } |
179 | 179 |
| 180 FeedbackSlot FeedbackVector::GetTypeProfileSlot() const { |
| 181 FeedbackMetadataIterator iter(metadata()); |
| 182 while (iter.HasNext()) { |
| 183 FeedbackSlot slot = iter.Next(); |
| 184 if (IsTypeProfile(slot)) { |
| 185 return slot; |
| 186 } |
| 187 } |
| 188 return FeedbackSlot(); |
| 189 } |
| 190 |
180 // static | 191 // static |
181 Handle<FeedbackVector> FeedbackVector::New(Isolate* isolate, | 192 Handle<FeedbackVector> FeedbackVector::New(Isolate* isolate, |
182 Handle<SharedFunctionInfo> shared) { | 193 Handle<SharedFunctionInfo> shared) { |
183 Factory* factory = isolate->factory(); | 194 Factory* factory = isolate->factory(); |
184 | 195 |
185 const int slot_count = shared->feedback_metadata()->slot_count(); | 196 const int slot_count = shared->feedback_metadata()->slot_count(); |
186 const int length = slot_count + kReservedIndexCount; | 197 const int length = slot_count + kReservedIndexCount; |
187 | 198 |
188 Handle<FixedArray> array = factory->NewFixedArray(length, TENURED); | 199 Handle<FixedArray> array = factory->NewFixedArray(length, TENURED); |
189 array->set_map_no_write_barrier(isolate->heap()->feedback_vector_map()); | 200 array->set_map_no_write_barrier(isolate->heap()->feedback_vector_map()); |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 Handle<Tuple2> entry = Handle<Tuple2>::cast(maybe_entry); | 1098 Handle<Tuple2> entry = Handle<Tuple2>::cast(maybe_entry); |
1088 Handle<String> type = | 1099 Handle<String> type = |
1089 Handle<String>(String::cast(entry->value1()), isolate); | 1100 Handle<String>(String::cast(entry->value1()), isolate); |
1090 int position = Smi::cast(entry->value2())->value(); | 1101 int position = Smi::cast(entry->value2())->value(); |
1091 PrintF("%d: %s\n", position, type->ToCString().get()); | 1102 PrintF("%d: %s\n", position, type->ToCString().get()); |
1092 } | 1103 } |
1093 } | 1104 } |
1094 | 1105 |
1095 } // namespace internal | 1106 } // namespace internal |
1096 } // namespace v8 | 1107 } // namespace v8 |
OLD | NEW |