Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: src/type-info.cc

Issue 1865863003: Cleanup IC-related code (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/type-info.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ast.h" 7 #include "src/ast/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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 void TypeFeedbackOracle::KeyedPropertyReceiverTypes( 289 void TypeFeedbackOracle::KeyedPropertyReceiverTypes(
290 FeedbackVectorSlot slot, SmallMapList* receiver_types, bool* is_string, 290 FeedbackVectorSlot slot, SmallMapList* receiver_types, bool* is_string,
291 IcCheckType* key_type) { 291 IcCheckType* key_type) {
292 receiver_types->Clear(); 292 receiver_types->Clear();
293 if (slot.IsInvalid()) { 293 if (slot.IsInvalid()) {
294 *is_string = false; 294 *is_string = false;
295 *key_type = ELEMENT; 295 *key_type = ELEMENT;
296 } else { 296 } else {
297 KeyedLoadICNexus nexus(feedback_vector_, slot); 297 KeyedLoadICNexus nexus(feedback_vector_, slot);
298 CollectReceiverTypes<FeedbackNexus>(&nexus, receiver_types); 298 CollectReceiverTypes(&nexus, receiver_types);
299 *is_string = HasOnlyStringMaps(receiver_types); 299 *is_string = HasOnlyStringMaps(receiver_types);
300 *key_type = nexus.FindFirstName() != NULL ? PROPERTY : ELEMENT; 300 *key_type = nexus.FindFirstName() != NULL ? PROPERTY : ELEMENT;
301 } 301 }
302 } 302 }
303 303
304 304
305 void TypeFeedbackOracle::AssignmentReceiverTypes(FeedbackVectorSlot slot, 305 void TypeFeedbackOracle::AssignmentReceiverTypes(FeedbackVectorSlot slot,
306 Handle<Name> name, 306 Handle<Name> name,
307 SmallMapList* receiver_types) { 307 SmallMapList* receiver_types) {
308 receiver_types->Clear(); 308 receiver_types->Clear();
(...skipping 16 matching lines...) Expand all
325 receiver_types->Clear(); 325 receiver_types->Clear();
326 if (!slot.IsInvalid()) CollectReceiverTypes(slot, receiver_types); 326 if (!slot.IsInvalid()) CollectReceiverTypes(slot, receiver_types);
327 } 327 }
328 328
329 329
330 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorSlot slot, 330 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorSlot slot,
331 Handle<Name> name, 331 Handle<Name> name,
332 Code::Flags flags, 332 Code::Flags flags,
333 SmallMapList* types) { 333 SmallMapList* types) {
334 StoreICNexus nexus(feedback_vector_, slot); 334 StoreICNexus nexus(feedback_vector_, slot);
335 CollectReceiverTypes<FeedbackNexus>(&nexus, name, flags, types); 335 CollectReceiverTypes(&nexus, name, flags, types);
336 } 336 }
337 337
338 338 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackNexus* nexus,
339 template <class T> 339 Handle<Name> name,
340 void TypeFeedbackOracle::CollectReceiverTypes(T* obj, Handle<Name> name,
341 Code::Flags flags, 340 Code::Flags flags,
342 SmallMapList* types) { 341 SmallMapList* types) {
343 if (FLAG_collect_megamorphic_maps_from_stub_cache && 342 if (FLAG_collect_megamorphic_maps_from_stub_cache &&
344 obj->ic_state() == MEGAMORPHIC) { 343 nexus->ic_state() == MEGAMORPHIC) {
345 types->Reserve(4, zone()); 344 types->Reserve(4, zone());
346 isolate()->stub_cache()->CollectMatchingMaps( 345 isolate()->stub_cache()->CollectMatchingMaps(
347 types, name, flags, native_context_, zone()); 346 types, name, flags, native_context_, zone());
348 } else { 347 } else {
349 CollectReceiverTypes<T>(obj, types); 348 CollectReceiverTypes(nexus, types);
350 } 349 }
351 } 350 }
352 351
353 352
354 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorSlot slot, 353 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorSlot slot,
355 SmallMapList* types) { 354 SmallMapList* types) {
356 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); 355 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot);
357 if (kind == FeedbackVectorSlotKind::STORE_IC) { 356 if (kind == FeedbackVectorSlotKind::STORE_IC) {
358 StoreICNexus nexus(feedback_vector_, slot); 357 StoreICNexus nexus(feedback_vector_, slot);
359 CollectReceiverTypes<FeedbackNexus>(&nexus, types); 358 CollectReceiverTypes(&nexus, types);
360 } else { 359 } else {
361 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, kind); 360 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, kind);
362 KeyedStoreICNexus nexus(feedback_vector_, slot); 361 KeyedStoreICNexus nexus(feedback_vector_, slot);
363 CollectReceiverTypes<FeedbackNexus>(&nexus, types); 362 CollectReceiverTypes(&nexus, types);
364 } 363 }
365 } 364 }
366 365
367 366 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackNexus* nexus,
368 template <class T> 367 SmallMapList* types) {
369 void TypeFeedbackOracle::CollectReceiverTypes(T* obj, SmallMapList* types) {
370 MapHandleList maps; 368 MapHandleList maps;
371 if (obj->ic_state() == MONOMORPHIC) { 369 if (nexus->ic_state() == MONOMORPHIC) {
372 Map* map = obj->FindFirstMap(); 370 Map* map = nexus->FindFirstMap();
373 if (map != NULL) maps.Add(handle(map)); 371 if (map != NULL) maps.Add(handle(map));
374 } else if (obj->ic_state() == POLYMORPHIC) { 372 } else if (nexus->ic_state() == POLYMORPHIC) {
375 obj->FindAllMaps(&maps); 373 nexus->FindAllMaps(&maps);
376 } else { 374 } else {
377 return; 375 return;
378 } 376 }
379 types->Reserve(maps.length(), zone()); 377 types->Reserve(maps.length(), zone());
380 for (int i = 0; i < maps.length(); i++) { 378 for (int i = 0; i < maps.length(); i++) {
381 Handle<Map> map(maps.at(i)); 379 Handle<Map> map(maps.at(i));
382 if (IsRelevantFeedback(*map, *native_context_)) { 380 if (IsRelevantFeedback(*map, *native_context_)) {
383 types->AddMapIfMissing(maps.at(i), zone()); 381 types->AddMapIfMissing(maps.at(i), zone());
384 } 382 }
385 } 383 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 // Dictionary has been allocated with sufficient size for all elements. 467 // Dictionary has been allocated with sufficient size for all elements.
470 DisallowHeapAllocation no_need_to_resize_dictionary; 468 DisallowHeapAllocation no_need_to_resize_dictionary;
471 HandleScope scope(isolate()); 469 HandleScope scope(isolate());
472 USE(UnseededNumberDictionary::AtNumberPut( 470 USE(UnseededNumberDictionary::AtNumberPut(
473 dictionary_, IdToKey(ast_id), handle(target, isolate()))); 471 dictionary_, IdToKey(ast_id), handle(target, isolate())));
474 } 472 }
475 473
476 474
477 } // namespace internal 475 } // namespace internal
478 } // namespace v8 476 } // namespace v8
OLDNEW
« no previous file with comments | « src/type-info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698