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

Side by Side Diff: src/type-feedback-vector-inl.h

Issue 1906823002: Move of the type feedback vector to the closure. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 4 years, 7 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.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/type-feedback-vector.h" 8 #include "src/type-feedback-vector.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 14 matching lines...) Expand all
25 return FeedbackVectorSlot(slot); 25 return FeedbackVectorSlot(slot);
26 } 26 }
27 27
28 28
29 // static 29 // static
30 TypeFeedbackMetadata* TypeFeedbackMetadata::cast(Object* obj) { 30 TypeFeedbackMetadata* TypeFeedbackMetadata::cast(Object* obj) {
31 DCHECK(obj->IsTypeFeedbackVector()); 31 DCHECK(obj->IsTypeFeedbackVector());
32 return reinterpret_cast<TypeFeedbackMetadata*>(obj); 32 return reinterpret_cast<TypeFeedbackMetadata*>(obj);
33 } 33 }
34 34
35 bool TypeFeedbackMetadata::is_empty() const {
36 if (length() == 0) return true;
37 return false;
38 }
35 39
36 int TypeFeedbackMetadata::slot_count() const { 40 int TypeFeedbackMetadata::slot_count() const {
37 if (length() == 0) return 0; 41 if (length() == 0) return 0;
38 DCHECK(length() > kReservedIndexCount); 42 DCHECK(length() > kReservedIndexCount);
39 return Smi::cast(get(kSlotsCountIndex))->value(); 43 return Smi::cast(get(kSlotsCountIndex))->value();
40 } 44 }
41 45
42 46
43 // static 47 // static
44 TypeFeedbackVector* TypeFeedbackVector::cast(Object* obj) { 48 TypeFeedbackVector* TypeFeedbackVector::cast(Object* obj) {
(...skipping 28 matching lines...) Expand all
73 : TypeFeedbackMetadata::cast(get(kMetadataIndex)); 77 : TypeFeedbackMetadata::cast(get(kMetadataIndex));
74 } 78 }
75 79
76 80
77 FeedbackVectorSlotKind TypeFeedbackVector::GetKind( 81 FeedbackVectorSlotKind TypeFeedbackVector::GetKind(
78 FeedbackVectorSlot slot) const { 82 FeedbackVectorSlot slot) const {
79 DCHECK(!is_empty()); 83 DCHECK(!is_empty());
80 return metadata()->GetKind(slot); 84 return metadata()->GetKind(slot);
81 } 85 }
82 86
83 87 // static
84 int TypeFeedbackVector::GetIndex(FeedbackVectorSlot slot) const { 88 int TypeFeedbackVector::GetIndex(FeedbackVectorSlot slot) {
85 DCHECK(slot.ToInt() < slot_count());
86 return kReservedIndexCount + slot.ToInt(); 89 return kReservedIndexCount + slot.ToInt();
87 } 90 }
88 91
89 92
90 // Conversion from an integer index to either a slot or an ic slot. The caller 93 // Conversion from an integer index to either a slot or an ic slot. The caller
91 // should know what kind she expects. 94 // should know what kind she expects.
92 FeedbackVectorSlot TypeFeedbackVector::ToSlot(int index) const { 95 // static
93 DCHECK(index >= kReservedIndexCount && index < length()); 96 FeedbackVectorSlot TypeFeedbackVector::ToSlot(int index) {
97 DCHECK(index >= kReservedIndexCount);
94 return FeedbackVectorSlot(index - kReservedIndexCount); 98 return FeedbackVectorSlot(index - kReservedIndexCount);
95 } 99 }
96 100
97 101
98 Object* TypeFeedbackVector::Get(FeedbackVectorSlot slot) const { 102 Object* TypeFeedbackVector::Get(FeedbackVectorSlot slot) const {
99 return get(GetIndex(slot)); 103 return get(GetIndex(slot));
100 } 104 }
101 105
102 106
103 void TypeFeedbackVector::Set(FeedbackVectorSlot slot, Object* value, 107 void TypeFeedbackVector::Set(FeedbackVectorSlot slot, Object* value,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 int index = vector()->GetIndex(slot()) + 1; 181 int index = vector()->GetIndex(slot()) + 1;
178 vector()->set(index, feedback_extra, mode); 182 vector()->set(index, feedback_extra, mode);
179 } 183 }
180 184
181 185
182 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); } 186 Isolate* FeedbackNexus::GetIsolate() const { return vector()->GetIsolate(); }
183 } // namespace internal 187 } // namespace internal
184 } // namespace v8 188 } // namespace v8
185 189
186 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_ 190 #endif // V8_TYPE_FEEDBACK_VECTOR_INL_H_
OLDNEW
« no previous file with comments | « src/type-feedback-vector.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698