| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1726 } | 1726 } |
| 1727 | 1727 |
| 1728 | 1728 |
| 1729 | 1729 |
| 1730 // KeyedStringGetProperty is called from KeyedLoadIC::GenerateGeneric. | 1730 // KeyedStringGetProperty is called from KeyedLoadIC::GenerateGeneric. |
| 1731 static Object* Runtime_KeyedGetProperty(Arguments args) { | 1731 static Object* Runtime_KeyedGetProperty(Arguments args) { |
| 1732 NoHandleAllocation ha; | 1732 NoHandleAllocation ha; |
| 1733 ASSERT(args.length() == 2); | 1733 ASSERT(args.length() == 2); |
| 1734 | 1734 |
| 1735 // Fast cases for getting named properties of the receiver JSObject | 1735 // Fast cases for getting named properties of the receiver JSObject |
| 1736 // itself. The global proxy objects has to be excluded since | 1736 // itself. |
| 1737 // LocalLookup on the global proxy object can return a valid result | 1737 // |
| 1738 // eventhough the global proxy object never has properties. This is | 1738 // The global proxy objects has to be excluded since LocalLookup on |
| 1739 // the case because the global proxy object forwards everything to | 1739 // the global proxy object can return a valid result eventhough the |
| 1740 // its hidden prototype including local lookups. | 1740 // global proxy object never has properties. This is the case |
| 1741 // because the global proxy object forwards everything to its hidden |
| 1742 // prototype including local lookups. |
| 1743 // |
| 1744 // Additionally, we need to make sure that we do not cache results |
| 1745 // for objects that require access checks. |
| 1741 if (args[0]->IsJSObject() && | 1746 if (args[0]->IsJSObject() && |
| 1742 !args[0]->IsJSGlobalProxy() && | 1747 !args[0]->IsJSGlobalProxy() && |
| 1748 !args[0]->IsAccessCheckNeeded() && |
| 1743 args[1]->IsString()) { | 1749 args[1]->IsString()) { |
| 1744 JSObject* receiver = JSObject::cast(args[0]); | 1750 JSObject* receiver = JSObject::cast(args[0]); |
| 1745 String* key = String::cast(args[1]); | 1751 String* key = String::cast(args[1]); |
| 1746 if (receiver->HasFastProperties()) { | 1752 if (receiver->HasFastProperties()) { |
| 1747 // Attempt to use lookup cache. | 1753 // Attempt to use lookup cache. |
| 1748 Object* obj = Heap::GetKeyedLookupCache(); | 1754 Object* obj = Heap::GetKeyedLookupCache(); |
| 1749 if (obj->IsFailure()) return obj; | 1755 if (obj->IsFailure()) return obj; |
| 1750 LookupCache* cache = LookupCache::cast(obj); | 1756 LookupCache* cache = LookupCache::cast(obj); |
| 1751 Map* receiver_map = receiver->map(); | 1757 Map* receiver_map = receiver->map(); |
| 1752 int offset = cache->Lookup(receiver_map, key); | 1758 int offset = cache->Lookup(receiver_map, key); |
| (...skipping 4155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5908 } else { | 5914 } else { |
| 5909 // Handle last resort GC and make sure to allow future allocations | 5915 // Handle last resort GC and make sure to allow future allocations |
| 5910 // to grow the heap without causing GCs (if possible). | 5916 // to grow the heap without causing GCs (if possible). |
| 5911 Counters::gc_last_resort_from_js.Increment(); | 5917 Counters::gc_last_resort_from_js.Increment(); |
| 5912 Heap::CollectAllGarbage(); | 5918 Heap::CollectAllGarbage(); |
| 5913 } | 5919 } |
| 5914 } | 5920 } |
| 5915 | 5921 |
| 5916 | 5922 |
| 5917 } } // namespace v8::internal | 5923 } } // namespace v8::internal |
| OLD | NEW |