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

Side by Side Diff: src/ic/ic.cc

Issue 685123007: Restore special interceptor stub for keyed loads. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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/ic.h ('k') | src/ic/ic-compiler.cc » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 } 1202 }
1203 } 1203 }
1204 } else if (key->IsUndefined()) { 1204 } else if (key->IsUndefined()) {
1205 key = isolate->factory()->undefined_string(); 1205 key = isolate->factory()->undefined_string();
1206 } 1206 }
1207 return key; 1207 return key;
1208 } 1208 }
1209 1209
1210 1210
1211 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) { 1211 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<HeapObject> receiver) {
1212 // Don't handle megamorphic property accesses for INTERCEPTORS or CALLBACKS
1213 // via megamorphic stubs, since they don't have a map in their relocation info
1214 // and so the stubs can't be harvested for the object needed for a map check.
1215 if (target()->type() != Code::NORMAL) {
1216 TRACE_GENERIC_IC(isolate(), "KeyedIC", "non-NORMAL target type");
1217 return generic_stub();
1218 }
1219
1212 Handle<Map> receiver_map(receiver->map(), isolate()); 1220 Handle<Map> receiver_map(receiver->map(), isolate());
1213 MapHandleList target_receiver_maps; 1221 MapHandleList target_receiver_maps;
1214 TargetMaps(&target_receiver_maps); 1222 TargetMaps(&target_receiver_maps);
1215 1223
1216 if (target_receiver_maps.length() == 0) { 1224 if (target_receiver_maps.length() == 0) {
1217 return PropertyICCompiler::ComputeKeyedLoadMonomorphic(receiver_map); 1225 return PropertyICCompiler::ComputeKeyedLoadMonomorphic(receiver_map);
1218 } 1226 }
1219 1227
1220 // The first time a receiver is seen that is a transitioned version of the 1228 // The first time a receiver is seen that is a transitioned version of the
1221 // previous monomorphic receiver type, assume the new ElementsKind is the 1229 // previous monomorphic receiver type, assume the new ElementsKind is the
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 // internalized string directly or is representable as a smi. 1278 // internalized string directly or is representable as a smi.
1271 key = TryConvertKey(key, isolate()); 1279 key = TryConvertKey(key, isolate());
1272 1280
1273 if (key->IsInternalizedString() || key->IsSymbol()) { 1281 if (key->IsInternalizedString() || key->IsSymbol()) {
1274 ASSIGN_RETURN_ON_EXCEPTION(isolate(), load_handle, 1282 ASSIGN_RETURN_ON_EXCEPTION(isolate(), load_handle,
1275 LoadIC::Load(object, Handle<Name>::cast(key)), 1283 LoadIC::Load(object, Handle<Name>::cast(key)),
1276 Object); 1284 Object);
1277 } else if (FLAG_use_ic && !object->IsAccessCheckNeeded()) { 1285 } else if (FLAG_use_ic && !object->IsAccessCheckNeeded()) {
1278 if (object->IsJSObject() || (object->IsString() && key->IsNumber())) { 1286 if (object->IsJSObject() || (object->IsString() && key->IsNumber())) {
1279 Handle<HeapObject> receiver = Handle<HeapObject>::cast(object); 1287 Handle<HeapObject> receiver = Handle<HeapObject>::cast(object);
1280 if (object->IsString() || !Object::ToSmi(isolate(), key).is_null()) { 1288 if (receiver->IsJSObject() &&
1289 Handle<JSObject>::cast(receiver)->HasIndexedInterceptor()) {
1290 stub = indexed_interceptor_stub();
1291 } else if (object->IsString() ||
1292 !Object::ToSmi(isolate(), key).is_null()) {
1281 stub = LoadElementStub(receiver); 1293 stub = LoadElementStub(receiver);
1282 } 1294 }
1283 } 1295 }
1284 } 1296 }
1285 1297
1286 if (!is_target_set()) { 1298 if (!is_target_set()) {
1287 Code* generic = *generic_stub(); 1299 Code* generic = *generic_stub();
1288 if (*stub == generic) { 1300 if (*stub == generic) {
1289 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic"); 1301 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic");
1290 } 1302 }
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
2736 static const Address IC_utilities[] = { 2748 static const Address IC_utilities[] = {
2737 #define ADDR(name) FUNCTION_ADDR(name), 2749 #define ADDR(name) FUNCTION_ADDR(name),
2738 IC_UTIL_LIST(ADDR) NULL 2750 IC_UTIL_LIST(ADDR) NULL
2739 #undef ADDR 2751 #undef ADDR
2740 }; 2752 };
2741 2753
2742 2754
2743 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } 2755 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; }
2744 } 2756 }
2745 } // namespace v8::internal 2757 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic/ic.h ('k') | src/ic/ic-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698