| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 Handle<TypeFeedbackMetadata> metadata = | 97 Handle<TypeFeedbackMetadata> metadata = |
| 98 Handle<TypeFeedbackMetadata>::cast(array); | 98 Handle<TypeFeedbackMetadata>::cast(array); |
| 99 | 99 |
| 100 // Add names to NamesTable. | 100 // Add names to NamesTable. |
| 101 const int name_count = spec->name_count(); | 101 const int name_count = spec->name_count(); |
| 102 | 102 |
| 103 Handle<UnseededNumberDictionary> names; | 103 Handle<UnseededNumberDictionary> names; |
| 104 if (name_count) { | 104 if (name_count) { |
| 105 names = UnseededNumberDictionary::New( | 105 names = UnseededNumberDictionary::New(isolate, name_count, TENURED); |
| 106 isolate, base::bits::RoundUpToPowerOfTwo32(name_count), TENURED, | |
| 107 USE_CUSTOM_MINIMUM_CAPACITY); | |
| 108 } | 106 } |
| 109 | 107 |
| 110 int name_index = 0; | 108 int name_index = 0; |
| 111 for (int i = 0; i < slot_count; i++) { | 109 for (int i = 0; i < slot_count; i++) { |
| 112 FeedbackVectorSlotKind kind = spec->GetKind(i); | 110 FeedbackVectorSlotKind kind = spec->GetKind(i); |
| 113 metadata->SetKind(FeedbackVectorSlot(i), kind); | 111 metadata->SetKind(FeedbackVectorSlot(i), kind); |
| 114 if (SlotRequiresName(kind)) { | 112 if (SlotRequiresName(kind)) { |
| 115 Handle<String> name = spec->GetName(name_index); | 113 Handle<String> name = spec->GetName(name_index); |
| 116 DCHECK(!name.is_null()); | 114 DCHECK(!name.is_null()); |
| 117 names = UnseededNumberDictionary::AtNumberPut(names, i, name); | 115 Handle<UnseededNumberDictionary> new_names = |
| 116 UnseededNumberDictionary::AtNumberPut(names, i, name); |
| 117 DCHECK_EQ(*new_names, *names); |
| 118 names = new_names; |
| 118 name_index++; | 119 name_index++; |
| 119 } | 120 } |
| 120 } | 121 } |
| 121 DCHECK_EQ(name_count, name_index); | 122 DCHECK_EQ(name_count, name_index); |
| 122 metadata->set(kNamesTableIndex, | 123 metadata->set(kNamesTableIndex, |
| 123 name_count ? static_cast<Object*>(*names) : Smi::FromInt(0)); | 124 name_count ? static_cast<Object*>(*names) : Smi::FromInt(0)); |
| 124 | 125 |
| 125 // It's important that the TypeFeedbackMetadata have a COW map, since it's | 126 // It's important that the TypeFeedbackMetadata have a COW map, since it's |
| 126 // pointed to by both a SharedFunctionInfo and indirectly by closures through | 127 // pointed to by both a SharedFunctionInfo and indirectly by closures through |
| 127 // the TypeFeedbackVector. The serializer uses the COW map type to decide | 128 // the TypeFeedbackVector. The serializer uses the COW map type to decide |
| (...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 return BinaryOperationHintFromFeedback(feedback); | 1080 return BinaryOperationHintFromFeedback(feedback); |
| 1080 } | 1081 } |
| 1081 | 1082 |
| 1082 CompareOperationHint CompareICNexus::GetCompareOperationFeedback() const { | 1083 CompareOperationHint CompareICNexus::GetCompareOperationFeedback() const { |
| 1083 int feedback = Smi::cast(GetFeedback())->value(); | 1084 int feedback = Smi::cast(GetFeedback())->value(); |
| 1084 return CompareOperationHintFromFeedback(feedback); | 1085 return CompareOperationHintFromFeedback(feedback); |
| 1085 } | 1086 } |
| 1086 | 1087 |
| 1087 } // namespace internal | 1088 } // namespace internal |
| 1088 } // namespace v8 | 1089 } // namespace v8 |
| OLD | NEW |