Chromium Code Reviews| 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 Object* result; | |
| 1642 { MaybeObject* maybe_result = AllocateStruct(POLYMORPHIC_CODE_CACHE_TYPE); | |
| 1643 if (!maybe_result->ToObject(&result)) return maybe_result; | |
| 1644 } | |
| 1645 PolymorphicCodeCache* code_cache = PolymorphicCodeCache::cast(result); | |
| 1646 code_cache->set_cache(undefined_value()); | |
|
Mads Ager (chromium)
2011/06/01 08:45:53
You actually don't need this. Structs have all fie
Jakob Kummerow
2011/06/01 10:15:27
Nice! Done.
| |
| 1647 return code_cache; | |
| 1648 } | |
| 1649 | |
| 1650 | |
| 1637 const Heap::StringTypeTable Heap::string_type_table[] = { | 1651 const Heap::StringTypeTable Heap::string_type_table[] = { |
| 1638 #define STRING_TYPE_ELEMENT(type, size, name, camel_name) \ | 1652 #define STRING_TYPE_ELEMENT(type, size, name, camel_name) \ |
| 1639 {type, size, k##camel_name##MapRootIndex}, | 1653 {type, size, k##camel_name##MapRootIndex}, |
| 1640 STRING_TYPE_LIST(STRING_TYPE_ELEMENT) | 1654 STRING_TYPE_LIST(STRING_TYPE_ELEMENT) |
| 1641 #undef STRING_TYPE_ELEMENT | 1655 #undef STRING_TYPE_ELEMENT |
| 1642 }; | 1656 }; |
| 1643 | 1657 |
| 1644 | 1658 |
| 1645 const Heap::ConstantSymbolTable Heap::constant_symbol_table[] = { | 1659 const Heap::ConstantSymbolTable Heap::constant_symbol_table[] = { |
| 1646 #define CONSTANT_SYMBOL_ELEMENT(name, contents) \ | 1660 #define CONSTANT_SYMBOL_ELEMENT(name, contents) \ |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2134 } | 2148 } |
| 2135 set_code_stubs(NumberDictionary::cast(obj)); | 2149 set_code_stubs(NumberDictionary::cast(obj)); |
| 2136 | 2150 |
| 2137 // Allocate the non_monomorphic_cache used in stub-cache.cc. The initial size | 2151 // Allocate the non_monomorphic_cache used in stub-cache.cc. The initial size |
| 2138 // is set to avoid expanding the dictionary during bootstrapping. | 2152 // is set to avoid expanding the dictionary during bootstrapping. |
| 2139 { MaybeObject* maybe_obj = NumberDictionary::Allocate(64); | 2153 { MaybeObject* maybe_obj = NumberDictionary::Allocate(64); |
| 2140 if (!maybe_obj->ToObject(&obj)) return false; | 2154 if (!maybe_obj->ToObject(&obj)) return false; |
| 2141 } | 2155 } |
| 2142 set_non_monomorphic_cache(NumberDictionary::cast(obj)); | 2156 set_non_monomorphic_cache(NumberDictionary::cast(obj)); |
| 2143 | 2157 |
| 2158 { MaybeObject* maybe_obj = AllocatePolymorphicCodeCache(); | |
| 2159 if (!maybe_obj->ToObject(&obj)) return false; | |
| 2160 } | |
| 2161 set_polymorphic_code_cache(PolymorphicCodeCache::cast(obj)); | |
| 2162 | |
| 2144 set_instanceof_cache_function(Smi::FromInt(0)); | 2163 set_instanceof_cache_function(Smi::FromInt(0)); |
| 2145 set_instanceof_cache_map(Smi::FromInt(0)); | 2164 set_instanceof_cache_map(Smi::FromInt(0)); |
| 2146 set_instanceof_cache_answer(Smi::FromInt(0)); | 2165 set_instanceof_cache_answer(Smi::FromInt(0)); |
| 2147 | 2166 |
| 2148 CreateFixedStubs(); | 2167 CreateFixedStubs(); |
| 2149 | 2168 |
| 2150 // Allocate the dictionary of intrinsic function names. | 2169 // Allocate the dictionary of intrinsic function names. |
| 2151 { MaybeObject* maybe_obj = StringDictionary::Allocate(Runtime::kNumFunctions); | 2170 { MaybeObject* maybe_obj = StringDictionary::Allocate(Runtime::kNumFunctions); |
| 2152 if (!maybe_obj->ToObject(&obj)) return false; | 2171 if (!maybe_obj->ToObject(&obj)) return false; |
| 2153 } | 2172 } |
| (...skipping 3769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5923 } | 5942 } |
| 5924 | 5943 |
| 5925 | 5944 |
| 5926 void ExternalStringTable::TearDown() { | 5945 void ExternalStringTable::TearDown() { |
| 5927 new_space_strings_.Free(); | 5946 new_space_strings_.Free(); |
| 5928 old_space_strings_.Free(); | 5947 old_space_strings_.Free(); |
| 5929 } | 5948 } |
| 5930 | 5949 |
| 5931 | 5950 |
| 5932 } } // namespace v8::internal | 5951 } } // namespace v8::internal |
| OLD | NEW |