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

Side by Side Diff: src/ic.cc

Issue 12319144: Avoid TLS accesses in Object::Lookup and Object::GetPrototype. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Simplified Object::GetPrototype a bit Created 7 years, 9 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') | src/ic-inl.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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 #endif 168 #endif
169 169
170 170
171 static bool TryRemoveInvalidPrototypeDependentStub(Code* target, 171 static bool TryRemoveInvalidPrototypeDependentStub(Code* target,
172 Object* receiver, 172 Object* receiver,
173 Object* name) { 173 Object* name) {
174 InlineCacheHolderFlag cache_holder = 174 InlineCacheHolderFlag cache_holder =
175 Code::ExtractCacheHolderFromFlags(target->flags()); 175 Code::ExtractCacheHolderFromFlags(target->flags());
176 176
177 Isolate* isolate = target->GetIsolate();
177 if (cache_holder == OWN_MAP && !receiver->IsJSObject()) { 178 if (cache_holder == OWN_MAP && !receiver->IsJSObject()) {
178 // The stub was generated for JSObject but called for non-JSObject. 179 // The stub was generated for JSObject but called for non-JSObject.
179 // IC::GetCodeCacheHolder is not applicable. 180 // IC::GetCodeCacheHolder is not applicable.
180 return false; 181 return false;
181 } else if (cache_holder == PROTOTYPE_MAP && 182 } else if (cache_holder == PROTOTYPE_MAP &&
182 receiver->GetPrototype()->IsNull()) { 183 receiver->GetPrototype(isolate)->IsNull()) {
183 // IC::GetCodeCacheHolder is not applicable. 184 // IC::GetCodeCacheHolder is not applicable.
184 return false; 185 return false;
185 } 186 }
186 Map* map = IC::GetCodeCacheHolder(receiver, cache_holder)->map(); 187 Map* map = IC::GetCodeCacheHolder(isolate, receiver, cache_holder)->map();
187 188
188 // Decide whether the inline cache failed because of changes to the 189 // Decide whether the inline cache failed because of changes to the
189 // receiver itself or changes to one of its prototypes. 190 // receiver itself or changes to one of its prototypes.
190 // 191 //
191 // If there are changes to the receiver itself, the map of the 192 // If there are changes to the receiver itself, the map of the
192 // receiver will have changed and the current target will not be in 193 // receiver will have changed and the current target will not be in
193 // the receiver map's code cache. Therefore, if the current target 194 // the receiver map's code cache. Therefore, if the current target
194 // is in the receiver map's code cache, the inline cache failed due 195 // is in the receiver map's code cache, the inline cache failed due
195 // to prototype check failure. 196 // to prototype check failure.
196 int index = map->IndexInCodeCache(name, target); 197 int index = map->IndexInCodeCache(name, target);
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 UpdateMegamorphicCache(map, *name, target()); 728 UpdateMegamorphicCache(map, *name, target());
728 } 729 }
729 } 730 }
730 set_target(*code); 731 set_target(*code);
731 break; 732 break;
732 case MEGAMORPHIC: { 733 case MEGAMORPHIC: {
733 // Cache code holding map should be consistent with 734 // Cache code holding map should be consistent with
734 // GenerateMonomorphicCacheProbe. It is not the map which holds the stub. 735 // GenerateMonomorphicCacheProbe. It is not the map which holds the stub.
735 Handle<JSObject> cache_object = object->IsJSObject() 736 Handle<JSObject> cache_object = object->IsJSObject()
736 ? Handle<JSObject>::cast(object) 737 ? Handle<JSObject>::cast(object)
737 : Handle<JSObject>(JSObject::cast(object->GetPrototype())); 738 : Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate())));
738 // Update the stub cache. 739 // Update the stub cache.
739 UpdateMegamorphicCache(cache_object->map(), *name, *code); 740 UpdateMegamorphicCache(cache_object->map(), *name, *code);
740 break; 741 break;
741 } 742 }
742 case DEBUG_STUB: 743 case DEBUG_STUB:
743 break; 744 break;
744 case POLYMORPHIC: 745 case POLYMORPHIC:
745 case GENERIC: 746 case GENERIC:
746 UNREACHABLE(); 747 UNREACHABLE();
747 break; 748 break;
(...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after
2562 #undef ADDR 2563 #undef ADDR
2563 }; 2564 };
2564 2565
2565 2566
2566 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2567 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2567 return IC_utilities[id]; 2568 return IC_utilities[id];
2568 } 2569 }
2569 2570
2570 2571
2571 } } // namespace v8::internal 2572 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/ic-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698