OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 // maps. | 844 // maps. |
845 isolate_->keyed_lookup_cache()->Clear(); | 845 isolate_->keyed_lookup_cache()->Clear(); |
846 isolate_->context_slot_cache()->Clear(); | 846 isolate_->context_slot_cache()->Clear(); |
847 isolate_->descriptor_lookup_cache()->Clear(); | 847 isolate_->descriptor_lookup_cache()->Clear(); |
848 | 848 |
849 isolate_->compilation_cache()->MarkCompactPrologue(); | 849 isolate_->compilation_cache()->MarkCompactPrologue(); |
850 | 850 |
851 CompletelyClearInstanceofCache(); | 851 CompletelyClearInstanceofCache(); |
852 | 852 |
853 if (is_compacting) FlushNumberStringCache(); | 853 if (is_compacting) FlushNumberStringCache(); |
| 854 if (FLAG_cleanup_code_caches_at_gc) { |
| 855 polymorphic_code_cache()->set_cache(undefined_value()); |
| 856 } |
854 | 857 |
855 ClearNormalizedMapCaches(); | 858 ClearNormalizedMapCaches(); |
856 } | 859 } |
857 | 860 |
858 | 861 |
859 Object* Heap::FindCodeObject(Address a) { | 862 Object* Heap::FindCodeObject(Address a) { |
860 Object* obj = NULL; // Initialization to please compiler. | 863 Object* obj = NULL; // Initialization to please compiler. |
861 { MaybeObject* maybe_obj = code_space_->FindObject(a); | 864 { MaybeObject* maybe_obj = code_space_->FindObject(a); |
862 if (!maybe_obj->ToObject(&obj)) { | 865 if (!maybe_obj->ToObject(&obj)) { |
863 obj = lo_space_->FindObject(a)->ToObjectUnchecked(); | 866 obj = lo_space_->FindObject(a)->ToObjectUnchecked(); |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1627 { MaybeObject* maybe_result = AllocateStruct(CODE_CACHE_TYPE); | 1630 { MaybeObject* maybe_result = AllocateStruct(CODE_CACHE_TYPE); |
1628 if (!maybe_result->ToObject(&result)) return maybe_result; | 1631 if (!maybe_result->ToObject(&result)) return maybe_result; |
1629 } | 1632 } |
1630 CodeCache* code_cache = CodeCache::cast(result); | 1633 CodeCache* code_cache = CodeCache::cast(result); |
1631 code_cache->set_default_cache(empty_fixed_array()); | 1634 code_cache->set_default_cache(empty_fixed_array()); |
1632 code_cache->set_normal_type_cache(undefined_value()); | 1635 code_cache->set_normal_type_cache(undefined_value()); |
1633 return code_cache; | 1636 return code_cache; |
1634 } | 1637 } |
1635 | 1638 |
1636 | 1639 |
| 1640 MaybeObject* Heap::AllocatePolymorphicCodeCache() { |
| 1641 return AllocateStruct(POLYMORPHIC_CODE_CACHE_TYPE); |
| 1642 } |
| 1643 |
| 1644 |
1637 const Heap::StringTypeTable Heap::string_type_table[] = { | 1645 const Heap::StringTypeTable Heap::string_type_table[] = { |
1638 #define STRING_TYPE_ELEMENT(type, size, name, camel_name) \ | 1646 #define STRING_TYPE_ELEMENT(type, size, name, camel_name) \ |
1639 {type, size, k##camel_name##MapRootIndex}, | 1647 {type, size, k##camel_name##MapRootIndex}, |
1640 STRING_TYPE_LIST(STRING_TYPE_ELEMENT) | 1648 STRING_TYPE_LIST(STRING_TYPE_ELEMENT) |
1641 #undef STRING_TYPE_ELEMENT | 1649 #undef STRING_TYPE_ELEMENT |
1642 }; | 1650 }; |
1643 | 1651 |
1644 | 1652 |
1645 const Heap::ConstantSymbolTable Heap::constant_symbol_table[] = { | 1653 const Heap::ConstantSymbolTable Heap::constant_symbol_table[] = { |
1646 #define CONSTANT_SYMBOL_ELEMENT(name, contents) \ | 1654 #define CONSTANT_SYMBOL_ELEMENT(name, contents) \ |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2134 } | 2142 } |
2135 set_code_stubs(NumberDictionary::cast(obj)); | 2143 set_code_stubs(NumberDictionary::cast(obj)); |
2136 | 2144 |
2137 // Allocate the non_monomorphic_cache used in stub-cache.cc. The initial size | 2145 // Allocate the non_monomorphic_cache used in stub-cache.cc. The initial size |
2138 // is set to avoid expanding the dictionary during bootstrapping. | 2146 // is set to avoid expanding the dictionary during bootstrapping. |
2139 { MaybeObject* maybe_obj = NumberDictionary::Allocate(64); | 2147 { MaybeObject* maybe_obj = NumberDictionary::Allocate(64); |
2140 if (!maybe_obj->ToObject(&obj)) return false; | 2148 if (!maybe_obj->ToObject(&obj)) return false; |
2141 } | 2149 } |
2142 set_non_monomorphic_cache(NumberDictionary::cast(obj)); | 2150 set_non_monomorphic_cache(NumberDictionary::cast(obj)); |
2143 | 2151 |
| 2152 { MaybeObject* maybe_obj = AllocatePolymorphicCodeCache(); |
| 2153 if (!maybe_obj->ToObject(&obj)) return false; |
| 2154 } |
| 2155 set_polymorphic_code_cache(PolymorphicCodeCache::cast(obj)); |
| 2156 |
2144 set_instanceof_cache_function(Smi::FromInt(0)); | 2157 set_instanceof_cache_function(Smi::FromInt(0)); |
2145 set_instanceof_cache_map(Smi::FromInt(0)); | 2158 set_instanceof_cache_map(Smi::FromInt(0)); |
2146 set_instanceof_cache_answer(Smi::FromInt(0)); | 2159 set_instanceof_cache_answer(Smi::FromInt(0)); |
2147 | 2160 |
2148 CreateFixedStubs(); | 2161 CreateFixedStubs(); |
2149 | 2162 |
2150 // Allocate the dictionary of intrinsic function names. | 2163 // Allocate the dictionary of intrinsic function names. |
2151 { MaybeObject* maybe_obj = StringDictionary::Allocate(Runtime::kNumFunctions); | 2164 { MaybeObject* maybe_obj = StringDictionary::Allocate(Runtime::kNumFunctions); |
2152 if (!maybe_obj->ToObject(&obj)) return false; | 2165 if (!maybe_obj->ToObject(&obj)) return false; |
2153 } | 2166 } |
(...skipping 3769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5923 } | 5936 } |
5924 | 5937 |
5925 | 5938 |
5926 void ExternalStringTable::TearDown() { | 5939 void ExternalStringTable::TearDown() { |
5927 new_space_strings_.Free(); | 5940 new_space_strings_.Free(); |
5928 old_space_strings_.Free(); | 5941 old_space_strings_.Free(); |
5929 } | 5942 } |
5930 | 5943 |
5931 | 5944 |
5932 } } // namespace v8::internal | 5945 } } // namespace v8::internal |
OLD | NEW |