| 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/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.h" | 8 #include "src/ic/ic.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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 | 154 |
| 155 // static | 155 // static |
| 156 int TypeFeedbackVector::GetIndexFromSpec(const FeedbackVectorSpec* spec, | 156 int TypeFeedbackVector::GetIndexFromSpec(const FeedbackVectorSpec* spec, |
| 157 FeedbackVectorSlot slot) { | 157 FeedbackVectorSlot slot) { |
| 158 return kReservedIndexCount + slot.ToInt(); | 158 return kReservedIndexCount + slot.ToInt(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 | 161 |
| 162 // static | 162 // static |
| 163 int TypeFeedbackVector::PushAppliedArgumentsIndex() { | |
| 164 return kReservedIndexCount; | |
| 165 } | |
| 166 | |
| 167 | |
| 168 // static | |
| 169 Handle<TypeFeedbackVector> TypeFeedbackVector::CreatePushAppliedArgumentsVector( | |
| 170 Isolate* isolate) { | |
| 171 StaticFeedbackVectorSpec spec; | |
| 172 FeedbackVectorSlot slot = spec.AddKeyedLoadICSlot(); | |
| 173 // TODO(ishell): allocate this metadata only once. | |
| 174 Handle<TypeFeedbackMetadata> feedback_metadata = | |
| 175 TypeFeedbackMetadata::New(isolate, &spec); | |
| 176 Handle<TypeFeedbackVector> feedback_vector = | |
| 177 TypeFeedbackVector::New(isolate, feedback_metadata); | |
| 178 DCHECK_EQ(PushAppliedArgumentsIndex(), feedback_vector->GetIndex(slot)); | |
| 179 USE(slot); | |
| 180 return feedback_vector; | |
| 181 } | |
| 182 | |
| 183 | |
| 184 // static | |
| 185 Handle<TypeFeedbackVector> TypeFeedbackVector::Copy( | 163 Handle<TypeFeedbackVector> TypeFeedbackVector::Copy( |
| 186 Isolate* isolate, Handle<TypeFeedbackVector> vector) { | 164 Isolate* isolate, Handle<TypeFeedbackVector> vector) { |
| 187 Handle<TypeFeedbackVector> result; | 165 Handle<TypeFeedbackVector> result; |
| 188 result = Handle<TypeFeedbackVector>::cast( | 166 result = Handle<TypeFeedbackVector>::cast( |
| 189 isolate->factory()->CopyFixedArray(Handle<FixedArray>::cast(vector))); | 167 isolate->factory()->CopyFixedArray(Handle<FixedArray>::cast(vector))); |
| 190 return result; | 168 return result; |
| 191 } | 169 } |
| 192 | 170 |
| 193 | 171 |
| 194 // This logic is copied from | 172 // This logic is copied from |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 return mode; | 819 return mode; |
| 842 } | 820 } |
| 843 | 821 |
| 844 | 822 |
| 845 IcCheckType KeyedStoreICNexus::GetKeyType() const { | 823 IcCheckType KeyedStoreICNexus::GetKeyType() const { |
| 846 // The structure of the vector slots tells us the type. | 824 // The structure of the vector slots tells us the type. |
| 847 return GetFeedback()->IsName() ? PROPERTY : ELEMENT; | 825 return GetFeedback()->IsName() ? PROPERTY : ELEMENT; |
| 848 } | 826 } |
| 849 } // namespace internal | 827 } // namespace internal |
| 850 } // namespace v8 | 828 } // namespace v8 |
| OLD | NEW |