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

Side by Side Diff: src/ic.cc

Issue 238973003: Handlify Object::GetPrototype and (most) callers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Minor Created 6 years, 8 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
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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 Code::ExtractCacheHolderFromFlags(target()->flags()); 255 Code::ExtractCacheHolderFromFlags(target()->flags());
256 256
257 switch (cache_holder) { 257 switch (cache_holder) {
258 case OWN_MAP: 258 case OWN_MAP:
259 // The stub was generated for JSObject but called for non-JSObject. 259 // The stub was generated for JSObject but called for non-JSObject.
260 // IC::GetCodeCacheHolder is not applicable. 260 // IC::GetCodeCacheHolder is not applicable.
261 if (!receiver->IsJSObject()) return false; 261 if (!receiver->IsJSObject()) return false;
262 break; 262 break;
263 case PROTOTYPE_MAP: 263 case PROTOTYPE_MAP:
264 // IC::GetCodeCacheHolder is not applicable. 264 // IC::GetCodeCacheHolder is not applicable.
265 if (receiver->GetPrototype(isolate())->IsNull()) return false; 265 if (Object::GetPrototype(isolate(), receiver)->IsNull()) return false;
Yang 2014/04/15 13:10:48 No need to handlify this.
266 break; 266 break;
267 } 267 }
268 268
269 Handle<Map> map( 269 Handle<Map> map(
270 IC::GetCodeCacheHolder(isolate(), *receiver, cache_holder)->map()); 270 IC::GetCodeCacheHolder(isolate(), receiver, cache_holder)->map());
271 271
272 // Decide whether the inline cache failed because of changes to the 272 // Decide whether the inline cache failed because of changes to the
273 // receiver itself or changes to one of its prototypes. 273 // receiver itself or changes to one of its prototypes.
274 // 274 //
275 // If there are changes to the receiver itself, the map of the 275 // If there are changes to the receiver itself, the map of the
276 // receiver will have changed and the current target will not be in 276 // receiver will have changed and the current target will not be in
277 // the receiver map's code cache. Therefore, if the current target 277 // the receiver map's code cache. Therefore, if the current target
278 // is in the receiver map's code cache, the inline cache failed due 278 // is in the receiver map's code cache, the inline cache failed due
279 // to prototype check failure. 279 // to prototype check failure.
280 int index = map->IndexInCodeCache(*name, *target()); 280 int index = map->IndexInCodeCache(*name, *target());
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 isolate()->stub_cache()->Set(name, map, code); 897 isolate()->stub_cache()->Set(name, map, code);
898 } 898 }
899 899
900 900
901 Handle<Code> IC::ComputeHandler(LookupResult* lookup, 901 Handle<Code> IC::ComputeHandler(LookupResult* lookup,
902 Handle<Object> object, 902 Handle<Object> object,
903 Handle<String> name, 903 Handle<String> name,
904 Handle<Object> value) { 904 Handle<Object> value) {
905 InlineCacheHolderFlag cache_holder = GetCodeCacheForObject(*object); 905 InlineCacheHolderFlag cache_holder = GetCodeCacheForObject(*object);
906 Handle<HeapObject> stub_holder(GetCodeCacheHolder( 906 Handle<HeapObject> stub_holder(GetCodeCacheHolder(
907 isolate(), *object, cache_holder)); 907 isolate(), object, cache_holder));
908 908
909 Handle<Code> code = isolate()->stub_cache()->FindHandler( 909 Handle<Code> code = isolate()->stub_cache()->FindHandler(
910 name, handle(stub_holder->map()), kind(), cache_holder, 910 name, handle(stub_holder->map()), kind(), cache_holder,
911 lookup->holder()->HasFastProperties() ? Code::FAST : Code::NORMAL); 911 lookup->holder()->HasFastProperties() ? Code::FAST : Code::NORMAL);
912 if (!code.is_null()) { 912 if (!code.is_null()) {
913 return code; 913 return code;
914 } 914 }
915 915
916 code = CompileHandler(lookup, object, name, value, cache_holder); 916 code = CompileHandler(lookup, object, name, value, cache_holder);
917 ASSERT(code->is_handler()); 917 ASSERT(code->is_handler());
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 case NORMAL: 971 case NORMAL:
972 if (kind() != Code::LOAD_IC) break; 972 if (kind() != Code::LOAD_IC) break;
973 if (holder->IsGlobalObject()) { 973 if (holder->IsGlobalObject()) {
974 Handle<GlobalObject> global = Handle<GlobalObject>::cast(holder); 974 Handle<GlobalObject> global = Handle<GlobalObject>::cast(holder);
975 Handle<PropertyCell> cell( 975 Handle<PropertyCell> cell(
976 global->GetPropertyCell(lookup), isolate()); 976 global->GetPropertyCell(lookup), isolate());
977 Handle<Code> code = compiler.CompileLoadGlobal( 977 Handle<Code> code = compiler.CompileLoadGlobal(
978 type, global, cell, name, lookup->IsDontDelete()); 978 type, global, cell, name, lookup->IsDontDelete());
979 // TODO(verwaest): Move caching of these NORMAL stubs outside as well. 979 // TODO(verwaest): Move caching of these NORMAL stubs outside as well.
980 Handle<HeapObject> stub_holder(GetCodeCacheHolder( 980 Handle<HeapObject> stub_holder(GetCodeCacheHolder(
981 isolate(), *object, cache_holder)); 981 isolate(), object, cache_holder));
982 HeapObject::UpdateMapCodeCache(stub_holder, name, code); 982 HeapObject::UpdateMapCodeCache(stub_holder, name, code);
983 return code; 983 return code;
984 } 984 }
985 // There is only one shared stub for loading normalized 985 // There is only one shared stub for loading normalized
986 // properties. It does not traverse the prototype chain, so the 986 // properties. It does not traverse the prototype chain, so the
987 // property must be found in the object for the stub to be 987 // property must be found in the object for the stub to be
988 // applicable. 988 // applicable.
989 if (!object.is_identical_to(holder)) break; 989 if (!object.is_identical_to(holder)) break;
990 return isolate()->builtins()->LoadIC_Normal(); 990 return isolate()->builtins()->LoadIC_Normal();
991 case CALLBACKS: { 991 case CALLBACKS: {
(...skipping 1954 matching lines...) Expand 10 before | Expand all | Expand 10 after
2946 #undef ADDR 2946 #undef ADDR
2947 }; 2947 };
2948 2948
2949 2949
2950 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2950 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2951 return IC_utilities[id]; 2951 return IC_utilities[id];
2952 } 2952 }
2953 2953
2954 2954
2955 } } // namespace v8::internal 2955 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698