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

Side by Side Diff: src/ic.cc

Issue 2889: Only remove the code object that caused the monomorphic prototype... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 Map* map = GetCodeCacheMapForObject(receiver); 136 Map* map = GetCodeCacheMapForObject(receiver);
137 137
138 // Decide whether the inline cache failed because of changes to the 138 // Decide whether the inline cache failed because of changes to the
139 // receiver itself or changes to one of its prototypes. 139 // receiver itself or changes to one of its prototypes.
140 // 140 //
141 // If there are changes to the receiver itself, the map of the 141 // If there are changes to the receiver itself, the map of the
142 // receiver will have changed and the current target will not be in 142 // receiver will have changed and the current target will not be in
143 // the receiver map's code cache. Therefore, if the current target 143 // the receiver map's code cache. Therefore, if the current target
144 // is in the receiver map's code cache, the inline cache failed due 144 // is in the receiver map's code cache, the inline cache failed due
145 // to prototype check failure. 145 // to prototype check failure.
146 if (map->IncludedInCodeCache(target)) { 146 int index = map->IndexInCodeCache(target);
147 if (index >= 0) {
147 // For keyed load/store, the most likely cause of cache failure is 148 // For keyed load/store, the most likely cause of cache failure is
148 // that the key has changed. We do not distinguish between 149 // that the key has changed. We do not distinguish between
149 // prototype and non-prototype failures for keyed access. 150 // prototype and non-prototype failures for keyed access.
150 Code::Kind kind = target->kind(); 151 Code::Kind kind = target->kind();
151 if (kind == Code::KEYED_LOAD_IC || kind == Code::KEYED_STORE_IC) { 152 if (kind == Code::KEYED_LOAD_IC || kind == Code::KEYED_STORE_IC) {
152 return MONOMORPHIC; 153 return MONOMORPHIC;
153 } 154 }
154 155
155 // Clear the code cache for this map to avoid hitting the same 156 // Remove the target from the code cache to avoid hitting the same
156 // invalid stub again. It seems likely that most of the code in 157 // invalid stub again.
157 // the cache is invalid if one of the stubs is so we flush the 158 map->RemoveFromCodeCache(index);
158 // entire code cache.
159 map->ClearCodeCache();
160 159
161 return MONOMORPHIC_PROTOTYPE_FAILURE; 160 return MONOMORPHIC_PROTOTYPE_FAILURE;
162 } 161 }
163 162
164 // The builtins object is special. It only changes when JavaScript 163 // The builtins object is special. It only changes when JavaScript
165 // builtins are loaded lazily. It is important to keep inline 164 // builtins are loaded lazily. It is important to keep inline
166 // caches for the builtins object monomorphic. Therefore, if we get 165 // caches for the builtins object monomorphic. Therefore, if we get
167 // an inline cache miss for the builtins object after lazily loading 166 // an inline cache miss for the builtins object after lazily loading
168 // JavaScript builtins, we clear the code cache and return 167 // JavaScript builtins, we clear the code cache and return
169 // uninitialized as the state to force the inline cache back to 168 // uninitialized as the state to force the inline cache back to
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 #undef ADDR 1155 #undef ADDR
1157 }; 1156 };
1158 1157
1159 1158
1160 Address IC::AddressFromUtilityId(IC::UtilityId id) { 1159 Address IC::AddressFromUtilityId(IC::UtilityId id) {
1161 return IC_utilities[id]; 1160 return IC_utilities[id];
1162 } 1161 }
1163 1162
1164 1163
1165 } } // namespace v8::internal 1164 } } // 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