OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "v8threads.h" | 44 #include "v8threads.h" |
45 #if V8_TARGET_ARCH_ARM && !V8_INTERPRETED_REGEXP | 45 #if V8_TARGET_ARCH_ARM && !V8_INTERPRETED_REGEXP |
46 #include "regexp-macro-assembler.h" | 46 #include "regexp-macro-assembler.h" |
47 #include "arm/regexp-macro-assembler-arm.h" | 47 #include "arm/regexp-macro-assembler-arm.h" |
48 #endif | 48 #endif |
49 | 49 |
50 | 50 |
51 namespace v8 { | 51 namespace v8 { |
52 namespace internal { | 52 namespace internal { |
53 | 53 |
| 54 Atomic32 RootsPartitioner::partitions_state_[kNumberOfRootsPartitions]; |
54 | 55 |
55 String* Heap::hidden_symbol_; | 56 String* Heap::hidden_symbol_; |
56 Object* Heap::roots_[Heap::kRootListLength]; | 57 Object* Heap::roots_[Heap::kRootListLength]; |
57 | 58 |
58 NewSpace Heap::new_space_; | 59 NewSpace Heap::new_space_; |
59 OldSpace* Heap::old_pointer_space_ = NULL; | 60 OldSpace* Heap::old_pointer_space_ = NULL; |
60 OldSpace* Heap::old_data_space_ = NULL; | 61 OldSpace* Heap::old_data_space_ = NULL; |
61 OldSpace* Heap::code_space_ = NULL; | 62 OldSpace* Heap::code_space_ = NULL; |
62 MapSpace* Heap::map_space_ = NULL; | 63 MapSpace* Heap::map_space_ = NULL; |
63 CellSpace* Heap::cell_space_ = NULL; | 64 CellSpace* Heap::cell_space_ = NULL; |
(...skipping 3968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4032 // empty. However the next thing we do is create the partial snapshot, | 4033 // empty. However the next thing we do is create the partial snapshot, |
4033 // filling up the partial snapshot cache with objects it needs as we go. | 4034 // filling up the partial snapshot cache with objects it needs as we go. |
4034 SerializerDeserializer::Iterate(v); | 4035 SerializerDeserializer::Iterate(v); |
4035 // We don't do a v->Synchronize call here, because in debug mode that will | 4036 // We don't do a v->Synchronize call here, because in debug mode that will |
4036 // output a flag to the snapshot. However at this point the serializer and | 4037 // output a flag to the snapshot. However at this point the serializer and |
4037 // deserializer are deliberately a little unsynchronized (see above) so the | 4038 // deserializer are deliberately a little unsynchronized (see above) so the |
4038 // checking of the sync flag in the snapshot would fail. | 4039 // checking of the sync flag in the snapshot would fail. |
4039 } | 4040 } |
4040 | 4041 |
4041 | 4042 |
| 4043 void Heap::ClaimAndIterateStrongRootsGroup(ObjectVisitor* v, |
| 4044 VisitMode mode, |
| 4045 RootsPartition partition) { |
| 4046 if (!RootsPartitioner::Claim(partition)) return; |
| 4047 |
| 4048 switch (partition) { |
| 4049 case kStrongRootsList: |
| 4050 v->VisitPointers(&roots_[0], &roots_[kStrongRootListLength]); |
| 4051 v->VisitPointer(BitCast<Object**>(&hidden_symbol_)); |
| 4052 break; |
| 4053 |
| 4054 case kBootstrapperRoots: |
| 4055 Bootstrapper::Iterate(v); |
| 4056 break; |
| 4057 |
| 4058 case kTopRoots: |
| 4059 Top::Iterate(v); |
| 4060 break; |
| 4061 |
| 4062 case kRelocatableRoots: |
| 4063 Relocatable::Iterate(v); |
| 4064 break; |
| 4065 |
| 4066 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 4067 case kDebugRoots: |
| 4068 Debug::Iterate(v); |
| 4069 break; |
| 4070 #endif |
| 4071 |
| 4072 case kCompilationCacheRoots: |
| 4073 CompilationCache::Iterate(v); |
| 4074 break; |
| 4075 |
| 4076 case kHandleScopeRoots: |
| 4077 HandleScopeImplementer::Iterate(v); |
| 4078 break; |
| 4079 |
| 4080 case kBuiltinsRoots: |
| 4081 if (mode != VISIT_ALL_IN_SCAVENGE) Builtins::IterateBuiltins(v); |
| 4082 break; |
| 4083 |
| 4084 case kGlobalHandlesRoots: |
| 4085 if (mode == VISIT_ONLY_STRONG) { |
| 4086 GlobalHandles::IterateStrongRoots(v); |
| 4087 } else { |
| 4088 GlobalHandles::IterateAllRoots(v); |
| 4089 } |
| 4090 break; |
| 4091 |
| 4092 case kThreadManagerRoots: |
| 4093 ThreadManager::Iterate(v); |
| 4094 break; |
| 4095 |
| 4096 case kSerializerDeserializerRoots: |
| 4097 SerializerDeserializer::Iterate(v); |
| 4098 break; |
| 4099 |
| 4100 default: |
| 4101 UNREACHABLE(); |
| 4102 } |
| 4103 } |
| 4104 |
| 4105 |
4042 // Flag is set when the heap has been configured. The heap can be repeatedly | 4106 // Flag is set when the heap has been configured. The heap can be repeatedly |
4043 // configured through the API until it is setup. | 4107 // configured through the API until it is setup. |
4044 static bool heap_configured = false; | 4108 static bool heap_configured = false; |
4045 | 4109 |
4046 // TODO(1236194): Since the heap size is configurable on the command line | 4110 // TODO(1236194): Since the heap size is configurable on the command line |
4047 // and through the API, we should gracefully handle the case that the heap | 4111 // and through the API, we should gracefully handle the case that the heap |
4048 // size is not big enough to fit all the initial objects. | 4112 // size is not big enough to fit all the initial objects. |
4049 bool Heap::ConfigureHeap(int max_semispace_size, int max_old_gen_size) { | 4113 bool Heap::ConfigureHeap(int max_semispace_size, int max_old_gen_size) { |
4050 if (HasBeenSetup()) return false; | 4114 if (HasBeenSetup()) return false; |
4051 | 4115 |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4766 return holes_size; | 4830 return holes_size; |
4767 } | 4831 } |
4768 | 4832 |
4769 | 4833 |
4770 GCTracer::GCTracer() | 4834 GCTracer::GCTracer() |
4771 : start_time_(0.0), | 4835 : start_time_(0.0), |
4772 start_size_(0), | 4836 start_size_(0), |
4773 gc_count_(0), | 4837 gc_count_(0), |
4774 full_gc_count_(0), | 4838 full_gc_count_(0), |
4775 is_compacting_(false), | 4839 is_compacting_(false), |
| 4840 #ifdef DEBUG |
4776 marked_count_(0), | 4841 marked_count_(0), |
| 4842 #endif |
4777 allocated_since_last_gc_(0), | 4843 allocated_since_last_gc_(0), |
4778 spent_in_mutator_(0), | 4844 spent_in_mutator_(0), |
4779 promoted_objects_size_(0) { | 4845 promoted_objects_size_(0) { |
4780 // These two fields reflect the state of the previous full collection. | 4846 // These two fields reflect the state of the previous full collection. |
4781 // Set them before they are changed by the collector. | 4847 // Set them before they are changed by the collector. |
4782 previous_has_compacted_ = MarkCompactCollector::HasCompacted(); | 4848 previous_has_compacted_ = MarkCompactCollector::HasCompacted(); |
4783 previous_marked_count_ = MarkCompactCollector::previous_marked_count(); | |
4784 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return; | 4849 if (!FLAG_trace_gc && !FLAG_print_cumulative_gc_stat) return; |
4785 start_time_ = OS::TimeCurrentMillis(); | 4850 start_time_ = OS::TimeCurrentMillis(); |
4786 start_size_ = Heap::SizeOfObjects(); | 4851 start_size_ = Heap::SizeOfObjects(); |
4787 | 4852 |
4788 for (int i = 0; i < Scope::kNumberOfScopes; i++) { | 4853 for (int i = 0; i < Scope::kNumberOfScopes; i++) { |
4789 scopes_[i] = 0; | 4854 scopes_[i] = 0; |
4790 } | 4855 } |
4791 | 4856 |
4792 in_free_list_or_wasted_before_gc_ = CountTotalHolesSize(); | 4857 in_free_list_or_wasted_before_gc_ = CountTotalHolesSize(); |
4793 | 4858 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4996 void ExternalStringTable::TearDown() { | 5061 void ExternalStringTable::TearDown() { |
4997 new_space_strings_.Free(); | 5062 new_space_strings_.Free(); |
4998 old_space_strings_.Free(); | 5063 old_space_strings_.Free(); |
4999 } | 5064 } |
5000 | 5065 |
5001 | 5066 |
5002 List<Object*> ExternalStringTable::new_space_strings_; | 5067 List<Object*> ExternalStringTable::new_space_strings_; |
5003 List<Object*> ExternalStringTable::old_space_strings_; | 5068 List<Object*> ExternalStringTable::old_space_strings_; |
5004 | 5069 |
5005 } } // namespace v8::internal | 5070 } } // namespace v8::internal |
OLD | NEW |