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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 // ----------------------------------------------------------------------------- | 975 // ----------------------------------------------------------------------------- |
976 // NewSpace implementation | 976 // NewSpace implementation |
977 | 977 |
978 | 978 |
979 bool NewSpace::Setup(Address start, int size) { | 979 bool NewSpace::Setup(Address start, int size) { |
980 // Setup new space based on the preallocated memory block defined by | 980 // Setup new space based on the preallocated memory block defined by |
981 // start and size. The provided space is divided into two semi-spaces. | 981 // start and size. The provided space is divided into two semi-spaces. |
982 // To support fast containment testing in the new space, the size of | 982 // To support fast containment testing in the new space, the size of |
983 // this chunk must be a power of two and it must be aligned to its size. | 983 // this chunk must be a power of two and it must be aligned to its size. |
984 int initial_semispace_capacity = Heap::InitialSemiSpaceSize(); | 984 int initial_semispace_capacity = Heap::InitialSemiSpaceSize(); |
985 int maximum_semispace_capacity = Heap::SemiSpaceSize(); | 985 int maximum_semispace_capacity = Heap::MaxSemiSpaceSize(); |
986 | 986 |
987 ASSERT(initial_semispace_capacity <= maximum_semispace_capacity); | 987 ASSERT(initial_semispace_capacity <= maximum_semispace_capacity); |
988 ASSERT(IsPowerOf2(maximum_semispace_capacity)); | 988 ASSERT(IsPowerOf2(maximum_semispace_capacity)); |
989 | 989 |
990 // Allocate and setup the histogram arrays if necessary. | 990 // Allocate and setup the histogram arrays if necessary. |
991 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) | 991 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) |
992 allocated_histogram_ = NewArray<HistogramInfo>(LAST_TYPE + 1); | 992 allocated_histogram_ = NewArray<HistogramInfo>(LAST_TYPE + 1); |
993 promoted_histogram_ = NewArray<HistogramInfo>(LAST_TYPE + 1); | 993 promoted_histogram_ = NewArray<HistogramInfo>(LAST_TYPE + 1); |
994 | 994 |
995 #define SET_NAME(name) allocated_histogram_[name].set_name(#name); \ | 995 #define SET_NAME(name) allocated_histogram_[name].set_name(#name); \ |
996 promoted_histogram_[name].set_name(#name); | 996 promoted_histogram_[name].set_name(#name); |
997 INSTANCE_TYPE_LIST(SET_NAME) | 997 INSTANCE_TYPE_LIST(SET_NAME) |
998 #undef SET_NAME | 998 #undef SET_NAME |
999 #endif | 999 #endif |
1000 | 1000 |
1001 ASSERT(size == 2 * maximum_semispace_capacity); | 1001 ASSERT(size == 2 * Heap::ReservedSemiSpaceSize()); |
1002 ASSERT(IsAddressAligned(start, size, 0)); | 1002 ASSERT(IsAddressAligned(start, size, 0)); |
1003 | 1003 |
1004 if (!to_space_.Setup(start, | 1004 if (!to_space_.Setup(start, |
1005 initial_semispace_capacity, | 1005 initial_semispace_capacity, |
1006 maximum_semispace_capacity)) { | 1006 maximum_semispace_capacity)) { |
1007 return false; | 1007 return false; |
1008 } | 1008 } |
1009 if (!from_space_.Setup(start + maximum_semispace_capacity, | 1009 if (!from_space_.Setup(start + maximum_semispace_capacity, |
1010 initial_semispace_capacity, | 1010 initial_semispace_capacity, |
1011 maximum_semispace_capacity)) { | 1011 maximum_semispace_capacity)) { |
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2780 reinterpret_cast<Object**>(object->address() | 2780 reinterpret_cast<Object**>(object->address() |
2781 + Page::kObjectAreaSize), | 2781 + Page::kObjectAreaSize), |
2782 allocation_top); | 2782 allocation_top); |
2783 PrintF("\n"); | 2783 PrintF("\n"); |
2784 } | 2784 } |
2785 } | 2785 } |
2786 } | 2786 } |
2787 #endif // DEBUG | 2787 #endif // DEBUG |
2788 | 2788 |
2789 } } // namespace v8::internal | 2789 } } // namespace v8::internal |
OLD | NEW |