OLD | NEW |
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 #include "src/type-info.h" | 5 #include "src/type-info.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 return Handle<Object>::cast(isolate()->factory()->undefined_value()); | 48 return Handle<Object>::cast(isolate()->factory()->undefined_value()); |
49 } | 49 } |
50 | 50 |
51 | 51 |
52 Handle<Object> TypeFeedbackOracle::GetInfo(FeedbackVectorSlot slot) { | 52 Handle<Object> TypeFeedbackOracle::GetInfo(FeedbackVectorSlot slot) { |
53 DCHECK(slot.ToInt() >= 0 && slot.ToInt() < feedback_vector_->length()); | 53 DCHECK(slot.ToInt() >= 0 && slot.ToInt() < feedback_vector_->length()); |
54 Handle<Object> undefined = | 54 Handle<Object> undefined = |
55 Handle<Object>::cast(isolate()->factory()->undefined_value()); | 55 Handle<Object>::cast(isolate()->factory()->undefined_value()); |
56 Object* obj = feedback_vector_->Get(slot); | 56 Object* obj = feedback_vector_->Get(slot); |
57 | 57 |
58 // Slots do not embed direct pointers to functions. Instead a WeakCell is | 58 // Slots do not embed direct pointers to maps, functions. Instead |
59 // always used. | 59 // a WeakCell is always used. |
60 DCHECK(!obj->IsJSFunction()); | |
61 if (obj->IsWeakCell()) { | 60 if (obj->IsWeakCell()) { |
62 WeakCell* cell = WeakCell::cast(obj); | 61 WeakCell* cell = WeakCell::cast(obj); |
63 if (cell->cleared()) return undefined; | 62 if (cell->cleared()) return undefined; |
64 obj = cell->value(); | |
65 } | |
66 | |
67 return Handle<Object>(obj, isolate()); | |
68 } | |
69 | |
70 | |
71 Handle<Object> TypeFeedbackOracle::GetInfo(FeedbackVectorICSlot slot) { | |
72 DCHECK(slot.ToInt() >= 0 && slot.ToInt() < feedback_vector_->length()); | |
73 Handle<Object> undefined = | |
74 Handle<Object>::cast(isolate()->factory()->undefined_value()); | |
75 Object* obj = feedback_vector_->Get(slot); | |
76 | |
77 // Vector-based ICs do not embed direct pointers to maps, functions. | |
78 // Instead a WeakCell is always used. | |
79 if (obj->IsWeakCell()) { | |
80 WeakCell* cell = WeakCell::cast(obj); | |
81 if (cell->cleared()) return undefined; | |
82 obj = cell->value(); | 63 obj = cell->value(); |
83 } | 64 } |
84 | 65 |
85 if (obj->IsJSFunction() || obj->IsAllocationSite() || obj->IsSymbol() || | 66 if (obj->IsJSFunction() || obj->IsAllocationSite() || obj->IsSymbol() || |
86 obj->IsSimd128Value()) { | 67 obj->IsSimd128Value()) { |
87 return Handle<Object>(obj, isolate()); | 68 return Handle<Object>(obj, isolate()); |
88 } | 69 } |
89 | 70 |
90 return undefined; | 71 return undefined; |
91 } | 72 } |
92 | 73 |
93 | 74 |
94 InlineCacheState TypeFeedbackOracle::LoadInlineCacheState(TypeFeedbackId id) { | 75 InlineCacheState TypeFeedbackOracle::LoadInlineCacheState(TypeFeedbackId id) { |
95 Handle<Object> maybe_code = GetInfo(id); | 76 Handle<Object> maybe_code = GetInfo(id); |
96 if (maybe_code->IsCode()) { | 77 if (maybe_code->IsCode()) { |
97 Handle<Code> code = Handle<Code>::cast(maybe_code); | 78 Handle<Code> code = Handle<Code>::cast(maybe_code); |
98 if (code->is_inline_cache_stub()) return code->ic_state(); | 79 if (code->is_inline_cache_stub()) return code->ic_state(); |
99 } | 80 } |
100 | 81 |
101 // If we can't find an IC, assume we've seen *something*, but we don't know | 82 // If we can't find an IC, assume we've seen *something*, but we don't know |
102 // what. PREMONOMORPHIC roughly encodes this meaning. | 83 // what. PREMONOMORPHIC roughly encodes this meaning. |
103 return PREMONOMORPHIC; | 84 return PREMONOMORPHIC; |
104 } | 85 } |
105 | 86 |
106 | 87 |
107 InlineCacheState TypeFeedbackOracle::LoadInlineCacheState( | 88 InlineCacheState TypeFeedbackOracle::LoadInlineCacheState( |
108 FeedbackVectorICSlot slot) { | 89 FeedbackVectorSlot slot) { |
109 if (!slot.IsInvalid()) { | 90 if (!slot.IsInvalid()) { |
110 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); | 91 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); |
111 if (kind == FeedbackVectorSlotKind::LOAD_IC) { | 92 if (kind == FeedbackVectorSlotKind::LOAD_IC) { |
112 LoadICNexus nexus(feedback_vector_, slot); | 93 LoadICNexus nexus(feedback_vector_, slot); |
113 return nexus.StateFromFeedback(); | 94 return nexus.StateFromFeedback(); |
114 } else if (kind == FeedbackVectorSlotKind::KEYED_LOAD_IC) { | 95 } else if (kind == FeedbackVectorSlotKind::KEYED_LOAD_IC) { |
115 KeyedLoadICNexus nexus(feedback_vector_, slot); | 96 KeyedLoadICNexus nexus(feedback_vector_, slot); |
116 return nexus.StateFromFeedback(); | 97 return nexus.StateFromFeedback(); |
117 } | 98 } |
118 } | 99 } |
119 | 100 |
120 // If we can't find an IC, assume we've seen *something*, but we don't know | 101 // If we can't find an IC, assume we've seen *something*, but we don't know |
121 // what. PREMONOMORPHIC roughly encodes this meaning. | 102 // what. PREMONOMORPHIC roughly encodes this meaning. |
122 return PREMONOMORPHIC; | 103 return PREMONOMORPHIC; |
123 } | 104 } |
124 | 105 |
125 | 106 |
126 bool TypeFeedbackOracle::StoreIsUninitialized(TypeFeedbackId ast_id) { | 107 bool TypeFeedbackOracle::StoreIsUninitialized(TypeFeedbackId ast_id) { |
127 Handle<Object> maybe_code = GetInfo(ast_id); | 108 Handle<Object> maybe_code = GetInfo(ast_id); |
128 if (!maybe_code->IsCode()) return false; | 109 if (!maybe_code->IsCode()) return false; |
129 Handle<Code> code = Handle<Code>::cast(maybe_code); | 110 Handle<Code> code = Handle<Code>::cast(maybe_code); |
130 return code->ic_state() == UNINITIALIZED; | 111 return code->ic_state() == UNINITIALIZED; |
131 } | 112 } |
132 | 113 |
133 | 114 |
134 bool TypeFeedbackOracle::StoreIsUninitialized(FeedbackVectorICSlot slot) { | 115 bool TypeFeedbackOracle::StoreIsUninitialized(FeedbackVectorSlot slot) { |
135 if (!slot.IsInvalid()) { | 116 if (!slot.IsInvalid()) { |
136 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); | 117 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); |
137 if (kind == FeedbackVectorSlotKind::STORE_IC) { | 118 if (kind == FeedbackVectorSlotKind::STORE_IC) { |
138 StoreICNexus nexus(feedback_vector_, slot); | 119 StoreICNexus nexus(feedback_vector_, slot); |
139 return nexus.StateFromFeedback() == UNINITIALIZED; | 120 return nexus.StateFromFeedback() == UNINITIALIZED; |
140 } else if (kind == FeedbackVectorSlotKind::KEYED_STORE_IC) { | 121 } else if (kind == FeedbackVectorSlotKind::KEYED_STORE_IC) { |
141 KeyedStoreICNexus nexus(feedback_vector_, slot); | 122 KeyedStoreICNexus nexus(feedback_vector_, slot); |
142 return nexus.StateFromFeedback() == UNINITIALIZED; | 123 return nexus.StateFromFeedback() == UNINITIALIZED; |
143 } | 124 } |
144 } | 125 } |
145 return true; | 126 return true; |
146 } | 127 } |
147 | 128 |
148 | 129 |
149 bool TypeFeedbackOracle::CallIsUninitialized(FeedbackVectorICSlot slot) { | 130 bool TypeFeedbackOracle::CallIsUninitialized(FeedbackVectorSlot slot) { |
150 Handle<Object> value = GetInfo(slot); | 131 Handle<Object> value = GetInfo(slot); |
151 return value->IsUndefined() || | 132 return value->IsUndefined() || |
152 value.is_identical_to( | 133 value.is_identical_to( |
153 TypeFeedbackVector::UninitializedSentinel(isolate())); | 134 TypeFeedbackVector::UninitializedSentinel(isolate())); |
154 } | 135 } |
155 | 136 |
156 | 137 |
157 bool TypeFeedbackOracle::CallIsMonomorphic(FeedbackVectorICSlot slot) { | 138 bool TypeFeedbackOracle::CallIsMonomorphic(FeedbackVectorSlot slot) { |
158 Handle<Object> value = GetInfo(slot); | 139 Handle<Object> value = GetInfo(slot); |
159 return value->IsAllocationSite() || value->IsJSFunction(); | 140 return value->IsAllocationSite() || value->IsJSFunction(); |
160 } | 141 } |
161 | 142 |
162 | 143 |
163 bool TypeFeedbackOracle::CallNewIsMonomorphic(FeedbackVectorSlot slot) { | 144 bool TypeFeedbackOracle::CallNewIsMonomorphic(FeedbackVectorSlot slot) { |
164 Handle<Object> info = GetInfo(slot); | 145 Handle<Object> info = GetInfo(slot); |
165 return info->IsAllocationSite() || info->IsJSFunction(); | 146 return info->IsAllocationSite() || info->IsJSFunction(); |
166 } | 147 } |
167 | 148 |
(...skipping 19 matching lines...) Expand all Loading... |
187 *key_type = KeyedStoreIC::GetKeyType(extra_ic_state); | 168 *key_type = KeyedStoreIC::GetKeyType(extra_ic_state); |
188 return; | 169 return; |
189 } | 170 } |
190 } | 171 } |
191 *store_mode = STANDARD_STORE; | 172 *store_mode = STANDARD_STORE; |
192 *key_type = ELEMENT; | 173 *key_type = ELEMENT; |
193 } | 174 } |
194 | 175 |
195 | 176 |
196 void TypeFeedbackOracle::GetStoreModeAndKeyType( | 177 void TypeFeedbackOracle::GetStoreModeAndKeyType( |
197 FeedbackVectorICSlot slot, KeyedAccessStoreMode* store_mode, | 178 FeedbackVectorSlot slot, KeyedAccessStoreMode* store_mode, |
198 IcCheckType* key_type) { | 179 IcCheckType* key_type) { |
199 if (!slot.IsInvalid() && | 180 if (!slot.IsInvalid() && |
200 feedback_vector_->GetKind(slot) == | 181 feedback_vector_->GetKind(slot) == |
201 FeedbackVectorSlotKind::KEYED_STORE_IC) { | 182 FeedbackVectorSlotKind::KEYED_STORE_IC) { |
202 KeyedStoreICNexus nexus(feedback_vector_, slot); | 183 KeyedStoreICNexus nexus(feedback_vector_, slot); |
203 *store_mode = nexus.GetKeyedAccessStoreMode(); | 184 *store_mode = nexus.GetKeyedAccessStoreMode(); |
204 *key_type = nexus.GetKeyType(); | 185 *key_type = nexus.GetKeyType(); |
205 } else { | 186 } else { |
206 *store_mode = STANDARD_STORE; | 187 *store_mode = STANDARD_STORE; |
207 *key_type = ELEMENT; | 188 *key_type = ELEMENT; |
208 } | 189 } |
209 } | 190 } |
210 | 191 |
211 | 192 |
212 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget( | 193 Handle<JSFunction> TypeFeedbackOracle::GetCallTarget(FeedbackVectorSlot slot) { |
213 FeedbackVectorICSlot slot) { | |
214 Handle<Object> info = GetInfo(slot); | 194 Handle<Object> info = GetInfo(slot); |
215 if (info->IsAllocationSite()) { | 195 if (info->IsAllocationSite()) { |
216 return Handle<JSFunction>(isolate()->native_context()->array_function()); | 196 return Handle<JSFunction>(isolate()->native_context()->array_function()); |
217 } | 197 } |
218 | 198 |
219 return Handle<JSFunction>::cast(info); | 199 return Handle<JSFunction>::cast(info); |
220 } | 200 } |
221 | 201 |
222 | 202 |
223 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget( | 203 Handle<JSFunction> TypeFeedbackOracle::GetCallNewTarget( |
224 FeedbackVectorSlot slot) { | 204 FeedbackVectorSlot slot) { |
225 Handle<Object> info = GetInfo(slot); | 205 Handle<Object> info = GetInfo(slot); |
226 if (info->IsJSFunction()) { | 206 if (info->IsJSFunction()) { |
227 return Handle<JSFunction>::cast(info); | 207 return Handle<JSFunction>::cast(info); |
228 } | 208 } |
229 | 209 |
230 DCHECK(info->IsAllocationSite()); | 210 DCHECK(info->IsAllocationSite()); |
231 return Handle<JSFunction>(isolate()->native_context()->array_function()); | 211 return Handle<JSFunction>(isolate()->native_context()->array_function()); |
232 } | 212 } |
233 | 213 |
234 | 214 |
235 Handle<AllocationSite> TypeFeedbackOracle::GetCallAllocationSite( | 215 Handle<AllocationSite> TypeFeedbackOracle::GetCallAllocationSite( |
236 FeedbackVectorICSlot slot) { | 216 FeedbackVectorSlot slot) { |
237 Handle<Object> info = GetInfo(slot); | 217 Handle<Object> info = GetInfo(slot); |
238 if (info->IsAllocationSite()) { | 218 if (info->IsAllocationSite()) { |
239 return Handle<AllocationSite>::cast(info); | 219 return Handle<AllocationSite>::cast(info); |
240 } | 220 } |
241 return Handle<AllocationSite>::null(); | 221 return Handle<AllocationSite>::null(); |
242 } | 222 } |
243 | 223 |
244 | 224 |
245 Handle<AllocationSite> TypeFeedbackOracle::GetCallNewAllocationSite( | 225 Handle<AllocationSite> TypeFeedbackOracle::GetCallNewAllocationSite( |
246 FeedbackVectorSlot slot) { | 226 FeedbackVectorSlot slot) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 316 |
337 bool TypeFeedbackOracle::HasOnlyStringMaps(SmallMapList* receiver_types) { | 317 bool TypeFeedbackOracle::HasOnlyStringMaps(SmallMapList* receiver_types) { |
338 bool all_strings = receiver_types->length() > 0; | 318 bool all_strings = receiver_types->length() > 0; |
339 for (int i = 0; i < receiver_types->length(); i++) { | 319 for (int i = 0; i < receiver_types->length(); i++) { |
340 all_strings &= receiver_types->at(i)->IsStringMap(); | 320 all_strings &= receiver_types->at(i)->IsStringMap(); |
341 } | 321 } |
342 return all_strings; | 322 return all_strings; |
343 } | 323 } |
344 | 324 |
345 | 325 |
346 void TypeFeedbackOracle::PropertyReceiverTypes(FeedbackVectorICSlot slot, | 326 void TypeFeedbackOracle::PropertyReceiverTypes(FeedbackVectorSlot slot, |
347 Handle<Name> name, | 327 Handle<Name> name, |
348 SmallMapList* receiver_types) { | 328 SmallMapList* receiver_types) { |
349 receiver_types->Clear(); | 329 receiver_types->Clear(); |
350 if (!slot.IsInvalid()) { | 330 if (!slot.IsInvalid()) { |
351 LoadICNexus nexus(feedback_vector_, slot); | 331 LoadICNexus nexus(feedback_vector_, slot); |
352 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); | 332 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); |
353 CollectReceiverTypes(&nexus, name, flags, receiver_types); | 333 CollectReceiverTypes(&nexus, name, flags, receiver_types); |
354 } | 334 } |
355 } | 335 } |
356 | 336 |
357 | 337 |
358 void TypeFeedbackOracle::KeyedPropertyReceiverTypes( | 338 void TypeFeedbackOracle::KeyedPropertyReceiverTypes( |
359 FeedbackVectorICSlot slot, SmallMapList* receiver_types, bool* is_string, | 339 FeedbackVectorSlot slot, SmallMapList* receiver_types, bool* is_string, |
360 IcCheckType* key_type) { | 340 IcCheckType* key_type) { |
361 receiver_types->Clear(); | 341 receiver_types->Clear(); |
362 if (slot.IsInvalid()) { | 342 if (slot.IsInvalid()) { |
363 *is_string = false; | 343 *is_string = false; |
364 *key_type = ELEMENT; | 344 *key_type = ELEMENT; |
365 } else { | 345 } else { |
366 KeyedLoadICNexus nexus(feedback_vector_, slot); | 346 KeyedLoadICNexus nexus(feedback_vector_, slot); |
367 CollectReceiverTypes<FeedbackNexus>(&nexus, receiver_types); | 347 CollectReceiverTypes<FeedbackNexus>(&nexus, receiver_types); |
368 *is_string = HasOnlyStringMaps(receiver_types); | 348 *is_string = HasOnlyStringMaps(receiver_types); |
369 *key_type = nexus.FindFirstName() != NULL ? PROPERTY : ELEMENT; | 349 *key_type = nexus.FindFirstName() != NULL ? PROPERTY : ELEMENT; |
370 } | 350 } |
371 } | 351 } |
372 | 352 |
373 | 353 |
374 void TypeFeedbackOracle::AssignmentReceiverTypes(TypeFeedbackId id, | 354 void TypeFeedbackOracle::AssignmentReceiverTypes(TypeFeedbackId id, |
375 Handle<Name> name, | 355 Handle<Name> name, |
376 SmallMapList* receiver_types) { | 356 SmallMapList* receiver_types) { |
377 receiver_types->Clear(); | 357 receiver_types->Clear(); |
378 Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC); | 358 Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC); |
379 CollectReceiverTypes(id, name, flags, receiver_types); | 359 CollectReceiverTypes(id, name, flags, receiver_types); |
380 } | 360 } |
381 | 361 |
382 | 362 |
383 void TypeFeedbackOracle::AssignmentReceiverTypes(FeedbackVectorICSlot slot, | 363 void TypeFeedbackOracle::AssignmentReceiverTypes(FeedbackVectorSlot slot, |
384 Handle<Name> name, | 364 Handle<Name> name, |
385 SmallMapList* receiver_types) { | 365 SmallMapList* receiver_types) { |
386 receiver_types->Clear(); | 366 receiver_types->Clear(); |
387 Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC); | 367 Code::Flags flags = Code::ComputeHandlerFlags(Code::STORE_IC); |
388 CollectReceiverTypes(slot, name, flags, receiver_types); | 368 CollectReceiverTypes(slot, name, flags, receiver_types); |
389 } | 369 } |
390 | 370 |
391 | 371 |
392 void TypeFeedbackOracle::KeyedAssignmentReceiverTypes( | 372 void TypeFeedbackOracle::KeyedAssignmentReceiverTypes( |
393 TypeFeedbackId id, SmallMapList* receiver_types, | 373 TypeFeedbackId id, SmallMapList* receiver_types, |
394 KeyedAccessStoreMode* store_mode, IcCheckType* key_type) { | 374 KeyedAccessStoreMode* store_mode, IcCheckType* key_type) { |
395 receiver_types->Clear(); | 375 receiver_types->Clear(); |
396 CollectReceiverTypes(id, receiver_types); | 376 CollectReceiverTypes(id, receiver_types); |
397 GetStoreModeAndKeyType(id, store_mode, key_type); | 377 GetStoreModeAndKeyType(id, store_mode, key_type); |
398 } | 378 } |
399 | 379 |
400 | 380 |
401 void TypeFeedbackOracle::KeyedAssignmentReceiverTypes( | 381 void TypeFeedbackOracle::KeyedAssignmentReceiverTypes( |
402 FeedbackVectorICSlot slot, SmallMapList* receiver_types, | 382 FeedbackVectorSlot slot, SmallMapList* receiver_types, |
403 KeyedAccessStoreMode* store_mode, IcCheckType* key_type) { | 383 KeyedAccessStoreMode* store_mode, IcCheckType* key_type) { |
404 receiver_types->Clear(); | 384 receiver_types->Clear(); |
405 CollectReceiverTypes(slot, receiver_types); | 385 CollectReceiverTypes(slot, receiver_types); |
406 GetStoreModeAndKeyType(slot, store_mode, key_type); | 386 GetStoreModeAndKeyType(slot, store_mode, key_type); |
407 } | 387 } |
408 | 388 |
409 | 389 |
410 void TypeFeedbackOracle::CountReceiverTypes(TypeFeedbackId id, | 390 void TypeFeedbackOracle::CountReceiverTypes(TypeFeedbackId id, |
411 SmallMapList* receiver_types) { | 391 SmallMapList* receiver_types) { |
412 receiver_types->Clear(); | 392 receiver_types->Clear(); |
413 CollectReceiverTypes(id, receiver_types); | 393 CollectReceiverTypes(id, receiver_types); |
414 } | 394 } |
415 | 395 |
416 | 396 |
417 void TypeFeedbackOracle::CountReceiverTypes(FeedbackVectorICSlot slot, | 397 void TypeFeedbackOracle::CountReceiverTypes(FeedbackVectorSlot slot, |
418 SmallMapList* receiver_types) { | 398 SmallMapList* receiver_types) { |
419 receiver_types->Clear(); | 399 receiver_types->Clear(); |
420 if (!slot.IsInvalid()) CollectReceiverTypes(slot, receiver_types); | 400 if (!slot.IsInvalid()) CollectReceiverTypes(slot, receiver_types); |
421 } | 401 } |
422 | 402 |
423 | 403 |
424 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorICSlot slot, | 404 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorSlot slot, |
425 Handle<Name> name, | 405 Handle<Name> name, |
426 Code::Flags flags, | 406 Code::Flags flags, |
427 SmallMapList* types) { | 407 SmallMapList* types) { |
428 StoreICNexus nexus(feedback_vector_, slot); | 408 StoreICNexus nexus(feedback_vector_, slot); |
429 CollectReceiverTypes<FeedbackNexus>(&nexus, name, flags, types); | 409 CollectReceiverTypes<FeedbackNexus>(&nexus, name, flags, types); |
430 } | 410 } |
431 | 411 |
432 | 412 |
433 void TypeFeedbackOracle::CollectReceiverTypes(TypeFeedbackId ast_id, | 413 void TypeFeedbackOracle::CollectReceiverTypes(TypeFeedbackId ast_id, |
434 Handle<Name> name, | 414 Handle<Name> name, |
(...skipping 25 matching lines...) Expand all Loading... |
460 | 440 |
461 void TypeFeedbackOracle::CollectReceiverTypes(TypeFeedbackId ast_id, | 441 void TypeFeedbackOracle::CollectReceiverTypes(TypeFeedbackId ast_id, |
462 SmallMapList* types) { | 442 SmallMapList* types) { |
463 Handle<Object> object = GetInfo(ast_id); | 443 Handle<Object> object = GetInfo(ast_id); |
464 if (!object->IsCode()) return; | 444 if (!object->IsCode()) return; |
465 Handle<Code> code = Handle<Code>::cast(object); | 445 Handle<Code> code = Handle<Code>::cast(object); |
466 CollectReceiverTypes<Code>(*code, types); | 446 CollectReceiverTypes<Code>(*code, types); |
467 } | 447 } |
468 | 448 |
469 | 449 |
470 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorICSlot slot, | 450 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorSlot slot, |
471 SmallMapList* types) { | 451 SmallMapList* types) { |
472 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); | 452 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); |
473 if (kind == FeedbackVectorSlotKind::STORE_IC) { | 453 if (kind == FeedbackVectorSlotKind::STORE_IC) { |
474 StoreICNexus nexus(feedback_vector_, slot); | 454 StoreICNexus nexus(feedback_vector_, slot); |
475 CollectReceiverTypes<FeedbackNexus>(&nexus, types); | 455 CollectReceiverTypes<FeedbackNexus>(&nexus, types); |
476 } else { | 456 } else { |
477 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, kind); | 457 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, kind); |
478 KeyedStoreICNexus nexus(feedback_vector_, slot); | 458 KeyedStoreICNexus nexus(feedback_vector_, slot); |
479 CollectReceiverTypes<FeedbackNexus>(&nexus, types); | 459 CollectReceiverTypes<FeedbackNexus>(&nexus, types); |
480 } | 460 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 // Dictionary has been allocated with sufficient size for all elements. | 566 // Dictionary has been allocated with sufficient size for all elements. |
587 DisallowHeapAllocation no_need_to_resize_dictionary; | 567 DisallowHeapAllocation no_need_to_resize_dictionary; |
588 HandleScope scope(isolate()); | 568 HandleScope scope(isolate()); |
589 USE(UnseededNumberDictionary::AtNumberPut( | 569 USE(UnseededNumberDictionary::AtNumberPut( |
590 dictionary_, IdToKey(ast_id), handle(target, isolate()))); | 570 dictionary_, IdToKey(ast_id), handle(target, isolate()))); |
591 } | 571 } |
592 | 572 |
593 | 573 |
594 } // namespace internal | 574 } // namespace internal |
595 } // namespace v8 | 575 } // namespace v8 |
OLD | NEW |