OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 Handle<String> name = Handle<String>::cast(key); | 732 Handle<String> name = Handle<String>::cast(key); |
733 | 733 |
734 // If the object is undefined or null it's illegal to try to get any | 734 // If the object is undefined or null it's illegal to try to get any |
735 // of its properties; throw a TypeError in that case. | 735 // of its properties; throw a TypeError in that case. |
736 if (object->IsUndefined() || object->IsNull()) { | 736 if (object->IsUndefined() || object->IsNull()) { |
737 return TypeError("non_object_property_load", object, name); | 737 return TypeError("non_object_property_load", object, name); |
738 } | 738 } |
739 | 739 |
740 // TODO(X64): Enable specialized stubs for length and prototype lookup. | 740 // TODO(X64): Enable specialized stubs for length and prototype lookup. |
741 #ifndef V8_TARGET_ARCH_X64 | 741 #ifndef V8_TARGET_ARCH_X64 |
742 if (false && FLAG_use_ic) { | 742 if (FLAG_use_ic) { |
743 // Use specialized code for getting the length of strings. | 743 // Use specialized code for getting the length of strings. |
744 if (object->IsString() && name->Equals(Heap::length_symbol())) { | 744 if (object->IsString() && name->Equals(Heap::length_symbol())) { |
745 Handle<String> string = Handle<String>::cast(object); | 745 Handle<String> string = Handle<String>::cast(object); |
746 Object* code = NULL; | 746 Object* code = NULL; |
747 code = StubCache::ComputeKeyedLoadStringLength(*name, *string); | 747 code = StubCache::ComputeKeyedLoadStringLength(*name, *string); |
748 if (code->IsFailure()) return code; | 748 if (code->IsFailure()) return code; |
749 set_target(Code::cast(code)); | 749 set_target(Code::cast(code)); |
750 #ifdef DEBUG | 750 #ifdef DEBUG |
751 TraceIC("KeyedLoadIC", name, state, target()); | 751 TraceIC("KeyedLoadIC", name, state, target()); |
752 #endif // DEBUG | 752 #endif // DEBUG |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 LookupResult lookup; | 794 LookupResult lookup; |
795 LookupForRead(*object, *name, &lookup); | 795 LookupForRead(*object, *name, &lookup); |
796 | 796 |
797 // If lookup is invalid, check if we need to throw an exception. | 797 // If lookup is invalid, check if we need to throw an exception. |
798 if (!lookup.IsValid()) { | 798 if (!lookup.IsValid()) { |
799 if (FLAG_strict || is_contextual()) { | 799 if (FLAG_strict || is_contextual()) { |
800 return ReferenceError("not_defined", name); | 800 return ReferenceError("not_defined", name); |
801 } | 801 } |
802 } | 802 } |
803 | 803 |
804 // TODO(X64): Enable inline caching for load. | |
805 #ifndef V8_TARGET_ARCH_X64 | |
806 // Update the inline cache. | |
807 if (FLAG_use_ic && lookup.IsLoaded()) { | 804 if (FLAG_use_ic && lookup.IsLoaded()) { |
808 UpdateCaches(&lookup, state, object, name); | 805 UpdateCaches(&lookup, state, object, name); |
809 } | 806 } |
810 #endif | |
811 | 807 |
812 PropertyAttributes attr; | 808 PropertyAttributes attr; |
813 if (lookup.IsValid() && lookup.type() == INTERCEPTOR) { | 809 if (lookup.IsValid() && lookup.type() == INTERCEPTOR) { |
814 // Get the property. | 810 // Get the property. |
815 Object* result = object->GetProperty(*object, &lookup, *name, &attr); | 811 Object* result = object->GetProperty(*object, &lookup, *name, &attr); |
816 if (result->IsFailure()) return result; | 812 if (result->IsFailure()) return result; |
817 // If the property is not present, check if we need to throw an | 813 // If the property is not present, check if we need to throw an |
818 // exception. | 814 // exception. |
819 if (attr == ABSENT && is_contextual()) { | 815 if (attr == ABSENT && is_contextual()) { |
820 return ReferenceError("not_defined", name); | 816 return ReferenceError("not_defined", name); |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 HandleScope scope; | 1092 HandleScope scope; |
1097 Handle<Object> result = SetElement(receiver, index, value); | 1093 Handle<Object> result = SetElement(receiver, index, value); |
1098 if (result.is_null()) return Failure::Exception(); | 1094 if (result.is_null()) return Failure::Exception(); |
1099 return *value; | 1095 return *value; |
1100 } | 1096 } |
1101 | 1097 |
1102 // Lookup the property locally in the receiver. | 1098 // Lookup the property locally in the receiver. |
1103 LookupResult lookup; | 1099 LookupResult lookup; |
1104 receiver->LocalLookup(*name, &lookup); | 1100 receiver->LocalLookup(*name, &lookup); |
1105 | 1101 |
1106 // TODO(X64): Enable inline cache for KeyedStoreIC. | |
1107 #ifndef V8_TARGET_ARCH_X64 | |
1108 // Update inline cache and stub cache. | 1102 // Update inline cache and stub cache. |
1109 if (FLAG_use_ic && lookup.IsLoaded()) { | 1103 if (FLAG_use_ic && lookup.IsLoaded()) { |
1110 UpdateCaches(&lookup, state, receiver, name, value); | 1104 UpdateCaches(&lookup, state, receiver, name, value); |
1111 } | 1105 } |
1112 #endif | |
1113 | 1106 |
1114 // Set the property. | 1107 // Set the property. |
1115 return receiver->SetProperty(*name, *value, NONE); | 1108 return receiver->SetProperty(*name, *value, NONE); |
1116 } | 1109 } |
1117 | 1110 |
1118 // Do not use ICs for objects that require access checks (including | 1111 // Do not use ICs for objects that require access checks (including |
1119 // the global object). | 1112 // the global object). |
1120 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded(); | 1113 bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded(); |
1121 ASSERT(!(use_ic && object->IsJSGlobalProxy())); | 1114 ASSERT(!(use_ic && object->IsJSGlobalProxy())); |
1122 | 1115 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1369 #undef ADDR | 1362 #undef ADDR |
1370 }; | 1363 }; |
1371 | 1364 |
1372 | 1365 |
1373 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 1366 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
1374 return IC_utilities[id]; | 1367 return IC_utilities[id]; |
1375 } | 1368 } |
1376 | 1369 |
1377 | 1370 |
1378 } } // namespace v8::internal | 1371 } } // namespace v8::internal |
OLD | NEW |