| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/ic/ic.h" | 7 #include "src/ic/ic.h" |
| 8 #include "src/ic/ic-state.h" | 8 #include "src/ic/ic-state.h" |
| 9 #include "src/objects.h" | 9 #include "src/objects.h" |
| 10 #include "src/type-feedback-vector-inl.h" | 10 #include "src/type-feedback-vector-inl.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 VectorICKind b = FromCodeKind(kind); | 70 VectorICKind b = FromCodeKind(kind); |
| 71 int index = VectorICComputer::index(kReservedIndexCount, slot.ToInt()); | 71 int index = VectorICComputer::index(kReservedIndexCount, slot.ToInt()); |
| 72 int data = Smi::cast(get(index))->value(); | 72 int data = Smi::cast(get(index))->value(); |
| 73 int new_data = VectorICComputer::encode(data, slot.ToInt(), b); | 73 int new_data = VectorICComputer::encode(data, slot.ToInt(), b); |
| 74 set(index, Smi::FromInt(new_data)); | 74 set(index, Smi::FromInt(new_data)); |
| 75 } | 75 } |
| 76 | 76 |
| 77 | 77 |
| 78 template Handle<TypeFeedbackVector> TypeFeedbackVector::Allocate( |
| 79 Isolate* isolate, const FeedbackVectorSpec* spec); |
| 80 template Handle<TypeFeedbackVector> TypeFeedbackVector::Allocate( |
| 81 Isolate* isolate, const ZoneFeedbackVectorSpec* spec); |
| 82 |
| 83 |
| 78 // static | 84 // static |
| 79 Handle<TypeFeedbackVector> TypeFeedbackVector::Allocate( | 85 template <typename Spec> |
| 80 Isolate* isolate, const FeedbackVectorSpec& spec) { | 86 Handle<TypeFeedbackVector> TypeFeedbackVector::Allocate(Isolate* isolate, |
| 81 const int slot_count = spec.slots(); | 87 const Spec* spec) { |
| 82 const int ic_slot_count = spec.ic_slots(); | 88 const int slot_count = spec->slots(); |
| 89 const int ic_slot_count = spec->ic_slots(); |
| 83 const int index_count = | 90 const int index_count = |
| 84 FLAG_vector_ics ? VectorICComputer::word_count(ic_slot_count) : 0; | 91 FLAG_vector_ics ? VectorICComputer::word_count(ic_slot_count) : 0; |
| 85 const int length = slot_count + (ic_slot_count * elements_per_ic_slot()) + | 92 const int length = slot_count + (ic_slot_count * elements_per_ic_slot()) + |
| 86 index_count + kReservedIndexCount; | 93 index_count + kReservedIndexCount; |
| 87 if (length == kReservedIndexCount) { | 94 if (length == kReservedIndexCount) { |
| 88 return Handle<TypeFeedbackVector>::cast( | 95 return Handle<TypeFeedbackVector>::cast( |
| 89 isolate->factory()->empty_fixed_array()); | 96 isolate->factory()->empty_fixed_array()); |
| 90 } | 97 } |
| 91 | 98 |
| 92 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length, TENURED); | 99 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length, TENURED); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 106 // Ensure we can skip the write barrier | 113 // Ensure we can skip the write barrier |
| 107 Handle<Object> uninitialized_sentinel = UninitializedSentinel(isolate); | 114 Handle<Object> uninitialized_sentinel = UninitializedSentinel(isolate); |
| 108 DCHECK_EQ(isolate->heap()->uninitialized_symbol(), *uninitialized_sentinel); | 115 DCHECK_EQ(isolate->heap()->uninitialized_symbol(), *uninitialized_sentinel); |
| 109 for (int i = kReservedIndexCount + index_count; i < length; i++) { | 116 for (int i = kReservedIndexCount + index_count; i < length; i++) { |
| 110 array->set(i, *uninitialized_sentinel, SKIP_WRITE_BARRIER); | 117 array->set(i, *uninitialized_sentinel, SKIP_WRITE_BARRIER); |
| 111 } | 118 } |
| 112 | 119 |
| 113 Handle<TypeFeedbackVector> vector = Handle<TypeFeedbackVector>::cast(array); | 120 Handle<TypeFeedbackVector> vector = Handle<TypeFeedbackVector>::cast(array); |
| 114 if (FLAG_vector_ics) { | 121 if (FLAG_vector_ics) { |
| 115 for (int i = 0; i < ic_slot_count; i++) { | 122 for (int i = 0; i < ic_slot_count; i++) { |
| 116 vector->SetKind(FeedbackVectorICSlot(i), spec.GetKind(i)); | 123 vector->SetKind(FeedbackVectorICSlot(i), spec->GetKind(i)); |
| 117 } | 124 } |
| 118 } | 125 } |
| 119 return vector; | 126 return vector; |
| 120 } | 127 } |
| 121 | 128 |
| 122 | 129 |
| 123 // static | 130 // static |
| 124 Handle<TypeFeedbackVector> TypeFeedbackVector::Copy( | 131 Handle<TypeFeedbackVector> TypeFeedbackVector::Copy( |
| 125 Isolate* isolate, Handle<TypeFeedbackVector> vector) { | 132 Isolate* isolate, Handle<TypeFeedbackVector> vector) { |
| 126 Handle<TypeFeedbackVector> result; | 133 Handle<TypeFeedbackVector> result; |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 | 533 |
| 527 Name* KeyedLoadICNexus::FindFirstName() const { | 534 Name* KeyedLoadICNexus::FindFirstName() const { |
| 528 Object* feedback = GetFeedback(); | 535 Object* feedback = GetFeedback(); |
| 529 if (feedback->IsString()) { | 536 if (feedback->IsString()) { |
| 530 return Name::cast(feedback); | 537 return Name::cast(feedback); |
| 531 } | 538 } |
| 532 return NULL; | 539 return NULL; |
| 533 } | 540 } |
| 534 } | 541 } |
| 535 } // namespace v8::internal | 542 } // namespace v8::internal |
| OLD | NEW |