OLD | NEW |
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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 return *Accessors::FunctionGetPrototype(Handle<JSFunction>::cast(object)); | 566 return *Accessors::FunctionGetPrototype(Handle<JSFunction>::cast(object)); |
567 } | 567 } |
568 } | 568 } |
569 | 569 |
570 // Check if the name is trivially convertible to an index and get | 570 // Check if the name is trivially convertible to an index and get |
571 // the element or char if so. | 571 // the element or char if so. |
572 uint32_t index; | 572 uint32_t index; |
573 if (kind() == Code::KEYED_LOAD_IC && name->AsArrayIndex(&index)) { | 573 if (kind() == Code::KEYED_LOAD_IC && name->AsArrayIndex(&index)) { |
574 // Rewrite to the generic keyed load stub. | 574 // Rewrite to the generic keyed load stub. |
575 if (FLAG_use_ic) set_target(*generic_stub()); | 575 if (FLAG_use_ic) set_target(*generic_stub()); |
576 Handle<Object> result = | 576 Handle<Object> result; |
577 Runtime::GetElementOrCharAt(isolate(), object, index); | 577 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
578 RETURN_IF_EMPTY_HANDLE(isolate(), result); | 578 isolate(), result, |
| 579 Runtime::GetElementOrCharAt(isolate(), object, index)); |
579 return *result; | 580 return *result; |
580 } | 581 } |
581 | 582 |
582 bool use_ic = MigrateDeprecated(object) ? false : FLAG_use_ic; | 583 bool use_ic = MigrateDeprecated(object) ? false : FLAG_use_ic; |
583 | 584 |
584 // Named lookup in the object. | 585 // Named lookup in the object. |
585 LookupResult lookup(isolate()); | 586 LookupResult lookup(isolate()); |
586 LookupForRead(object, name, &lookup); | 587 LookupForRead(object, name, &lookup); |
587 | 588 |
588 // If we did not find a property, check if we need to throw an exception. | 589 // If we did not find a property, check if we need to throw an exception. |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 return generic_stub(); | 1079 return generic_stub(); |
1079 } | 1080 } |
1080 | 1081 |
1081 return isolate()->stub_cache()->ComputeLoadElementPolymorphic( | 1082 return isolate()->stub_cache()->ComputeLoadElementPolymorphic( |
1082 &target_receiver_maps); | 1083 &target_receiver_maps); |
1083 } | 1084 } |
1084 | 1085 |
1085 | 1086 |
1086 MaybeObject* KeyedLoadIC::Load(Handle<Object> object, Handle<Object> key) { | 1087 MaybeObject* KeyedLoadIC::Load(Handle<Object> object, Handle<Object> key) { |
1087 if (MigrateDeprecated(object)) { | 1088 if (MigrateDeprecated(object)) { |
1088 Handle<Object> result = Runtime::GetObjectProperty(isolate(), object, key); | 1089 Handle<Object> result; |
1089 RETURN_IF_EMPTY_HANDLE(isolate(), result); | 1090 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 1091 isolate(), result, Runtime::GetObjectProperty(isolate(), object, key)); |
1090 return *result; | 1092 return *result; |
1091 } | 1093 } |
1092 | 1094 |
1093 MaybeObject* maybe_object = NULL; | 1095 MaybeObject* maybe_object = NULL; |
1094 Handle<Code> stub = generic_stub(); | 1096 Handle<Code> stub = generic_stub(); |
1095 | 1097 |
1096 // Check for non-string values that can be converted into an | 1098 // Check for non-string values that can be converted into an |
1097 // internalized string directly or is representable as a smi. | 1099 // internalized string directly or is representable as a smi. |
1098 key = TryConvertKey(key, isolate()); | 1100 key = TryConvertKey(key, isolate()); |
1099 | 1101 |
(...skipping 19 matching lines...) Expand all Loading... |
1119 | 1121 |
1120 if (!is_target_set()) { | 1122 if (!is_target_set()) { |
1121 if (*stub == *generic_stub()) { | 1123 if (*stub == *generic_stub()) { |
1122 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic"); | 1124 TRACE_GENERIC_IC(isolate(), "KeyedLoadIC", "set generic"); |
1123 } | 1125 } |
1124 set_target(*stub); | 1126 set_target(*stub); |
1125 TRACE_IC("LoadIC", key); | 1127 TRACE_IC("LoadIC", key); |
1126 } | 1128 } |
1127 | 1129 |
1128 if (maybe_object != NULL) return maybe_object; | 1130 if (maybe_object != NULL) return maybe_object; |
1129 Handle<Object> result = Runtime::GetObjectProperty(isolate(), object, key); | 1131 Handle<Object> result; |
1130 RETURN_IF_EMPTY_HANDLE(isolate(), result); | 1132 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 1133 isolate(), result, Runtime::GetObjectProperty(isolate(), object, key)); |
1131 return *result; | 1134 return *result; |
1132 } | 1135 } |
1133 | 1136 |
1134 | 1137 |
1135 static bool LookupForWrite(Handle<JSObject> receiver, | 1138 static bool LookupForWrite(Handle<JSObject> receiver, |
1136 Handle<String> name, | 1139 Handle<String> name, |
1137 Handle<Object> value, | 1140 Handle<Object> value, |
1138 LookupResult* lookup, | 1141 LookupResult* lookup, |
1139 IC* ic) { | 1142 IC* ic) { |
1140 Handle<JSObject> holder = receiver; | 1143 Handle<JSObject> holder = receiver; |
(...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2839 #undef ADDR | 2842 #undef ADDR |
2840 }; | 2843 }; |
2841 | 2844 |
2842 | 2845 |
2843 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2846 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2844 return IC_utilities[id]; | 2847 return IC_utilities[id]; |
2845 } | 2848 } |
2846 | 2849 |
2847 | 2850 |
2848 } } // namespace v8::internal | 2851 } } // namespace v8::internal |
OLD | NEW |