OLD | NEW |
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 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 } | 1102 } |
1103 } | 1103 } |
1104 } else if (key->IsUndefined()) { | 1104 } else if (key->IsUndefined()) { |
1105 key = isolate->factory()->undefined_string(); | 1105 key = isolate->factory()->undefined_string(); |
1106 } | 1106 } |
1107 return key; | 1107 return key; |
1108 } | 1108 } |
1109 | 1109 |
1110 | 1110 |
1111 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<JSObject> receiver) { | 1111 Handle<Code> KeyedLoadIC::LoadElementStub(Handle<JSObject> receiver) { |
1112 // Don't handle megamorphic property accesses for INTERCEPTORS or CALLBACKS | |
1113 // via megamorphic stubs, since they don't have a map in their relocation info | |
1114 // and so the stubs can't be harvested for the object needed for a map check. | |
1115 if (target()->type() != Code::NORMAL) { | |
1116 TRACE_GENERIC_IC(isolate(), "KeyedIC", "non-NORMAL target type"); | |
1117 return generic_stub(); | |
1118 } | |
1119 | |
1120 Handle<Map> receiver_map(receiver->map(), isolate()); | 1112 Handle<Map> receiver_map(receiver->map(), isolate()); |
1121 MapHandleList target_receiver_maps; | 1113 MapHandleList target_receiver_maps; |
1122 if (target().is_identical_to(string_stub())) { | 1114 if (target().is_identical_to(string_stub())) { |
1123 target_receiver_maps.Add(isolate()->factory()->string_map()); | 1115 target_receiver_maps.Add(isolate()->factory()->string_map()); |
1124 } else { | 1116 } else { |
1125 TargetMaps(&target_receiver_maps); | 1117 TargetMaps(&target_receiver_maps); |
1126 } | 1118 } |
1127 if (target_receiver_maps.length() == 0) { | 1119 if (target_receiver_maps.length() == 0) { |
1128 return PropertyICCompiler::ComputeKeyedLoadMonomorphic(receiver_map); | 1120 return PropertyICCompiler::ComputeKeyedLoadMonomorphic(receiver_map); |
1129 } | 1121 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 LoadIC::Load(object, Handle<Name>::cast(key)), | 1177 LoadIC::Load(object, Handle<Name>::cast(key)), |
1186 Object); | 1178 Object); |
1187 } else if (FLAG_use_ic && !object->IsAccessCheckNeeded()) { | 1179 } else if (FLAG_use_ic && !object->IsAccessCheckNeeded()) { |
1188 if (object->IsString() && key->IsNumber()) { | 1180 if (object->IsString() && key->IsNumber()) { |
1189 if (state() == UNINITIALIZED) stub = string_stub(); | 1181 if (state() == UNINITIALIZED) stub = string_stub(); |
1190 } else if (object->IsJSObject()) { | 1182 } else if (object->IsJSObject()) { |
1191 Handle<JSObject> receiver = Handle<JSObject>::cast(object); | 1183 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
1192 if (receiver->elements()->map() == | 1184 if (receiver->elements()->map() == |
1193 isolate()->heap()->sloppy_arguments_elements_map()) { | 1185 isolate()->heap()->sloppy_arguments_elements_map()) { |
1194 stub = sloppy_arguments_stub(); | 1186 stub = sloppy_arguments_stub(); |
1195 } else if (receiver->HasIndexedInterceptor()) { | |
1196 stub = indexed_interceptor_stub(); | |
1197 } else if (!Object::ToSmi(isolate(), key).is_null() && | 1187 } else if (!Object::ToSmi(isolate(), key).is_null() && |
1198 (!target().is_identical_to(sloppy_arguments_stub()))) { | 1188 (!target().is_identical_to(sloppy_arguments_stub()))) { |
1199 stub = LoadElementStub(receiver); | 1189 stub = LoadElementStub(receiver); |
1200 } | 1190 } |
1201 } | 1191 } |
1202 } | 1192 } |
1203 | 1193 |
1204 if (!is_target_set()) { | 1194 if (!is_target_set()) { |
1205 Code* generic = *generic_stub(); | 1195 Code* generic = *generic_stub(); |
1206 if (*stub == generic) { | 1196 if (*stub == generic) { |
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2617 static const Address IC_utilities[] = { | 2607 static const Address IC_utilities[] = { |
2618 #define ADDR(name) FUNCTION_ADDR(name), | 2608 #define ADDR(name) FUNCTION_ADDR(name), |
2619 IC_UTIL_LIST(ADDR) NULL | 2609 IC_UTIL_LIST(ADDR) NULL |
2620 #undef ADDR | 2610 #undef ADDR |
2621 }; | 2611 }; |
2622 | 2612 |
2623 | 2613 |
2624 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 2614 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
2625 } | 2615 } |
2626 } // namespace v8::internal | 2616 } // namespace v8::internal |
OLD | NEW |