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

Side by Side Diff: src/ic.cc

Issue 12088021: Only update POLYMORPHIC stubs using other POLYMORPHIC or GENERIC stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed nit Created 7 years, 10 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/ic.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 // 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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 switch (state) { 746 switch (state) {
747 case UNINITIALIZED: 747 case UNINITIALIZED:
748 case MONOMORPHIC_PROTOTYPE_FAILURE: 748 case MONOMORPHIC_PROTOTYPE_FAILURE:
749 case PREMONOMORPHIC: 749 case PREMONOMORPHIC:
750 set_target(*code); 750 set_target(*code);
751 break; 751 break;
752 case MONOMORPHIC: 752 case MONOMORPHIC:
753 if (code->ic_state() != MONOMORPHIC) { 753 if (code->ic_state() != MONOMORPHIC) {
754 Map* map = target()->FindFirstMap(); 754 Map* map = target()->FindFirstMap();
755 if (map != NULL) { 755 if (map != NULL) {
756 isolate()->stub_cache()->Set(*name, map, target()); 756 UpdateMegamorphicCache(map, *name, target());
757 } 757 }
758 } 758 }
759 set_target(*code); 759 set_target(*code);
760 break; 760 break;
761 case MEGAMORPHIC: { 761 case MEGAMORPHIC: {
762 // Cache code holding map should be consistent with 762 // Cache code holding map should be consistent with
763 // GenerateMonomorphicCacheProbe. It is not the map which holds the stub. 763 // GenerateMonomorphicCacheProbe. It is not the map which holds the stub.
764 Handle<JSObject> cache_object = object->IsJSObject() 764 Handle<JSObject> cache_object = object->IsJSObject()
765 ? Handle<JSObject>::cast(object) 765 ? Handle<JSObject>::cast(object)
766 : Handle<JSObject>(JSObject::cast(object->GetPrototype())); 766 : Handle<JSObject>(JSObject::cast(object->GetPrototype()));
767 // Update the stub cache. 767 // Update the stub cache.
768 isolate()->stub_cache()->Set(*name, cache_object->map(), *code); 768 UpdateMegamorphicCache(cache_object->map(), *name, *code);
769 break; 769 break;
770 } 770 }
771 case DEBUG_STUB: 771 case DEBUG_STUB:
772 break; 772 break;
773 case POLYMORPHIC: 773 case POLYMORPHIC:
774 case GENERIC: 774 case GENERIC:
775 UNREACHABLE(); 775 UNREACHABLE();
776 break; 776 break;
777 } 777 }
778 778
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 965
966 void IC::PatchCache(State state, 966 void IC::PatchCache(State state,
967 StrictModeFlag strict_mode, 967 StrictModeFlag strict_mode,
968 Handle<JSObject> receiver, 968 Handle<JSObject> receiver,
969 Handle<String> name, 969 Handle<String> name,
970 Handle<Code> code) { 970 Handle<Code> code) {
971 switch (state) { 971 switch (state) {
972 case UNINITIALIZED: 972 case UNINITIALIZED:
973 case PREMONOMORPHIC: 973 case PREMONOMORPHIC:
974 case MONOMORPHIC_PROTOTYPE_FAILURE: 974 case MONOMORPHIC_PROTOTYPE_FAILURE:
975 case POLYMORPHIC:
976 set_target(*code); 975 set_target(*code);
977 break; 976 break;
978 case MONOMORPHIC: 977 case MONOMORPHIC:
979 // Only move to megamorphic if the target changes. 978 // Only move to megamorphic if the target changes.
980 if (target() != *code) { 979 if (target() != *code) {
981 // We are transitioning from monomorphic to megamorphic case. 980 // We are transitioning from monomorphic to megamorphic case.
982 // Place the current monomorphic stub and stub compiled for 981 // Place the current monomorphic stub and stub compiled for
983 // the receiver into stub cache. 982 // the receiver into stub cache.
984 Map* map = target()->FindFirstMap(); 983 Map* map = target()->FindFirstMap();
985 if (map != NULL) { 984 if (map != NULL) {
986 UpdateMegamorphicCache(map, *name, target()); 985 UpdateMegamorphicCache(map, *name, target());
987 } 986 }
988 UpdateMegamorphicCache(receiver->map(), *name, *code); 987 UpdateMegamorphicCache(receiver->map(), *name, *code);
989 set_target((strict_mode == kStrictMode) 988 set_target((strict_mode == kStrictMode)
990 ? *megamorphic_stub_strict() 989 ? *megamorphic_stub_strict()
991 : *megamorphic_stub()); 990 : *megamorphic_stub());
992 } 991 }
993 break; 992 break;
994 case MEGAMORPHIC: 993 case MEGAMORPHIC:
995 // Update the stub cache. 994 // Update the stub cache.
996 UpdateMegamorphicCache(receiver->map(), *name, *code); 995 UpdateMegamorphicCache(receiver->map(), *name, *code);
997 break; 996 break;
997 case POLYMORPHIC:
998 // When trying to patch a polymorphic stub with anything other than
999 // another polymorphic stub, go generic.
1000 // TODO(verwaest): Currently we always go generic since no polymorphic
1001 // stubs enter this code path. Replace with proper updating once named
1002 // load/store can also be polymorphic.
1003 set_target((strict_mode == kStrictMode)
1004 ? *generic_stub_strict()
1005 : *generic_stub());
1006 break;
998 case GENERIC: 1007 case GENERIC:
999 case DEBUG_STUB: 1008 case DEBUG_STUB:
1000 break; 1009 break;
1001 } 1010 }
1002 } 1011 }
1003 1012
1004 1013
1005 void LoadIC::UpdateCaches(LookupResult* lookup, 1014 void LoadIC::UpdateCaches(LookupResult* lookup,
1006 State state, 1015 State state,
1007 Handle<Object> object, 1016 Handle<Object> object,
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after
2563 #undef ADDR 2572 #undef ADDR
2564 }; 2573 };
2565 2574
2566 2575
2567 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2576 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2568 return IC_utilities[id]; 2577 return IC_utilities[id];
2569 } 2578 }
2570 2579
2571 2580
2572 } } // namespace v8::internal 2581 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698