OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 3130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3141 | 3141 |
3142 // Initialize descriptor cache. | 3142 // Initialize descriptor cache. |
3143 isolate_->descriptor_lookup_cache()->Clear(); | 3143 isolate_->descriptor_lookup_cache()->Clear(); |
3144 | 3144 |
3145 // Initialize compilation cache. | 3145 // Initialize compilation cache. |
3146 isolate_->compilation_cache()->Clear(); | 3146 isolate_->compilation_cache()->Clear(); |
3147 } | 3147 } |
3148 | 3148 |
3149 | 3149 |
3150 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) { | 3150 bool Heap::RootCanBeWrittenAfterInitialization(Heap::RootListIndex root_index) { |
3151 RootListIndex writable_roots[] = { | 3151 switch (root_index) { |
3152 kStoreBufferTopRootIndex, | 3152 case kStoreBufferTopRootIndex: |
3153 kStackLimitRootIndex, | 3153 case kNumberStringCacheRootIndex: |
3154 kNumberStringCacheRootIndex, | 3154 case kInstanceofCacheFunctionRootIndex: |
3155 kInstanceofCacheFunctionRootIndex, | 3155 case kInstanceofCacheMapRootIndex: |
3156 kInstanceofCacheMapRootIndex, | 3156 case kInstanceofCacheAnswerRootIndex: |
3157 kInstanceofCacheAnswerRootIndex, | 3157 case kCodeStubsRootIndex: |
3158 kCodeStubsRootIndex, | 3158 case kNonMonomorphicCacheRootIndex: |
3159 kNonMonomorphicCacheRootIndex, | 3159 case kPolymorphicCodeCacheRootIndex: |
3160 kPolymorphicCodeCacheRootIndex, | 3160 case kEmptyScriptRootIndex: |
3161 kLastScriptIdRootIndex, | 3161 case kSymbolRegistryRootIndex: |
3162 kEmptyScriptRootIndex, | 3162 case kMaterializedObjectsRootIndex: |
3163 kRealStackLimitRootIndex, | 3163 case kAllocationSitesScratchpadRootIndex: |
3164 kArgumentsAdaptorDeoptPCOffsetRootIndex, | 3164 case kMicrotaskQueueRootIndex: |
3165 kConstructStubDeoptPCOffsetRootIndex, | 3165 case kDetachedContextsRootIndex: |
3166 kGetterStubDeoptPCOffsetRootIndex, | 3166 case kWeakObjectToCodeTableRootIndex: |
3167 kSetterStubDeoptPCOffsetRootIndex, | 3167 // Smi values |
3168 kStringTableRootIndex, | 3168 #define SMI_ENTRY(type, name, Name) case k##Name##RootIndex: |
3169 }; | 3169 SMI_ROOT_LIST(SMI_ENTRY) |
| 3170 #undef SMI_ENTRY |
| 3171 // String table |
| 3172 case kStringTableRootIndex: |
| 3173 return true; |
3170 | 3174 |
3171 for (unsigned int i = 0; i < arraysize(writable_roots); i++) { | 3175 default: |
3172 if (root_index == writable_roots[i]) return true; | 3176 return false; |
3173 } | 3177 } |
3174 return false; | |
3175 } | 3178 } |
3176 | 3179 |
3177 | 3180 |
3178 bool Heap::RootCanBeTreatedAsConstant(RootListIndex root_index) { | 3181 bool Heap::RootCanBeTreatedAsConstant(RootListIndex root_index) { |
3179 return !RootCanBeWrittenAfterInitialization(root_index) && | 3182 return !RootCanBeWrittenAfterInitialization(root_index) && |
3180 !InNewSpace(roots_array_start()[root_index]); | 3183 !InNewSpace(roots_array_start()[root_index]); |
3181 } | 3184 } |
3182 | 3185 |
3183 | 3186 |
3184 Object* RegExpResultsCache::Lookup(Heap* heap, String* key_string, | 3187 Object* RegExpResultsCache::Lookup(Heap* heap, String* key_string, |
(...skipping 3346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6531 static_cast<int>(object_sizes_last_time_[index])); | 6534 static_cast<int>(object_sizes_last_time_[index])); |
6532 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6535 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6533 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6536 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6534 | 6537 |
6535 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6538 MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6536 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6539 MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6537 ClearObjectStats(); | 6540 ClearObjectStats(); |
6538 } | 6541 } |
6539 } | 6542 } |
6540 } // namespace v8::internal | 6543 } // namespace v8::internal |
OLD | NEW |