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

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

Issue 8354003: Handle keyed stores after elements transition monomorphically if possible (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 } else if (object->IsMap()) { 416 } else if (object->IsMap()) {
417 types->Add(Handle<Map>::cast(object)); 417 types->Add(Handle<Map>::cast(object));
418 } else if (Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC) { 418 } else if (Handle<Code>::cast(object)->ic_state() == MEGAMORPHIC) {
419 types->Reserve(4); 419 types->Reserve(4);
420 ASSERT(object->IsCode()); 420 ASSERT(object->IsCode());
421 isolate_->stub_cache()->CollectMatchingMaps(types, *name, flags); 421 isolate_->stub_cache()->CollectMatchingMaps(types, *name, flags);
422 } 422 }
423 } 423 }
424 424
425 425
426 static void AddMapIfMissing(Handle<Map> map, SmallMapList* list) {
427 for (int i = 0; i < list->length(); ++i) {
428 if (list->at(i).is_identical_to(map)) return;
429 }
430 list->Add(map);
431 }
432
433
426 void TypeFeedbackOracle::CollectKeyedReceiverTypes(unsigned ast_id, 434 void TypeFeedbackOracle::CollectKeyedReceiverTypes(unsigned ast_id,
427 SmallMapList* types) { 435 SmallMapList* types) {
428 Handle<Object> object = GetInfo(ast_id); 436 Handle<Object> object = GetInfo(ast_id);
429 if (!object->IsCode()) return; 437 if (!object->IsCode()) return;
430 Handle<Code> code = Handle<Code>::cast(object); 438 Handle<Code> code = Handle<Code>::cast(object);
431 if (code->kind() == Code::KEYED_LOAD_IC || 439 if (code->kind() == Code::KEYED_LOAD_IC ||
432 code->kind() == Code::KEYED_STORE_IC) { 440 code->kind() == Code::KEYED_STORE_IC) {
433 AssertNoAllocation no_allocation; 441 AssertNoAllocation no_allocation;
434 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); 442 int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
435 for (RelocIterator it(*code, mask); !it.done(); it.next()) { 443 for (RelocIterator it(*code, mask); !it.done(); it.next()) {
436 RelocInfo* info = it.rinfo(); 444 RelocInfo* info = it.rinfo();
437 Object* object = info->target_object(); 445 Object* object = info->target_object();
438 if (object->IsMap()) { 446 if (object->IsMap()) {
439 types->Add(Handle<Map>(Map::cast(object))); 447 AddMapIfMissing(Handle<Map>(Map::cast(object)), types);
440 } 448 }
441 } 449 }
442 } 450 }
443 } 451 }
444 452
445 453
446 byte TypeFeedbackOracle::ToBooleanTypes(unsigned ast_id) { 454 byte TypeFeedbackOracle::ToBooleanTypes(unsigned ast_id) {
447 Handle<Object> object = GetInfo(ast_id); 455 Handle<Object> object = GetInfo(ast_id);
448 return object->IsCode() ? Handle<Code>::cast(object)->to_boolean_state() : 0; 456 return object->IsCode() ? Handle<Code>::cast(object)->to_boolean_state() : 0;
449 } 457 }
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 USE(maybe_result); 569 USE(maybe_result);
562 #ifdef DEBUG 570 #ifdef DEBUG
563 Object* result = NULL; 571 Object* result = NULL;
564 // Dictionary has been allocated with sufficient size for all elements. 572 // Dictionary has been allocated with sufficient size for all elements.
565 ASSERT(maybe_result->ToObject(&result)); 573 ASSERT(maybe_result->ToObject(&result));
566 ASSERT(*dictionary_ == result); 574 ASSERT(*dictionary_ == result);
567 #endif 575 #endif
568 } 576 }
569 577
570 } } // namespace v8::internal 578 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698