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/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" |
11 #include "src/type-feedback-vector-inl.h" | 11 #include "src/type-feedback-vector-inl.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 // static | 16 // static |
17 TypeFeedbackVector::VectorICKind TypeFeedbackVector::FromCodeKind( | 17 TypeFeedbackVector::VectorICKind TypeFeedbackVector::FromCodeKind( |
18 Code::Kind kind) { | 18 Code::Kind kind) { |
19 switch (kind) { | 19 switch (kind) { |
20 case Code::CALL_IC: | 20 case Code::CALL_IC: |
21 return KindCallIC; | 21 return KindCallIC; |
22 case Code::LOAD_IC: | 22 case Code::LOAD_IC: |
23 return KindLoadIC; | 23 return KindLoadIC; |
24 case Code::KEYED_LOAD_IC: | 24 case Code::KEYED_LOAD_IC: |
25 return KindKeyedLoadIC; | 25 return KindKeyedLoadIC; |
| 26 case Code::STORE_IC: |
| 27 DCHECK(FLAG_vector_stores); |
| 28 return KindStoreIC; |
| 29 case Code::KEYED_STORE_IC: |
| 30 DCHECK(FLAG_vector_stores); |
| 31 return KindKeyedStoreIC; |
26 default: | 32 default: |
27 // Shouldn't get here. | 33 // Shouldn't get here. |
28 UNREACHABLE(); | 34 UNREACHABLE(); |
29 } | 35 } |
30 | 36 |
31 return KindUnused; | 37 return KindUnused; |
32 } | 38 } |
33 | 39 |
34 | 40 |
35 // static | 41 // static |
36 Code::Kind TypeFeedbackVector::FromVectorICKind(VectorICKind kind) { | 42 Code::Kind TypeFeedbackVector::FromVectorICKind(VectorICKind kind) { |
37 switch (kind) { | 43 switch (kind) { |
38 case KindCallIC: | 44 case KindCallIC: |
39 return Code::CALL_IC; | 45 return Code::CALL_IC; |
40 case KindLoadIC: | 46 case KindLoadIC: |
41 return Code::LOAD_IC; | 47 return Code::LOAD_IC; |
42 case KindKeyedLoadIC: | 48 case KindKeyedLoadIC: |
43 return Code::KEYED_LOAD_IC; | 49 return Code::KEYED_LOAD_IC; |
| 50 case KindStoreIC: |
| 51 DCHECK(FLAG_vector_stores); |
| 52 return Code::STORE_IC; |
| 53 case KindKeyedStoreIC: |
| 54 DCHECK(FLAG_vector_stores); |
| 55 return Code::KEYED_STORE_IC; |
44 case KindUnused: | 56 case KindUnused: |
45 break; | 57 break; |
46 } | 58 } |
47 // Sentinel for no information. | 59 // Sentinel for no information. |
48 return Code::NUMBER_OF_KINDS; | 60 return Code::NUMBER_OF_KINDS; |
49 } | 61 } |
50 | 62 |
51 | 63 |
52 Code::Kind TypeFeedbackVector::GetKind(FeedbackVectorICSlot slot) const { | 64 Code::Kind TypeFeedbackVector::GetKind(FeedbackVectorICSlot slot) const { |
53 int index = VectorICComputer::index(kReservedIndexCount, slot.ToInt()); | 65 int index = VectorICComputer::index(kReservedIndexCount, slot.ToInt()); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 if (kind == Code::CALL_IC) { | 205 if (kind == Code::CALL_IC) { |
194 CallICNexus nexus(this, slot); | 206 CallICNexus nexus(this, slot); |
195 nexus.Clear(host); | 207 nexus.Clear(host); |
196 } else if (kind == Code::LOAD_IC) { | 208 } else if (kind == Code::LOAD_IC) { |
197 LoadICNexus nexus(this, slot); | 209 LoadICNexus nexus(this, slot); |
198 nexus.Clear(host); | 210 nexus.Clear(host); |
199 } else if (kind == Code::KEYED_LOAD_IC) { | 211 } else if (kind == Code::KEYED_LOAD_IC) { |
200 KeyedLoadICNexus nexus(this, slot); | 212 KeyedLoadICNexus nexus(this, slot); |
201 nexus.Clear(host); | 213 nexus.Clear(host); |
202 } | 214 } |
| 215 // TODO(mvstanton): Handle clearing of store ics when FLAG_vector_stores |
| 216 // is true. |
203 } | 217 } |
204 } | 218 } |
205 } | 219 } |
206 | 220 |
207 | 221 |
208 Handle<FixedArray> FeedbackNexus::EnsureArrayOfSize(int length) { | 222 Handle<FixedArray> FeedbackNexus::EnsureArrayOfSize(int length) { |
209 Isolate* isolate = GetIsolate(); | 223 Isolate* isolate = GetIsolate(); |
210 Handle<Object> feedback = handle(GetFeedback(), isolate); | 224 Handle<Object> feedback = handle(GetFeedback(), isolate); |
211 if (!feedback->IsFixedArray() || | 225 if (!feedback->IsFixedArray() || |
212 FixedArray::cast(*feedback)->length() != length) { | 226 FixedArray::cast(*feedback)->length() != length) { |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 | 554 |
541 Name* KeyedLoadICNexus::FindFirstName() const { | 555 Name* KeyedLoadICNexus::FindFirstName() const { |
542 Object* feedback = GetFeedback(); | 556 Object* feedback = GetFeedback(); |
543 if (feedback->IsString()) { | 557 if (feedback->IsString()) { |
544 return Name::cast(feedback); | 558 return Name::cast(feedback); |
545 } | 559 } |
546 return NULL; | 560 return NULL; |
547 } | 561 } |
548 } | 562 } |
549 } // namespace v8::internal | 563 } // namespace v8::internal |
OLD | NEW |