Chromium Code Reviews| 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 #ifndef V8_TYPE_FEEDBACK_VECTOR_INL_H_ | 5 #ifndef V8_TYPE_FEEDBACK_VECTOR_INL_H_ |
| 6 #define V8_TYPE_FEEDBACK_VECTOR_INL_H_ | 6 #define V8_TYPE_FEEDBACK_VECTOR_INL_H_ |
| 7 | 7 |
| 8 #include "src/globals.h" | 8 #include "src/globals.h" |
| 9 #include "src/type-feedback-vector.h" | 9 #include "src/type-feedback-vector.h" |
| 10 | 10 |
| 11 namespace v8 { | 11 namespace v8 { |
| 12 namespace internal { | 12 namespace internal { |
| 13 | 13 |
| 14 | 14 |
| 15 template <typename Derived> | 15 template <typename Derived> |
| 16 FeedbackVectorSlot FeedbackVectorSpecBase<Derived>::AddSlot( | 16 FeedbackVectorSlot FeedbackVectorSpecBase<Derived>::AddSlot( |
| 17 FeedbackVectorSlotKind kind) { | 17 FeedbackVectorSlotKind kind) { |
| 18 int slot = This()->slots(); | 18 int slot = This()->slots(); |
| 19 int entries_per_slot = TypeFeedbackMetadata::GetSlotSize(kind); | 19 int entries_per_slot = TypeFeedbackMetadata::GetSlotSize(kind); |
| 20 This()->append(kind); | 20 This()->append(kind); |
| 21 for (int i = 1; i < entries_per_slot; i++) { | 21 for (int i = 1; i < entries_per_slot; i++) { |
| 22 This()->append(FeedbackVectorSlotKind::INVALID); | 22 This()->append(FeedbackVectorSlotKind::INVALID); |
| 23 } | 23 } |
| 24 return FeedbackVectorSlot(slot); | 24 return FeedbackVectorSlot(slot); |
| 25 } | 25 } |
| 26 | 26 |
| 27 | 27 |
| 28 // static | 28 // static |
| 29 TypeFeedbackMetadata* TypeFeedbackMetadata::cast(Object* obj) { | 29 TypeFeedbackMetadata* TypeFeedbackMetadata::cast(Object* obj) { |
| 30 DCHECK(obj->IsTypeFeedbackVector()); | 30 DCHECK(obj->IsTypeFeedbackMetadata()); |
|
mvstanton
2017/01/09 09:56:38
Good catch!
| |
| 31 return reinterpret_cast<TypeFeedbackMetadata*>(obj); | 31 return reinterpret_cast<TypeFeedbackMetadata*>(obj); |
| 32 } | 32 } |
| 33 | 33 |
| 34 bool TypeFeedbackMetadata::is_empty() const { | 34 bool TypeFeedbackMetadata::is_empty() const { |
| 35 if (length() == 0) return true; | 35 if (length() == 0) return true; |
| 36 return false; | 36 return false; |
| 37 } | 37 } |
| 38 | 38 |
| 39 int TypeFeedbackMetadata::slot_count() const { | 39 int TypeFeedbackMetadata::slot_count() const { |
| 40 if (length() == 0) return 0; | 40 if (length() == 0) return 0; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 int index = vector()->GetIndex(slot()) + 1; | 272 int index = vector()->GetIndex(slot()) + 1; |
| 273 vector()->set(index, feedback_extra, mode); | 273 vector()->set(index, feedback_extra, mode); |
| 274 } | 274 } |
| 275 | 275 |
| 276 | 276 |
| 277 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } | 277 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } |
| 278 } // namespace internal | 278 } // namespace internal |
| 279 } // namespace v8 | 279 } // namespace v8 |
| 280 | 280 |
| 281 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ | 281 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ |
| OLD | NEW |