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

Side by Side Diff: src/ic.cc

Issue 25001005: Cleanup in IC patching. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | « no previous file | src/objects.h » ('j') | 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 intptr_t delta = 175 intptr_t delta =
176 original_code->instruction_start() - code->instruction_start(); 176 original_code->instruction_start() - code->instruction_start();
177 return addr + delta; 177 return addr + delta;
178 } 178 }
179 #endif 179 #endif
180 180
181 181
182 static bool TryRemoveInvalidPrototypeDependentStub(Code* target, 182 static bool TryRemoveInvalidPrototypeDependentStub(Code* target,
183 Object* receiver, 183 Object* receiver,
184 Object* name) { 184 Object* name) {
185 if (target->is_keyed_load_stub() || 185 if (target->is_keyed_stub()) {
186 target->is_keyed_call_stub() ||
187 target->is_keyed_store_stub()) {
188 // Determine whether the failure is due to a name failure. 186 // Determine whether the failure is due to a name failure.
189 if (!name->IsName()) return false; 187 if (!name->IsName()) return false;
190 Name* stub_name = target->FindFirstName(); 188 Name* stub_name = target->FindFirstName();
191 if (Name::cast(name) != stub_name) return false; 189 if (Name::cast(name) != stub_name) return false;
192 } 190 }
193 191
194 InlineCacheHolderFlag cache_holder = 192 InlineCacheHolderFlag cache_holder =
195 Code::ExtractCacheHolderFromFlags(target->flags()); 193 Code::ExtractCacheHolderFromFlags(target->flags());
196 194
197 Isolate* isolate = target->GetIsolate(); 195 Isolate* isolate = target->GetIsolate();
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 Handle<HeapObject> receiver, 1093 Handle<HeapObject> receiver,
1096 Handle<String> name, 1094 Handle<String> name,
1097 Handle<Code> code) { 1095 Handle<Code> code) {
1098 switch (state) { 1096 switch (state) {
1099 case UNINITIALIZED: 1097 case UNINITIALIZED:
1100 case PREMONOMORPHIC: 1098 case PREMONOMORPHIC:
1101 case MONOMORPHIC_PROTOTYPE_FAILURE: 1099 case MONOMORPHIC_PROTOTYPE_FAILURE:
1102 UpdateMonomorphicIC(receiver, code, name); 1100 UpdateMonomorphicIC(receiver, code, name);
1103 break; 1101 break;
1104 case MONOMORPHIC: 1102 case MONOMORPHIC:
1105 // Only move to megamorphic if the target changes. 1103 ASSERT(target() != *code);
1106 if (target() != *code) { 1104 if (!target()->is_keyed_stub()) {
ulan 2013/09/30 07:57:46 I don't see why (!target()->is_keyed_stub()) equiv
Toon Verwaest 2013/09/30 08:21:08 That's exactly the point. Currently this code is o
1107 if (target()->is_load_stub() || target()->is_store_stub()) { 1105 bool is_same_handler = false;
1108 bool is_same_handler = false; 1106 {
1109 { 1107 DisallowHeapAllocation no_allocation;
1110 DisallowHeapAllocation no_allocation; 1108 Code* old_handler = target()->FindFirstHandler();
1111 Code* old_handler = target()->FindFirstHandler(); 1109 is_same_handler = old_handler == *code;
1112 is_same_handler = old_handler == *code; 1110 }
1113 } 1111 if (is_same_handler
1114 if (is_same_handler 1112 && IsTransitionedMapOfMonomorphicTarget(receiver->map())) {
1115 && IsTransitionedMapOfMonomorphicTarget(receiver->map())) { 1113 UpdateMonomorphicIC(receiver, code, name);
1116 UpdateMonomorphicIC(receiver, code, name); 1114 break;
1117 break; 1115 }
1118 } 1116 if (UpdatePolymorphicIC(state, receiver, name, code)) {
1119 if (UpdatePolymorphicIC(state, receiver, name, code)) { 1117 break;
1120 break;
1121 }
1122
1123 CopyICToMegamorphicCache(name);
1124 } 1118 }
1125 1119
1126 UpdateMegamorphicCache(receiver->map(), *name, *code); 1120 CopyICToMegamorphicCache(name);
1127 set_target(*megamorphic_stub());
1128 } 1121 }
1122
1123 UpdateMegamorphicCache(receiver->map(), *name, *code);
1124 set_target(*megamorphic_stub());
1129 break; 1125 break;
1130 case MEGAMORPHIC: 1126 case MEGAMORPHIC:
1131 UpdateMegamorphicCache(receiver->map(), *name, *code); 1127 UpdateMegamorphicCache(receiver->map(), *name, *code);
1132 break; 1128 break;
1133 case POLYMORPHIC: 1129 case POLYMORPHIC:
1134 if (target()->is_load_stub() || target()->is_store_stub()) { 1130 if (target()->is_keyed_stub()) {
1131 // When trying to patch a polymorphic keyed stub with anything other
1132 // than another polymorphic stub, go generic.
1133 set_target(*generic_stub());
1134 } else {
1135 if (UpdatePolymorphicIC(state, receiver, name, code)) { 1135 if (UpdatePolymorphicIC(state, receiver, name, code)) {
1136 break; 1136 break;
1137 } 1137 }
1138 CopyICToMegamorphicCache(name); 1138 CopyICToMegamorphicCache(name);
1139 UpdateMegamorphicCache(receiver->map(), *name, *code); 1139 UpdateMegamorphicCache(receiver->map(), *name, *code);
1140 set_target(*megamorphic_stub()); 1140 set_target(*megamorphic_stub());
1141 } else {
1142 // When trying to patch a polymorphic keyed load/store element stub
1143 // with anything other than another polymorphic stub, go generic.
1144 set_target(*generic_stub());
1145 } 1141 }
1146 break; 1142 break;
1147 case DEBUG_STUB: 1143 case DEBUG_STUB:
1148 break; 1144 break;
1149 case GENERIC: 1145 case GENERIC:
1150 UNREACHABLE(); 1146 UNREACHABLE();
1151 break; 1147 break;
1152 } 1148 }
1153 } 1149 }
1154 1150
(...skipping 1911 matching lines...) Expand 10 before | Expand all | Expand 10 after
3066 #undef ADDR 3062 #undef ADDR
3067 }; 3063 };
3068 3064
3069 3065
3070 Address IC::AddressFromUtilityId(IC::UtilityId id) { 3066 Address IC::AddressFromUtilityId(IC::UtilityId id) {
3071 return IC_utilities[id]; 3067 return IC_utilities[id];
3072 } 3068 }
3073 3069
3074 3070
3075 } } // namespace v8::internal 3071 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698