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 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 } | 815 } |
816 | 816 |
817 | 817 |
818 Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context, | 818 Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context, |
819 Handle<FixedArray> keys) { | 819 Handle<FixedArray> keys) { |
820 if (context->map_cache()->IsUndefined()) { | 820 if (context->map_cache()->IsUndefined()) { |
821 // Allocate the new map cache for the global context. | 821 // Allocate the new map cache for the global context. |
822 Handle<MapCache> new_cache = NewMapCache(24); | 822 Handle<MapCache> new_cache = NewMapCache(24); |
823 context->set_map_cache(*new_cache); | 823 context->set_map_cache(*new_cache); |
824 } | 824 } |
825 // Check to see whether there is a maching element in the cache. | 825 // Check to see whether there is a matching element in the cache. |
826 Handle<MapCache> cache = | 826 Handle<MapCache> cache = |
827 Handle<MapCache>(MapCache::cast(context->map_cache())); | 827 Handle<MapCache>(MapCache::cast(context->map_cache())); |
828 Handle<Object> result = Handle<Object>(cache->Lookup(*keys)); | 828 Handle<Object> result = Handle<Object>(cache->Lookup(*keys)); |
829 if (result->IsMap()) return Handle<Map>::cast(result); | 829 if (result->IsMap()) return Handle<Map>::cast(result); |
830 // Create a new map and add it to the cache. | 830 // Create a new map and add it to the cache. |
831 Handle<Map> map = | 831 Handle<Map> map = |
832 CopyMap(Handle<Map>(context->object_function()->initial_map()), | 832 CopyMap(Handle<Map>(context->object_function()->initial_map()), |
833 keys->length()); | 833 keys->length()); |
834 AddToMapCache(context, keys, map); | 834 AddToMapCache(context, keys, map); |
835 return Handle<Map>(map); | 835 return Handle<Map>(map); |
(...skipping 24 matching lines...) Expand all Loading... |
860 Execution::ConfigureInstance(instance, | 860 Execution::ConfigureInstance(instance, |
861 instance_template, | 861 instance_template, |
862 pending_exception); | 862 pending_exception); |
863 } else { | 863 } else { |
864 *pending_exception = false; | 864 *pending_exception = false; |
865 } | 865 } |
866 } | 866 } |
867 | 867 |
868 | 868 |
869 } } // namespace v8::internal | 869 } } // namespace v8::internal |
OLD | NEW |